Search in sources :

Example 6 with DeleteAction

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

the class DeleteActionTest method testGetOptionsReturnsEmptySetIfNotFollowingLinks.

@Test
public void testGetOptionsReturnsEmptySetIfNotFollowingLinks() {
    final DeleteAction delete = createAnyFilter("any", false, 0, false);
    assertEquals(Collections.emptySet(), delete.getOptions());
}
Also used : DeleteAction(org.apache.logging.log4j.core.appender.rolling.action.DeleteAction) Test(org.junit.Test)

Example 7 with DeleteAction

use of org.apache.logging.log4j.core.appender.rolling.action.DeleteAction 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)

Example 8 with DeleteAction

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

the class DeleteActionTest method create.

private static DeleteAction create(final String path, final boolean followLinks, final int maxDepth, final boolean testMode, final PathCondition[] conditions) {
    final Configuration config = new BasicConfigurationFactory().new BasicConfiguration();
    final DeleteAction delete = DeleteAction.createDeleteAction(path, followLinks, maxDepth, testMode, null, conditions, null, config);
    return delete;
}
Also used : Configuration(org.apache.logging.log4j.core.config.Configuration) DeleteAction(org.apache.logging.log4j.core.appender.rolling.action.DeleteAction) BasicConfigurationFactory(org.apache.logging.log4j.core.BasicConfigurationFactory)

Example 9 with DeleteAction

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

the class DeleteActionTest method testGetOptionsReturnsSetWithFollowLinksIfFollowingLinks.

@Test
public void testGetOptionsReturnsSetWithFollowLinksIfFollowingLinks() {
    final DeleteAction delete = createAnyFilter("any", true, 0, false);
    assertEquals(EnumSet.of(FileVisitOption.FOLLOW_LINKS), delete.getOptions());
}
Also used : DeleteAction(org.apache.logging.log4j.core.appender.rolling.action.DeleteAction) Test(org.junit.Test)

Aggregations

DeleteAction (org.apache.logging.log4j.core.appender.rolling.action.DeleteAction)9 Test (org.junit.Test)8 Path (java.nio.file.Path)3 DeletingVisitor (org.apache.logging.log4j.core.appender.rolling.action.DeletingVisitor)2 BasicConfigurationFactory (org.apache.logging.log4j.core.BasicConfigurationFactory)1 PathCondition (org.apache.logging.log4j.core.appender.rolling.action.PathCondition)1 Configuration (org.apache.logging.log4j.core.config.Configuration)1