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 2017/08/28 20:51:54 UTC

[1/4] maven-surefire git commit: SUREFIRE-1384: Start implemeting JUnit Plattform ProviderInfo for automatic provider lookup

Repository: maven-surefire
Updated Branches:
  refs/heads/junit5 9580f5ef2 -> 507809204


SUREFIRE-1384: Start implemeting JUnit Plattform ProviderInfo for automatic
provider lookup


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

Branch: refs/heads/junit5
Commit: 1a7dd9b84f8462fa841e015826b44c553ff64b5e
Parents: 9580f5e
Author: Benedikt Ritter <br...@apache.org>
Authored: Thu Jun 8 14:46:04 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Sat Aug 19 11:42:54 2017 +0200

----------------------------------------------------------------------
 .../plugin/surefire/AbstractSurefireMojo.java   | 48 ++++++++++++++-
 .../maven/surefire/its/JUnitPlattformIT.java    | 48 +++++++++++++++
 .../src/test/resources/junit-plattform/pom.xml  | 58 +++++++++++++++++
 .../src/test/java/junitplattform/BasicTest.java | 65 ++++++++++++++++++++
 4 files changed, 217 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1a7dd9b8/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index a3ab13e..ef81cb8 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -933,6 +933,7 @@ public abstract class AbstractSurefireMojo
                               new TestNgProviderInfo( getTestNgArtifact() ),
                               new JUnitCoreProviderInfo( getJunitArtifact(), junitDepArtifact ),
                               new JUnit4ProviderInfo( getJunitArtifact(), junitDepArtifact ),
+                              new JUnitPlattformProviderInfo( getJunitArtifact() ),
                               new JUnit3ProviderInfo() )
             .resolve();
     }
@@ -1430,12 +1431,22 @@ public abstract class AbstractSurefireMojo
 
     private boolean isJunit47Compatible( Artifact artifact )
     {
-        return dependencyResolver.isWithinVersionSpec( artifact, "[4.7,)" );
+        return dependencyResolver.isWithinVersionSpec( artifact, "[4.7,4.12.0)" );
     }
 
     private boolean isAnyJunit4( Artifact artifact )
     {
-        return dependencyResolver.isWithinVersionSpec( artifact, "[4.0,)" );
+        return dependencyResolver.isWithinVersionSpec( artifact, "[4.0,4.12.0)" );
+    }
+
+    private boolean isJunitJupiter( Artifact artifact )
+    {
+        return dependencyResolver.isWithinVersionSpec( artifact, "[5.0.0,)" );
+    }
+
+    private boolean isJunitVintage( Artifact artifact )
+    {
+        return dependencyResolver.isWithinVersionSpec( artifact, "[4.12.0,5.0.0)" );
     }
 
     static boolean isForkModeNever( String forkMode )
@@ -2602,6 +2613,39 @@ public abstract class AbstractSurefireMojo
 
     }
 
+    final class JUnitPlattformProviderInfo
+        implements ProviderInfo
+    {
+        private final Artifact junitArtifact;
+
+        JUnitPlattformProviderInfo( Artifact junitArtifact )
+        {
+            this.junitArtifact = junitArtifact;
+        }
+
+        @Nonnull public String getProviderName()
+        {
+            return "org.apache.maven.surefire.junitplatform.JUnitPlatformProvider";
+        }
+
+        public boolean isApplicable()
+        {
+            return isJunitJupiter( junitArtifact ) || isJunitVintage( junitArtifact );
+        }
+
+        public void addProviderProperties() throws MojoExecutionException
+        {
+        }
+
+        public Classpath getProviderClasspath()
+            throws ArtifactResolutionException, ArtifactNotFoundException, ArtifactResolverException
+        {
+            return dependencyResolver.getProviderClasspath( "surefire-junit-platform",
+                                                            surefireBooterArtifact.getBaseVersion() );
+        }
+
+    }
+
     final class JUnitCoreProviderInfo
         implements ProviderInfo
     {

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1a7dd9b8/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitPlattformIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitPlattformIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitPlattformIT.java
new file mode 100644
index 0000000..b046dcc
--- /dev/null
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitPlattformIT.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 org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
+import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+import org.junit.Test;
+
+import static java.lang.System.getProperty;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assume.assumeThat;
+
+public class JUnitPlattformIT
+    extends SurefireJUnit4IntegrationTestCase
+{
+    private SurefireLauncher unpack()
+    {
+        return unpack( "/junit-plattform" );
+    }
+
+    @Test
+    public void test40()
+        throws Exception
+    {
+        assumeThat( "java.specification.version: ",
+                getProperty( "java.specification.version" ), is( greaterThanOrEqualTo( "1.8" ) ) );
+
+        unpack().executeTest().verifyErrorFree( 1 );
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1a7dd9b8/surefire-integration-tests/src/test/resources/junit-plattform/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit-plattform/pom.xml b/surefire-integration-tests/src/test/resources/junit-plattform/pom.xml
new file mode 100644
index 0000000..44105ee
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/junit-plattform/pom.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<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>org.apache.maven.plugins.surefire</groupId>
+  <artifactId>junit-plattform</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>Test for JUnit Plattform</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
+      <version>5.0.0-M4</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>${surefire.version}</version>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1a7dd9b8/surefire-integration-tests/src/test/resources/junit-plattform/src/test/java/junitplattform/BasicTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit-plattform/src/test/java/junitplattform/BasicTest.java b/surefire-integration-tests/src/test/resources/junit-plattform/src/test/java/junitplattform/BasicTest.java
new file mode 100644
index 0000000..3f03bdd
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/junit-plattform/src/test/java/junitplattform/BasicTest.java
@@ -0,0 +1,65 @@
+package junitplattform;
+
+/*
+ * 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 static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+public class BasicTest
+{
+
+    private boolean setUpCalled = false;
+
+    private static boolean tearDownCalled = false;
+
+    @BeforeEach
+    public void setUp()
+    {
+        setUpCalled = true;
+        tearDownCalled = false;
+        System.out.println( "Called setUp" );
+    }
+
+    @AfterEach
+    public void tearDown()
+    {
+        setUpCalled = false;
+        tearDownCalled = true;
+        System.out.println( "Called tearDown" );
+    }
+
+    @Test
+    public void testSetUp()
+    {
+        assertTrue( setUpCalled, "setUp was not called" );
+    }
+
+
+    @AfterAll
+    public static void oneTimeTearDown()
+    {
+
+    }
+
+}


[4/4] maven-surefire git commit: enforcer:3.0.0-M1@enforce-java

Posted by ti...@apache.org.
enforcer:3.0.0-M1@enforce-java


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

Branch: refs/heads/junit5
Commit: 507809204929751b57c3cc053bc76d85dd98458b
Parents: 05b4286
Author: Tibor17 <ti...@apache.org>
Authored: Mon Aug 28 22:47:37 2017 +0200
Committer: Tibor17 <ti...@apache.org>
Committed: Mon Aug 28 22:47:37 2017 +0200

----------------------------------------------------------------------
 pom.xml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/50780920/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 77c0385..0f9cc12 100644
--- a/pom.xml
+++ b/pom.xml
@@ -344,6 +344,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-enforcer-plugin</artifactId>
+        <version>3.0.0-M1</version>
         <executions>
           <execution>
             <id>enforce-java</id>
@@ -353,7 +354,9 @@
             <configuration>
               <rules>
                 <requireJavaVersion>
-                  <version>[1.6.0, 1.9.0)</version>
+                  <!-- We use JDK 1.8 to check -Xdoclint:all at compile time but with javac -source 1.6 -target 1.6 -->
+                  <!-- enforcer:1.3.1 fails on jdk9. 3.0.0-M1 does not but surefire:12.2.4 crashes later. -->
+                  <version>[1.8, 1.9)</version>
                 </requireJavaVersion>
               </rules>
             </configuration>
@@ -366,7 +369,7 @@
             <configuration>
               <rules>
                 <requireMavenVersion>
-                  <version>[3.0.5,)</version>
+                  <version>[3.1.0,)</version>
                 </requireMavenVersion>
               </rules>
             </configuration>


[3/4] maven-surefire git commit: Address Tibors comments from #153

Posted by ti...@apache.org.
Address Tibors comments from #153


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

Branch: refs/heads/junit5
Commit: 05b42861b856a123fde83a31ab47f0c8d70b9fc7
Parents: 59d3239
Author: Benedikt Ritter <br...@apache.org>
Authored: Sat Aug 19 11:53:50 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Sat Aug 19 11:53:50 2017 +0200

----------------------------------------------------------------------
 .../org/apache/maven/plugin/surefire/AbstractSurefireMojo.java | 4 ++--
 .../src/test/resources/junit-plattform/pom.xml                 | 2 +-
 .../src/test/java/junitplattform/BasicTest.java                | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/05b42861/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index d8c59a1..dd05e05 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -1431,12 +1431,12 @@ public abstract class AbstractSurefireMojo
 
     private boolean isJunit47Compatible( Artifact artifact )
     {
-        return dependencyResolver.isWithinVersionSpec( artifact, "[4.7,4.12.0)" );
+        return dependencyResolver.isWithinVersionSpec( artifact, "[4.7,)" );
     }
 
     private boolean isAnyJunit4( Artifact artifact )
     {
-        return dependencyResolver.isWithinVersionSpec( artifact, "[4.0,4.12.0)" );
+        return dependencyResolver.isWithinVersionSpec( artifact, "[4.0,)" );
     }
 
     private boolean isJunitJupiter( Artifact artifact )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/05b42861/surefire-integration-tests/src/test/resources/junit-plattform/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit-plattform/pom.xml b/surefire-integration-tests/src/test/resources/junit-plattform/pom.xml
index 44105ee..4f6027c 100644
--- a/surefire-integration-tests/src/test/resources/junit-plattform/pom.xml
+++ b/surefire-integration-tests/src/test/resources/junit-plattform/pom.xml
@@ -20,7 +20,7 @@
 
 <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">
+         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>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/05b42861/surefire-integration-tests/src/test/resources/junit-plattform/src/test/java/junitplattform/BasicTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit-plattform/src/test/java/junitplattform/BasicTest.java b/surefire-integration-tests/src/test/resources/junit-plattform/src/test/java/junitplattform/BasicTest.java
index 3f03bdd..91acaa9 100644
--- a/surefire-integration-tests/src/test/resources/junit-plattform/src/test/java/junitplattform/BasicTest.java
+++ b/surefire-integration-tests/src/test/resources/junit-plattform/src/test/java/junitplattform/BasicTest.java
@@ -29,9 +29,9 @@ import org.junit.jupiter.api.Test;
 public class BasicTest
 {
 
-    private boolean setUpCalled = false;
+    private boolean setUpCalled;
 
-    private static boolean tearDownCalled = false;
+    private static boolean tearDownCalled;
 
     @BeforeEach
     public void setUp()
@@ -59,7 +59,7 @@ public class BasicTest
     @AfterAll
     public static void oneTimeTearDown()
     {
-
+        assertTrue( tearDownCalled );
     }
 
 }


[2/4] maven-surefire git commit: Fix compile error

Posted by ti...@apache.org.
Fix compile error


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

Branch: refs/heads/junit5
Commit: 59d32392920d9f7753073184aaed772e5e089a84
Parents: 1a7dd9b
Author: Benedikt Ritter <br...@apache.org>
Authored: Sat Aug 19 11:48:38 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Sat Aug 19 11:48:38 2017 +0200

----------------------------------------------------------------------
 .../org/apache/maven/plugin/surefire/AbstractSurefireMojo.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/59d32392/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index ef81cb8..d8c59a1 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -2638,10 +2638,11 @@ public abstract class AbstractSurefireMojo
         }
 
         public Classpath getProviderClasspath()
-            throws ArtifactResolutionException, ArtifactNotFoundException, ArtifactResolverException
+            throws ArtifactResolutionException, ArtifactNotFoundException
         {
             return dependencyResolver.getProviderClasspath( "surefire-junit-platform",
-                                                            surefireBooterArtifact.getBaseVersion() );
+                                                            surefireBooterArtifact.getBaseVersion(),
+                                                            null );
         }
 
     }