Skip to content

Commit 7994fd0

Browse files
committed
Fix missing resource
1 parent 5a04e52 commit 7994fd0

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderCronTest.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
import org.apache.logging.log4j.core.util.CronExpression;
3333
import org.apache.logging.log4j.plugins.Named;
3434
import org.apache.logging.log4j.test.junit.TempLoggingDir;
35-
import org.junit.jupiter.api.BeforeEach;
35+
import org.junit.jupiter.api.AfterAll;
36+
import org.junit.jupiter.api.BeforeAll;
3637
import org.junit.jupiter.api.Test;
3738
import org.opentest4j.TestAbortedException;
3839

@@ -42,8 +43,10 @@ class RollingAppenderCronTest extends AbstractRollingListenerTest {
4243

4344
static {
4445
try {
45-
CONFIG = Path.of(requireNonNull(RollingAppenderCronTest.class.getResource("RollingAppenderCronTest.xml"))
46-
.toURI());
46+
final Path config =
47+
Path.of(requireNonNull(RollingAppenderCronTest.class.getResource("RollingAppenderCronTest.old.xml"))
48+
.toURI());
49+
CONFIG = config.resolveSibling("RollingAppenderCronTest.xml");
4750
} catch (final URISyntaxException e) {
4851
throw new TestAbortedException("Unable to compute configuration location.", e);
4952
}
@@ -55,14 +58,19 @@ class RollingAppenderCronTest extends AbstractRollingListenerTest {
5558
@TempLoggingDir
5659
private static Path loggingPath;
5760

58-
@BeforeEach
59-
void beforeEach() throws Exception {
61+
@BeforeAll
62+
static void beforeEach() throws Exception {
6063
final Path src =
6164
Path.of(requireNonNull(RollingAppenderCronTest.class.getResource("RollingAppenderCronTest.old.xml"))
6265
.toURI());
6366
Files.copy(src, CONFIG, REPLACE_EXISTING);
6467
}
6568

69+
@AfterAll
70+
static void cleanUp() throws Exception {
71+
Files.deleteIfExists(CONFIG);
72+
}
73+
6674
@Test
6775
@LoggerContextSource(timeout = 10)
6876
public void testAppender(final LoggerContext context, @Named("RollingFile") final RollingFileManager manager)

0 commit comments

Comments
 (0)