use of org.apache.logging.log4j.core.appender.rolling.action.DeleteAction in project logging-log4j2 by apache.
the class DeleteActionTest method testGetFiltersReturnsConstructorValue.
@Test
public void testGetFiltersReturnsConstructorValue() {
final PathCondition[] filters = { new FixedCondition(true), new FixedCondition(false) };
final DeleteAction delete = create("any", true, 0, false, filters);
assertEquals(Arrays.asList(filters), delete.getPathConditions());
}
use of org.apache.logging.log4j.core.appender.rolling.action.DeleteAction in project logging-log4j2 by apache.
the class DeleteActionTest method testGetBasePathStringReturnsOriginalParam.
@Test
public void testGetBasePathStringReturnsOriginalParam() {
final DeleteAction delete = createAnyFilter("${sys:user.home}/a/b/c", false, 1, false);
assertEquals("${sys:user.home}/a/b/c", delete.getBasePathString());
}
use of org.apache.logging.log4j.core.appender.rolling.action.DeleteAction in project logging-log4j2 by apache.
the class DeleteActionTest method testGetBasePathResolvesLookups.
@Test
public void testGetBasePathResolvesLookups() {
final DeleteAction delete = createAnyFilter("${sys:user.home}/a/b/c", false, 1, false);
final Path actual = delete.getBasePath();
final String expected = System.getProperty("user.home") + "/a/b/c";
assertEquals(FileSystems.getDefault().getPath(expected), actual);
}
use of org.apache.logging.log4j.core.appender.rolling.action.DeleteAction in project logging-log4j2 by apache.
the class DeleteActionTest method testCreateFileVisitorTestModeIsActionTestMode.
@Test
public void testCreateFileVisitorTestModeIsActionTestMode() {
final DeleteAction delete = createAnyFilter("any", true, 0, false);
assertFalse(delete.isTestMode());
final FileVisitor<Path> visitor = delete.createFileVisitor(delete.getBasePath(), delete.getPathConditions());
assertTrue(visitor instanceof DeletingVisitor);
assertFalse(((DeletingVisitor) visitor).isTestMode());
final DeleteAction deleteTestMode = createAnyFilter("any", true, 0, true);
assertTrue(deleteTestMode.isTestMode());
final FileVisitor<Path> testVisitor = deleteTestMode.createFileVisitor(delete.getBasePath(), delete.getPathConditions());
assertTrue(testVisitor instanceof DeletingVisitor);
assertTrue(((DeletingVisitor) testVisitor).isTestMode());
}
use of org.apache.logging.log4j.core.appender.rolling.action.DeleteAction in project logging-log4j2 by apache.
the class DeleteActionTest method testGetMaxDepthReturnsConstructorValue.
@Test
public void testGetMaxDepthReturnsConstructorValue() {
final DeleteAction delete = createAnyFilter("any", false, 23, false);
assertEquals(23, delete.getMaxDepth());
}
Aggregations