Repository: maven-surefire
Updated Branches:
  refs/heads/master 9c8a75906 -> 8881fabb9


[SUREFIRE] fixed pending issues, refactoring


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

Branch: refs/heads/master
Commit: 8881fabb9625522a4790ef8c96179233a51e7385
Parents: 9c8a759
Author: Tibor17 <[email protected]>
Authored: Tue Sep 22 22:57:13 2015 +0200
Committer: Tibor17 <[email protected]>
Committed: Tue Sep 22 22:57:13 2015 +0200

----------------------------------------------------------------------
 .../plugin/surefire/AbstractSurefireMojo.java   |  1 +
 maven-surefire-plugin/src/site/apt/index.apt.vm |  6 ++
 .../surefire/booter/MasterProcessReader.java    | 32 +++++++++-
 .../maven/surefire/booter/ForkedBooter.java     |  6 +-
 .../maven/surefire/junit4/JUnit4Provider.java   |  3 +-
 surefire-providers/surefire-junit47/pom.xml     |  2 +-
 .../surefire/junitcore/JUnitCoreProvider.java   |  3 +-
 .../surefire/junitcore/JUnit47SuiteTest.java    | 61 ++++++++++++++++++++
 .../surefire/junitcore/JUnit4SuiteTest.java     | 61 --------------------
 .../maven/surefire/testng/TestNGProvider.java   |  4 +-
 10 files changed, 105 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8881fabb/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 d67e29f..5546152 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
@@ -1976,6 +1976,7 @@ public abstract class AbstractSurefireMojo
         checksum.add( getTestSourceDirectory() );
         checksum.add( getTest() );
         checksum.add( getIncludes() );
+        checksum.add( getSkipAfterFailureCount() );
         checksum.add( getShutdown() );
         checksum.add( getExcludes() );
         checksum.add( getLocalRepository() );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8881fabb/maven-surefire-plugin/src/site/apt/index.apt.vm
----------------------------------------------------------------------
diff --git a/maven-surefire-plugin/src/site/apt/index.apt.vm 
b/maven-surefire-plugin/src/site/apt/index.apt.vm
index 09ea2c0..9c7ef2f 100644
--- a/maven-surefire-plugin/src/site/apt/index.apt.vm
+++ b/maven-surefire-plugin/src/site/apt/index.apt.vm
@@ -137,10 +137,14 @@ mvn verify
 
   * {{{./examples/skipping-test.html}Skipping Tests}}
 
+  * {{{./examples/skip-after-failure.html}Skip After Failure}}
+
   * {{{./examples/inclusion-exclusion.html}Inclusions and Exclusions of Tests}}
 
   * {{{./examples/single-test.html}Running a Single Test}}
 
+  * {{{./examples/rerun-failing-tests.html}Re-run Failing Tests}}
+
   * {{{./examples/class-loading.html}Class Loading and Forking}}
 
   * {{{./examples/debugging.html}Debugging Tests}}
@@ -153,6 +157,8 @@ mvn verify
 
   * {{{./examples/fork-options-and-parallel-execution.html}Fork Options and 
Parallel Test Execution}}
 
+  * {{{./examples/logging.html}Using Console Logs}}
+
   * {{{./examples/shutdown.html}Shutdown of Forked JVM}}
 
   []

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8881fabb/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessReader.java
----------------------------------------------------------------------
diff --git 
a/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessReader.java
 
b/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessReader.java
index f2f783c..dcb7d2a 100644
--- 
a/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessReader.java
+++ 
b/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessReader.java
@@ -37,6 +37,11 @@ import static java.lang.Thread.State.RUNNABLE;
 import static java.lang.Thread.State.TERMINATED;
 import static java.util.concurrent.locks.LockSupport.park;
 import static java.util.concurrent.locks.LockSupport.unpark;
+import static org.apache.maven.surefire.booter.MasterProcessCommand.NOOP;
+import static org.apache.maven.surefire.booter.MasterProcessCommand.RUN_CLASS;
+import static org.apache.maven.surefire.booter.MasterProcessCommand.SHUTDOWN;
+import static 
org.apache.maven.surefire.booter.MasterProcessCommand.SKIP_SINCE_NEXT_TEST;
+import static 
org.apache.maven.surefire.booter.MasterProcessCommand.TEST_SET_FINISHED;
 import static org.apache.maven.surefire.booter.MasterProcessCommand.decode;
 import static 
org.apache.maven.surefire.util.internal.StringUtils.encodeStringForForkCommunication;
 import static org.apache.maven.surefire.util.internal.StringUtils.isNotBlank;
@@ -123,7 +128,32 @@ public final class MasterProcessReader
         listeners.add( new TwoPropertiesWrapper<MasterProcessCommand, 
MasterProcessListener>( null, listener ) );
     }
 
-    public void addListener( MasterProcessCommand cmd, MasterProcessListener 
listener )
+    public void addTestListener( MasterProcessListener listener )
+    {
+        addListener( RUN_CLASS, listener );
+    }
+
+    public void addTestsFinishedListener( MasterProcessListener listener )
+    {
+        addListener( TEST_SET_FINISHED, listener );
+    }
+
+    public void addSkipNextListener( MasterProcessListener listener )
+    {
+        addListener( SKIP_SINCE_NEXT_TEST, listener );
+    }
+
+    public void addShutdownListener( MasterProcessListener listener )
+    {
+        addListener( SHUTDOWN, listener );
+    }
+
+    public void addNoopListener( MasterProcessListener listener )
+    {
+        addListener( NOOP, listener );
+    }
+
+    private void addListener( MasterProcessCommand cmd, MasterProcessListener 
listener )
     {
         listeners.add( new TwoPropertiesWrapper<MasterProcessCommand, 
MasterProcessListener>( cmd, listener ) );
     }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8881fabb/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
----------------------------------------------------------------------
diff --git 
a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
 
b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
index bf58ca9..c7376f7 100644
--- 
a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
+++ 
b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
@@ -38,8 +38,6 @@ import org.apache.maven.surefire.report.StackTraceWriter;
 import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
-import static org.apache.maven.surefire.booter.MasterProcessCommand.SHUTDOWN;
-import static org.apache.maven.surefire.booter.MasterProcessCommand.NOOP;
 import static org.apache.maven.surefire.booter.Shutdown.DEFAULT;
 import static org.apache.maven.surefire.booter.Shutdown.KILL;
 import static 
org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_BYE;
@@ -159,9 +157,9 @@ public final class ForkedBooter
     private static ScheduledFuture<?> listenToShutdownCommands()
     {
         MasterProcessReader reader = MasterProcessReader.getReader();
-        reader.addListener( SHUTDOWN, createExitHandler() );
+        reader.addShutdownListener( createExitHandler() );
         AtomicBoolean pingDone = new AtomicBoolean( true );
-        reader.addListener( NOOP, createPingHandler( pingDone ) );
+        reader.addNoopListener( createPingHandler( pingDone ) );
         return JVM_TERMINATOR.scheduleAtFixedRate( createPingJob( pingDone ), 
0, PING_TIMEOUT_IN_SECONDS, SECONDS );
     }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8881fabb/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
----------------------------------------------------------------------
diff --git 
a/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
 
b/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
index 045b194..8401b22 100644
--- 
a/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
+++ 
b/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
@@ -52,7 +52,6 @@ import org.junit.runner.Runner;
 import org.junit.runner.manipulation.Filter;
 import org.junit.runner.notification.StoppedByUserException;
 
-import static 
org.apache.maven.surefire.booter.MasterProcessCommand.SKIP_SINCE_NEXT_TEST;
 import static 
org.apache.maven.surefire.common.junit4.JUnit4ProviderUtil.createSuiteDescription;
 import static 
org.apache.maven.surefire.common.junit4.JUnit4ProviderUtil.cutTestClassAndMethod;
 import static 
org.apache.maven.surefire.common.junit4.JUnit4ProviderUtil.generateFailingTests;
@@ -221,7 +220,7 @@ public class JUnit4Provider
                 notifier.pleaseStop();
             }
         };
-        commandsReader.addListener( SKIP_SINCE_NEXT_TEST, listener );
+        commandsReader.addSkipNextListener( listener );
         return listener;
     }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8881fabb/surefire-providers/surefire-junit47/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/pom.xml 
b/surefire-providers/surefire-junit47/pom.xml
index 708c7f7..fcf99ac 100644
--- a/surefire-providers/surefire-junit47/pom.xml
+++ b/surefire-providers/surefire-junit47/pom.xml
@@ -126,7 +126,7 @@
         <configuration>
           <redirectTestOutputToFile>true</redirectTestOutputToFile>
           <includes>
-            <include>**/JUnit4SuiteTest.java</include>
+            <include>**/JUnit47SuiteTest.java</include>
           </includes>
         </configuration>
       </plugin>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8881fabb/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
----------------------------------------------------------------------
diff --git 
a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
 
b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
index 799c211..4b69f63 100644
--- 
a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
+++ 
b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
@@ -50,7 +50,6 @@ import org.junit.runner.manipulation.Filter;
 import org.junit.runner.notification.Failure;
 import org.junit.runner.notification.RunListener;
 
-import static 
org.apache.maven.surefire.booter.MasterProcessCommand.SKIP_SINCE_NEXT_TEST;
 import static 
org.apache.maven.surefire.junitcore.ConcurrentRunListener.createInstance;
 import static 
org.apache.maven.surefire.common.junit4.JUnit4ProviderUtil.generateFailingTests;
 import static 
org.apache.maven.surefire.common.junit4.JUnit4RunListenerFactory.createCustomListeners;
@@ -224,7 +223,7 @@ public class JUnitCoreProvider
                 stoppable.pleaseStop();
             }
         };
-        commandsReader.addListener( SKIP_SINCE_NEXT_TEST, listener );
+        commandsReader.addSkipNextListener( listener );
         return listener;
     }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8881fabb/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnit47SuiteTest.java
----------------------------------------------------------------------
diff --git 
a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnit47SuiteTest.java
 
b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnit47SuiteTest.java
new file mode 100644
index 0000000..5392cc8
--- /dev/null
+++ 
b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnit47SuiteTest.java
@@ -0,0 +1,61 @@
+package org.apache.maven.surefire.junitcore;
+
+/*
+ * 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.apache.maven.surefire.junitcore.pc.OptimizedParallelComputerTest;
+import org.apache.maven.surefire.junitcore.pc.ParallelComputerBuilderTest;
+import org.apache.maven.surefire.junitcore.pc.ParallelComputerUtilTest;
+import org.apache.maven.surefire.junitcore.pc.SchedulingStrategiesTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Adapt the JUnit47 tests which use only annotations to the JUnit3 test suite.
+ *
+ * @author Tibor Digana (tibor17)
+ * @since 2.16
+ */
[email protected]( {
+    Surefire746Test.class,
+    Surefire813IncorrectResultTest.class,
+    ParallelComputerUtilTest.class,
+    ParallelComputerBuilderTest.class,
+    SchedulingStrategiesTest.class,
+    JUnitCoreParametersTest.class,
+    OptimizedParallelComputerTest.class,
+    ConcurrentRunListenerTest.class,
+    ConfigurableParallelComputerTest.class,
+    JUnit4Reflector481Test.class,
+    JUnitCoreParametersTest.class,
+    JUnitCoreRunListenerTest.class,
+    MavenSurefireJUnit47RunnerTest.class,
+    MavenSurefireJUnit48RunnerTest.class,
+    TestMethodTest.class
+} )
+@RunWith( Suite.class )
+public class JUnit47SuiteTest
+{
+    public static Test suite()
+    {
+        return new JUnit4TestAdapter( JUnit47SuiteTest.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8881fabb/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnit4SuiteTest.java
----------------------------------------------------------------------
diff --git 
a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnit4SuiteTest.java
 
b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnit4SuiteTest.java
deleted file mode 100644
index c38ba0a..0000000
--- 
a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnit4SuiteTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.apache.maven.surefire.junitcore;
-
-/*
- * 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.apache.maven.surefire.junitcore.pc.OptimizedParallelComputerTest;
-import org.apache.maven.surefire.junitcore.pc.ParallelComputerBuilderTest;
-import org.apache.maven.surefire.junitcore.pc.ParallelComputerUtilTest;
-import org.apache.maven.surefire.junitcore.pc.SchedulingStrategiesTest;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Adapt the JUnit4 tests which use only annotations to the JUnit3 test suite.
- *
- * @author Tibor Digana (tibor17)
- * @since 2.16
- */
[email protected]( {
-    Surefire746Test.class,
-    Surefire813IncorrectResultTest.class,
-    ParallelComputerUtilTest.class,
-    ParallelComputerBuilderTest.class,
-    SchedulingStrategiesTest.class,
-    JUnitCoreParametersTest.class,
-    OptimizedParallelComputerTest.class,
-    ConcurrentRunListenerTest.class,
-    ConfigurableParallelComputerTest.class,
-    JUnit4Reflector481Test.class,
-    JUnitCoreParametersTest.class,
-    JUnitCoreRunListenerTest.class,
-    MavenSurefireJUnit47RunnerTest.class,
-    MavenSurefireJUnit48RunnerTest.class,
-    TestMethodTest.class
-} )
-@RunWith( Suite.class )
-public class JUnit4SuiteTest
-{
-    public static Test suite()
-    {
-        return new JUnit4TestAdapter( JUnit4SuiteTest.class );
-    }
-}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8881fabb/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
----------------------------------------------------------------------
diff --git 
a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
 
b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
index c2a1018..63ec5bb 100644
--- 
a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
+++ 
b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
@@ -41,8 +41,6 @@ import org.apache.maven.surefire.util.RunOrderCalculator;
 import org.apache.maven.surefire.util.ScanResult;
 import org.apache.maven.surefire.util.TestsToRun;
 
-import static 
org.apache.maven.surefire.booter.MasterProcessCommand.SKIP_SINCE_NEXT_TEST;
-
 /**
  * @author Kristian Rosenvold
  * @noinspection UnusedDeclaration
@@ -178,7 +176,7 @@ public class TestNGProvider
                 FailFastEventsSingleton.getInstance().setSkipOnNextTest();
             }
         };
-        commandsReader.addListener( SKIP_SINCE_NEXT_TEST, listener );
+        commandsReader.addSkipNextListener( listener );
         return listener;
     }
 

Reply via email to