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 2018/01/13 22:24:31 UTC

maven-surefire git commit: [SUREFIRE-1463] integration tests should run on the top of JDK 9

Repository: maven-surefire
Updated Branches:
  refs/heads/SUREFIRE-1463 [created] e4deb5ec6


[SUREFIRE-1463] integration tests should run on the top of JDK 9


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/e4deb5ec
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/e4deb5ec
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/e4deb5ec

Branch: refs/heads/SUREFIRE-1463
Commit: e4deb5ec60d257f8a11664de745f6a2f27a50f14
Parents: 27a5e6a
Author: Tibor17 <ti...@apache.org>
Authored: Sat Jan 13 23:22:07 2018 +0100
Committer: Tibor17 <ti...@apache.org>
Committed: Sat Jan 13 23:23:09 2018 +0100

----------------------------------------------------------------------
 .mvn/jvm.config                                 |  1 +
 maven-failsafe-plugin/pom.xml                   |  1 +
 .../src/it/jetty-war-test-failing/pom.xml       |  4 ++--
 .../src/it/jetty-war-test-passing/pom.xml       |  4 ++--
 .../src/it/multiple-summaries-failing/pom.xml   |  8 +++++++
 .../src/it/multiple-summaries/pom.xml           |  8 +++++++
 .../src/it/working-directory/pom.xml            |  8 +++++++
 pom.xml                                         |  1 +
 surefire-integration-tests/pom.xml              | 25 ++++----------------
 .../maven/surefire/its/AbstractJigsawIT.java    | 20 ++++++++--------
 .../maven/surefire/its/Java9FullApiIT.java      |  5 +++-
 .../surefire/its/fixture/SurefireLauncher.java  |  8 +++++--
 ...urefire1295AttributeJvmCrashesToTestsIT.java |  4 ++--
 13 files changed, 58 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4deb5ec/.mvn/jvm.config
----------------------------------------------------------------------
diff --git a/.mvn/jvm.config b/.mvn/jvm.config
new file mode 100644
index 0000000..7512600
--- /dev/null
+++ b/.mvn/jvm.config
@@ -0,0 +1 @@
+-server -Xmx356m -Dhttps.protocols="TLSv1" -Djava.awt.headless=true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4deb5ec/maven-failsafe-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/pom.xml b/maven-failsafe-plugin/pom.xml
index ace3231..9e3d87b 100644
--- a/maven-failsafe-plugin/pom.xml
+++ b/maven-failsafe-plugin/pom.xml
@@ -300,6 +300,7 @@
               </execution>
             </executions>
             <configuration>
+              <javaHome>${jdk.home}</javaHome>
               <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
             </configuration>
           </plugin>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4deb5ec/maven-failsafe-plugin/src/it/jetty-war-test-failing/pom.xml
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/it/jetty-war-test-failing/pom.xml b/maven-failsafe-plugin/src/it/jetty-war-test-failing/pom.xml
index cc65b18..3fc8886 100644
--- a/maven-failsafe-plugin/src/it/jetty-war-test-failing/pom.xml
+++ b/maven-failsafe-plugin/src/it/jetty-war-test-failing/pom.xml
@@ -122,8 +122,8 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>2.0.2</version>
         <configuration>
-          <source>1.5</source>
-          <target>1.5</target>
+          <source>1.8</source>
+          <target>1.8</target>
         </configuration>
       </plugin>
     </plugins>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4deb5ec/maven-failsafe-plugin/src/it/jetty-war-test-passing/pom.xml
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/it/jetty-war-test-passing/pom.xml b/maven-failsafe-plugin/src/it/jetty-war-test-passing/pom.xml
index b90d3d8..79c46e5 100644
--- a/maven-failsafe-plugin/src/it/jetty-war-test-passing/pom.xml
+++ b/maven-failsafe-plugin/src/it/jetty-war-test-passing/pom.xml
@@ -122,8 +122,8 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>2.0.2</version>
         <configuration>
-          <source>1.5</source>
-          <target>1.5</target>
+          <source>1.8</source>
+          <target>1.8</target>
         </configuration>
       </plugin>
     </plugins>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4deb5ec/maven-failsafe-plugin/src/it/multiple-summaries-failing/pom.xml
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/it/multiple-summaries-failing/pom.xml b/maven-failsafe-plugin/src/it/multiple-summaries-failing/pom.xml
index 41e36d5..0f0b706 100644
--- a/maven-failsafe-plugin/src/it/multiple-summaries-failing/pom.xml
+++ b/maven-failsafe-plugin/src/it/multiple-summaries-failing/pom.xml
@@ -77,6 +77,14 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0.2</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4deb5ec/maven-failsafe-plugin/src/it/multiple-summaries/pom.xml
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/it/multiple-summaries/pom.xml b/maven-failsafe-plugin/src/it/multiple-summaries/pom.xml
index 921af08..fcb5e2f 100644
--- a/maven-failsafe-plugin/src/it/multiple-summaries/pom.xml
+++ b/maven-failsafe-plugin/src/it/multiple-summaries/pom.xml
@@ -72,6 +72,14 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0.2</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4deb5ec/maven-failsafe-plugin/src/it/working-directory/pom.xml
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/it/working-directory/pom.xml b/maven-failsafe-plugin/src/it/working-directory/pom.xml
index c250b69..4530c7e 100644
--- a/maven-failsafe-plugin/src/it/working-directory/pom.xml
+++ b/maven-failsafe-plugin/src/it/working-directory/pom.xml
@@ -51,6 +51,14 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0.2</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4deb5ec/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3592b31..1619c3f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -584,6 +584,7 @@
                   <exclude>src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider
                   </exclude>
                   <exclude>DEPENDENCIES</exclude>
+                  <exclude>.mvn/*</exclude>
                 </excludes>
               </configuration>
             </execution>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4deb5ec/surefire-integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/pom.xml b/surefire-integration-tests/pom.xml
index c1a6c4a..e798e0d 100644
--- a/surefire-integration-tests/pom.xml
+++ b/surefire-integration-tests/pom.xml
@@ -76,8 +76,10 @@
       <artifactId>commons-io</artifactId>
     </dependency>
     <dependency>
+      <!-- Java 9 requires version 3.6+ (todo put it in parent POM. Note: commons-lang3:3.7 is compiled with Java 7) -->
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
+      <version>3.7</version>
     </dependency>
   </dependencies>
 
@@ -93,11 +95,12 @@
         <artifactId>maven-failsafe-plugin</artifactId>
         <version>2.12.4</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 -->
         <configuration>
+          <jvm>${jdk.home}/bin/java</jvm>
           <runOrder>alphabetical</runOrder>
           <threadCount>1</threadCount>
           <perCoreThreadCount>false</perCoreThreadCount>
-          <forkMode>never</forkMode>
-          <argLine>${argLine}</argLine>
+          <forkMode>once</forkMode>
+          <argLine>-Xmx356m</argLine>
           <includes>
             <include>org/apache/**/*IT*.java</include>
           </includes>
@@ -201,24 +204,6 @@
 
   <profiles>
     <profile>
-      <id>parallel</id>
-      <properties>
-        <useInterpolatedSettings>false</useInterpolatedSettings>
-      </properties>
-      <build>
-        <plugins>
-          <plugin>
-            <artifactId>maven-failsafe-plugin</artifactId>
-            <configuration>
-              <parallel>classes</parallel>
-              <threadCount>${surefire.threadcount}</threadCount>
-              <argLine>${argLine} -Xmx512m -XX:MaxPermSize=356m</argLine>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <profile>
       <id>embedded</id>
       <activation>
         <file>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4deb5ec/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java
index 5063a2d..d1a5b2c 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java
@@ -29,6 +29,8 @@ import java.io.InputStream;
 import java.util.Properties;
 import java.util.StringTokenizer;
 
+import static org.apache.maven.surefire.its.fixture.SurefireLauncher.EXT_JDK_HOME;
+import static org.apache.maven.surefire.its.fixture.SurefireLauncher.EXT_JDK_HOME_KEY;
 import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeTrue;
 
@@ -41,8 +43,6 @@ import static org.junit.Assume.assumeTrue;
 public abstract class AbstractJigsawIT
         extends SurefireJUnit4IntegrationTestCase
 {
-    protected static final String JDK_HOME_KEY = "jdk.home";
-    protected static final String JDK_HOME = System.getProperty( JDK_HOME_KEY );
     private static final double JIGSAW_JAVA_VERSION = 9.0d;
 
     protected abstract String getProjectDirectoryName();
@@ -50,14 +50,14 @@ public abstract class AbstractJigsawIT
     protected SurefireLauncher assumeJigsaw() throws IOException
     {
         assumeTrue( "There's no JDK 9 provided.",
-                          isJavaVersion9AtLeast() || JDK_HOME != null && isExtJavaVerion9AtLeast() );
-        // fail( JDK_HOME_KEY + " was provided with value " + JDK_HOME + " but it is not Jigsaw Java 9." );
+                          isJavaVersion9AtLeast() || EXT_JDK_HOME != null && isExtJavaVerion9AtLeast() );
+        // fail( EXT_JDK_HOME_KEY + " was provided with value " + EXT_JDK_HOME + " but it is not Jigsaw Java 9." );
 
         SurefireLauncher launcher = unpack();
 
-        if ( JDK_HOME != null )
+        if ( EXT_JDK_HOME != null )
         {
-            launcher.setLauncherJavaHome( JDK_HOME );
+            launcher.setLauncherJavaHome( EXT_JDK_HOME );
         }
 
         return launcher;
@@ -65,7 +65,7 @@ public abstract class AbstractJigsawIT
 
     protected SurefireLauncher assumeJava9Property() throws IOException
     {
-        assumeTrue( "There's no JDK 9 provided.", JDK_HOME != null && isExtJavaVerion9AtLeast() );
+        assumeTrue( "There's no JDK 9 provided.", EXT_JDK_HOME != null && isExtJavaVerion9AtLeast() );
         return unpack();
     }
 
@@ -81,12 +81,12 @@ public abstract class AbstractJigsawIT
 
     private static boolean isExtJavaVerion9AtLeast() throws IOException
     {
-        File release = new File( JDK_HOME, "release" );
+        File release = new File( EXT_JDK_HOME, "release" );
 
         if ( !release.isFile() )
         {
-            fail( JDK_HOME_KEY + " was provided with value " + JDK_HOME + " but file does not exist "
-                          + JDK_HOME + File.separator + "release"
+            fail( EXT_JDK_HOME_KEY + " was provided with value " + EXT_JDK_HOME + " but file does not exist "
+                          + EXT_JDK_HOME + File.separator + "release"
             );
         }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4deb5ec/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
index 22841ae..5d9b7fe 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
@@ -25,6 +25,9 @@ import org.junit.Test;
 import java.io.File;
 import java.io.IOException;
 
+import static org.apache.maven.surefire.its.fixture.SurefireLauncher.EXT_JDK_HOME;
+import static org.apache.maven.surefire.its.fixture.SurefireLauncher.EXT_JDK_HOME_KEY;
+
 /**
  * Running Surefire on the top of JDK 9 and should be able to load
  * classes of multiple different Jigsaw modules without error.
@@ -59,7 +62,7 @@ public class Java9FullApiIT
         OutputValidator validator = assumeJava9Property()
                                             .setForkJvm()
                                             .debugLogging()
-                                            .sysProp( JDK_HOME_KEY, new File( JDK_HOME ).getCanonicalPath() )
+                                            .sysProp( EXT_JDK_HOME_KEY, new File( EXT_JDK_HOME ).getCanonicalPath() )
                                             .execute( "verify" )
                                             .verifyErrorFree( 1 );
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4deb5ec/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
index 1c6c971..6c5b7ef 100755
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
@@ -36,6 +36,10 @@ import java.util.List;
  */
 public final class SurefireLauncher
 {
+    public static final String EXT_JDK_HOME_KEY = "jdk.home";
+
+    public static final String EXT_JDK_HOME = System.getProperty( EXT_JDK_HOME_KEY );
+
     private final MavenLauncher mavenLauncher;
 
     private final String surefireVersion = System.getProperty( "surefire.version" );
@@ -66,9 +70,9 @@ public final class SurefireLauncher
         setInProcessJavaHome();
     }
 
-    public SurefireLauncher setInProcessJavaHome()
+    private SurefireLauncher setInProcessJavaHome()
     {
-        String javaHome = System.getenv( "JAVA_HOME" );
+        String javaHome = System.getenv( EXT_JDK_HOME == null ? "JAVA_HOME" : EXT_JDK_HOME );
         if ( javaHome != null && !javaHome.isEmpty() )
         {
             try

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4deb5ec/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1295AttributeJvmCrashesToTestsIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1295AttributeJvmCrashesToTestsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1295AttributeJvmCrashesToTestsIT.java
index f051c1c..0a703fc 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1295AttributeJvmCrashesToTestsIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1295AttributeJvmCrashesToTestsIT.java
@@ -28,8 +28,8 @@ import org.junit.Test;
 
 import java.util.Iterator;
 
-import static org.apache.commons.lang.SystemUtils.IS_OS_LINUX;
-import static org.apache.commons.lang.SystemUtils.IS_OS_MAC_OSX;
+import static org.apache.commons.lang3.SystemUtils.IS_OS_LINUX;
+import static org.apache.commons.lang3.SystemUtils.IS_OS_MAC_OSX;
 import static org.fest.assertions.Assertions.assertThat;
 import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeTrue;