You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by pk...@apache.org on 2024/04/03 13:07:38 UTC
(logging-log4j2) branch main updated: Fix missing resource
This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/main by this push:
new 7994fd0f29 Fix missing resource
7994fd0f29 is described below
commit 7994fd0f295c2ddf8fd3c6c060cf9c7bb841153b
Author: Piotr P. Karwasz <pi...@karwasz.org>
AuthorDate: Wed Apr 3 15:07:30 2024 +0200
Fix missing resource
---
.../core/appender/rolling/RollingAppenderCronTest.java | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderCronTest.java b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderCronTest.java
index d1262d1687..ec4effaaf0 100644
--- a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderCronTest.java
+++ b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderCronTest.java
@@ -32,7 +32,8 @@ import org.apache.logging.log4j.core.test.junit.LoggerContextSource;
import org.apache.logging.log4j.core.util.CronExpression;
import org.apache.logging.log4j.plugins.Named;
import org.apache.logging.log4j.test.junit.TempLoggingDir;
-import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.opentest4j.TestAbortedException;
@@ -42,8 +43,10 @@ class RollingAppenderCronTest extends AbstractRollingListenerTest {
static {
try {
- CONFIG = Path.of(requireNonNull(RollingAppenderCronTest.class.getResource("RollingAppenderCronTest.xml"))
- .toURI());
+ final Path config =
+ Path.of(requireNonNull(RollingAppenderCronTest.class.getResource("RollingAppenderCronTest.old.xml"))
+ .toURI());
+ CONFIG = config.resolveSibling("RollingAppenderCronTest.xml");
} catch (final URISyntaxException e) {
throw new TestAbortedException("Unable to compute configuration location.", e);
}
@@ -55,14 +58,19 @@ class RollingAppenderCronTest extends AbstractRollingListenerTest {
@TempLoggingDir
private static Path loggingPath;
- @BeforeEach
- void beforeEach() throws Exception {
+ @BeforeAll
+ static void beforeEach() throws Exception {
final Path src =
Path.of(requireNonNull(RollingAppenderCronTest.class.getResource("RollingAppenderCronTest.old.xml"))
.toURI());
Files.copy(src, CONFIG, REPLACE_EXISTING);
}
+ @AfterAll
+ static void cleanUp() throws Exception {
+ Files.deleteIfExists(CONFIG);
+ }
+
@Test
@LoggerContextSource(timeout = 10)
public void testAppender(final LoggerContext context, @Named("RollingFile") final RollingFileManager manager)