mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 02:05:56 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a965e4084 | ||
|
|
e80331beef | ||
|
|
a5fce22b95 | ||
|
|
a97ed89d08 | ||
|
|
cce84f5c15 | ||
|
|
ff38457af1 |
26
pom.xml
26
pom.xml
@@ -29,7 +29,7 @@
|
|||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>log4j2.yaml</include>
|
<include>log4j2.yml</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>log4j2-windows.yaml</include>
|
<include>log4j2-windows.yml</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
<winShortcut>false</winShortcut>
|
<winShortcut>false</winShortcut>
|
||||||
<winMenu>false</winMenu>
|
<winMenu>false</winMenu>
|
||||||
<javaOptions>
|
<javaOptions>
|
||||||
<javaOption>-Dlog4j2.configurationFile=log4j2-windows.yaml</javaOption>
|
<javaOption>-Dlog4j2.configurationFile=log4j2-windows.yml</javaOption>
|
||||||
</javaOptions>
|
</javaOptions>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
@@ -161,7 +161,7 @@
|
|||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>log4j2-debian.yaml</include>
|
<include>log4j2-debian.yml</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -381,33 +381,33 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-api</artifactId>
|
<artifactId>log4j-api</artifactId>
|
||||||
<version>3.0.0-beta2</version>
|
<version>2.25.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
|
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-core</artifactId>
|
<artifactId>log4j-core</artifactId>
|
||||||
<version>3.0.0-beta2</version>
|
<version>2.25.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j2-impl -->
|
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j2-impl -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-slf4j2-impl</artifactId>
|
<artifactId>log4j-slf4j2-impl</artifactId>
|
||||||
<version>3.0.0-beta2</version>
|
<version>2.25.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/tools.jackson.dataformat/jackson-dataformat-yaml -->
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>tools.jackson.dataformat</groupId>
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
<artifactId>jackson-dataformat-yaml</artifactId>
|
<artifactId>jackson-dataformat-yaml</artifactId>
|
||||||
<version>3.0.3</version>
|
<version>2.20.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/tools.jackson.core/jackson-databind -->
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>tools.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>3.0.3</version>
|
<version>2.20.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/commons-cli/commons-cli -->
|
<!-- https://mvnrepository.com/artifact/commons-cli/commons-cli -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
java -Dlog4j2.configurationFile=log4j2-debian.yaml -jar /usr/lib/${project.artifactId}/${project.artifactId}-${project.version}.jar "$@"
|
java -Dlog4j2.configurationFile=log4j2-debian.yml -jar /usr/lib/${project.artifactId}/${project.artifactId}-${project.version}.jar "$@"
|
||||||
@@ -6,6 +6,10 @@ import at.pcgamingfreaks.mkvaudiosubtitlechanger.util.ProjectUtil;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.Level;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.core.LoggerContext;
|
||||||
|
import org.apache.logging.log4j.core.appender.RollingFileAppender;
|
||||||
|
import org.apache.logging.log4j.core.config.Configuration;
|
||||||
import org.apache.logging.log4j.core.config.Configurator;
|
import org.apache.logging.log4j.core.config.Configurator;
|
||||||
import picocli.CommandLine;
|
import picocli.CommandLine;
|
||||||
|
|
||||||
@@ -39,7 +43,7 @@ public class CommandRunner implements Runnable {
|
|||||||
System.out.println("Safemode active. No files will be changed!");
|
System.out.println("Safemode active. No files will be changed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
LastExecutionHandler lastExecutionHandler = config.isOnlyNewFiles() ? new LastExecutionHandler("./last-executions.yml") : null;
|
LastExecutionHandler lastExecutionHandler = config.isOnlyNewFiles() ? new LastExecutionHandler(getApplicationHome()) : null;
|
||||||
FileFilter fileFilter = new FileFilter(config.getExcluded(), config.getIncludePattern(), config.getFilterDate(), lastExecutionHandler);
|
FileFilter fileFilter = new FileFilter(config.getExcluded(), config.getIncludePattern(), config.getFilterDate(), lastExecutionHandler);
|
||||||
FileProcessor fileProcessor = new CachedFileProcessor(new MkvFileProcessor(config.getMkvToolNix(), fileFilter));
|
FileProcessor fileProcessor = new CachedFileProcessor(new MkvFileProcessor(config.getMkvToolNix(), fileFilter));
|
||||||
AttributeChangeProcessor attributeChangeProcessor = new AttributeChangeProcessor(config.getPreferredSubtitles().toArray(new String[0]), config.getForcedKeywords(), config.getCommentaryKeywords(), config.getHearingImpaired());
|
AttributeChangeProcessor attributeChangeProcessor = new AttributeChangeProcessor(config.getPreferredSubtitles().toArray(new String[0]), config.getForcedKeywords(), config.getCommentaryKeywords(), config.getHearingImpaired());
|
||||||
@@ -49,4 +53,21 @@ public class CommandRunner implements Runnable {
|
|||||||
: new SingleFileAttributeUpdater(config, fileProcessor, attributeChangeProcessor, lastExecutionHandler);
|
: new SingleFileAttributeUpdater(config, fileProcessor, attributeChangeProcessor, lastExecutionHandler);
|
||||||
kernel.execute();
|
kernel.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getApplicationHome() {
|
||||||
|
LoggerContext context = (LoggerContext) LogManager.getContext(false);
|
||||||
|
Configuration config = context.getConfiguration();
|
||||||
|
|
||||||
|
for (org.apache.logging.log4j.core.Appender appender : config.getAppenders().values()) {
|
||||||
|
if (appender instanceof RollingFileAppender rollingFileAppender) {
|
||||||
|
String fileName = rollingFileAppender.getFileName();
|
||||||
|
return new java.io.File(fileName).getParentFile().getParent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.error("Could not load log4j2 path info");
|
||||||
|
System.out.println("Could not load log4j2 path info");
|
||||||
|
System.exit(1);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,12 @@ import java.util.Properties;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class LastExecutionHandler {
|
public class LastExecutionHandler {
|
||||||
|
private static final String FILE_NAME = "last-execution.properties";
|
||||||
private final File file;
|
private final File file;
|
||||||
private final Properties lastFileExecution;
|
private final Properties lastFileExecution;
|
||||||
|
|
||||||
public LastExecutionHandler(String path) {
|
public LastExecutionHandler(String path) {
|
||||||
file = new File(path);
|
file = new File(path + "/" + FILE_NAME);
|
||||||
lastFileExecution = loadLastFileExecution(file);
|
lastFileExecution = loadLastFileExecution(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ public class LastExecutionHandler {
|
|||||||
try (FileInputStream in = new FileInputStream(file)) {
|
try (FileInputStream in = new FileInputStream(file)) {
|
||||||
properties.load(in);
|
properties.load(in);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.warn("Couldn't find or read {}", file.getPath(), e);
|
log.info("Couldn't find or read {}", file.getPath(), e);
|
||||||
}
|
}
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public abstract class AttributeUpdater {
|
|||||||
executor.awaitTermination(1, TimeUnit.DAYS);
|
executor.awaitTermination(1, TimeUnit.DAYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastExecutionHandler.persist();
|
if (lastExecutionHandler != null) lastExecutionHandler.persist();
|
||||||
|
|
||||||
statistic.stopTimer();
|
statistic.stopTimer();
|
||||||
statistic.print();
|
statistic.print();
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package at.pcgamingfreaks.mkvaudiosubtitlechanger.impl.processors;
|
|||||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.exceptions.MkvToolNixException;
|
import at.pcgamingfreaks.mkvaudiosubtitlechanger.exceptions.MkvToolNixException;
|
||||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.impl.FileFilter;
|
import at.pcgamingfreaks.mkvaudiosubtitlechanger.impl.FileFilter;
|
||||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.model.*;
|
import at.pcgamingfreaks.mkvaudiosubtitlechanger.model.*;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import tools.jackson.databind.ObjectMapper;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|||||||
@@ -1,12 +1,20 @@
|
|||||||
Configuration:
|
Configuration:
|
||||||
name: DefaultLogger
|
name: MainConfig
|
||||||
|
|
||||||
|
Properties:
|
||||||
|
Property:
|
||||||
|
- name: logDir
|
||||||
|
value: ${sys:user.home}/.local/mkvaudiosubtitlechanger/logs
|
||||||
|
- name: logPattern
|
||||||
|
value: "%d{DEFAULT} | %-5level | %msg %n %throwable"
|
||||||
|
|
||||||
Appenders:
|
Appenders:
|
||||||
RollingFile:
|
RollingFile:
|
||||||
name: FileAppender
|
name: FileAppender
|
||||||
fileName: logs/application.log
|
fileName: ${logDir}/application.log
|
||||||
filePattern: logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
filePattern: ${logDir}/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
||||||
PatternLayout:
|
PatternLayout:
|
||||||
Pattern: "%d{DEFAULT} | %-5level | %msg %n %throwable"
|
Pattern: ${logPattern}
|
||||||
ThresholdFilter:
|
ThresholdFilter:
|
||||||
level: debug
|
level: debug
|
||||||
Policies:
|
Policies:
|
||||||
@@ -1,18 +1,25 @@
|
|||||||
Configuration:
|
Configuration:
|
||||||
name: DefaultLogger
|
|
||||||
|
Properties:
|
||||||
|
Property:
|
||||||
|
- name: logDir
|
||||||
|
value: "./logs"
|
||||||
|
- name: log_pattern
|
||||||
|
value: "%d{DEFAULT} | %-5level | %thread | %C{1} | %msg %n %throwable"
|
||||||
|
|
||||||
Appenders:
|
Appenders:
|
||||||
Console:
|
Console:
|
||||||
name: Console_Out
|
name: Console_Out
|
||||||
PatternLayout:
|
PatternLayout:
|
||||||
Pattern: "%d{DEFAULT} | %-5level | %thread | %C{1} | %msg %n %throwable"
|
Pattern: ${log_pattern}
|
||||||
ThresholdFilter:
|
ThresholdFilter:
|
||||||
level: debug
|
level: debug
|
||||||
RollingFile:
|
RollingFile:
|
||||||
name: FileAppender
|
name: FileAppender
|
||||||
fileName: logs/application.log
|
fileName: ${logDir}/application.log
|
||||||
filePattern: logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
filePattern: ${logDir}/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
||||||
PatternLayout:
|
PatternLayout:
|
||||||
Pattern: "%d{DEFAULT} | %-5level | %thread | %C{1} | %msg %n %throwable"
|
Pattern: ${logPattern}
|
||||||
ThresholdFilter:
|
ThresholdFilter:
|
||||||
level: debug
|
level: debug
|
||||||
Policies:
|
Policies:
|
||||||
@@ -1,12 +1,20 @@
|
|||||||
Configuration:
|
Configuration:
|
||||||
name: DefaultLogger
|
name: WindowsConfig
|
||||||
|
|
||||||
|
Properties:
|
||||||
|
Property:
|
||||||
|
- name: logDir
|
||||||
|
value: ${sys:user.home}/AppData/Local/MKVAudioSubtitleChanger/logs
|
||||||
|
- name: logPattern
|
||||||
|
value: "%d{DEFAULT} | %-5level | %msg %n %throwable"
|
||||||
|
|
||||||
Appenders:
|
Appenders:
|
||||||
RollingFile:
|
RollingFile:
|
||||||
name: FileAppender
|
name: FileAppender
|
||||||
fileName: ${sys:user.home}/.local/mkvaudiosubtitlechanger/logs/application.log
|
fileName: ${logDir}/application.log
|
||||||
filePattern: ${sys:user.home}/.local/mkvaudiosubtitlechanger/logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
filePattern: ${logDir}/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
||||||
PatternLayout:
|
PatternLayout:
|
||||||
Pattern: "%d{DEFAULT} | %-5level | %msg %n %throwable"
|
Pattern: ${logPattern}
|
||||||
ThresholdFilter:
|
ThresholdFilter:
|
||||||
level: debug
|
level: debug
|
||||||
Policies:
|
Policies:
|
||||||
@@ -15,7 +23,7 @@ Configuration:
|
|||||||
DefaultRolloverStrategy:
|
DefaultRolloverStrategy:
|
||||||
max: 30
|
max: 30
|
||||||
Delete:
|
Delete:
|
||||||
basePath: archive
|
basePath: logs/archive
|
||||||
maxDepth: 1
|
maxDepth: 1
|
||||||
IfLastModified:
|
IfLastModified:
|
||||||
age: 30d
|
age: 30d
|
||||||
@@ -1,12 +1,20 @@
|
|||||||
Configuration:
|
Configuration:
|
||||||
name: DefaultLogger
|
name: MainConfig
|
||||||
|
|
||||||
|
Properties:
|
||||||
|
Property:
|
||||||
|
- name: logDir
|
||||||
|
value: ./logs
|
||||||
|
- name: logPattern
|
||||||
|
value: "%d{DEFAULT} | %-5level | %msg %n %throwable"
|
||||||
|
|
||||||
Appenders:
|
Appenders:
|
||||||
RollingFile:
|
RollingFile:
|
||||||
name: FileAppender
|
name: FileAppender
|
||||||
fileName: ${sys:user.home}/AppData/Local/MKVAudioSubtitleChanger/logs/application.log
|
fileName: ${logDir}/application.log
|
||||||
filePattern: ${sys:user.home}/AppData/Local/MKVAudioSubtitleChanger/logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
filePattern: ${logDir}/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
||||||
PatternLayout:
|
PatternLayout:
|
||||||
Pattern: "%d{DEFAULT} | %-5level | %msg %n %throwable"
|
Pattern: ${logPattern}
|
||||||
ThresholdFilter:
|
ThresholdFilter:
|
||||||
level: debug
|
level: debug
|
||||||
Policies:
|
Policies:
|
||||||
@@ -11,62 +11,63 @@ import java.time.Instant;
|
|||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
class LastExecutionHandlerTest {
|
class LastExecutionHandlerTest {
|
||||||
private static final String LAST_EXECUTION_YML = "./last-execution.properties";
|
private static final String LAST_EXECUTION_PATH = ".";
|
||||||
|
private static final String LAST_EXECUTION_FILE = "./last-execution.properties";
|
||||||
private static final String TEST_MKV_FILE = "/arst/file.mkv";
|
private static final String TEST_MKV_FILE = "/arst/file.mkv";
|
||||||
|
|
||||||
@AfterEach
|
@AfterEach
|
||||||
void destruct() {
|
void destruct() {
|
||||||
File file = new File(LAST_EXECUTION_YML);
|
File file = new File(LAST_EXECUTION_FILE);
|
||||||
if (file.exists()) file.delete();
|
if (file.exists()) file.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void missingFile() throws IOException {
|
void missingFile() throws IOException {
|
||||||
LastExecutionHandler underTest = new LastExecutionHandler(LAST_EXECUTION_YML);
|
LastExecutionHandler underTest = new LastExecutionHandler(LAST_EXECUTION_PATH);
|
||||||
assertNull(underTest.get(TEST_MKV_FILE));
|
assertNull(underTest.get(TEST_MKV_FILE));
|
||||||
underTest.update(TEST_MKV_FILE);
|
underTest.update(TEST_MKV_FILE);
|
||||||
assertNotNull(underTest.get(TEST_MKV_FILE));
|
assertNotNull(underTest.get(TEST_MKV_FILE));
|
||||||
underTest.persist();
|
underTest.persist();
|
||||||
File file = new File(LAST_EXECUTION_YML);
|
File file = new File(LAST_EXECUTION_FILE);
|
||||||
assertTrue(file.exists());
|
assertTrue(file.exists());
|
||||||
assertTrue(Files.readString(file.toPath()).contains(TEST_MKV_FILE + "="));
|
assertTrue(Files.readString(file.toPath()).contains(TEST_MKV_FILE + "="));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void emptyFile() throws IOException {
|
void emptyFile() throws IOException {
|
||||||
File file = new File(LAST_EXECUTION_YML);
|
File file = new File(LAST_EXECUTION_FILE);
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
missingFile(); // does the checks needed for empty file case
|
missingFile(); // does the checks needed for empty file case
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void existingFileNoChanges() throws IOException {
|
void existingFileNoChanges() throws IOException {
|
||||||
File file = new File(LAST_EXECUTION_YML);
|
File file = new File(LAST_EXECUTION_FILE);
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
Files.writeString(file.toPath(), TEST_MKV_FILE + "=" + Instant.now());
|
Files.writeString(file.toPath(), TEST_MKV_FILE + "=" + Instant.now());
|
||||||
String expected = Files.readString(file.toPath()).replace(":", "\\:");
|
String expected = Files.readString(file.toPath()).replace(":", "\\:");
|
||||||
|
|
||||||
LastExecutionHandler underTest = new LastExecutionHandler(LAST_EXECUTION_YML);
|
LastExecutionHandler underTest = new LastExecutionHandler(LAST_EXECUTION_PATH);
|
||||||
assertNotNull(underTest.get(TEST_MKV_FILE));
|
assertNotNull(underTest.get(TEST_MKV_FILE));
|
||||||
underTest.persist();
|
underTest.persist();
|
||||||
File file1 = new File(LAST_EXECUTION_YML);
|
File file1 = new File(LAST_EXECUTION_FILE);
|
||||||
assertTrue(file1.exists());
|
assertTrue(file1.exists());
|
||||||
assertTrue(Files.readString(file.toPath()).contains(expected), "File contains expected value");
|
assertTrue(Files.readString(file.toPath()).contains(expected), "File contains expected value");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void existingFileWithChanges() throws IOException {
|
void existingFileWithChanges() throws IOException {
|
||||||
File file = new File(LAST_EXECUTION_YML);
|
File file = new File(LAST_EXECUTION_FILE);
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
Files.writeString(file.toPath(), TEST_MKV_FILE + "=" + Instant.now());
|
Files.writeString(file.toPath(), TEST_MKV_FILE + "=" + Instant.now());
|
||||||
String expected = Files.readString(file.toPath());
|
String expected = Files.readString(file.toPath());
|
||||||
|
|
||||||
LastExecutionHandler underTest = new LastExecutionHandler(LAST_EXECUTION_YML);
|
LastExecutionHandler underTest = new LastExecutionHandler(LAST_EXECUTION_PATH);
|
||||||
assertNotNull(underTest.get(TEST_MKV_FILE));
|
assertNotNull(underTest.get(TEST_MKV_FILE));
|
||||||
underTest.update(TEST_MKV_FILE);
|
underTest.update(TEST_MKV_FILE);
|
||||||
assertNotNull(underTest.get(TEST_MKV_FILE));
|
assertNotNull(underTest.get(TEST_MKV_FILE));
|
||||||
underTest.persist();
|
underTest.persist();
|
||||||
File file1 = new File(LAST_EXECUTION_YML);
|
File file1 = new File(LAST_EXECUTION_FILE);
|
||||||
assertTrue(file1.exists());
|
assertTrue(file1.exists());
|
||||||
assertNotEquals(expected, Files.readString(file.toPath()));
|
assertNotEquals(expected, Files.readString(file.toPath()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user