Search in sources :

Example 1 with DeletingVisitor

use of org.apache.logging.log4j.core.appender.rolling.action.DeletingVisitor 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());
}
Also used : Path(java.nio.file.Path) DeletingVisitor(org.apache.logging.log4j.core.appender.rolling.action.DeletingVisitor) DeleteAction(org.apache.logging.log4j.core.appender.rolling.action.DeleteAction) Test(org.junit.Test)

Example 2 with DeletingVisitor

use of org.apache.logging.log4j.core.appender.rolling.action.DeletingVisitor in project logging-log4j2 by apache.

the class DeleteActionTest method testCreateFileVisitorReturnsDeletingVisitor.

@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);
}
Also used : Path(java.nio.file.Path) DeletingVisitor(org.apache.logging.log4j.core.appender.rolling.action.DeletingVisitor) DeleteAction(org.apache.logging.log4j.core.appender.rolling.action.DeleteAction) Test(org.junit.Test)

Aggregations

Path (java.nio.file.Path)2 DeleteAction (org.apache.logging.log4j.core.appender.rolling.action.DeleteAction)2 DeletingVisitor (org.apache.logging.log4j.core.appender.rolling.action.DeletingVisitor)2 Test (org.junit.Test)2