You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2022/02/17 19:59:54 UTC
[maven-surefire] branch release/2.22.3 updated (877f5c2 -> deee517)
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a change to branch release/2.22.3
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git.
discard 877f5c2 SUREFIRE-1909 Support JUnit 5 reflection access by changing add-exports to add-opens
new deee517 SUREFIRE-1909 Support JUnit 5 reflection access by changing add-exports to add-opens
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (877f5c2)
\
N -- N -- N refs/heads/release/2.22.3 (deee517)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../maven/surefire/its/Junit5ModulePathIT.java | 25 ++--------------------
1 file changed, 2 insertions(+), 23 deletions(-)
[maven-surefire] 01/01: SUREFIRE-1909 Support JUnit 5 reflection access by changing add-exports to add-opens
Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch release/2.22.3
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit deee5171afe7da953ad4af8e93050b2c7963dc1f
Author: Nils Renaud <re...@gmail.com>
AuthorDate: Tue Feb 8 17:49:35 2022 +0100
SUREFIRE-1909 Support JUnit 5 reflection access by changing add-exports to add-opens
Signed-off-by: Nils Renaud <re...@gmail.com>
(cherry picked from commit 6b4ccdd19f904cdef710a126e2b9af4b1c7b60df)
Signed-off-by: Nils Renaud <re...@gmail.com>
---
.../ModularClasspathForkConfiguration.java | 2 +-
.../ModularClasspathForkConfigurationTest.java | 2 +-
.../maven/surefire/its/Junit5ModulePathIT.java | 48 ++++++++++++++++++++++
.../src/test/resources/junit5-modulepath/pom.xml | 46 +++++++++++++++++++++
.../src/main/java/com/app/Main.java | 31 ++++++++++++++
.../src/main/java/module-info.java | 21 ++++++++++
.../src/test/java/com/app/AppTest.java | 37 +++++++++++++++++
7 files changed, 185 insertions(+), 2 deletions(-)
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java
index b6130c5..a6b17d8 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java
@@ -167,7 +167,7 @@ public class ModularClasspathForkConfiguration
for ( String pkg : packages )
{
- writer.write( "--add-exports" );
+ writer.write( "--add-opens" );
writer.newLine();
writer.append( moduleName )
.append( '/' )
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java
index 6d34dcd..46a97d2 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java
@@ -104,7 +104,7 @@ public class ModularClasspathForkConfigurationTest
.isEqualTo( "booter.jar" + pathSeparator + "non-modular.jar" + pathSeparator + patchFile.getPath() );
assertThat( argsFileLines.get( 4 ) ).isEqualTo( "--patch-module" );
assertThat( argsFileLines.get( 5 ) ).isEqualTo( "abc=" + patchFile.getPath() );
- assertThat( argsFileLines.get( 6 ) ).isEqualTo( "--add-exports" );
+ assertThat( argsFileLines.get( 6 ) ).isEqualTo( "--add-opens" );
assertThat( argsFileLines.get( 7 ) ).isEqualTo( "abc/org.apache.abc=ALL-UNNAMED" );
assertThat( argsFileLines.get( 8 ) ).isEqualTo( "--add-modules" );
assertThat( argsFileLines.get( 9 ) ).isEqualTo( "abc" );
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/Junit5ModulePathIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/Junit5ModulePathIT.java
new file mode 100644
index 0000000..fec6061
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/Junit5ModulePathIT.java
@@ -0,0 +1,48 @@
+package org.apache.maven.surefire.its;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+/**
+ *
+ */
+public class Junit5ModulePathIT
+ extends AbstractJigsawIT
+{
+ @Test
+ public void testModulePath()
+ throws IOException
+ {
+ assumeJigsaw()
+ .debugLogging()
+ .executeTest()
+ .verifyErrorFreeLog()
+ .assertTestSuiteResults( 2 );
+ }
+
+ @Override
+ protected String getProjectDirectoryName()
+ {
+ return "junit5-modulepath";
+ }
+}
diff --git a/surefire-its/src/test/resources/junit5-modulepath/pom.xml b/surefire-its/src/test/resources/junit5-modulepath/pom.xml
new file mode 100644
index 0000000..c997bd0
--- /dev/null
+++ b/surefire-its/src/test/resources/junit5-modulepath/pom.xml
@@ -0,0 +1,46 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>foo</groupId>
+ <artifactId>app</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <name>app</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.release>${java.specification.version}</maven.compiler.release>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.10.0</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ <version>2.9.9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>5.6.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/surefire-its/src/test/resources/junit5-modulepath/src/main/java/com/app/Main.java b/surefire-its/src/test/resources/junit5-modulepath/src/main/java/com/app/Main.java
new file mode 100644
index 0000000..51e145b
--- /dev/null
+++ b/surefire-its/src/test/resources/junit5-modulepath/src/main/java/com/app/Main.java
@@ -0,0 +1,31 @@
+package com.app;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.joda.time.DateTime;
+
+public class Main
+{
+ public static void main( String... args )
+ {
+ DateTime dt = new DateTime();
+ System.out.println( dt );
+ }
+}
diff --git a/surefire-its/src/test/resources/junit5-modulepath/src/main/java/module-info.java b/surefire-its/src/test/resources/junit5-modulepath/src/main/java/module-info.java
new file mode 100644
index 0000000..5f3eed4
--- /dev/null
+++ b/surefire-its/src/test/resources/junit5-modulepath/src/main/java/module-info.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+module com.app {
+ requires joda.time;
+}
diff --git a/surefire-its/src/test/resources/junit5-modulepath/src/test/java/com/app/AppTest.java b/surefire-its/src/test/resources/junit5-modulepath/src/test/java/com/app/AppTest.java
new file mode 100644
index 0000000..8f2d3f5
--- /dev/null
+++ b/surefire-its/src/test/resources/junit5-modulepath/src/test/java/com/app/AppTest.java
@@ -0,0 +1,37 @@
+package com.app;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.junit.jupiter.api.Test;
+
+public class AppTest
+{
+ @Test
+ void testNoop()
+ throws Exception
+ {
+ }
+
+ @Test
+ void testMain()
+ {
+ Main.main();
+ }
+}