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/01/23 19:59:44 UTC

[maven-surefire] branch release/2.22.3 updated (174b7ad -> 81a2023)

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 174b7ad  [jenkinsci] windows-he
 discard 6635923  [jenkinsci] Maven 3.2.x and 3.6.x; JDK 7,8,11
 discard 024e323  [SUREFIRE-1851] Prevent NPE in SmartStackTraceParser
 discard 152be2d  [SUREFIRE-1842] - NPE at end of successful test run
 discard c7fe5c9  [SUREFIRE-1825] Unable to zip the Cucumber TXT report file on Linux and MacOS
 discard 2fd60c5  [SUREFIRE-1659] Log4j logger in TestExecutionListener corrupts Surefire's STDOUT
 discard 1d4a916  update ASF CI url
 discard 5cc58ec  [SUREFIRE-1843] - Trademarks / privacy policy footer displays broken
 discard 90368b3  [SUREFIRE-1924] Upgrade plexus-java to Version 1.0.7
     new d4d2413  [SUREFIRE-1924] Upgrade plexus-java to Version 1.0.7
     new 9ca0cc5  [SUREFIRE-1843] - Trademarks / privacy policy footer displays broken
     new 54a0582  update ASF CI url
     new d0fa1ec  [SUREFIRE-1659] Log4j logger in TestExecutionListener corrupts Surefire's STDOUT
     new b6678e1  [SUREFIRE-1825] Unable to zip the Cucumber TXT report file on Linux and MacOS
     new 62557e4  [SUREFIRE-1842] - NPE at end of successful test run
     new d33ae9e  [SUREFIRE-1851] Prevent NPE in SmartStackTraceParser
     new 2bbb86c  [jenkinsci] Maven 3.2.x and 3.6.x; JDK 7,8,11
     new 2ff0016  [jenkinsci] windows-he
     new 0f295d8  setupJunitLogger() should be called AFTER startCapture()
     new 81a2023  enabled and fixed tests in surefire-junit-platform

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   (174b7ad)
            \
             N -- N -- N   refs/heads/release/2.22.3 (81a2023)

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 11 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-common/pom.xml                            |  4 ++++
 pom.xml                                                  |  5 +++++
 surefire-providers/surefire-junit-platform/pom.xml       |  4 ++++
 .../surefire/junitplatform/JUnitPlatformProvider.java    | 11 ++++++++++-
 .../maven/surefire/junitplatform/JUnit47SuiteTest.java   | 16 +++++++---------
 .../surefire/junitplatform/RunListenerAdapterTest.java   |  5 ++++-
 .../surefire/junitplatform/TestMethodFilterTest.java     |  5 ++++-
 7 files changed, 38 insertions(+), 12 deletions(-)
 copy maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/JUnit4SuiteTest.java => surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/JUnit47SuiteTest.java (74%)

[maven-surefire] 03/11: update ASF CI url

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 54a0582d2488b95f9342ca822d5ac38c952e1364
Author: tibordigana <ti...@gmail.com>
AuthorDate: Mon Nov 15 21:26:52 2021 +0100

    update ASF CI url
    
    (cherry picked from commit 3b77fd35f2322460a0099208d0c6fbff000cbd9f)
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index aa4a1ad..c00ce26 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
   </issueManagement>
   <ciManagement>
     <system>Jenkins</system>
-    <url>https://builds.apache.org/job/maven-box/job/maven-surefire</url>
+    <url>https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-surefire/</url>
   </ciManagement>
   <distributionManagement>
     <site>

[maven-surefire] 08/11: [jenkinsci] Maven 3.2.x and 3.6.x; JDK 7,8,11

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 2bbb86cbc718dbbb120dd1ac9e575b3e33a71663
Author: Tibor Digaňa <ti...@apache.org>
AuthorDate: Sun Jan 23 07:06:27 2022 +0100

    [jenkinsci] Maven 3.2.x and 3.6.x; JDK 7,8,11
---
 Jenkinsfile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 9de3f2f..1013636 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -31,8 +31,8 @@ properties(
 )
 
 final def oses = ['linux':'ubuntu && !H24', 'windows':'Windows']
-final def mavens = env.BRANCH_NAME == 'master' ? ['3.2.x', '3.3.x', '3.5.x'] : ['3.5.x']
-final def jdks = [7, 8, 9, 10, 11]
+final def mavens = env.BRANCH_NAME == 'master' ? ['3.2.x', '3.6.x'] : ['3.6.x']
+final def jdks = [7, 8, 11]
 
 final def options = ['-e', '-V', '-B', '-nsu', '-P', 'run-its']
 final def goals = ['clean', 'install', 'jacoco:report']

[maven-surefire] 05/11: [SUREFIRE-1825] Unable to zip the Cucumber TXT report file on Linux and MacOS

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 b6678e13f1f4e6533a8d74e974596d91a07f6c46
Author: tibordigana <ti...@apache.org>
AuthorDate: Sat Jul 18 22:26:55 2020 +0200

    [SUREFIRE-1825] Unable to zip the Cucumber TXT report file on Linux and MacOS
    
    (cherry picked from commit 53ea3ea7c320c62c9068c1d226a8f1233e99e7e0)
---
 .../org/apache/maven/plugin/surefire/report/FileReporterUtils.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterUtils.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterUtils.java
index fd33d8e..ea5c6c6 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterUtils.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterUtils.java
@@ -47,6 +47,10 @@ public final class FileReporterUtils
 
     private static String getOSSpecificIllegalChars()
     {
-        return IS_OS_WINDOWS ? "\\/:*?\"<>|\0" : "/\0";
+        // forbidden and quoted characters
+        // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
+        // https://cygwin.com/cygwin-ug-net/using-specialnames.html
+        // https://www.cyberciti.biz/faq/linuxunix-rules-for-naming-file-and-directory-names/
+        return IS_OS_WINDOWS ? "[],\\/:*?\"<>|\0" : "()&\\/:*?\"<>|\0";
     }
 }

[maven-surefire] 11/11: enabled and fixed tests in surefire-junit-platform

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 81a20232c885143f2c793aa9c5c8bf70cf0623b9
Author: Tibor Digaňa <ti...@apache.org>
AuthorDate: Sun Jan 23 20:57:40 2022 +0100

    enabled and fixed tests in surefire-junit-platform
---
 surefire-providers/surefire-junit-platform/pom.xml |  4 ++
 .../surefire/junitplatform/JUnit47SuiteTest.java   | 44 ++++++++++++++++++++++
 .../junitplatform/RunListenerAdapterTest.java      |  5 ++-
 .../junitplatform/TestMethodFilterTest.java        |  5 ++-
 4 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/surefire-providers/surefire-junit-platform/pom.xml b/surefire-providers/surefire-junit-platform/pom.xml
index b50dc6d..da34605 100644
--- a/surefire-providers/surefire-junit-platform/pom.xml
+++ b/surefire-providers/surefire-junit-platform/pom.xml
@@ -138,6 +138,10 @@
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
                     <jvm>${java.home}/bin/java</jvm>
+                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
+                    <includes>
+                        <include>**/JUnit47SuiteTest.java</include>
+                    </includes>
                 </configuration>
             </plugin>
             <plugin>
diff --git a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/JUnit47SuiteTest.java b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/JUnit47SuiteTest.java
new file mode 100644
index 0000000..6e56760
--- /dev/null
+++ b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/JUnit47SuiteTest.java
@@ -0,0 +1,44 @@
+package org.apache.maven.surefire.junitplatform;
+
+/*
+ * 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 junit.framework.JUnit4TestAdapter;
+import junit.framework.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ *
+ */
+@SuiteClasses( {
+        JUnitPlatformProviderTest.class,
+        RunListenerAdapterTest.class,
+        TestMethodFilterTest.class,
+        TestPlanScannerFilterTest.class
+} )
+@RunWith( Suite.class )
+public class JUnit47SuiteTest
+{
+    public static Test suite()
+    {
+        return new JUnit4TestAdapter( JUnit47SuiteTest.class );
+    }
+}
diff --git a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java
index a6cbddd..a0ba6b7 100644
--- a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java
+++ b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java
@@ -46,9 +46,11 @@ import org.apache.maven.surefire.report.SimpleReportEntry;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.engine.config.DefaultJupiterConfiguration;
 import org.junit.jupiter.engine.config.JupiterConfiguration;
 import org.junit.jupiter.engine.descriptor.ClassTestDescriptor;
 import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor;
+import org.junit.platform.engine.ConfigurationParameters;
 import org.junit.platform.engine.TestDescriptor;
 import org.junit.platform.engine.TestDescriptor.Type;
 import org.junit.platform.engine.TestExecutionResult;
@@ -69,7 +71,8 @@ import org.mockito.InOrder;
  */
 public class RunListenerAdapterTest
 {
-    private static final JupiterConfiguration JUPITER_CONFIGURATION = mock(JupiterConfiguration.class);
+    private static final JupiterConfiguration JUPITER_CONFIGURATION =
+            new DefaultJupiterConfiguration( mock( ConfigurationParameters.class ) );
 
     private RunListener listener;
 
diff --git a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestMethodFilterTest.java b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestMethodFilterTest.java
index 3633faa..b5cb528 100644
--- a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestMethodFilterTest.java
+++ b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestMethodFilterTest.java
@@ -29,9 +29,11 @@ import java.lang.reflect.Method;
 
 import org.apache.maven.surefire.testset.TestListResolver;
 import org.junit.Test;
+import org.junit.jupiter.engine.config.DefaultJupiterConfiguration;
 import org.junit.jupiter.engine.config.JupiterConfiguration;
 import org.junit.jupiter.engine.descriptor.ClassTestDescriptor;
 import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor;
+import org.junit.platform.engine.ConfigurationParameters;
 import org.junit.platform.engine.FilterResult;
 import org.junit.platform.engine.UniqueId;
 
@@ -42,7 +44,8 @@ import org.junit.platform.engine.UniqueId;
  */
 public class TestMethodFilterTest
 {
-    private static final JupiterConfiguration JUPITER_CONFIGURATION = mock(JupiterConfiguration.class);
+    private static final JupiterConfiguration JUPITER_CONFIGURATION =
+            new DefaultJupiterConfiguration( mock( ConfigurationParameters.class ) );
 
     private final TestListResolver resolver = mock( TestListResolver.class );
 

[maven-surefire] 01/11: [SUREFIRE-1924] Upgrade plexus-java to Version 1.0.7

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 d4d24134f323cfb38a36113c89d7f218c22b1e5b
Author: Tibor Digaňa <ti...@apache.org>
AuthorDate: Fri Dec 31 20:25:01 2021 +0100

    [SUREFIRE-1924] Upgrade plexus-java to Version 1.0.7
    
    (cherry picked from commit 773451c6874b02e26854a8763e0889e2126d4f95)
---
 maven-surefire-common/pom.xml                                    | 4 ++++
 .../maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java | 2 +-
 pom.xml                                                          | 9 +++++++--
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/maven-surefire-common/pom.xml b/maven-surefire-common/pom.xml
index 409e28f..98ee90b 100644
--- a/maven-surefire-common/pom.xml
+++ b/maven-surefire-common/pom.xml
@@ -108,6 +108,10 @@
       <artifactId>plexus-java</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.ow2.asm</groupId>
+      <artifactId>asm</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
       <scope>test</scope>
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
index 96a2a5c..731ef46 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
@@ -35,7 +35,7 @@ import org.apache.maven.surefire.util.DefaultScanResult;
 import org.codehaus.plexus.languages.java.jpms.LocationManager;
 import org.codehaus.plexus.languages.java.jpms.ResolvePathsRequest;
 import org.codehaus.plexus.languages.java.jpms.ResolvePathsResult;
-import org.codehaus.plexus.languages.java.jpms.ResolvePathsResult.ModuleNameSource;
+import org.codehaus.plexus.languages.java.jpms.ModuleNameSource;
 import org.codehaus.plexus.logging.Logger;
 import org.junit.BeforeClass;
 import org.junit.Test;
diff --git a/pom.xml b/pom.xml
index 8da630b..aa4a1ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -256,7 +256,12 @@
       <dependency>
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-java</artifactId>
-        <version>0.9.10</version>
+        <version>1.0.7</version>
+      </dependency>
+      <dependency>
+        <groupId>org.ow2.asm</groupId>
+        <artifactId>asm</artifactId>
+        <version>9.2</version>
       </dependency>
       <dependency>
         <groupId>org.mockito</groupId>
@@ -635,7 +640,7 @@
           <plugins>
             <!-- Moving to a profile, since these dependencies won't exist the first
                  time a new snapshot version is built. This prevents the first
-                 snapshot build from proceeding beyond the build for the top-level 
+                 snapshot build from proceeding beyond the build for the top-level
                  Surefire parent POM.
             -->
             <plugin>

[maven-surefire] 10/11: setupJunitLogger() should be called AFTER startCapture()

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 0f295d8daf7d15c7ca670adf73f3a0165535281e
Author: Tibor Digaňa <ti...@apache.org>
AuthorDate: Sun Jan 23 20:33:58 2022 +0100

    setupJunitLogger() should be called AFTER startCapture()
---
 .../maven/surefire/junitplatform/JUnitPlatformProvider.java   | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProvider.java b/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProvider.java
index 10a5dfe..63d65c1 100644
--- a/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProvider.java
+++ b/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProvider.java
@@ -91,7 +91,6 @@ public class JUnitPlatformProvider
         this.launcher = launcher;
         filters = newFilters();
         configurationParameters = newConfigurationParameters();
-        Logger.getLogger( "org.junit" ).setLevel( WARNING );
     }
 
     @Override
@@ -110,6 +109,7 @@ public class JUnitPlatformProvider
         {
             RunListener runListener = reporterFactory.createReporter();
             startCapture( ( ConsoleOutputReceiver ) runListener );
+            setupJunitLogger();
             if ( forkTestSet instanceof TestsToRun )
             {
                 invokeAllTests( (TestsToRun) forkTestSet, runListener );
@@ -135,6 +135,15 @@ public class JUnitPlatformProvider
         return runResult;
     }
 
+    private static void setupJunitLogger()
+    {
+        Logger logger = Logger.getLogger( "org.junit" );
+        if ( logger.getLevel() == null )
+        {
+            logger.setLevel( WARNING );
+        }
+    }
+
     private TestsToRun scanClasspath()
     {
         TestPlanScannerFilter filter = new TestPlanScannerFilter( launcher, filters );

[maven-surefire] 02/11: [SUREFIRE-1843] - Trademarks / privacy policy footer displays broken

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 9ca0cc5b87eb667a78b4b6ca4f7a521388f6bb52
Author: Michael Boyles <mi...@hotmail.co.uk>
AuthorDate: Wed Sep 23 00:17:58 2020 +0100

    [SUREFIRE-1843] - Trademarks / privacy policy footer displays broken
    
    (cherry picked from commit 51e04414c3e66835b470c4566b78272b4d5a0c74)
---
 src/site/site.xml | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/site/site.xml b/src/site/site.xml
index 447f71b..11d869a 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -64,12 +64,7 @@
     
     <footer>
 		<![CDATA[
-		<div class="row pull-left">
-		  <p>Apache ${project.name}, ${project.name}, Apache, the Apache feather logo, and the Apache ${project.name} project logos are trademarks of The Apache Software Foundation.</p>
-		</div>
-		<div class="row pull-left">
-		  <a href="${project.url}privacy-policy.html">Privacy Policy</a>
-        </div>
+		  <p>Apache ${project.name}, ${project.name}, Apache, the Apache feather logo, and the Apache ${project.name} project logos are trademarks of The Apache Software Foundation. <a href="${project.url}privacy-policy.html">Privacy Policy</a></p>
         ]]>
     </footer>
   </body>

[maven-surefire] 04/11: [SUREFIRE-1659] Log4j logger in TestExecutionListener corrupts Surefire's STDOUT

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 d0fa1ecfa3a24d61a09a7efe240d7aaaacb6512f
Author: Xavier Dury <ka...@hotmail.com>
AuthorDate: Fri Mar 26 15:43:56 2021 +0100

    [SUREFIRE-1659] Log4j logger in TestExecutionListener corrupts
    Surefire's STDOUT
    
    (cherry picked from commit 0ec1283c1652408cae53650eebdd0c33f876a807)
---
 .../its/JUnitPlatformStreamCorruptionIT.java       | 30 ++++++++
 .../surefire-1659-stream-corruption/pom.xml        | 88 ++++++++++++++++++++++
 .../com/example/demo/JUnitPlatformSampleTest.java  | 17 +++++
 .../src/test/resources/jul-to-slf4j.properties     |  1 +
 .../src/test/resources/junit-platform.properties   |  1 +
 .../src/test/resources/log4j2.xml                  | 13 ++++
 .../src/test/resources/logback-test.xml            | 11 +++
 .../junitplatform/JUnitPlatformProvider.java       |  3 +-
 .../maven/surefire/junitplatform/LazyLauncher.java | 70 +++++++++++++++++
 9 files changed, 232 insertions(+), 2 deletions(-)

diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformStreamCorruptionIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformStreamCorruptionIT.java
index 00a556c..b4b08bd 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformStreamCorruptionIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformStreamCorruptionIT.java
@@ -53,4 +53,34 @@ public class JUnitPlatformStreamCorruptionIT
         assertThat( lines )
                 .isEmpty();
     }
+
+    @Test
+    public void warningIsNotEmittedWithJulToSlf4j() throws VerificationException
+    {
+        OutputValidator validator = unpack( "/surefire-1659-stream-corruption" )
+                .activateProfile( "junit-platform-with-jul-to-slf4j" )
+                .executeTest()
+                .verifyErrorFree( 1 );
+
+        List<String> lines = validator.loadLogLines(
+                startsWith( "[WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM" ) );
+
+        assertThat( lines )
+                .isEmpty();
+    }
+
+    @Test
+    public void warningIsNotEmittedWithJulToLog4j() throws VerificationException
+    {
+        OutputValidator validator = unpack( "/surefire-1659-stream-corruption" )
+                .activateProfile( "junit-platform-with-jul-to-log4j" )
+                .executeTest()
+                .verifyErrorFree( 1 );
+
+        List<String> lines = validator.loadLogLines(
+                startsWith( "[WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM" ) );
+
+        assertThat( lines )
+                .isEmpty();
+    }
 }
diff --git a/surefire-its/src/test/resources/surefire-1659-stream-corruption/pom.xml b/surefire-its/src/test/resources/surefire-1659-stream-corruption/pom.xml
new file mode 100644
index 0000000..1184931
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1659-stream-corruption/pom.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.maven.plugins.surefire</groupId>
+    <artifactId>junit-platform-1.0.0</artifactId>
+    <version>1.0</version>
+    <name>[SUREFIRE-1659] Log4j logger in TestExecutionListener corrupts Surefire's STDOUT.</name>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.compiler.source>${java.specification.version}</maven.compiler.source>
+        <maven.compiler.target>${java.specification.version}</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <version>5.7.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <profiles>
+        <profile>
+            <id>junit-platform-with-jul-to-slf4j</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <version>${surefire.version}</version>
+                        <configuration>
+                            <systemPropertyVariables>
+                                <java.util.logging.config.file>${project.basedir}/src/test/resources/jul-to-slf4j.properties</java.util.logging.config.file>
+                            </systemPropertyVariables>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+            <dependencies>
+                <dependency>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>jul-to-slf4j</artifactId>
+                    <version>1.7.25</version>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>ch.qos.logback</groupId>
+                    <artifactId>logback-classic</artifactId>
+                    <version>1.2.3</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>junit-platform-with-jul-to-log4j</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <version>${surefire.version}</version>
+                        <configuration>
+                            <systemPropertyVariables>
+                                <java.util.logging.manager>org.apache.logging.log4j.jul.LogManager</java.util.logging.manager>
+                            </systemPropertyVariables>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-core</artifactId>
+                    <version>2.13.1</version>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-jul</artifactId>
+                    <version>2.13.1</version>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
+
+</project>
diff --git a/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/java/com/example/demo/JUnitPlatformSampleTest.java b/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/java/com/example/demo/JUnitPlatformSampleTest.java
new file mode 100644
index 0000000..f0359bb
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/java/com/example/demo/JUnitPlatformSampleTest.java
@@ -0,0 +1,17 @@
+package com.example.demo;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.logging.Logger;
+
+public class JUnitPlatformSampleTest
+{
+
+    @Test
+    public void sampleTest()
+    {
+        Logger.getLogger( getClass().getName() ).info( "running test" );
+        Assertions.assertTrue( true );
+    }
+}
diff --git a/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/resources/jul-to-slf4j.properties b/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/resources/jul-to-slf4j.properties
new file mode 100644
index 0000000..637a886
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/resources/jul-to-slf4j.properties
@@ -0,0 +1 @@
+handlers = org.slf4j.bridge.SLF4JBridgeHandler
diff --git a/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/resources/junit-platform.properties b/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/resources/junit-platform.properties
new file mode 100644
index 0000000..648ee97
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/resources/junit-platform.properties
@@ -0,0 +1 @@
+# This file is needed in order for JUnit to log something early on org.junit.platform.launcher.core.LauncherConfigurationParameters
diff --git a/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/resources/log4j2.xml b/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/resources/log4j2.xml
new file mode 100644
index 0000000..a5185ce
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/resources/log4j2.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration status="INFO">
+    <Appenders>
+        <Console name="console" target="SYSTEM_OUT">
+            <PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"/>
+        </Console>
+    </Appenders>
+    <Loggers>
+        <Root level="info" additivity="false">
+            <AppenderRef ref="console"/>
+        </Root>
+    </Loggers>
+</Configuration>
diff --git a/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/resources/logback-test.xml b/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/resources/logback-test.xml
new file mode 100644
index 0000000..35d1b19
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1659-stream-corruption/src/test/resources/logback-test.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+    <root level="INFO">
+        <appender-ref ref="STDOUT"/>
+    </root>
+</configuration>
diff --git a/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProvider.java b/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProvider.java
index fef72e6..10a5dfe 100644
--- a/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProvider.java
+++ b/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProvider.java
@@ -61,7 +61,6 @@ import org.junit.platform.launcher.Launcher;
 import org.junit.platform.launcher.LauncherDiscoveryRequest;
 import org.junit.platform.launcher.TagFilter;
 import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder;
-import org.junit.platform.launcher.core.LauncherFactory;
 
 /**
  * JUnit 5 Platform Provider.
@@ -83,7 +82,7 @@ public class JUnitPlatformProvider
 
     public JUnitPlatformProvider( ProviderParameters parameters )
     {
-        this( parameters, LauncherFactory.create() );
+        this( parameters, new LazyLauncher() );
     }
 
     JUnitPlatformProvider( ProviderParameters parameters, Launcher launcher )
diff --git a/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/LazyLauncher.java b/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/LazyLauncher.java
new file mode 100644
index 0000000..c057c32
--- /dev/null
+++ b/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/LazyLauncher.java
@@ -0,0 +1,70 @@
+package org.apache.maven.surefire.junitplatform;
+
+/*
+ * 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.platform.launcher.Launcher;
+import org.junit.platform.launcher.LauncherDiscoveryRequest;
+import org.junit.platform.launcher.TestExecutionListener;
+import org.junit.platform.launcher.TestPlan;
+import org.junit.platform.launcher.core.LauncherFactory;
+
+/**
+ * Launcher proxy which delays the most possible the initialization of the real JUnit
+ * Launcher in order to avoid stream/stdout corruption due to early logging.
+ */
+class LazyLauncher implements Launcher
+{
+
+    private Launcher launcher;
+
+    @Override
+    public void registerTestExecutionListeners( TestExecutionListener... testExecutionListeners )
+    {
+        launcher().registerTestExecutionListeners( testExecutionListeners );
+    }
+
+    @Override
+    public TestPlan discover( LauncherDiscoveryRequest launcherDiscoveryRequest )
+    {
+        return launcher().discover( launcherDiscoveryRequest );
+    }
+
+    @Override
+    public void execute( LauncherDiscoveryRequest launcherDiscoveryRequest,
+                         TestExecutionListener... testExecutionListeners )
+    {
+        launcher().execute( launcherDiscoveryRequest, testExecutionListeners );
+    }
+
+    @Override
+    public void execute( TestPlan testPlan, TestExecutionListener... testExecutionListeners )
+    {
+        launcher().execute( testPlan, testExecutionListeners );
+    }
+
+    private Launcher launcher()
+    {
+        if ( launcher == null )
+        {
+            launcher = LauncherFactory.create();
+        }
+        return launcher;
+    }
+}

[maven-surefire] 07/11: [SUREFIRE-1851] Prevent NPE in SmartStackTraceParser

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 d33ae9e8ef4f4dae8da979cd857f3e51391812b0
Author: Adam Jones <jo...@rocketmail.com>
AuthorDate: Mon Oct 5 02:32:14 2020 +0200

    [SUREFIRE-1851] Prevent NPE in SmartStackTraceParser
    
    (cherry picked from commit 08163fa6d0d161070a6add1c05a1058781160415)
---
 .../surefire/report/SmartStackTraceParser.java     |  6 ++-
 .../apache/maven/surefire/report/ATestClass.java   |  5 +++
 .../surefire/report/SmartStackTraceParserTest.java | 15 ++++++++
 .../{ATestClass.java => SomeMockedException.java}  | 43 ++++++++++------------
 4 files changed, 45 insertions(+), 24 deletions(-)

diff --git a/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java b/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java
index 7c68f95..cccb939 100644
--- a/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java
+++ b/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java
@@ -196,11 +196,15 @@ public class SmartStackTraceParser
 
     private boolean rootIsInclass()
     {
-        return stackTrace.length > 0 && stackTrace[0].getClassName().equals( testClassName );
+        return stackTrace != null && stackTrace.length > 0 && stackTrace[0].getClassName().equals( testClassName );
     }
 
     static List<StackTraceElement> focusOnClass( StackTraceElement[] stackTrace, Class clazz )
     {
+        if ( stackTrace == null )
+        {
+            return Collections.emptyList();
+        }
         List<StackTraceElement> result = new ArrayList<StackTraceElement>();
         for ( StackTraceElement element : stackTrace )
         {
diff --git a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/ATestClass.java b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/ATestClass.java
index baff162..d75e741 100644
--- a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/ATestClass.java
+++ b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/ATestClass.java
@@ -60,4 +60,9 @@ public class ATestClass
         throw new RuntimeException( "This message will be truncated, somewhere over the rainbow. "
                                         + "Gangnam style, Gangnam style, Gangnam style, , Gangnam style, Gangnam style" );
     }
+
+    public void aMockedException()
+    {
+        throw new SomeMockedException();
+    }
 }
diff --git a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java
index e600718..a598f5b 100644
--- a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java
+++ b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java
@@ -303,6 +303,21 @@ public class SmartStackTraceParserTest
         }
     }
 
+    public void testNullStackTrace()
+    {
+        try
+        {
+            new ATestClass().aMockedException();
+        }
+        catch ( Exception e )
+        {
+            SmartStackTraceParser smartStackTraceParser =
+                    new SmartStackTraceParser( ATestClass.class.getName(), e, null );
+            String res = smartStackTraceParser.getString();
+            assertEquals( "ATestClass » SomeMocked", res );
+        }
+    }
+
     public ExecutionException getSingleNested()
     {
         FutureTask<Object> futureTask = new FutureTask<Object>( new RunnableTestClass2() );
diff --git a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/ATestClass.java b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SomeMockedException.java
similarity index 54%
copy from surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/ATestClass.java
copy to surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SomeMockedException.java
index baff162..5852db2 100644
--- a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/ATestClass.java
+++ b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SomeMockedException.java
@@ -19,45 +19,42 @@ package org.apache.maven.surefire.report;
  * under the License.
  */
 
-import java.io.File;
-
-@SuppressWarnings( "UnusedDeclaration" )
-public class ATestClass
+/**
+ * @author Adam Jones
+ */
+public class SomeMockedException extends RuntimeException
 {
-
-    public void failInAssert()
-    {
-        throw new AssertionError( "X is not Z" );
-    }
-
-    public void nestedFailInAssert()
+    public SomeMockedException()
     {
-        failInAssert();
     }
 
-    public void npe()
+    @Override
+    public String getMessage()
     {
-        throw new NullPointerException( "It was null" );
+        return null;
     }
 
-    public void nestedNpe()
+    @Override
+    public String getLocalizedMessage()
     {
-        npe();
+        return null;
     }
 
-    public void npeOutsideTest()
+    @Override
+    public Throwable getCause()
     {
-        File file = new File( (String) null );
+        return null;
     }
 
-    public void nestedNpeOutsideTest()
+    @Override
+    public String toString()
     {
-        npeOutsideTest();
+        return null;
     }
 
-    public void aLongTestErrorMessage()
+    @Override
+    public StackTraceElement[] getStackTrace()
     {
-        throw new RuntimeException( "This message will be truncated, somewhere over the rainbow. "
-                                        + "Gangnam style, Gangnam style, Gangnam style, , Gangnam style, Gangnam style" );
+        return null;
     }
 }

[maven-surefire] 09/11: [jenkinsci] windows-he

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 2ff00166a9b057c1188fc4a31eba772ed9d7f0fc
Author: Tibor Digaňa <ti...@apache.org>
AuthorDate: Sun Jan 23 07:22:44 2022 +0100

    [jenkinsci] windows-he
---
 Jenkinsfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 1013636..6eabce6 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -30,7 +30,7 @@ properties(
     ]
 )
 
-final def oses = ['linux':'ubuntu && !H24', 'windows':'Windows']
+final def oses = ['linux':'ubuntu', 'windows':'windows-he']
 final def mavens = env.BRANCH_NAME == 'master' ? ['3.2.x', '3.6.x'] : ['3.6.x']
 final def jdks = [7, 8, 11]
 

[maven-surefire] 06/11: [SUREFIRE-1842] - NPE at end of successful test run

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 62557e4111df48f637aa0f5744073d6ea982c076
Author: tibordigana <ti...@apache.org>
AuthorDate: Wed Sep 23 03:38:43 2020 +0200

    [SUREFIRE-1842] - NPE at end of successful test run
    
    (cherry picked from commit aef6573be8a31f8235786517405b49a6c1ef89c5)
---
 .../java/org/apache/maven/surefire/booter/BaseProviderFactory.java     | 3 +--
 .../test/java/org/apache/maven/surefire/junit4/JUnit4ProviderTest.java | 3 +++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
index 2b329ee..4df2c28 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
@@ -111,8 +111,7 @@ public class BaseProviderFactory
     @Override
     public RunOrderCalculator getRunOrderCalculator()
     {
-        return directoryScannerParameters == null
-                ? null : new DefaultRunOrderCalculator( runOrderParameters, getThreadCount() );
+        return new DefaultRunOrderCalculator( runOrderParameters, getThreadCount() );
     }
 
     @Override
diff --git a/surefire-providers/surefire-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4ProviderTest.java b/surefire-providers/surefire-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4ProviderTest.java
index bf6cafc..a970c6b 100644
--- a/surefire-providers/surefire-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4ProviderTest.java
+++ b/surefire-providers/surefire-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4ProviderTest.java
@@ -21,9 +21,11 @@ package org.apache.maven.surefire.junit4;
 
 import junit.framework.TestCase;
 import org.apache.maven.surefire.booter.BaseProviderFactory;
+import org.apache.maven.surefire.testset.RunOrderParameters;
 import org.apache.maven.surefire.testset.TestRequest;
 import org.junit.runner.Description;
 
+import java.io.File;
 import java.util.HashMap;
 
 import static java.util.Arrays.asList;
@@ -48,6 +50,7 @@ public class JUnit4ProviderTest
         providerParameters.setProviderProperties( new HashMap<String, String>() );
         providerParameters.setClassLoaders( getClass().getClassLoader() );
         providerParameters.setTestRequest( new TestRequest( null, null, null ) );
+        providerParameters.setRunOrderParameters( new RunOrderParameters( "hourly", new File( "" ) ) );
         return new JUnit4Provider( providerParameters );
     }