Java Code Examples for org.apache.logging.log4j.core.appender.rolling.action.DeleteAction#createFileVisitor()

The following examples show how to use org.apache.logging.log4j.core.appender.rolling.action.DeleteAction#createFileVisitor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeleteActionTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example 2
Source File: DeleteActionTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@Test
public void testCreateFileVisitorReturnsDeletingVisitor() {
    final DeleteAction delete = createAnyFilter("any", true, 0, false);
    final FileVisitor<Path> visitor = delete.createFileVisitor(delete.getBasePath(), delete.getPathConditions());
    assertTrue(visitor instanceof DeletingVisitor);
}