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 2022/10/16 07:02:36 UTC
[logging-log4j2] branch master updated: Rollback JUnit Pioneer upgrade and othe test fixes
This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/master by this push:
new 55dd71241a Rollback JUnit Pioneer upgrade and othe test fixes
55dd71241a is described below
commit 55dd71241ac57d3d56a026b55af4bd6a347ff754
Author: Piotr P. Karwasz <pi...@karwasz.org>
AuthorDate: Sun Oct 16 07:16:33 2022 +0200
Rollback JUnit Pioneer upgrade and othe test fixes
JUnit Pioneer 1.7.x moved system properties changes from @BeforeAll to
@BeforeEach, which breaks many our tests.
This also adds a test module descriptor to `log4j-jpl`.
---
log4j-api-test/pom.xml | 4 +-
.../src/main/{java9 => module}/module-info.java | 22 +++----
.../logging/log4j/NoopThreadContextTest.java | 4 +-
log4j-core-test/pom.xml | 4 +-
.../src/main/{java9 => module}/module-info.java | 16 ++---
log4j-jpl/pom.xml | 69 ++++++++++++++--------
.../src/main/{java => module}/module-info.java | 0
log4j-jpl/src/{main => test}/java/module-info.java | 5 ++
log4j-jul/pom.xml | 64 --------------------
log4j-script/src/main/module/module-info.java | 2 -
.../log4j/spring/boot/SpringProfileArbiter.java | 3 +-
pom.xml | 3 +-
12 files changed, 72 insertions(+), 124 deletions(-)
diff --git a/log4j-api-test/pom.xml b/log4j-api-test/pom.xml
index 88b9aa782c..3268c990e4 100644
--- a/log4j-api-test/pom.xml
+++ b/log4j-api-test/pom.xml
@@ -115,7 +115,7 @@
</goals>
<configuration>
<sources>
- <source>${project.basedir}/src/main/java9</source>
+ <source>${project.basedir}/src/main/module</source>
</sources>
</configuration>
</execution>
@@ -182,7 +182,7 @@
<phase>prepare-package</phase>
<configuration>
<compileSourceRoots>
- <compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
+ <compileSourceRoot>${project.basedir}/src/main/module</compileSourceRoot>
</compileSourceRoots>
</configuration>
</execution>
diff --git a/log4j-api-test/src/main/java9/module-info.java b/log4j-api-test/src/main/module/module-info.java
similarity index 66%
rename from log4j-api-test/src/main/java9/module-info.java
rename to log4j-api-test/src/main/module/module-info.java
index 3d35fb9fe6..650b21d769 100644
--- a/log4j-api-test/src/main/java9/module-info.java
+++ b/log4j-api-test/src/main/module/module-info.java
@@ -21,17 +21,13 @@ module org.apache.logging.log4j.test {
opens org.apache.logging.log4j.test.junit to org.junit.platform.commons;
requires transitive org.apache.logging.log4j;
- requires com.fasterxml.jackson.core;
- requires com.fasterxml.jackson.databind;
- requires org.apache.commons.lang3;
- requires org.assertj.core;
- requires transitive org.hamcrest;
- requires transitive org.junit.jupiter.api;
- requires org.junit.jupiter.engine;
- requires transitive org.junit.jupiter.params;
- requires org.junit.platform.commons;
- requires org.junit.platform.engine;
- requires transitive org.junit.platform.launcher;
- requires org.junitpioneer;
- requires transitive junit;
+ requires static org.apache.commons.lang3;
+ requires static org.assertj.core;
+ requires static org.hamcrest;
+ requires static org.junit.jupiter.api;
+ requires static org.junit.jupiter.params;
+ requires static org.junit.platform.commons;
+ requires static org.junit.platform.launcher;
+ requires static org.junitpioneer;
+ requires static junit;
}
diff --git a/log4j-api-test/src/test/java/org/apache/logging/log4j/NoopThreadContextTest.java b/log4j-api-test/src/test/java/org/apache/logging/log4j/NoopThreadContextTest.java
index 58198c7143..d06328676f 100644
--- a/log4j-api-test/src/test/java/org/apache/logging/log4j/NoopThreadContextTest.java
+++ b/log4j-api-test/src/test/java/org/apache/logging/log4j/NoopThreadContextTest.java
@@ -26,11 +26,11 @@ import org.junitpioneer.jupiter.SetSystemProperty;
/**
* Tests {@link ThreadContext}.
*/
-@SetSystemProperty(key = "log4j2.disableThreadContext", value = "true")
-@SetSystemProperty(key = "log4j2.disableThreadContextMap", value = "true")
public class NoopThreadContextTest {
@Test
+ @SetSystemProperty(key = "log4j2.disableThreadContext", value = "true")
+ @SetSystemProperty(key = "log4j2.disableThreadContextMap", value = "true")
@InitializesThreadContext
@UsingThreadContextMap
public void testNoop() {
diff --git a/log4j-core-test/pom.xml b/log4j-core-test/pom.xml
index c3dd458333..7284206f5c 100644
--- a/log4j-core-test/pom.xml
+++ b/log4j-core-test/pom.xml
@@ -316,7 +316,7 @@
</goals>
<configuration>
<sources>
- <source>${project.basedir}/src/main/java9</source>
+ <source>${project.basedir}/src/main/module</source>
</sources>
</configuration>
</execution>
@@ -390,7 +390,7 @@
<phase>prepare-package</phase>
<configuration>
<compileSourceRoots>
- <compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
+ <compileSourceRoot>${project.basedir}/src/main/module</compileSourceRoot>
</compileSourceRoots>
</configuration>
</execution>
diff --git a/log4j-core-test/src/main/java9/module-info.java b/log4j-core-test/src/main/module/module-info.java
similarity index 82%
rename from log4j-core-test/src/main/java9/module-info.java
rename to log4j-core-test/src/main/module/module-info.java
index 2299153583..00b74a0d5a 100644
--- a/log4j-core-test/src/main/java9/module-info.java
+++ b/log4j-core-test/src/main/module/module-info.java
@@ -34,16 +34,12 @@ module org.apache.logging.log4j.core.test {
requires java.naming;
requires org.apache.logging.log4j;
requires org.apache.logging.log4j.test;
- requires org.apache.logging.log4j.plugins;
+ requires transitive org.apache.logging.log4j.plugins;
requires org.apache.logging.log4j.plugins.test;
- requires org.apache.logging.log4j.core;
- requires com.fasterxml.jackson.core;
- requires com.fasterxml.jackson.databind;
- requires junit;
- requires org.junit.jupiter.api;
- requires org.junit.jupiter.engine;
- requires org.junit.jupiter.params;
- requires org.junit.platform.commons;
- requires org.junit.platform.engine;
+ requires transitive org.apache.logging.log4j.core;
+ requires static org.hamcrest;
+ requires static junit;
+ requires static org.junit.jupiter.api;
+ requires static org.junit.platform.commons;
provides PluginService with Log4jPlugins;
}
diff --git a/log4j-jpl/pom.xml b/log4j-jpl/pom.xml
index 6ed58e6741..77e333dc04 100644
--- a/log4j-jpl/pom.xml
+++ b/log4j-jpl/pom.xml
@@ -77,6 +77,23 @@
<build>
<plugins>
+ <!-- For Eclipse users' sake we move the module descriptor to a separate source folder -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.basedir}/src/main/module</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
@@ -130,22 +147,41 @@
</execution>
</executions>
</plugin>
+ <!-- Workaround Surefire 3.0.0-M7 limitation: it does not add the main classes with 'patch-module' -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes combine.self="override"/>
- </configuration>
+ <artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
- <id>test</id>
- <phase>test</phase>
+ <id>shade-test-module</id>
+ <phase>process-test-classes</phase>
<goals>
- <goal>test</goal>
+ <goal>copy-resources</goal>
</goals>
+ <configuration>
+ <outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${project.build.outputDirectory}</directory>
+ </resource>
+ </resources>
+ </configuration>
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <!-- Manual override of the Surefire provider -->
+ <!-- The `surefire-platform` provider initializes JUL before calling our tests -->
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-junit47</artifactId>
+ <version>${surefire.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
</plugins>
</build>
<reporting>
@@ -225,25 +261,6 @@
<activation>
<jdk>[11,)</jdk>
</activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <!-- Disable forked VM as 2.21 yields https://issues.apache.org/jira/browse/SUREFIRE-720 -->
- <configuration combine.self="override"/>
- <executions>
- <execution>
- <id>test</id>
- <phase>test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
<reporting>
<plugins>
<plugin>
diff --git a/log4j-jpl/src/main/java/module-info.java b/log4j-jpl/src/main/module/module-info.java
similarity index 100%
copy from log4j-jpl/src/main/java/module-info.java
copy to log4j-jpl/src/main/module/module-info.java
diff --git a/log4j-jpl/src/main/java/module-info.java b/log4j-jpl/src/test/java/module-info.java
similarity index 88%
rename from log4j-jpl/src/main/java/module-info.java
rename to log4j-jpl/src/test/java/module-info.java
index 0b5affa597..0fe97d5818 100644
--- a/log4j-jpl/src/main/java/module-info.java
+++ b/log4j-jpl/src/test/java/module-info.java
@@ -15,8 +15,13 @@
* limitations under the license.
*/
module org.apache.logging.log4j.jpl {
+ exports org.apache.logging.log4j.jpl to
+ junit;
+
requires org.apache.logging.log4j;
requires transitive org.apache.logging.log4j.core;
+ requires org.apache.logging.log4j.core.test;
+ requires org.hamcrest;
provides java.lang.System.LoggerFinder with org.apache.logging.log4j.jpl.Log4jSystemLoggerFinder;
}
diff --git a/log4j-jul/pom.xml b/log4j-jul/pom.xml
index 18ba588c76..f33a8f19d1 100644
--- a/log4j-jul/pom.xml
+++ b/log4j-jul/pom.xml
@@ -42,70 +42,6 @@
<artifactId>log4j-core</artifactId>
<optional>true</optional>
</dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-api-test</artifactId>
- <scope>test</scope>
- <exclusions>
- <!-- Exclude Junit 5 - it is hardwired to use java.util.logging and breaks all these tests -->
- <exclusion>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-migrationsupport</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.junit-pioneer</groupId>
- <artifactId>junit-pioneer</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.junit.platform</groupId>
- <artifactId>junit-platform-commons</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.junit.platform</groupId>
- <artifactId>junit-platform-launcher</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core-test</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-migrationsupport</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.junit-pioneer</groupId>
- <artifactId>junit-pioneer</artifactId>
- </exclusion>
- <!-- Exclude Junit 5 - it is hardwired to use java.util.logging and breaks all these tests -->
- <exclusion>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
diff --git a/log4j-script/src/main/module/module-info.java b/log4j-script/src/main/module/module-info.java
index 0fa939f95e..df254be3a9 100644
--- a/log4j-script/src/main/module/module-info.java
+++ b/log4j-script/src/main/module/module-info.java
@@ -28,8 +28,6 @@ module org.apache.logging.log4j.script {
exports org.apache.logging.log4j.script.config.arbiter;
opens org.apache.logging.log4j.script.config.arbiter to
org.apache.logging.log4j.core;
- opens org.apache.logging.log4j.script.config.builder to
- org.apache.logging.log4j.core;
exports org.apache.logging.log4j.script.filter;
exports org.apache.logging.log4j.script.layout;
opens org.apache.logging.log4j.script.layout to
diff --git a/log4j-spring-boot/src/main/java/org/apache/logging/log4j/spring/boot/SpringProfileArbiter.java b/log4j-spring-boot/src/main/java/org/apache/logging/log4j/spring/boot/SpringProfileArbiter.java
index 32afc36714..fff8edd355 100644
--- a/log4j-spring-boot/src/main/java/org/apache/logging/log4j/spring/boot/SpringProfileArbiter.java
+++ b/log4j-spring-boot/src/main/java/org/apache/logging/log4j/spring/boot/SpringProfileArbiter.java
@@ -20,13 +20,12 @@ import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.arbiters.Arbiter;
-import org.apache.logging.log4j.core.config.plugins.PluginBuilderAttribute;
import org.apache.logging.log4j.core.config.plugins.PluginBuilderFactory;
import org.apache.logging.log4j.core.config.plugins.PluginConfiguration;
import org.apache.logging.log4j.core.config.plugins.PluginLoggerContext;
import org.apache.logging.log4j.plugins.Configurable;
-import org.apache.logging.log4j.plugins.Inject;
import org.apache.logging.log4j.plugins.Plugin;
+import org.apache.logging.log4j.plugins.PluginBuilderAttribute;
import org.apache.logging.log4j.status.StatusLogger;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
diff --git a/pom.xml b/pom.xml
index 3c0a45ca2a..52b9313b64 100644
--- a/pom.xml
+++ b/pom.xml
@@ -336,7 +336,8 @@
<json-unit.version>2.35.0</json-unit.version>
<junit.version>4.13.2</junit.version>
<junit-jupiter.version>5.9.0</junit-jupiter.version>
- <junit-pioneer.version>1.7.1</junit-pioneer.version>
+ <!-- Do not upgrade to 1.7.x until https://github.com/junit-pioneer/junit-pioneer/issues/623 is fixed -->
+ <junit-pioneer.version>1.6.2</junit-pioneer.version>
<kafka.version>1.1.1</kafka.version>
<kubernetes-client.version>4.6.1</kubernetes-client.version>
<lightcouch.version>0.0.6</lightcouch.version>