|
65 | 65 | import org.apache.logging.log4j.core.filter.ThresholdFilter; |
66 | 66 | import org.apache.logging.log4j.core.layout.HtmlLayout; |
67 | 67 | import org.apache.logging.log4j.core.layout.PatternLayout; |
68 | | -import org.junit.jupiter.api.Test; |
69 | | -import org.junit.jupiter.api.io.TempDir; |
| 68 | +// import org.junit.jupiter.api.Test; |
| 69 | +// import org.junit.jupiter.api.io.TempDir; |
| 70 | + |
| 71 | +import org.junit.Test; |
| 72 | +import org.junit.Rule; |
| 73 | +import org.junit.rules.TemporaryFolder; |
70 | 74 |
|
71 | 75 | public abstract class AbstractLog4j1ConfigurationTest { |
72 | 76 |
|
73 | | - @TempDir |
74 | | - File tempDir; |
| 77 | + // @TempDir |
| 78 | + // File tempDir; |
| 79 | + |
| 80 | + @Rule |
| 81 | + public TemporaryFolder tempFolder = TemporaryFolder.builder().assureDeletion().build(); |
75 | 82 |
|
76 | 83 | abstract Configuration getConfiguration(String configResourcePrefix) throws URISyntaxException, IOException; |
77 | 84 |
|
@@ -475,13 +482,18 @@ private int checkFilters(final org.apache.log4j.spi.Filter filter) { |
475 | 482 | // #### tempDir ######### /tmp/junit-8800472835944933796 |
476 | 483 | // ######### folder /tmp/junit12627114905753561837/junit16127502666327035264 |
477 | 484 |
|
478 | | - @Test |
| 485 | + // @Test |
479 | 486 | public void testMultipleFilters() throws Exception { |
480 | 487 | // Create a subdirectory inside the tempDir |
481 | | - File nestedDir = new File(tempDir, "junit" + System.nanoTime()); |
482 | | - System.out.println("#############" + nestedDir.getCanonicalPath()); |
| 488 | + // File nestedDir = new File(tempDir, "junit" + System.nanoTime()); |
| 489 | + // String temporaryFolder = nestedDir.getCanonicalPath(); |
| 490 | + // System.out.println("#############" + nestedDir.getCanonicalPath()); |
| 491 | + // System.out.println("#############" + temporaryFolder.replace("-", "")); |
| 492 | + |
| 493 | + // System.setProperty("test.tmpDir", nestedDir.getCanonicalPath().replace("-", "")); |
483 | 494 |
|
484 | | - System.setProperty("test.tmpDir", nestedDir.getCanonicalPath()); |
| 495 | + final File folder = tempFolder.newFolder(); |
| 496 | + System.setProperty("test.tmpDir", folder.getCanonicalPath()); |
485 | 497 |
|
486 | 498 | try (final LoggerContext loggerContext = configure("log4j-multipleFilters")) { |
487 | 499 | final Configuration configuration = loggerContext.getConfiguration(); |
|
0 commit comments