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 2016/10/13 19:31:02 UTC

[01/25] maven-surefire git commit: [SUREFIRE] optimized writings to the PrintStream

Repository: maven-surefire
Updated Branches:
  refs/heads/junit5 8eae2878c -> da9281412


[SUREFIRE] optimized writings to the PrintStream


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

Branch: refs/heads/junit5
Commit: 61c7257a33b08076ccd3fab407af6a0ee0006b99
Parents: ef06e41
Author: Tibor17 <ti...@lycos.com>
Authored: Wed Sep 21 01:46:10 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sat Sep 24 10:38:16 2016 +0200

----------------------------------------------------------------------
 .../org/apache/maven/surefire/booter/ForkingRunListener.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/61c7257a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
index d0d8cca..282c4d4 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
@@ -199,11 +199,13 @@ public class ForkingRunListener
             new byte[buf.length * 3 + 1]; // Hex-escaping can be up to 3 times length of a regular byte.
         int i = escapeBytesToPrintable( content, 0, buf, off, len );
         content[i++] = (byte) '\n';
+        byte[] encodeBytes = new byte[header.length + i];
+        System.arraycopy( header, 0, encodeBytes, 0, header.length );
+        System.arraycopy( content, 0, encodeBytes, header.length, i );
 
         synchronized ( target ) // See notes about synchronization/thread safety in class javadoc
         {
-            target.write( header, 0, header.length );
-            target.write( content, 0, i );
+            target.write( encodeBytes, 0, encodeBytes.length );
         }
     }
 


[21/25] maven-surefire git commit: Consistently rename JUnit 4.x integration tests

Posted by ti...@apache.org.
Consistently rename JUnit 4.x integration tests


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

Branch: refs/heads/junit5
Commit: 77cafbe36d5b3ca82b4fc3837b26be1aab73c537
Parents: e6b3921
Author: Benedikt Ritter <br...@apache.org>
Authored: Mon Oct 3 18:06:38 2016 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed Oct 12 07:07:56 2016 +0200

----------------------------------------------------------------------
 .../surefire/its/JUnit47ConcurrencyIT.java      | 58 +++++++++++++
 .../its/JUnit47StaticInnerClassTestsIT.java     | 34 ++++++++
 .../surefire/its/JUnit47WithCucumberIT.java     | 71 ++++++++++++++++
 .../maven/surefire/its/JUnit4IgnoreIT.java      | 52 ++++++++++++
 .../maven/surefire/its/JUnit4VersionsIT.java    | 87 ++++++++++++++++++++
 .../its/Junit47StaticInnerClassTestsIT.java     | 34 --------
 .../surefire/its/Junit47WithCucumberIT.java     | 71 ----------------
 .../surefire/its/Junit47concurrencyIT.java      | 58 -------------
 .../maven/surefire/its/Junit4IgnoreIT.java      | 52 ------------
 .../maven/surefire/its/Junit4VersionsIT.java    | 87 --------------------
 .../test/resources/concurrentjunit47/pom.xml    | 62 --------------
 .../src/test/java/junit47/BasicTest.java        | 71 ----------------
 .../test/resources/junit47-concurrency/pom.xml  | 61 ++++++++++++++
 .../src/test/java/junit47/BasicTest.java        | 71 ++++++++++++++++
 14 files changed, 434 insertions(+), 435 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/77cafbe3/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ConcurrencyIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ConcurrencyIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ConcurrencyIT.java
new file mode 100644
index 0000000..57007a7
--- /dev/null
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ConcurrencyIT.java
@@ -0,0 +1,58 @@
+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.OutputValidator;
+import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.*;
+import static org.hamcrest.CoreMatchers.*;
+
+/**
+ * Basic suite test using all known versions of JUnit 4.x
+ *
+ * @author Kristian Rosenvold
+ */
+public class JUnit47ConcurrencyIT
+    extends SurefireJUnit4IntegrationTestCase
+{
+    @Test
+    public void test47()
+        throws Exception
+    {
+        OutputValidator validator = unpack( "junit47-concurrency" )
+            .executeTest()
+            .verifyErrorFree( 4 );
+        String result = null;
+        for ( String line : validator.loadLogLines() )
+        {
+            if ( line.startsWith( "[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:" ) )
+            {
+                result = line;
+                break;
+            }
+        }
+        assertNotNull( result);
+        assertThat( result, anyOf( containsString( "Time elapsed: 1." ), containsString( "Time elapsed: 0.9" ) ) );
+        assertThat( result, endsWith( " s - in concurrentjunit47.src.test.java.junit47.BasicTest" ) );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/77cafbe3/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47StaticInnerClassTestsIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47StaticInnerClassTestsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47StaticInnerClassTestsIT.java
new file mode 100644
index 0000000..e50e6d7
--- /dev/null
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47StaticInnerClassTestsIT.java
@@ -0,0 +1,34 @@
+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.junit.Test;
+
+public class JUnit47StaticInnerClassTestsIT
+    extends SurefireJUnit4IntegrationTestCase
+{
+
+    @Test
+    public void testStaticInnerClassTests()
+    {
+        executeErrorFreeTest( "junit47-static-inner-class-tests", 3 );
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/77cafbe3/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java
new file mode 100644
index 0000000..4bb1842
--- /dev/null
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java
@@ -0,0 +1,71 @@
+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.junit.Before;
+import org.junit.Test;
+
+import static org.apache.commons.lang3.JavaVersion.JAVA_1_6;
+import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
+
+/**
+ * Tests the JUnit 47 provider with the cucumber runner. At the moment, they don't play along that perfectly (minor
+ * glitches in the reports with parallel=classes), but at least all tests are executed, the execution times are counted
+ * correctly and failing tests are reported. The main problem that the junit47 provider has with the cucumber runner is
+ * that the junit Description instance created by the runner has a null test class attribute.
+ * 
+ * @author agudian
+ */
+public class JUnit47WithCucumberIT
+    extends SurefireJUnit4IntegrationTestCase
+{
+
+    @Before
+    public void assumeJdk16()
+    {
+        assumeJavaVersion( JAVA_1_6 );
+    }
+
+    @Test
+    public void testWithoutParallel()
+    {
+        // 8 tests in total is what's probably correct
+        doTest( "none", 8 );
+    }
+
+    @Test
+    public void testWithParallelClasses()
+    {
+        // with parallel=classes, we get 9 tests in total,
+        // as the dummy "scenario" test entry is reported twice: once as success, and once with the failure from the
+        // failing test step
+        doTest( "classes", 9 );
+    }
+
+    private void doTest( String parallel, int total )
+    {
+        unpack( "junit47-cucumber" )
+                .sysProp( "parallel", parallel )
+                .sysProp( "threadCount", "2" )
+                .executeTest()
+                .assertTestSuiteResults( total, 0, 2, 0 );
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/77cafbe3/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4IgnoreIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4IgnoreIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4IgnoreIT.java
new file mode 100644
index 0000000..71ec3d8
--- /dev/null
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4IgnoreIT.java
@@ -0,0 +1,52 @@
+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;
+
+/**
+ * Test JUnit 4 tests marked with "Ignore" attribute
+ *
+ * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ */
+public class JUnit4IgnoreIT
+    extends SurefireJUnit4IntegrationTestCase
+{
+    @Test
+    public void testJunit4Ignore()
+    {
+        // Todo: Support assumption failure == ignore for junit4
+        unpack().executeTest().verifyErrorFreeLog().assertTestSuiteResults( 7, 0, 0, 6 );
+    }
+
+    @Test
+    public void testJunit47ParallelIgnore()
+    {
+        unpack().setJUnitVersion( "4.8.1" ).parallelClasses().executeTest().verifyErrorFreeLog().assertTestSuiteResults(
+            7, 0, 0, 7 );
+    }
+
+    private SurefireLauncher unpack()
+    {
+        return unpack( "/junit-ignore" );
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/77cafbe3/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java
new file mode 100644
index 0000000..87fe140
--- /dev/null
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java
@@ -0,0 +1,87 @@
+package org.apache.maven.surefire.its;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
+import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+
+import static org.junit.runners.Parameterized.*;
+
+/**
+ * Basic suite test using all known versions of JUnit 4.x
+ *
+ * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ */
+@RunWith( Parameterized.class )
+public class JUnit4VersionsIT
+    extends SurefireJUnit4IntegrationTestCase
+{
+
+    @Parameters( name = "{index}: JUnit {0}" )
+    public static Collection<Object[]> junitVersions()
+    {
+        return Arrays.asList( new Object[][] {
+                { "4.0" },
+                { "4.1" },
+                { "4.2" },
+                { "4.3" },
+                { "4.3.1" },
+                { "4.4" },
+                { "4.5" },
+                { "4.6" },
+                { "4.7" },
+                { "4.8" },
+                { "4.8.1" },
+                { "4.8.2" },
+                { "4.9" },
+                { "4.10" },
+                { "4.11" },
+                { "4.12" }
+        } );
+    }
+
+    @Parameter
+    public String version;
+
+    private SurefireLauncher unpack()
+    {
+        return unpack( "/junit4" );
+    }
+
+    @Test
+    public void testJunit()
+        throws Exception
+    {
+        runJUnitTest( version );
+    }
+
+    public void runJUnitTest( String version )
+        throws Exception
+    {
+        unpack().setJUnitVersion( version ).executeTest().verifyErrorFree( 1 );
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/77cafbe3/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47StaticInnerClassTestsIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47StaticInnerClassTestsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47StaticInnerClassTestsIT.java
deleted file mode 100644
index b8d38bf..0000000
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47StaticInnerClassTestsIT.java
+++ /dev/null
@@ -1,34 +0,0 @@
-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.junit.Test;
-
-public class Junit47StaticInnerClassTestsIT
-    extends SurefireJUnit4IntegrationTestCase
-{
-
-    @Test
-    public void testStaticInnerClassTests()
-    {
-        executeErrorFreeTest( "junit47-static-inner-class-tests", 3 );
-    }
-}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/77cafbe3/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47WithCucumberIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47WithCucumberIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47WithCucumberIT.java
deleted file mode 100644
index 4850005..0000000
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47WithCucumberIT.java
+++ /dev/null
@@ -1,71 +0,0 @@
-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.junit.Before;
-import org.junit.Test;
-
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_6;
-import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
-
-/**
- * Tests the JUnit 47 provider with the cucumber runner. At the moment, they don't play along that perfectly (minor
- * glitches in the reports with parallel=classes), but at least all tests are executed, the execution times are counted
- * correctly and failing tests are reported. The main problem that the junit47 provider has with the cucumber runner is
- * that the junit Description instance created by the runner has a null test class attribute.
- * 
- * @author agudian
- */
-public class Junit47WithCucumberIT
-    extends SurefireJUnit4IntegrationTestCase
-{
-
-    @Before
-    public void assumeJdk16()
-    {
-        assumeJavaVersion( JAVA_1_6 );
-    }
-
-    @Test
-    public void testWithoutParallel()
-    {
-        // 8 tests in total is what's probably correct
-        doTest( "none", 8 );
-    }
-
-    @Test
-    public void testWithParallelClasses()
-    {
-        // with parallel=classes, we get 9 tests in total,
-        // as the dummy "scenario" test entry is reported twice: once as success, and once with the failure from the
-        // failing test step
-        doTest( "classes", 9 );
-    }
-
-    private void doTest( String parallel, int total )
-    {
-        unpack( "junit47-cucumber" )
-                .sysProp( "parallel", parallel )
-                .sysProp( "threadCount", "2" )
-                .executeTest()
-                .assertTestSuiteResults( total, 0, 2, 0 );
-    }
-}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/77cafbe3/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47concurrencyIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47concurrencyIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47concurrencyIT.java
deleted file mode 100644
index 12c4419..0000000
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47concurrencyIT.java
+++ /dev/null
@@ -1,58 +0,0 @@
-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.OutputValidator;
-import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.*;
-import static org.hamcrest.CoreMatchers.*;
-
-/**
- * Basic suite test using all known versions of JUnit 4.x
- *
- * @author Kristian Rosenvold
- */
-public class Junit47concurrencyIT
-    extends SurefireJUnit4IntegrationTestCase
-{
-    @Test
-    public void test47()
-        throws Exception
-    {
-        OutputValidator validator = unpack( "concurrentjunit47" )
-            .executeTest()
-            .verifyErrorFree( 4 );
-        String result = null;
-        for ( String line : validator.loadLogLines() )
-        {
-            if ( line.startsWith( "[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:" ) )
-            {
-                result = line;
-                break;
-            }
-        }
-        assertNotNull( result);
-        assertThat( result, anyOf( containsString( "Time elapsed: 1." ), containsString( "Time elapsed: 0.9" ) ) );
-        assertThat( result, endsWith( " s - in concurrentjunit47.src.test.java.junit47.BasicTest" ) );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/77cafbe3/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4IgnoreIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4IgnoreIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4IgnoreIT.java
deleted file mode 100644
index 0e050ce..0000000
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4IgnoreIT.java
+++ /dev/null
@@ -1,52 +0,0 @@
-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;
-
-/**
- * Test JUnit 4 tests marked with "Ignore" attribute
- *
- * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
- */
-public class Junit4IgnoreIT
-    extends SurefireJUnit4IntegrationTestCase
-{
-    @Test
-    public void testJunit4Ignore()
-    {
-        // Todo: Support assumption failure == ignore for junit4
-        unpack().executeTest().verifyErrorFreeLog().assertTestSuiteResults( 7, 0, 0, 6 );
-    }
-
-    @Test
-    public void testJunit47ParallelIgnore()
-    {
-        unpack().setJUnitVersion( "4.8.1" ).parallelClasses().executeTest().verifyErrorFreeLog().assertTestSuiteResults(
-            7, 0, 0, 7 );
-    }
-
-    private SurefireLauncher unpack()
-    {
-        return unpack( "/junit-ignore" );
-    }
-}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/77cafbe3/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java
deleted file mode 100644
index 500591a..0000000
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.apache.maven.surefire.its;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
-import org.apache.maven.surefire.its.fixture.SurefireLauncher;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameter;
-
-import static org.junit.runners.Parameterized.*;
-
-/**
- * Basic suite test using all known versions of JUnit 4.x
- *
- * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
- */
-@RunWith( Parameterized.class )
-public class Junit4VersionsIT
-    extends SurefireJUnit4IntegrationTestCase
-{
-
-    @Parameters( name = "{index}: JUnit {0}" )
-    public static Collection<Object[]> junitVersions()
-    {
-        return Arrays.asList( new Object[][] {
-                { "4.0" },
-                { "4.1" },
-                { "4.2" },
-                { "4.3" },
-                { "4.3.1" },
-                { "4.4" },
-                { "4.5" },
-                { "4.6" },
-                { "4.7" },
-                { "4.8" },
-                { "4.8.1" },
-                { "4.8.2" },
-                { "4.9" },
-                { "4.10" },
-                { "4.11" },
-                { "4.12" }
-        } );
-    }
-
-    @Parameter
-    public String version;
-
-    private SurefireLauncher unpack()
-    {
-        return unpack( "/junit4" );
-    }
-
-    @Test
-    public void testJunit()
-        throws Exception
-    {
-        runJUnitTest( version );
-    }
-
-    public void runJUnitTest( String version )
-        throws Exception
-    {
-        unpack().setJUnitVersion( version ).executeTest().verifyErrorFree( 1 );
-    }
-}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/77cafbe3/surefire-integration-tests/src/test/resources/concurrentjunit47/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/concurrentjunit47/pom.xml b/surefire-integration-tests/src/test/resources/concurrentjunit47/pom.xml
deleted file mode 100644
index d064175..0000000
--- a/surefire-integration-tests/src/test/resources/concurrentjunit47/pom.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?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>
-
-
-  <parent>
-    <groupId>org.apache.maven.surefire</groupId>
-    <artifactId>it-parent</artifactId>
-    <version>1.0</version>
-    <relativePath>../pom.xml</relativePath>
-  </parent>
-
-  <groupId>org.apache.maven.plugins.surefire</groupId>
-  <artifactId>junit47</artifactId>
-  <version>1.0-SNAPSHOT</version>
-  <name>Test for JUnit 4.7</name>
-
-  <dependencies>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.7</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-  
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-          <configuration>
-              <parallel>methods</parallel>
-              <perCoreThreadCount>false</perCoreThreadCount>
-              <threadCount>3</threadCount>
-          </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/77cafbe3/surefire-integration-tests/src/test/resources/concurrentjunit47/src/test/java/junit47/BasicTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/concurrentjunit47/src/test/java/junit47/BasicTest.java b/surefire-integration-tests/src/test/resources/concurrentjunit47/src/test/java/junit47/BasicTest.java
deleted file mode 100644
index 1f11060..0000000
--- a/surefire-integration-tests/src/test/resources/concurrentjunit47/src/test/java/junit47/BasicTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package concurrentjunit47.src.test.java.junit47;
-
-/*
- * 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.*;
-
-import java.util.concurrent.TimeUnit;
-
-public class BasicTest
-{
-    private boolean setUpCalled = false;
-
-    @Before
-    public void setUp()
-    {
-        setUpCalled = true;
-        System.out.println( "Called setUp" );
-    }
-
-    @After
-    public void tearDown()
-    {
-        setUpCalled = false;
-        System.out.println( "Called tearDown" );
-    }
-
-    @Test
-    public void testSetUp()
-    {
-        Assert.assertTrue( "setUp was not called", setUpCalled );
-    }
-
-    @Test
-    public void a() throws Exception {
-        TimeUnit.SECONDS.sleep( 1 );
-    }
-
-    @Test
-    public void b() throws Exception {
-        TimeUnit.SECONDS.sleep( 1 );
-    }
-
-    @Test
-    public void c() throws Exception {
-        TimeUnit.SECONDS.sleep( 1 );
-    }
-
-    @AfterClass
-    public static void oneTimeTearDown()
-    {
-
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/77cafbe3/surefire-integration-tests/src/test/resources/junit47-concurrency/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit47-concurrency/pom.xml b/surefire-integration-tests/src/test/resources/junit47-concurrency/pom.xml
new file mode 100644
index 0000000..4f648df
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/junit47-concurrency/pom.xml
@@ -0,0 +1,61 @@
+<?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>
+
+  <parent>
+    <groupId>org.apache.maven.surefire</groupId>
+    <artifactId>it-parent</artifactId>
+    <version>1.0</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <groupId>org.apache.maven.plugins.surefire</groupId>
+  <artifactId>junit47-concurrency</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>Concurrency test for JUnit 4.7</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.7</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <parallel>methods</parallel>
+          <perCoreThreadCount>false</perCoreThreadCount>
+          <threadCount>3</threadCount>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/77cafbe3/surefire-integration-tests/src/test/resources/junit47-concurrency/src/test/java/junit47/BasicTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit47-concurrency/src/test/java/junit47/BasicTest.java b/surefire-integration-tests/src/test/resources/junit47-concurrency/src/test/java/junit47/BasicTest.java
new file mode 100644
index 0000000..1f11060
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/junit47-concurrency/src/test/java/junit47/BasicTest.java
@@ -0,0 +1,71 @@
+package concurrentjunit47.src.test.java.junit47;
+
+/*
+ * 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.*;
+
+import java.util.concurrent.TimeUnit;
+
+public class BasicTest
+{
+    private boolean setUpCalled = false;
+
+    @Before
+    public void setUp()
+    {
+        setUpCalled = true;
+        System.out.println( "Called setUp" );
+    }
+
+    @After
+    public void tearDown()
+    {
+        setUpCalled = false;
+        System.out.println( "Called tearDown" );
+    }
+
+    @Test
+    public void testSetUp()
+    {
+        Assert.assertTrue( "setUp was not called", setUpCalled );
+    }
+
+    @Test
+    public void a() throws Exception {
+        TimeUnit.SECONDS.sleep( 1 );
+    }
+
+    @Test
+    public void b() throws Exception {
+        TimeUnit.SECONDS.sleep( 1 );
+    }
+
+    @Test
+    public void c() throws Exception {
+        TimeUnit.SECONDS.sleep( 1 );
+    }
+
+    @AfterClass
+    public static void oneTimeTearDown()
+    {
+
+    }
+
+}
\ No newline at end of file


[19/25] maven-surefire git commit: Make Junit4VersionsIT a parameterized test

Posted by ti...@apache.org.
Make Junit4VersionsIT a parameterized test


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

Branch: refs/heads/junit5
Commit: 41d1cfca8519b1e0419609a9f5b15b84e89ac3d6
Parents: 86f89a8
Author: Benedikt Ritter <br...@apache.org>
Authored: Sun Oct 9 15:38:44 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Tue Oct 11 00:25:28 2016 +0200

----------------------------------------------------------------------
 .../maven/surefire/its/Junit4VersionsIT.java    | 85 +++++++-------------
 1 file changed, 28 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/41d1cfca/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java
index cf82e64..2296cf8 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java
@@ -19,85 +19,56 @@ package org.apache.maven.surefire.its;
  * under the License.
  */
 
+import java.util.Arrays;
+import java.util.Collection;
+
 import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
 import org.apache.maven.surefire.its.fixture.SurefireLauncher;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+
+import static org.junit.runners.Parameterized.*;
 
 /**
  * Basic suite test using all known versions of JUnit 4.x
  *
  * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
  */
+@RunWith( Parameterized.class )
 public class Junit4VersionsIT
     extends SurefireJUnit4IntegrationTestCase
 {
 
-    private SurefireLauncher unpack()
-    {
-        return unpack( "/junit4" );
-    }
-
-    @Test
-    public void test40()
-        throws Exception
-    {
-        runJUnitTest( "4.0" );
-    }
-
-    @Test
-    public void test41()
-        throws Exception
-    {
-        runJUnitTest( "4.1" );
+    @Parameters( name = "{index}: JUnit {0}" )
+    public static Collection<Object[]> junitVersions() {
+        return Arrays.asList( new Object[][]{
+                { "4.0" },
+                { "4.1" },
+                { "4.2" },
+                { "4.3" },
+                { "4.3.1" },
+                { "4.4" },
+                { "4.5" },
+                { "4.6" },
+                { "4.7" }
+        } );
     }
 
-    @Test
-    public void test42()
-        throws Exception
-    {
-        runJUnitTest( "4.2" );
-    }
+    @Parameter
+    public String version;
 
-    @Test
-    public void test43()
-        throws Exception
-    {
-        runJUnitTest( "4.3" );
-    }
-
-    @Test
-    public void test431()
-        throws Exception
-    {
-        runJUnitTest( "4.3.1" );
-    }
-
-    @Test
-    public void test44()
-        throws Exception
-    {
-        runJUnitTest( "4.4" );
-    }
-
-    @Test
-    public void test45()
-        throws Exception
-    {
-        runJUnitTest( "4.5" );
-    }
-
-    @Test
-    public void test46()
-        throws Exception
+    private SurefireLauncher unpack()
     {
-        runJUnitTest( "4.6" );
+        return unpack( "/junit4" );
     }
 
     @Test
-    public void test47()
+    public void testJunit()
         throws Exception
     {
-        runJUnitTest( "4.7" );
+        runJUnitTest( version );
     }
 
     public void runJUnitTest( String version )


[23/25] maven-surefire git commit: refactoring and build fix

Posted by ti...@apache.org.
refactoring and build fix


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

Branch: refs/heads/junit5
Commit: 5e9f5637cead161f5e210b86febcc23d502d3f67
Parents: fd9f6e5
Author: Tibor17 <ti...@lycos.com>
Authored: Wed Oct 12 22:20:48 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Wed Oct 12 22:20:48 2016 +0200

----------------------------------------------------------------------
 .../surefire/booterclient/ForkStarter.java      |  2 +-
 .../AbstractForkInputStream.java                |  2 +-
 .../surefire/report/DefaultReporterFactory.java | 14 +++++-----
 .../apache/maven/surefire/booter/Command.java   |  2 +-
 .../maven/surefire/booter/CommandReader.java    |  2 +-
 .../surefire/booter/MasterProcessCommand.java   |  2 +-
 .../surefire/util/internal/ObjectUtils.java     |  1 +
 .../surefire/util/internal/StringUtils.java     | 29 ++++----------------
 8 files changed, 19 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/5e9f5637/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
index 2eb8259..d512f24 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
@@ -96,7 +96,7 @@ import static org.apache.maven.surefire.util.internal.ConcurrencyUtils.countDown
 import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDaemonThread;
 import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDaemonThreadFactory;
 import static org.apache.maven.surefire.util.internal.StringUtils.FORK_STREAM_CHARSET_NAME;
-import static org.apache.maven.surefire.util.internal.StringUtils.requireNonNull;
+import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
 
 /**
  * Starts the fork or runs in-process.

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/5e9f5637/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractForkInputStream.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractForkInputStream.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractForkInputStream.java
index 281c05d..8cc0cdd 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractForkInputStream.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractForkInputStream.java
@@ -22,7 +22,7 @@ package org.apache.maven.plugin.surefire.booterclient.lazytestprovider;
 import java.io.IOException;
 import java.io.InputStream;
 
-import static org.apache.maven.surefire.util.internal.StringUtils.requireNonNull;
+import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
 
 /**
  * Reader stream sends bytes to forked jvm std-{@link InputStream input-stream}.

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/5e9f5637/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
index e011fee..2332856 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
@@ -21,6 +21,7 @@ package org.apache.maven.plugin.surefire.report;
 
 import org.apache.maven.plugin.surefire.StartupReportConfiguration;
 import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
+import org.apache.maven.plugin.surefire.log.api.Level;
 import org.apache.maven.plugin.surefire.log.api.NullConsoleLogger;
 import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
 import org.apache.maven.shared.utils.logging.MessageBuilder;
@@ -28,7 +29,6 @@ import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.RunListener;
 import org.apache.maven.surefire.report.RunStatistics;
 import org.apache.maven.surefire.report.StackTraceWriter;
-import org.apache.maven.plugin.surefire.log.api.Level;
 import org.apache.maven.surefire.suite.RunResult;
 
 import java.util.ArrayList;
@@ -39,7 +39,7 @@ import java.util.Map;
 import java.util.TreeMap;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
-import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
+import static org.apache.maven.plugin.surefire.log.api.Level.resolveLevel;
 import static org.apache.maven.plugin.surefire.report.ConsoleReporter.PLAIN;
 import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType.error;
 import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType.failure;
@@ -50,8 +50,8 @@ import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.Tes
 import static org.apache.maven.plugin.surefire.report.ReportEntryType.ERROR;
 import static org.apache.maven.plugin.surefire.report.ReportEntryType.FAILURE;
 import static org.apache.maven.plugin.surefire.report.ReportEntryType.SUCCESS;
-import static org.apache.maven.plugin.surefire.log.api.Level.resolveLevel;
 import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
+import static org.apache.maven.surefire.util.internal.ObjectUtils.useNonNull;
 
 /**
  * Provides reporting modules on the plugin side.
@@ -108,26 +108,26 @@ public class DefaultReporterFactory
     private FileReporter createFileReporter()
     {
         final FileReporter fileReporter = reportConfiguration.instantiateFileReporter();
-        return defaultIfNull( fileReporter, NullFileReporter.INSTANCE );
+        return useNonNull( fileReporter, NullFileReporter.INSTANCE );
     }
 
     private StatelessXmlReporter createSimpleXMLReporter()
     {
         final StatelessXmlReporter xmlReporter = reportConfiguration.instantiateStatelessXmlReporter();
-        return defaultIfNull( xmlReporter, NullStatelessXmlReporter.INSTANCE );
+        return useNonNull( xmlReporter, NullStatelessXmlReporter.INSTANCE );
     }
 
     private TestcycleConsoleOutputReceiver createConsoleOutputReceiver()
     {
         final TestcycleConsoleOutputReceiver consoleOutputReceiver =
                 reportConfiguration.instantiateConsoleOutputFileReporter();
-        return defaultIfNull( consoleOutputReceiver, NullConsoleOutputReceiver.INSTANCE );
+        return useNonNull( consoleOutputReceiver, NullConsoleOutputReceiver.INSTANCE );
     }
 
     private StatisticsReporter createStatisticsReporter()
     {
         final StatisticsReporter statisticsReporter = reportConfiguration.getStatisticsReporter();
-        return defaultIfNull( statisticsReporter, NullStatisticsReporter.INSTANCE );
+        return useNonNull( statisticsReporter, NullStatisticsReporter.INSTANCE );
     }
 
     private boolean shouldReportToConsole()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/5e9f5637/surefire-api/src/main/java/org/apache/maven/surefire/booter/Command.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/Command.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/Command.java
index 070980c..49ae52d 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/Command.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/Command.java
@@ -19,7 +19,7 @@ package org.apache.maven.surefire.booter;
  * under the License.
  */
 
-import static org.apache.maven.surefire.util.internal.StringUtils.requireNonNull;
+import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
 import static org.apache.maven.surefire.util.internal.StringUtils.isBlank;
 import static org.apache.maven.surefire.booter.MasterProcessCommand.RUN_CLASS;
 import static org.apache.maven.surefire.booter.MasterProcessCommand.SHUTDOWN;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/5e9f5637/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
index 4287080..bdd6092 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
@@ -52,7 +52,7 @@ import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDae
 import static org.apache.maven.surefire.util.internal.StringUtils.encodeStringForForkCommunication;
 import static org.apache.maven.surefire.util.internal.StringUtils.isBlank;
 import static org.apache.maven.surefire.util.internal.StringUtils.isNotBlank;
-import static org.apache.maven.surefire.util.internal.StringUtils.requireNonNull;
+import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
 
 /**
  * Reader of commands coming from plugin(master) process.

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/5e9f5637/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessCommand.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessCommand.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessCommand.java
index 5e6bca9..a53a046 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessCommand.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessCommand.java
@@ -29,7 +29,7 @@ import java.nio.charset.Charset;
 
 import static org.apache.maven.surefire.util.internal.StringUtils.FORK_STREAM_CHARSET_NAME;
 import static org.apache.maven.surefire.util.internal.StringUtils.encodeStringForForkCommunication;
-import static org.apache.maven.surefire.util.internal.StringUtils.requireNonNull;
+import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
 import static java.lang.String.format;
 
 /**

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/5e9f5637/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/ObjectUtils.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/ObjectUtils.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/ObjectUtils.java
new file mode 100644
index 0000000..93d914d
--- /dev/null
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/ObjectUtils.java
@@ -0,0 +1 @@
+package org.apache.maven.surefire.util.internal;

/*
 * 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.
 */

/**
 * Similar to Java 7 java.util.Objects.
 *
 * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
 * @since 2
 .19.2
 */
public final class ObjectUtils
{
    private ObjectUtils()
    {
        throw new IllegalStateException( "no instantiable constructor" );
    }

    public static <T> T useNonNull( T target, T fallback )
    {
        return isNull( target ) ? fallback : target;
    }

    /*
    * In JDK7 use java.util.Objects instead.
    * todo
    * */
    public static boolean isNull( Object target )
    {
        return target == null;
    }

    /*
    * In JDK7 use java.util.Objects instead.
    * todo
    * */
    public static boolean nonNull( Object target )
    {
        return !isNull( target );
    }

    /*
    * In JDK7 use java.util.Objects instead.
    * todo
    * */
    public static <T> T requireNonNull( T obj, String message )
    {
        if ( isNull( obj ) )
        {
            throw new NullPointerException( message );
        }
        return obj;
    }

    /*
    * In JDK7 use java.util.Objects instead.
    * todo
    * */
    public static <T> T requireNonN
 ull( T obj )
    {
        return requireNonNull( obj, null );
    }
}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/5e9f5637/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
index 07722a1..a955183 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
@@ -55,7 +55,7 @@ import java.util.StringTokenizer;
  *               NOTE: This class is not part of any api and is public purely for technical reasons !
  * @since 1.0
  */
-public class StringUtils
+public final class StringUtils
 {
     public static final String NL = System.getProperty( "line.separator" );
 
@@ -68,6 +68,11 @@ public class StringUtils
     // 8-bit charset Latin-1
     public static final String FORK_STREAM_CHARSET_NAME = "ISO-8859-1";
 
+    private StringUtils()
+    {
+        throw new IllegalStateException( "no instantiable constructor" );
+    }
+
     public static String[] split( String text, String separator )
     {
         int max = -1;
@@ -378,26 +383,4 @@ public class StringUtils
            throw new RuntimeException( "The JVM must support Charset " + FORK_STREAM_CHARSET_NAME, e );
         }
     }
-
-    /*
-    * In JDK7 use java.util.Objects instead.
-    * todo
-    * */
-    public static <T> T requireNonNull( T obj, String message )
-    {
-        if ( obj == null )
-        {
-            throw new NullPointerException( message );
-        }
-        return obj;
-    }
-
-    /*
-    * In JDK7 use java.util.Objects instead.
-    * todo
-    * */
-    public static <T> T requireNonNull( T obj )
-    {
-        return requireNonNull( obj, null );
-    }
 }


[10/25] maven-surefire git commit: [SUREFIRE] refactoring

Posted by ti...@apache.org.
[SUREFIRE] 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/e563566b
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/e563566b
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/e563566b

Branch: refs/heads/junit5
Commit: e563566b4d3713cc1277771c31a86defbeb7ddbe
Parents: 4f3f59e
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Oct 2 11:08:09 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Oct 2 11:12:38 2016 +0200

----------------------------------------------------------------------
 .../surefire/report/StatelessXmlReporter.java   | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e563566b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
index f30e54f..8ebeb96 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
@@ -45,7 +45,7 @@ import java.util.StringTokenizer;
 
 import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType;
 import static org.apache.maven.plugin.surefire.report.FileReporterUtils.stripIllegalFilenameChars;
-import static org.apache.maven.surefire.util.internal.StringUtils.isNotBlank;
+import static org.apache.maven.surefire.util.internal.StringUtils.isBlank;
 
 // CHECKSTYLE_OFF: LineLength
 /**
@@ -321,9 +321,8 @@ public class StatelessXmlReporter
     private static File getReportFile( ReportEntry report, File reportsDirectory, String reportNameSuffix )
     {
         String reportName = "TEST-" + report.getName();
-        String reportFileName =
-                isNotBlank( reportNameSuffix ) ? reportName + "-" + reportNameSuffix + ".xml" : reportName + ".xml";
-        return new File( reportsDirectory, stripIllegalFilenameChars( reportFileName ) );
+        String customizedReportName = isBlank( reportNameSuffix ) ? reportName : reportName + "-" + reportNameSuffix;
+        return new File( reportsDirectory, stripIllegalFilenameChars( customizedReportName + ".xml" ) );
     }
 
     private static void startTestElement( XMLWriter ppw, WrappedReportEntry report, String reportNameSuffix,
@@ -490,7 +489,6 @@ public class StatelessXmlReporter
                 xmlWriter.addAttribute( "value", extraEscape( value, true ) );
 
                 xmlWriter.endElement();
-
             }
         }
         xmlWriter.endElement();
@@ -506,14 +504,10 @@ public class StatelessXmlReporter
     private static String extraEscape( String message, boolean attribute )
     {
         // Someday convert to xml 1.1 which handles everything but 0 inside string
-        if ( !containsEscapesIllegalnXml10( message ) )
-        {
-            return message;
-        }
-        return escapeXml( message, attribute );
+        return containsEscapesIllegalXml10( message ) ? escapeXml( message, attribute ) : message;
     }
 
-    private static class EncodingOutputStream
+    private static final class EncodingOutputStream
         extends FilterOutputStream
     {
         private int c1;
@@ -563,7 +557,7 @@ public class StatelessXmlReporter
         }
     }
 
-    private static boolean containsEscapesIllegalnXml10( String message )
+    private static boolean containsEscapesIllegalXml10( String message )
     {
         int size = message.length();
         for ( int i = 0; i < size; i++ )
@@ -611,7 +605,7 @@ public class StatelessXmlReporter
         return sb.toString();
     }
 
-    private static class ByteConstantsHolder
+    private static final class ByteConstantsHolder
     {
         private static final byte[] CDATA_START_BYTES;
 


[25/25] maven-surefire git commit: Merge branch 'master' into merge-with-master

Posted by ti...@apache.org.
Merge branch 'master' into merge-with-master


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

Branch: refs/heads/junit5
Commit: da928141270c2e8bcad9999f7dcdf24ec80ec357
Parents: 8eae287 b1d11c6
Author: Benedikt Ritter <br...@apache.org>
Authored: Thu Oct 13 21:12:42 2016 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Thu Oct 13 21:12:42 2016 +0200

----------------------------------------------------------------------
 maven-failsafe-plugin/pom.xml                   |   5 +
 .../plugin/failsafe/IntegrationTestMojo.java    |  63 +++++++++--
 .../failsafe/IntegrationTestMojoTest.java       |   1 +
 .../plugin/surefire/AbstractSurefireMojo.java   |  34 ++++--
 .../maven/plugin/surefire/CommonReflector.java  |   4 +-
 .../surefire/StartupReportConfiguration.java    |  19 ++--
 .../surefire/SurefireExecutionParameters.java   |   4 +
 .../plugin/surefire/SurefireProperties.java     |   2 +-
 .../surefire/booterclient/BooterSerializer.java |   4 +-
 .../surefire/booterclient/ForkStarter.java      |  45 ++++++--
 .../AbstractForkInputStream.java                |   2 +-
 .../booterclient/output/ForkClient.java         |   9 ++
 .../report/ConsoleOutputFileReporter.java       |   5 +-
 .../surefire/report/DefaultReporterFactory.java |  50 +++++++--
 .../report/NullConsoleOutputReceiver.java       |  55 ++++++++++
 .../surefire/report/NullConsoleReporter.java    |  58 ++++++++++
 .../surefire/report/NullFileReporter.java       |  45 ++++++++
 .../report/NullStatelessXmlReporter.java        |  48 +++++++++
 .../surefire/report/NullStatisticsReporter.java |  66 ++++++++++++
 .../surefire/report/StatelessXmlReporter.java   |  21 ++--
 .../surefire/report/TestSetRunListener.java     |  87 ++++-----------
 .../surefire/report/WrappedReportEntry.java     |   4 +-
 .../surefire/runorder/StatisticsReporter.java   |  11 +-
 ...erDeserializerProviderConfigurationTest.java |   2 +-
 ...terDeserializerStartupConfigurationTest.java |   2 +-
 .../booterclient/ForkingRunListenerTest.java    |   7 +-
 .../report/DefaultReporterFactoryTest.java      |   6 +-
 .../maven/plugin/surefire/SurefirePlugin.java   |  23 ++++
 .../apt/examples/configuring-classpath.apt.vm   |   1 +
 .../fork-options-and-parallel-execution.apt.vm  |   2 +-
 .../src/site/apt/examples/shutdown.apt.vm       |   3 +-
 maven-surefire-plugin/src/site/fml/faq.fml      |  11 ++
 .../src/site/markdown/multilineexceptions.md    |   2 +-
 pom.xml                                         |   7 +-
 .../surefire/booter/BaseProviderFactory.java    |  12 +++
 .../apache/maven/surefire/booter/Command.java   |   2 +-
 .../maven/surefire/booter/CommandReader.java    |   2 +-
 .../surefire/booter/ForkingRunListener.java     |   6 +-
 .../surefire/booter/MasterProcessCommand.java   |   2 +-
 .../surefire/booter/SurefireReflector.java      |  18 ++--
 .../providerapi/ProviderParameters.java         |   2 +
 .../surefire/report/ConsoleOutputCapture.java   |   3 +-
 .../surefire/testset/RunOrderParameters.java    |   4 +-
 .../surefire/util/internal/ObjectUtils.java     |   1 +
 .../surefire/util/internal/StringUtils.java     |  31 ++----
 .../maven/surefire/booter/BooterConstants.java  |   1 +
 .../surefire/booter/BooterDeserializer.java     |  10 +-
 .../maven/surefire/booter/ForkedBooter.java     |  22 ++--
 .../surefire/booter/ProviderConfiguration.java  |  19 +++-
 .../maven/surefire/booter/ProviderFactory.java  |   5 +-
 .../booter/SurefireBooterForkException.java     |  51 +++++++++
 surefire-integration-tests/pom.xml              |   3 +-
 .../surefire/its/JUnit47ConcurrencyIT.java      |  58 ++++++++++
 .../its/JUnit47StaticInnerClassTestsIT.java     |  34 ++++++
 .../surefire/its/JUnit47WithCucumberIT.java     |  71 ++++++++++++
 .../maven/surefire/its/JUnit4IgnoreIT.java      |  52 +++++++++
 .../maven/surefire/its/JUnit4VersionsIT.java    |  87 +++++++++++++++
 .../its/Junit47StaticInnerClassTestsIT.java     |  32 ------
 .../surefire/its/Junit47WithCucumberIT.java     |  71 ------------
 .../surefire/its/Junit47concurrencyIT.java      |  58 ----------
 .../maven/surefire/its/Junit4IgnoreIT.java      |  52 ---------
 .../maven/surefire/its/Junit4VersionsIT.java    | 108 -------------------
 .../jiras/Surefire1028UnableToRunSingleIT.java  |  59 ++++++++++
 .../Surefire1028UnableToRunSingleTest.java      |  59 ----------
 ...refire747MethodParallelWithSuiteCountIT.java |  86 ++++++++++-----
 .../test/resources/concurrentjunit47/pom.xml    |  62 -----------
 .../src/test/java/junit47/BasicTest.java        |  71 ------------
 .../src/test/java/pkg/ATest.java                |   2 +-
 .../src/test/java/pkg/BTest.java                |   2 +-
 .../src/test/java/pkg/CTest.java                |   2 +-
 .../src/test/java/pkg/DTest.java                |   2 +-
 .../src/test/java/pkg/ATest.java                |   2 +-
 .../src/test/java/pkg/BTest.java                |   2 +-
 .../src/test/java/pkg/CTest.java                |   2 +-
 .../src/test/java/pkg/DTest.java                |   2 +-
 .../test/resources/junit47-concurrency/pom.xml  |  61 +++++++++++
 .../src/test/java/junit47/BasicTest.java        |  71 ++++++++++++
 .../junit47-parallel-with-suite/pom.xml         |   5 +-
 .../src/test/java/surefire747/SuiteTest1.java   |   8 +-
 .../src/test/java/surefire747/SuiteTest2.java   |   8 +-
 80 files changed, 1255 insertions(+), 776 deletions(-)
----------------------------------------------------------------------



[24/25] maven-surefire git commit: Pass suffix parameter to unpack method in order to generate separate test workspaces

Posted by ti...@apache.org.
Pass suffix parameter to unpack method in order to generate separate test workspaces


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

Branch: refs/heads/junit5
Commit: b1d11c64b05273f0a802a4ddcb1935f2c5de0a35
Parents: 5e9f563
Author: Benedikt Ritter <br...@apache.org>
Authored: Thu Oct 13 08:50:51 2016 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Thu Oct 13 08:50:51 2016 +0200

----------------------------------------------------------------------
 .../test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b1d11c64/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java
index 87fe140..8dd8f0c 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java
@@ -69,7 +69,7 @@ public class JUnit4VersionsIT
 
     private SurefireLauncher unpack()
     {
-        return unpack( "/junit4" );
+        return unpack( "/junit4", version );
     }
 
     @Test


[05/25] maven-surefire git commit: [SUREFIRE-1198] Failsafe does not allow to configure the jar file to use

Posted by ti...@apache.org.
[SUREFIRE-1198] Failsafe does not allow to configure the jar file to use


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

Branch: refs/heads/junit5
Commit: f1aea63320b66e635e0dc27e4f9ecd0e155099d9
Parents: 53c7980
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Sep 25 04:19:47 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Sep 25 04:19:47 2016 +0200

----------------------------------------------------------------------
 maven-failsafe-plugin/pom.xml                   |  5 +++
 .../plugin/failsafe/IntegrationTestMojo.java    | 40 +++++++++++++++-----
 .../failsafe/IntegrationTestMojoTest.java       |  1 +
 .../apt/examples/configuring-classpath.apt.vm   |  1 +
 maven-surefire-plugin/src/site/fml/faq.fml      | 11 ++++++
 pom.xml                                         |  7 ++--
 6 files changed, 51 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f1aea633/maven-failsafe-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/pom.xml b/maven-failsafe-plugin/pom.xml
index ff02870..91c7677 100644
--- a/maven-failsafe-plugin/pom.xml
+++ b/maven-failsafe-plugin/pom.xml
@@ -73,6 +73,11 @@
       <type>zip</type>
       <classifier>site-source</classifier>
     </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f1aea633/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
index 9f30534..b3f76db 100644
--- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
+++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
@@ -25,7 +25,6 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.surefire.AbstractSurefireMojo;
@@ -58,9 +57,12 @@ public class IntegrationTestMojo
      * The path representing project <em>JAR</em> file, if exists; Otherwise the directory containing generated
      * classes of the project being tested. This will be included after the test classes in the test classpath.
      */
-    @Parameter( defaultValue = "${project.build.outputDirectory}" )
+    @Parameter
     private File classesDirectory;
 
+    @Parameter( readonly = true, defaultValue = "${project.build.outputDirectory}" )
+    private File defaultClassesDirectory;
+
     /**
      * Set this to "true" to skip running integration tests, but still compile them. Its use is NOT RECOMMENDED, but
      * quite convenient on occasion.
@@ -388,6 +390,23 @@ public class IntegrationTestMojo
         }
     }
 
+    private boolean isJarArtifact( File artifactFile )
+    {
+        return artifactFile != null && artifactFile.isFile() && artifactFile.getName().toLowerCase().endsWith( ".jar" );
+    }
+
+    private static File toAbsoluteCanonical( File f )
+    {
+        try
+        {
+            return f == null ? null : f.getAbsoluteFile().getCanonicalFile();
+        }
+        catch ( IOException e )
+        {
+            throw new IllegalStateException( e.getLocalizedMessage(), e );
+        }
+    }
+
     @SuppressWarnings( "deprecation" )
     protected boolean isSkipExecution()
     {
@@ -481,18 +500,19 @@ public class IntegrationTestMojo
      */
     public File getClassesDirectory()
     {
-        Artifact artifact = getProject().getArtifact();
-        File artifactFile = artifact.getFile();
-
-        boolean useArtifactFile = artifactFile != null && artifactFile.isFile()
-            && artifactFile.getName().toLowerCase().endsWith( ".jar" );
-
-        return useArtifactFile ? artifactFile : classesDirectory;
+        File artifact = getProject().getArtifact().getFile();
+        boolean isDefaultClsDir = classesDirectory == null;
+        return isDefaultClsDir ? ( isJarArtifact( artifact ) ? artifact : defaultClassesDirectory ) : classesDirectory;
     }
 
     public void setClassesDirectory( File classesDirectory )
     {
-        this.classesDirectory = classesDirectory;
+        this.classesDirectory = toAbsoluteCanonical( classesDirectory );
+    }
+
+    public void setDefaultClassesDirectory( File defaultClassesDirectory )
+    {
+        this.defaultClassesDirectory = toAbsoluteCanonical( defaultClassesDirectory );
     }
 
     public File getReportsDirectory()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f1aea633/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/IntegrationTestMojoTest.java
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/IntegrationTestMojoTest.java b/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/IntegrationTestMojoTest.java
new file mode 100644
index 0000000..cd69d68
--- /dev/null
+++ b/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/IntegrationTestMojoTest.java
@@ -0,0 +1 @@
+package org.apache.maven.plugin.failsafe;

/*
 * 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.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.versioning.Invali
 dVersionSpecificationException;
import org.apache.maven.project.MavenProject;
import org.junit.Before;
import org.junit.Test;

import java.io.File;
import java.io.IOException;

import static org.apache.maven.artifact.versioning.VersionRange.createFromVersionSpec;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import static org.fest.assertions.Assertions.assertThat;

/**
 * @since 2.19.2
 */
public class IntegrationTestMojoTest
{
    private IntegrationTestMojo mojo;

    @Before
    public void init() throws InvalidVersionSpecificationException, IOException
    {
        Artifact artifact = new DefaultArtifact( "g", "a", createFromVersionSpec( "1.0" ), "compile", "jar", "", null );
        artifact.setFile( new File( "./target/tmp/a-1.0.jar" ) );
        new File( "./target/tmp" ).mkdir();
        artifact.getFile().createNewFile();
        mojo = spy( IntegrationTestMojo.class );
        MavenProject project = 
 mock( MavenProject.class );
        when( project.getArtifact() ).thenReturn( artifact );
        when( mojo.getProject() ).thenReturn( project );
    }

    @Test
    public void shouldBeJar()
    {
        mojo.setDefaultClassesDirectory( new File( "./target/classes" ) );
        File binaries = mojo.getClassesDirectory();
        assertThat( binaries.getName() ).isEqualTo( "a-1.0.jar" );
    }

    @Test
    public void shouldBeAnotherJar()
    {
        mojo.setClassesDirectory( new File( "./target/another-1.0.jar" ) );
        mojo.setDefaultClassesDirectory( new File( "./target/classes" ) );
        File binaries = mojo.getClassesDirectory();
        assertThat( binaries.getName() ).isEqualTo( "another-1.0.jar" );
    }

    @Test
    public void shouldBeClasses()
    {
        mojo.setClassesDirectory( new File( "./target/classes" ) );
        mojo.setDefaultClassesDirectory( new File( "./target/classes" ) );
        File binaries = mojo.getClassesDirectory();
        assertT
 hat( binaries.getName() ).isEqualTo( "classes" );
    }
}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f1aea633/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm
----------------------------------------------------------------------
diff --git a/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm b/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm
index 809f268..75e1e9d 100644
--- a/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm
+++ b/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm
@@ -48,6 +48,7 @@ The Default Classpath
 
 #{if}(${project.artifactId}=="maven-failsafe-plugin")
   Notice that loading JAR file is preferable over the output classes directory in the maven-failsafe-plugin.
+  This behavior can be changed by configuration parameter <<<classesDirectory>>>.
 #{end}
 
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f1aea633/maven-surefire-plugin/src/site/fml/faq.fml
----------------------------------------------------------------------
diff --git a/maven-surefire-plugin/src/site/fml/faq.fml b/maven-surefire-plugin/src/site/fml/faq.fml
index b1ec6da..6be7913 100644
--- a/maven-surefire-plugin/src/site/fml/faq.fml
+++ b/maven-surefire-plugin/src/site/fml/faq.fml
@@ -97,5 +97,16 @@ under the License.
         </p>
       </answer>
     </faq>
+    <faq id="failsafe-jar">
+      <question>How maven-failsafe-plugin allows me to configure the jar file or classes to use</question>
+      <answer>
+        <p>
+        By default maven-failsafe-plugin uses project artifact file if packaging is set to "jar" in pom.xml.
+        This can be modified and for instance set to main project classes if you use configuration parameter
+        "classesDirectory". This would mean that you set value "${project.build.outputDirectory}" for the parameter
+        "classesDirectory" in the configuration of plugin.
+        </p>
+      </answer>
+    </faq>
   </part>
 </faqs>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f1aea633/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 94b2ea6..77c0385 100644
--- a/pom.xml
+++ b/pom.xml
@@ -221,10 +221,9 @@
         <version>1.6</version>
       </dependency>
       <dependency>
-        <groupId>jmock</groupId>
-        <artifactId>jmock</artifactId>
-        <version>1.0.1</version>
-        <scope>test</scope>
+        <groupId>org.mockito</groupId>
+        <artifactId>mockito-core</artifactId>
+        <version>1.10.19</version>
       </dependency>
       <dependency>
         <groupId>junit</groupId>


[03/25] maven-surefire git commit: [SUREFIRE] getForkedProcessExitTimeoutInSeconds() and getRerunFailingTestsCount() missing in computation of checksum

Posted by ti...@apache.org.
[SUREFIRE] getForkedProcessExitTimeoutInSeconds() and getRerunFailingTestsCount() missing in computation of checksum


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

Branch: refs/heads/junit5
Commit: ada12d4073bcde0be1b7c4324fceb72915b72c59
Parents: 2c6105c
Author: Tibor17 <ti...@lycos.com>
Authored: Sat Sep 24 11:55:00 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sat Sep 24 11:55:00 2016 +0200

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


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ada12d40/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 5e22b70..bd9e0bd 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
@@ -2087,6 +2087,8 @@ public abstract class AbstractSurefireMojo
         checksum.add( getFailIfNoTests() );
         checksum.add( getRunOrder() );
         checksum.add( getDependenciesToScan() );
+        checksum.add( getForkedProcessExitTimeoutInSeconds() );
+        checksum.add( getRerunFailingTestsCount() );
         addPluginSpecificChecksumItems( checksum );
         return checksum.getSha1();
 


[15/25] maven-surefire git commit: [SUREFIRE-1281] Fix permanently failing Surefire Windows Build

Posted by ti...@apache.org.
[SUREFIRE-1281] Fix permanently failing Surefire Windows Build


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

Branch: refs/heads/junit5
Commit: 4b43807504d36d624ba9f72649fabd74579eceff
Parents: 9dc1574
Author: Tibor17 <ti...@lycos.com>
Authored: Mon Oct 3 02:06:19 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Mon Oct 3 02:06:19 2016 +0200

----------------------------------------------------------------------
 .../test/resources/fail-fast-junit/src/test/java/pkg/ATest.java    | 2 +-
 .../test/resources/fail-fast-junit/src/test/java/pkg/BTest.java    | 2 +-
 .../test/resources/fail-fast-junit/src/test/java/pkg/CTest.java    | 2 +-
 .../test/resources/fail-fast-junit/src/test/java/pkg/DTest.java    | 2 +-
 .../test/resources/fail-fast-testng/src/test/java/pkg/ATest.java   | 2 +-
 .../test/resources/fail-fast-testng/src/test/java/pkg/BTest.java   | 2 +-
 .../test/resources/fail-fast-testng/src/test/java/pkg/CTest.java   | 2 +-
 .../test/resources/fail-fast-testng/src/test/java/pkg/DTest.java   | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4b438075/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/ATest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/ATest.java b/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/ATest.java
index 5a3fb4e..4d09bab 100644
--- a/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/ATest.java
+++ b/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/ATest.java
@@ -12,7 +12,7 @@ public class ATest
         throws Exception
     {
         // checking processros # due to very slow Windows Jenkins machines
-        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 1200 : 500 );
+        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 3600 : 1500 );
         throw new RuntimeException( "assert \"foo\" == \"bar\"\n" +
                                         "             |\n"
                                         + "             false" );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4b438075/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/BTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/BTest.java b/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/BTest.java
index 3015f40..1dc76b7 100644
--- a/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/BTest.java
+++ b/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/BTest.java
@@ -11,7 +11,7 @@ public class BTest
         throws InterruptedException
     {
         // checking processros # due to very slow Windows Jenkins machines
-        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 3000 : 1250 );
+        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 );
         throw new RuntimeException();
     }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4b438075/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/CTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/CTest.java b/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/CTest.java
index 9865e69..2660779 100644
--- a/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/CTest.java
+++ b/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/CTest.java
@@ -11,7 +11,7 @@ public class CTest
         throws InterruptedException
     {
         // checking processros # due to very slow Windows Jenkins machines
-        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 3000 : 1250 );
+        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 );
     }
 
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4b438075/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/DTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/DTest.java b/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/DTest.java
index 4167f67..12a9bc7 100644
--- a/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/DTest.java
+++ b/surefire-integration-tests/src/test/resources/fail-fast-junit/src/test/java/pkg/DTest.java
@@ -11,7 +11,7 @@ public class DTest
         throws InterruptedException
     {
         // checking processros # due to very slow Windows Jenkins machines
-        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 3000 : 1250 );
+        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 );
     }
 
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4b438075/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/ATest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/ATest.java b/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/ATest.java
index b90859b..46b9d09 100644
--- a/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/ATest.java
+++ b/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/ATest.java
@@ -11,7 +11,7 @@ public class ATest
         throws InterruptedException
     {
         // checking processros # due to very slow Windows Jenkins machines
-        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 1200 : 500 );
+        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 3600 : 1500 );
         throw new RuntimeException( "assert \"foo\" == \"bar\"\n"
                                         + "             |\n"
                                         + "             false" );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4b438075/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/BTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/BTest.java b/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/BTest.java
index 8cdc13d..90e2fdb 100644
--- a/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/BTest.java
+++ b/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/BTest.java
@@ -11,7 +11,7 @@ public class BTest
         throws InterruptedException
     {
         // checking processros # due to very slow Windows Jenkins machines
-        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 3000 : 1250 );
+        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 );
         throw new RuntimeException();
     }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4b438075/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/CTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/CTest.java b/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/CTest.java
index 8fe2faf..d407aa3 100644
--- a/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/CTest.java
+++ b/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/CTest.java
@@ -11,7 +11,7 @@ public class CTest
         throws InterruptedException
     {
         // checking processros # due to very slow Windows Jenkins machines
-        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 3000 : 1250 );
+        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 );
     }
 
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4b438075/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/DTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/DTest.java b/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/DTest.java
index c4ffd68..a00260f 100644
--- a/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/DTest.java
+++ b/surefire-integration-tests/src/test/resources/fail-fast-testng/src/test/java/pkg/DTest.java
@@ -11,7 +11,7 @@ public class DTest
         throws InterruptedException
     {
         // checking processros # due to very slow Windows Jenkins machines
-        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 3000 : 1250 );
+        TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 );
     }
 
 }


[11/25] maven-surefire git commit: [SUREFIRE-1289] forkedProcessTimeoutInSeconds should not use ping timer of 10 seconds but 0.1 sec period timer

Posted by ti...@apache.org.
[SUREFIRE-1289] forkedProcessTimeoutInSeconds should not use ping timer of 10 seconds but 0.1 sec period timer


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

Branch: refs/heads/junit5
Commit: b2488b64567934c341d2643856d57dd48aa88359
Parents: e563566
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Oct 2 11:08:51 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Oct 2 11:12:39 2016 +0200

----------------------------------------------------------------------
 .../org/apache/maven/plugin/surefire/booterclient/ForkStarter.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b2488b64/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
index 4f9c813..baea043 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
@@ -716,7 +716,7 @@ public class ForkStarter
 
     private ScheduledFuture<?> triggerTimeoutCheck()
     {
-        return pingThreadScheduler.scheduleAtFixedRate( new Runnable()
+        return timeoutCheckScheduler.scheduleAtFixedRate( new Runnable()
         {
             public void run()
             {


[20/25] maven-surefire git commit: Add missing JUnit 4 versions to Junit4VersionsIT

Posted by ti...@apache.org.
Add missing JUnit 4 versions to Junit4VersionsIT


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

Branch: refs/heads/junit5
Commit: e6b39217de0ebb968b36945a4b5e086b9925e26d
Parents: 41d1cfc
Author: Benedikt Ritter <br...@apache.org>
Authored: Sun Oct 9 15:40:55 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Tue Oct 11 00:25:29 2016 +0200

----------------------------------------------------------------------
 .../apache/maven/surefire/its/Junit4VersionsIT.java   | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e6b39217/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java
index 2296cf8..500591a 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java
@@ -42,8 +42,9 @@ public class Junit4VersionsIT
 {
 
     @Parameters( name = "{index}: JUnit {0}" )
-    public static Collection<Object[]> junitVersions() {
-        return Arrays.asList( new Object[][]{
+    public static Collection<Object[]> junitVersions()
+    {
+        return Arrays.asList( new Object[][] {
                 { "4.0" },
                 { "4.1" },
                 { "4.2" },
@@ -52,7 +53,14 @@ public class Junit4VersionsIT
                 { "4.4" },
                 { "4.5" },
                 { "4.6" },
-                { "4.7" }
+                { "4.7" },
+                { "4.8" },
+                { "4.8.1" },
+                { "4.8.2" },
+                { "4.9" },
+                { "4.10" },
+                { "4.11" },
+                { "4.12" }
         } );
     }
 


[18/25] maven-surefire git commit: Fix formatting, convert tabs to spaces

Posted by ti...@apache.org.
Fix formatting, convert tabs to spaces


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

Branch: refs/heads/junit5
Commit: 86f89a8c8d98d4e1b210ec7b494184a81d4940bf
Parents: f37a8d4
Author: Benedikt Ritter <br...@apache.org>
Authored: Mon Oct 3 17:49:07 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Mon Oct 10 21:46:23 2016 +0200

----------------------------------------------------------------------
 .../surefire/its/Junit47StaticInnerClassTestsIT.java      | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/86f89a8c/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47StaticInnerClassTestsIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47StaticInnerClassTestsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47StaticInnerClassTestsIT.java
index 0901d58..b8d38bf 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47StaticInnerClassTestsIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit47StaticInnerClassTestsIT.java
@@ -22,11 +22,13 @@ package org.apache.maven.surefire.its;
 import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
 import org.junit.Test;
 
-public class Junit47StaticInnerClassTestsIT extends SurefireJUnit4IntegrationTestCase
+public class Junit47StaticInnerClassTestsIT
+    extends SurefireJUnit4IntegrationTestCase
 {
 
     @Test
-	public void testStaticInnerClassTests() {
-		executeErrorFreeTest( "junit47-static-inner-class-tests", 3 );
-	}
+    public void testStaticInnerClassTests()
+    {
+        executeErrorFreeTest( "junit47-static-inner-class-tests", 3 );
+    }
 }


[17/25] maven-surefire git commit: [SUREFIRE-1281] Fix permanently failing Surefire Windows Build

Posted by ti...@apache.org.
[SUREFIRE-1281] Fix permanently failing Surefire Windows Build


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

Branch: refs/heads/junit5
Commit: f37a8d4dcb59b0ea8fd982f3d8db9b158088fa28
Parents: e0ce6cb
Author: Tibor17 <ti...@lycos.com>
Authored: Fri Oct 7 07:46:16 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Fri Oct 7 07:46:16 2016 +0200

----------------------------------------------------------------------
 surefire-integration-tests/pom.xml              |  1 +
 ...refire747MethodParallelWithSuiteCountIT.java | 86 ++++++++++++++------
 .../junit47-parallel-with-suite/pom.xml         |  5 +-
 .../src/test/java/surefire747/SuiteTest1.java   |  8 +-
 .../src/test/java/surefire747/SuiteTest2.java   |  8 +-
 5 files changed, 76 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f37a8d4d/surefire-integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/pom.xml b/surefire-integration-tests/pom.xml
index 43d4b0a..beab2be 100644
--- a/surefire-integration-tests/pom.xml
+++ b/surefire-integration-tests/pom.xml
@@ -116,6 +116,7 @@
             <testBuildDirectory>${project.build.testOutputDirectory}</testBuildDirectory>
             <verifier.forkMode>${verifier.forkMode}</verifier.forkMode>
           </systemPropertyVariables>
+          <redirectTestOutputToFile>false</redirectTestOutputToFile>
         </configuration>
         <dependencies>
           <dependency>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f37a8d4d/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire747MethodParallelWithSuiteCountIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire747MethodParallelWithSuiteCountIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire747MethodParallelWithSuiteCountIT.java
index 6166b3e..c5dbc84 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire747MethodParallelWithSuiteCountIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire747MethodParallelWithSuiteCountIT.java
@@ -23,12 +23,18 @@ import org.apache.maven.it.VerificationException;
 import org.apache.maven.surefire.its.fixture.OutputValidator;
 import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
 import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+import org.junit.Before;
 import org.junit.Test;
 
+import java.text.Format;
+import java.text.NumberFormat;
 import java.util.Iterator;
 import java.util.Set;
 import java.util.TreeSet;
 
+import static java.lang.String.format;
+import static java.math.RoundingMode.DOWN;
+import static java.util.Locale.ROOT;
 import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.CoreMatchers.endsWith;
@@ -40,11 +46,15 @@ import static org.junit.Assert.assertTrue;
  * @author Kristian Rosenvold
  */
 public class Surefire747MethodParallelWithSuiteCountIT
-    extends SurefireJUnit4IntegrationTestCase
+        extends SurefireJUnit4IntegrationTestCase
 {
+    // if you want to change his constant, change it in SuiteTest1.java and SuiteTest2.java as well
+    private static final int PERFORMANCE_TEST_MULTIPLICATION_FACTOR = 4;
+
+    private Format lowerScaleFormatter, noFractionalDigitsFormatter;
 
     private static Set<String> printTestLines( OutputValidator validator, String pattern )
-        throws VerificationException
+            throws VerificationException
     {
         Set<String> log = new TreeSet<String>( validator.loadLogLines() );
         for ( Iterator<String> it = log.iterator(); it.hasNext(); )
@@ -63,9 +73,25 @@ public class Surefire747MethodParallelWithSuiteCountIT
         return Integer.decode( logLine.split( "=" )[1] );
     }
 
+    @Before
+    public void init()
+    {
+        NumberFormat lowScaleFormatter = NumberFormat.getInstance( ROOT );
+        lowScaleFormatter.setRoundingMode( DOWN );
+        lowScaleFormatter.setMinimumFractionDigits( 1 );
+        lowScaleFormatter.setMaximumFractionDigits( 1 );
+        this.lowerScaleFormatter = lowScaleFormatter;
+
+        NumberFormat noFractionalDigitsFormatter = NumberFormat.getInstance( ROOT );
+        noFractionalDigitsFormatter.setRoundingMode( DOWN );
+        noFractionalDigitsFormatter.setMinimumFractionDigits( 0 );
+        noFractionalDigitsFormatter.setMaximumFractionDigits( 0 );
+        this.noFractionalDigitsFormatter = noFractionalDigitsFormatter;
+    }
+
     @Test
     public void testMethodsParallelWithSuite()
-        throws VerificationException
+            throws VerificationException
     {
         OutputValidator validator = unpack().executeTest().verifyErrorFree( 6 );
         Set<String> testLines = printTestLines( validator, "test finished after duration=" );
@@ -73,37 +99,45 @@ public class Surefire747MethodParallelWithSuiteCountIT
         for ( String testLine : testLines )
         {
             long duration = duration( testLine );
-            long min = 250, max = 750;
-            assertTrue( String.format( "duration %d should be between %d and %d ms", duration, min, max ),
-                        duration > min && duration < max );
+            long min = 250 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR;
+            long max = 750 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR;
+            assertTrue( format( "duration %d should be between %d and %d ms", duration, min, max ),
+                              duration > min && duration < max
+            );
         }
         Set<String> suiteLines = printTestLines( validator, "suite finished after duration=" );
         assertThat( suiteLines.size(), is( 1 ) );
         long duration = duration( suiteLines.iterator().next() );
-        long min = 750, max = 1250;
-        assertTrue( String.format( "duration %d should be between %d and %d ms", duration, min, max ),
-                    duration > min && duration < max );
+        long min = 750 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR;
+        long max = 1250 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR;
+        assertTrue( format( "duration %d should be between %d and %d ms", duration, min, max ),
+                          duration > min && duration < max
+        );
+
+        String delayMin = lowerScaleFormatter.format( 0.98 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR * 0.5 );
+        String delayMax = noFractionalDigitsFormatter.format( PERFORMANCE_TEST_MULTIPLICATION_FACTOR * 0.5 ) + ".";
 
         for ( String line : validator.loadLogLines() )
         {
             if ( line.startsWith( "Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:" ) )
             {
-                assertThat( line, anyOf( // 0.5 sec, the delta -1.0/+0.3 can be varying depending on CI jobs
-                        containsString( "Time elapsed: 0.4" ),
-                        containsString( "Time elapsed: 0.5" ),
-                        containsString( "Time elapsed: 0.6" ),
-                        containsString( "Time elapsed: 0.7" ),
-                        containsString( "Time elapsed: 0.8" ) ) );
+                assertThat( line, anyOf( // 1.9xx to 2.xxx can vary depending on CI jobs
+                                               containsString( "Time elapsed: " + delayMin ),
+                                               containsString( "Time elapsed: " + delayMax )
+                        )
+                );
                 assertThat( line, anyOf(
-                        endsWith(" s - in surefire747.SuiteTest1" ),
-                        endsWith(" s - in surefire747.SuiteTest2" ) ) );
+                                               endsWith( " s - in surefire747.SuiteTest1" ),
+                                               endsWith( " s - in surefire747.SuiteTest2" )
+                        )
+                );
             }
         }
     }
 
     @Test
     public void testClassesParallelWithSuite()
-        throws VerificationException
+            throws VerificationException
     {
         OutputValidator validator = unpack().parallelClasses().executeTest().verifyErrorFree( 6 );
         Set<String> testLines = printTestLines( validator, "test finished after duration=" );
@@ -111,16 +145,20 @@ public class Surefire747MethodParallelWithSuiteCountIT
         for ( String testLine : testLines )
         {
             long duration = duration( testLine );
-            long min = 1250, max = 1750;
-            assertTrue( String.format( "duration %d should be between %d and %d ms", duration, min, max ),
-                        duration > min && duration < max );
+            long min = 1450 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR;
+            long max = 1750 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR;
+            assertTrue( format( "duration %d should be between %d and %d ms", duration, min, max ),
+                              duration > min && duration < max
+            );
         }
         Set<String> suiteLines = printTestLines( validator, "suite finished after duration=" );
         assertThat( suiteLines.size(), is( 1 ) );
         long duration = duration( suiteLines.iterator().next() );
-        long min = 1250, max = 1750;
-        assertTrue( String.format( "duration %d should be between %d and %d ms", duration, min, max ),
-                    duration > min && duration < max );
+        long min = 1450 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR;
+        long max = 1750 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR;
+        assertTrue( format( "duration %d should be between %d and %d ms", duration, min, max ),
+                          duration > min && duration < max
+        );
     }
 
     public SurefireLauncher unpack()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f37a8d4d/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/pom.xml b/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/pom.xml
index 403b56b..eb68f3e 100644
--- a/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/pom.xml
+++ b/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/pom.xml
@@ -5,7 +5,7 @@
   <artifactId>junit4-test</artifactId>
   <packaging>jar</packaging>
   <version>1.0-SNAPSHOT</version>
-  <name>surefire-747-parallelo-method-skips-test</name>
+  <name>surefire-747-parallel-method-skips-test</name>
   <url>http://maven.apache.org</url>
   <dependencies>
     <dependency>
@@ -32,7 +32,8 @@
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${surefire.version}</version>
            <configuration>
-             <threadCount>10</threadCount>
+             <perCoreThreadCount>false</perCoreThreadCount>
+             <threadCount>5</threadCount>
              <includes>
                 <include>**/TestSuite.java</include>
              </includes>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f37a8d4d/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/src/test/java/surefire747/SuiteTest1.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/src/test/java/surefire747/SuiteTest1.java b/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/src/test/java/surefire747/SuiteTest1.java
index 96138c8..9ac0b90 100644
--- a/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/src/test/java/surefire747/SuiteTest1.java
+++ b/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/src/test/java/surefire747/SuiteTest1.java
@@ -30,6 +30,8 @@ import org.junit.Test;
  */
 public class SuiteTest1
 {
+    private static final int PERFORMANCE_TEST_MULTIPLICATION_FACTOR = 4;
+
     private static long startedAt;
 
     public SuiteTest1()
@@ -67,7 +69,7 @@ public class SuiteTest1
         throws InterruptedException
     {
         System.out.println( "begin SuiteTest1.first" );
-        Thread.sleep( 500 );
+        Thread.sleep( 500 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR );
         System.out.println( "end SuiteTest1.first" );
     }
 
@@ -76,7 +78,7 @@ public class SuiteTest1
         throws InterruptedException
     {
         System.out.println( "begin SuiteTest1.second" );
-        Thread.sleep( 500 );
+        Thread.sleep( 500 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR );
         System.out.println( "end SuiteTest1.second" );
     }
 
@@ -85,7 +87,7 @@ public class SuiteTest1
         throws InterruptedException
     {
         System.out.println( "begin SuiteTest1.third" );
-        Thread.sleep( 500 );
+        Thread.sleep( 500 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR );
         System.out.println( "end SuiteTest1.third" );
     }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f37a8d4d/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/src/test/java/surefire747/SuiteTest2.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/src/test/java/surefire747/SuiteTest2.java b/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/src/test/java/surefire747/SuiteTest2.java
index b5eb77c..99ad7cd 100644
--- a/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/src/test/java/surefire747/SuiteTest2.java
+++ b/surefire-integration-tests/src/test/resources/junit47-parallel-with-suite/src/test/java/surefire747/SuiteTest2.java
@@ -30,6 +30,8 @@ import org.junit.Test;
  */
 public class SuiteTest2
 {
+    private static final int PERFORMANCE_TEST_MULTIPLICATION_FACTOR = 4;
+
     private static long startedAt;
 
     public SuiteTest2()
@@ -67,7 +69,7 @@ public class SuiteTest2
         throws InterruptedException
     {
         System.out.println( "begin SuiteTest2.first" );
-        Thread.sleep( 500 );
+        Thread.sleep( 500 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR );
         System.out.println( "end SuiteTest2.first" );
     }
 
@@ -76,7 +78,7 @@ public class SuiteTest2
         throws InterruptedException
     {
         System.out.println( "begin SuiteTest2.second" );
-        Thread.sleep( 500 );
+        Thread.sleep( 500 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR );
         System.out.println( "end SuiteTest2.second" );
     }
 
@@ -85,7 +87,7 @@ public class SuiteTest2
         throws InterruptedException
     {
         System.out.println( "begin SuiteTest2.third" );
-        Thread.sleep( 500 );
+        Thread.sleep( 500 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR );
         System.out.println( "end SuiteTest2.third" );
     }
 }


[13/25] maven-surefire git commit: [SUREFIRE-1291] enable unit tests in surefire-integration-tests and rename Surefire1028UnableToRunSingleTest to *IT

Posted by ti...@apache.org.
[SUREFIRE-1291] enable unit tests in surefire-integration-tests and rename Surefire1028UnableToRunSingleTest to *IT


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

Branch: refs/heads/junit5
Commit: a9162eed51b0ac0017bee8144c97a290553589bf
Parents: 33a32d1
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Oct 2 20:42:50 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Oct 2 20:42:50 2016 +0200

----------------------------------------------------------------------
 surefire-integration-tests/pom.xml              |  2 +-
 .../jiras/Surefire1028UnableToRunSingleIT.java  | 59 ++++++++++++++++++++
 .../Surefire1028UnableToRunSingleTest.java      | 59 --------------------
 3 files changed, 60 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a9162eed/surefire-integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/pom.xml b/surefire-integration-tests/pom.xml
index 3fe4f55..43d4b0a 100644
--- a/surefire-integration-tests/pom.xml
+++ b/surefire-integration-tests/pom.xml
@@ -86,7 +86,7 @@
       <plugin>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
-          <skip>true</skip>
+          <test>*Test</test>
         </configuration>
       </plugin>
       <plugin>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a9162eed/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1028UnableToRunSingleIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1028UnableToRunSingleIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1028UnableToRunSingleIT.java
new file mode 100644
index 0000000..74cb281
--- /dev/null
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1028UnableToRunSingleIT.java
@@ -0,0 +1,59 @@
+package org.apache.maven.surefire.its.jiras;
+
+/*
+ * 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;
+
+/**
+ * Plugin Configuration: parallel=classes
+ * <p/>
+ * With Surefire 2.15
+ * {@code $ mvn test -Dtest=MyTest#testFoo}
+ * Results :
+ * Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+ * <p/>
+ * With Surefire 2.16
+ * {@code $ mvn test -Dtest=MyTest#testFoo}
+ * <p/>
+ * Results :
+ * Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
+ *
+ * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
+ * @see {@linkplain https://jira.codehaus.org/browse/SUREFIRE-1028}
+ * @since 2.18
+ */
+public class Surefire1028UnableToRunSingleIT
+    extends SurefireJUnit4IntegrationTestCase
+{
+
+    @Test
+    public void methodFilteringParallelExecution()
+    {
+        unpack().setTestToRun( "SomeTest#test" ).parallelClasses().useUnlimitedThreads()
+                .executeTest().verifyErrorFree( 1 ).verifyTextInLog( "OK!" );
+    }
+
+    private SurefireLauncher unpack()
+    {
+        return unpack( "surefire-1028-unable-to-run-single-test" );
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a9162eed/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1028UnableToRunSingleTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1028UnableToRunSingleTest.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1028UnableToRunSingleTest.java
deleted file mode 100644
index ac40212..0000000
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1028UnableToRunSingleTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.apache.maven.surefire.its.jiras;
-
-/*
- * 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;
-
-/**
- * Plugin Configuration: parallel=classes
- * <p/>
- * With Surefire 2.15
- * {@code $ mvn test -Dtest=MyTest#testFoo}
- * Results :
- * Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
- * <p/>
- * With Surefire 2.16
- * {@code $ mvn test -Dtest=MyTest#testFoo}
- * <p/>
- * Results :
- * Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
- *
- * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
- * @see {@linkplain https://jira.codehaus.org/browse/SUREFIRE-1028}
- * @since 2.18
- */
-public class Surefire1028UnableToRunSingleTest
-    extends SurefireJUnit4IntegrationTestCase
-{
-
-    @Test
-    public void methodFilteringParallelExecution()
-    {
-        unpack().setTestToRun( "SomeTest#test" ).parallelClasses().useUnlimitedThreads()
-                .executeTest().verifyErrorFree( 1 ).verifyTextInLog( "OK!" );
-    }
-
-    private SurefireLauncher unpack()
-    {
-        return unpack( "surefire-1028-unable-to-run-single-test" );
-    }
-}


[04/25] maven-surefire git commit: [SUREFIRE-1284] Statistics file should not be determined as (directory of surefire-reports).getParentFile().getParentFile(). It is a problem if report directory is customized. Statistics file should be located in projec

Posted by ti...@apache.org.
[SUREFIRE-1284] Statistics file should not be determined as (directory of surefire-reports).getParentFile().getParentFile(). It is a problem if report directory is customized. Statistics file should be located in project dir.


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

Branch: refs/heads/junit5
Commit: 53c79809e20b30a6ff08dea2075602b7e790c2e2
Parents: ada12d4
Author: Tibor17 <ti...@lycos.com>
Authored: Sat Sep 24 14:04:44 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sat Sep 24 14:04:44 2016 +0200

----------------------------------------------------------------------
 .../plugin/surefire/AbstractSurefireMojo.java    | 12 +++++-------
 .../maven/plugin/surefire/CommonReflector.java   |  4 ++--
 .../surefire/StartupReportConfiguration.java     | 19 ++++++++-----------
 .../plugin/surefire/SurefireProperties.java      |  2 +-
 .../report/DefaultReporterFactoryTest.java       |  6 +++---
 .../maven/surefire/booter/SurefireReflector.java |  6 ++----
 .../surefire/testset/RunOrderParameters.java     |  4 ++--
 .../surefire/booter/BooterDeserializer.java      |  3 ++-
 8 files changed, 25 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/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 bd9e0bd..1dd80b2 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
@@ -1029,7 +1029,7 @@ public abstract class AbstractSurefireMojo
         ClassLoaderConfiguration classLoaderConfiguration = getClassLoaderConfiguration();
         provider.addProviderProperties();
         RunOrderParameters runOrderParameters =
-            new RunOrderParameters( getRunOrder(), getStatisticsFileName( getConfigChecksum() ) );
+            new RunOrderParameters( getRunOrder(), getStatisticsFile( getConfigChecksum() ) );
 
         if ( isNotForking() )
         {
@@ -1562,10 +1562,9 @@ public abstract class AbstractSurefireMojo
         return h;
     }
 
-    public String getStatisticsFileName( String configurationHash )
+    public File getStatisticsFile( String configurationHash )
     {
-        return getReportsDirectory().getParentFile().getParentFile() + File.separator + ".surefire-"
-            + configurationHash;
+        return new File( getBasedir(), ".surefire-" + configurationHash );
     }
 
     StartupConfiguration createStartupConfiguration( ProviderInfo provider,
@@ -1631,8 +1630,8 @@ public abstract class AbstractSurefireMojo
         return new StartupReportConfiguration( isUseFile(), isPrintSummary(), getReportFormat(),
                                                isRedirectTestOutputToFile(), isDisableXmlReport(),
                                                getReportsDirectory(), isTrimStackTrace(), getReportNameSuffix(),
-                                               configChecksum, requiresRunHistory(), getRerunFailingTestsCount(),
-                                               getReportSchemaLocation() );
+                                               getStatisticsFile( configChecksum ), requiresRunHistory(),
+                                               getRerunFailingTestsCount(), getReportSchemaLocation() );
     }
 
     private boolean isSpecificTestSpecified()
@@ -2091,7 +2090,6 @@ public abstract class AbstractSurefireMojo
         checksum.add( getRerunFailingTestsCount() );
         addPluginSpecificChecksumItems( checksum );
         return checksum.getSha1();
-
     }
 
     protected void addPluginSpecificChecksumItems( ChecksumCalculator checksum )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
index 4ae589f..1918930 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
@@ -71,14 +71,14 @@ public class CommonReflector
     {
         Constructor<?> constructor = getConstructor( startupReportConfiguration, boolean.class, boolean.class,
                                                            String.class, boolean.class, boolean.class, File.class,
-                                                           boolean.class, String.class, String.class, boolean.class,
+                                                           boolean.class, String.class, File.class, boolean.class,
                                                            int.class, String.class );
         //noinspection BooleanConstructorCall
         Object[] params = { reporterConfiguration.isUseFile(), reporterConfiguration.isPrintSummary(),
             reporterConfiguration.getReportFormat(), reporterConfiguration.isRedirectTestOutputToFile(),
             reporterConfiguration.isDisableXmlReport(), reporterConfiguration.getReportsDirectory(),
             reporterConfiguration.isTrimStackTrace(), reporterConfiguration.getReportNameSuffix(),
-            reporterConfiguration.getConfigurationHash(), reporterConfiguration.isRequiresRunHistory(),
+            reporterConfiguration.getStatisticsFile(), reporterConfiguration.isRequiresRunHistory(),
             reporterConfiguration.getRerunFailingTestsCount(), reporterConfiguration.getXsdSchemaLocation() };
         return newInstance( constructor, params );
     }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
index 8b1b710..482ce00 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
@@ -63,7 +63,7 @@ public final class StartupReportConfiguration
 
     private final String reportNameSuffix;
 
-    private final String configurationHash;
+    private final File statisticsFile;
 
     private final boolean requiresRunHistory;
 
@@ -90,7 +90,7 @@ public final class StartupReportConfiguration
     public StartupReportConfiguration( boolean useFile, boolean printSummary, String reportFormat,
                                        boolean redirectTestOutputToFile, boolean disableXmlReport,
                                        @Nonnull File reportsDirectory, boolean trimStackTrace, String reportNameSuffix,
-                                       String configurationHash, boolean requiresRunHistory,
+                                       File statisticsFile, boolean requiresRunHistory,
                                        int rerunFailingTestsCount, String xsdSchemaLocation )
     {
         this.useFile = useFile;
@@ -101,7 +101,7 @@ public final class StartupReportConfiguration
         this.reportsDirectory = reportsDirectory;
         this.trimStackTrace = trimStackTrace;
         this.reportNameSuffix = reportNameSuffix;
-        this.configurationHash = configurationHash;
+        this.statisticsFile = statisticsFile;
         this.requiresRunHistory = requiresRunHistory;
         this.originalSystemOut = System.out;
         this.originalSystemErr = System.err;
@@ -115,7 +115,8 @@ public final class StartupReportConfiguration
     public static StartupReportConfiguration defaultValue()
     {
         File target = new File( "./target" );
-        return new StartupReportConfiguration( true, true, "PLAIN", false, false, target, false, null, "TESTHASH",
+        File statisticsFile = new File( target, "TESTHASH" );
+        return new StartupReportConfiguration( true, true, "PLAIN", false, false, target, false, null, statisticsFile,
                                                false, 0, null );
     }
 
@@ -125,7 +126,8 @@ public final class StartupReportConfiguration
     public static StartupReportConfiguration defaultNoXml()
     {
         File target = new File( "./target" );
-        return new StartupReportConfiguration( true, true, "PLAIN", false, true, target, false, null, "TESTHASHxXML",
+        File statisticsFile = new File( target, "TESTHASHxXML" );
+        return new StartupReportConfiguration( true, true, "PLAIN", false, true, target, false, null, statisticsFile,
                                                false, 0, null );
     }
 
@@ -208,7 +210,7 @@ public final class StartupReportConfiguration
 
     public File getStatisticsFile()
     {
-        return new File( reportsDirectory.getParentFile().getParentFile(), ".surefire-" + this.configurationHash );
+        return statisticsFile;
     }
 
     public Properties getTestVmSystemProperties()
@@ -221,11 +223,6 @@ public final class StartupReportConfiguration
         return trimStackTrace;
     }
 
-    public String getConfigurationHash()
-    {
-        return configurationHash;
-    }
-
     public boolean isRequiresRunHistory()
     {
         return requiresRunHistory;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
index b1537d6..3663f39 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
@@ -47,7 +47,7 @@ public class SurefireProperties
     implements KeyValueSource
 {
     private static final Collection<String> KEYS_THAT_CANNOT_BE_USED_AS_SYSTEM_PROPERTIES =
-            asList( "java.library.path", "file.encoding", "jdk.map.althashing.threshold" );
+            asList( "java.library.path", "file.encoding", "jdk.map.althashing.threshold", "line.separator" );
 
     private final LinkedHashSet<Object> items = new LinkedHashSet<Object>();
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
index 0a0a9c8..e51c993 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
@@ -27,7 +27,6 @@ import junit.framework.TestCase;
 
 import org.apache.maven.plugin.surefire.StartupReportConfiguration;
 import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
-import org.apache.maven.plugin.surefire.log.api.NullConsoleLogger;
 import org.apache.maven.surefire.report.RunStatistics;
 import org.apache.maven.surefire.report.SafeThrowable;
 import org.apache.maven.surefire.report.StackTraceWriter;
@@ -62,9 +61,10 @@ public class DefaultReporterFactoryTest
 
     public void testMergeTestHistoryResult()
     {
+        File reportsDirectory = new File("target");
         StartupReportConfiguration reportConfig =
-                new StartupReportConfiguration( true, true, "PLAIN", false, false, new File("target"), false, null,
-                                                      "TESTHASH", false, 1, null );
+                new StartupReportConfiguration( true, true, "PLAIN", false, false, reportsDirectory, false, null,
+                                                      new File( reportsDirectory, "TESTHASH" ), false, 1, null );
 
         DummyTestReporter reporter = new DummyTestReporter();
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
index 958a23a..528589c 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
@@ -235,11 +235,10 @@ public class SurefireReflector
             return null;
         }
         //Can't use the constructor with the RunOrder parameter. Using it causes some integration tests to fail.
-        Class<?>[] arguments = { String.class, String.class };
+        Class<?>[] arguments = { String.class, File.class };
         Constructor constructor = getConstructor( this.runOrderParameters, arguments );
         File runStatisticsFile = runOrderParameters.getRunStatisticsFile();
-        return newInstance( constructor, RunOrder.asString( runOrderParameters.getRunOrder() ),
-                            runStatisticsFile == null ? null : runStatisticsFile.getAbsolutePath() );
+        return newInstance( constructor, RunOrder.asString( runOrderParameters.getRunOrder() ), runStatisticsFile );
     }
 
     Object createTestArtifactInfo( TestArtifactInfo testArtifactInfo )
@@ -253,7 +252,6 @@ public class SurefireReflector
         return newInstance( constructor, testArtifactInfo.getVersion(), testArtifactInfo.getClassifier() );
     }
 
-
     Object createReporterConfiguration( ReporterConfiguration reporterConfig )
     {
         Constructor constructor = getConstructor( reporterConfiguration, File.class, boolean.class );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java b/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java
index 9c096f1..6a2cceb 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java
@@ -37,10 +37,10 @@ public class RunOrderParameters
         this.runStatisticsFile = runStatisticsFile;
     }
 
-    public RunOrderParameters( String runOrder, String runStatisticsFile )
+    public RunOrderParameters( String runOrder, File runStatisticsFile )
     {
         this.runOrder = runOrder == null ? RunOrder.DEFAULT : RunOrder.valueOfMulti( runOrder );
-        this.runStatisticsFile = runStatisticsFile != null ? new File( runStatisticsFile ) : null;
+        this.runStatisticsFile = runStatisticsFile;
     }
 
     public static RunOrderParameters alphabetical()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
index 208a4be..bb64115 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
@@ -86,7 +86,8 @@ public class BooterDeserializer
             new DirectoryScannerParameters( testClassesDirectory, includes, excludes, specificTests,
                                             properties.getBooleanProperty( FAILIFNOTESTS ), runOrder );
 
-        RunOrderParameters runOrderParameters = new RunOrderParameters( runOrder, runStatisticsFile );
+        RunOrderParameters runOrderParameters
+                = new RunOrderParameters( runOrder, runStatisticsFile == null ? null : new File( runStatisticsFile ) );
 
         TestArtifactInfo testNg = new TestArtifactInfo( testNgVersion, testArtifactClassifier );
         TestRequest testSuiteDefinition =


[14/25] maven-surefire git commit: [SUREFIRE-1246] Surefire + Cobertura: Shutdown of Forked JVM timeouts before all thread ends

Posted by ti...@apache.org.
[SUREFIRE-1246] Surefire + Cobertura: Shutdown of Forked JVM timeouts before all thread ends


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

Branch: refs/heads/junit5
Commit: 9dc15743de2c9ba189837d41752cf973507d6c31
Parents: a9162ee
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Oct 2 23:32:04 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Oct 2 23:32:04 2016 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java | 1 +
 .../org/apache/maven/surefire/booter/ProviderConfiguration.java    | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9dc15743/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
----------------------------------------------------------------------
diff --git a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
index f508372..97f1a79 100644
--- a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
+++ b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
@@ -143,6 +143,7 @@ public class SurefirePlugin
      * by <em>System.exit()</em>. Use this parameter in order to determine the timeout of terminating the process.
      * <a href="http://maven.apache.org/surefire/maven-surefire-plugin/examples/shutdown.html">see the documentation:
      * http://maven.apache.org/surefire/maven-surefire-plugin/examples/shutdown.html</a>
+     * Turns to default fallback value of 30 seconds if negative integer.
      *
      * @since 2.19.2
      */

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9dc15743/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
index c2d61e0..b0825a8 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
@@ -182,6 +182,6 @@ public class ProviderConfiguration
 
     public long systemExitTimeout( long fallback )
     {
-        return systemExitTimeout == null ? fallback : systemExitTimeout;
+        return systemExitTimeout == null || systemExitTimeout < 0 ? fallback : systemExitTimeout;
     }
 }


[06/25] maven-surefire git commit: [SUREFIRE-1198] Failsafe does not allow to configure the jar file to use

Posted by ti...@apache.org.
[SUREFIRE-1198] Failsafe does not allow to configure the jar file to use


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

Branch: refs/heads/junit5
Commit: 432231e7e9d01b9ef109acd39176045e0b18e5a5
Parents: f1aea63
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Sep 25 05:04:39 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Sep 25 05:04:39 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java  | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/432231e7/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
index b3f76db..c0048d5 100644
--- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
+++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
@@ -56,6 +56,7 @@ public class IntegrationTestMojo
     /**
      * The path representing project <em>JAR</em> file, if exists; Otherwise the directory containing generated
      * classes of the project being tested. This will be included after the test classes in the test classpath.
+     * Defaults to built artifact <em>JAR</em> file or ${project.build.outputDirectory}.
      */
     @Parameter
     private File classesDirectory;


[22/25] maven-surefire git commit: [SUREFIRE-1293] Simplify org.apache.maven.plugin.surefire.report.TestSetRunListener by using the null object pattern

Posted by ti...@apache.org.
[SUREFIRE-1293] Simplify org.apache.maven.plugin.surefire.report.TestSetRunListener
by using the null object pattern


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

Branch: refs/heads/junit5
Commit: fd9f6e5598e7ce6cdb4168ce15cf6ca138b7753f
Parents: 77cafbe
Author: Benedikt Ritter <br...@apache.org>
Authored: Sun Oct 9 16:41:49 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Wed Oct 12 11:26:20 2016 +0200

----------------------------------------------------------------------
 .../surefire/report/DefaultReporterFactory.java | 46 +++++++++--
 .../report/NullConsoleOutputReceiver.java       | 55 +++++++++++++
 .../surefire/report/NullConsoleReporter.java    | 58 +++++++++++++
 .../surefire/report/NullFileReporter.java       | 45 ++++++++++
 .../report/NullStatelessXmlReporter.java        | 48 +++++++++++
 .../surefire/report/NullStatisticsReporter.java | 66 +++++++++++++++
 .../surefire/report/TestSetRunListener.java     | 87 ++++----------------
 .../surefire/runorder/StatisticsReporter.java   | 11 ++-
 8 files changed, 335 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/fd9f6e55/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
index a2bc7ec..e011fee 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
@@ -20,9 +20,9 @@ package org.apache.maven.plugin.surefire.report;
  */
 
 import org.apache.maven.plugin.surefire.StartupReportConfiguration;
-import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
 import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
 import org.apache.maven.plugin.surefire.log.api.NullConsoleLogger;
+import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
 import org.apache.maven.shared.utils.logging.MessageBuilder;
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.RunListener;
@@ -39,6 +39,7 @@ import java.util.Map;
 import java.util.TreeMap;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
+import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
 import static org.apache.maven.plugin.surefire.report.ConsoleReporter.PLAIN;
 import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType.error;
 import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType.failure;
@@ -64,7 +65,6 @@ public class DefaultReporterFactory
 {
     private final StartupReportConfiguration reportConfiguration;
     private final ConsoleLogger consoleLogger;
-    private final StatisticsReporter statisticsReporter;
     private final Collection<TestSetRunListener> listeners;
 
     private RunStatistics globalStats = new RunStatistics();
@@ -82,19 +82,17 @@ public class DefaultReporterFactory
     {
         this.reportConfiguration = reportConfiguration;
         this.consoleLogger = consoleLogger;
-        statisticsReporter = reportConfiguration.getStatisticsReporter();
         listeners = new ConcurrentLinkedQueue<TestSetRunListener>();
     }
 
     public RunListener createReporter()
     {
-        ConsoleReporter consoleReporter = shouldReportToConsole() ? new ConsoleReporter( consoleLogger ) : null;
         TestSetRunListener testSetRunListener =
-            new TestSetRunListener( consoleReporter,
-                                    reportConfiguration.instantiateFileReporter(),
-                                    reportConfiguration.instantiateStatelessXmlReporter(),
-                                    reportConfiguration.instantiateConsoleOutputFileReporter(),
-                                    statisticsReporter,
+            new TestSetRunListener( createConsoleReporter(),
+                                    createFileReporter(),
+                                    createSimpleXMLReporter(),
+                                    createConsoleOutputReceiver(),
+                                    createStatisticsReporter(),
                                     reportConfiguration.isTrimStackTrace(),
                                     PLAIN.equals( reportConfiguration.getReportFormat() ),
                                     reportConfiguration.isBriefOrPlainFormat() );
@@ -102,6 +100,36 @@ public class DefaultReporterFactory
         return testSetRunListener;
     }
 
+    private ConsoleReporter createConsoleReporter()
+    {
+        return shouldReportToConsole() ? new ConsoleReporter( consoleLogger ) : NullConsoleReporter.INSTANCE;
+    }
+
+    private FileReporter createFileReporter()
+    {
+        final FileReporter fileReporter = reportConfiguration.instantiateFileReporter();
+        return defaultIfNull( fileReporter, NullFileReporter.INSTANCE );
+    }
+
+    private StatelessXmlReporter createSimpleXMLReporter()
+    {
+        final StatelessXmlReporter xmlReporter = reportConfiguration.instantiateStatelessXmlReporter();
+        return defaultIfNull( xmlReporter, NullStatelessXmlReporter.INSTANCE );
+    }
+
+    private TestcycleConsoleOutputReceiver createConsoleOutputReceiver()
+    {
+        final TestcycleConsoleOutputReceiver consoleOutputReceiver =
+                reportConfiguration.instantiateConsoleOutputFileReporter();
+        return defaultIfNull( consoleOutputReceiver, NullConsoleOutputReceiver.INSTANCE );
+    }
+
+    private StatisticsReporter createStatisticsReporter()
+    {
+        final StatisticsReporter statisticsReporter = reportConfiguration.getStatisticsReporter();
+        return defaultIfNull( statisticsReporter, NullStatisticsReporter.INSTANCE );
+    }
+
     private boolean shouldReportToConsole()
     {
         return reportConfiguration.isUseFile()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/fd9f6e55/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullConsoleOutputReceiver.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullConsoleOutputReceiver.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullConsoleOutputReceiver.java
new file mode 100644
index 0000000..55e4ee2
--- /dev/null
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullConsoleOutputReceiver.java
@@ -0,0 +1,55 @@
+package org.apache.maven.plugin.surefire.report;
+
+/*
+ * 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.report.ReportEntry;
+
+/**
+ * ConsoleReporter doing nothing rather than using null.
+ *
+ * @author <a href="mailto:britter@apache.org">Benedikt Ritter</a>
+ * @since 2.19.2
+ */
+class NullConsoleOutputReceiver
+    implements TestcycleConsoleOutputReceiver
+{
+
+    static final NullConsoleOutputReceiver INSTANCE = new NullConsoleOutputReceiver();
+
+    private NullConsoleOutputReceiver()
+    {
+    }
+
+    public void testSetStarting( ReportEntry reportEntry )
+    {
+    }
+
+    public void testSetCompleted( ReportEntry report )
+    {
+    }
+
+    public void close()
+    {
+    }
+
+    public void writeTestOutput( byte[] buf, int off, int len, boolean stdout )
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/fd9f6e55/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullConsoleReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullConsoleReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullConsoleReporter.java
new file mode 100644
index 0000000..1bd4e9a
--- /dev/null
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullConsoleReporter.java
@@ -0,0 +1,58 @@
+package org.apache.maven.plugin.surefire.report;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+
+import org.apache.maven.plugin.surefire.log.api.NullConsoleLogger;
+import org.apache.maven.surefire.report.ReportEntry;
+
+/**
+ * ConsoleReporter doing nothing rather than using null.
+ *
+ * @author <a href="mailto:britter@apache.org">Benedikt Ritter</a>
+ * @since 2.19.2
+ */
+class NullConsoleReporter
+    extends ConsoleReporter
+{
+
+    static final NullConsoleReporter INSTANCE = new NullConsoleReporter();
+
+    private NullConsoleReporter()
+    {
+        super( new NullConsoleLogger() );
+    }
+
+    @Override
+    public void testSetStarting( ReportEntry report )
+    {
+    }
+
+    @Override
+    public void testSetCompleted( WrappedReportEntry report, TestSetStats testSetStats, List<String> testResults )
+    {
+    }
+
+    @Override
+    public void reset()
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/fd9f6e55/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullFileReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullFileReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullFileReporter.java
new file mode 100644
index 0000000..bf7e3ef
--- /dev/null
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullFileReporter.java
@@ -0,0 +1,45 @@
+package org.apache.maven.plugin.surefire.report;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+
+/**
+ * FileReporter doing nothing rather than using null.
+ *
+ * @author <a href="mailto:britter@apache.org">Benedikt Ritter</a>
+ * @since 2.19.2
+ */
+class NullFileReporter
+    extends FileReporter
+{
+
+    static final NullFileReporter INSTANCE = new NullFileReporter();
+
+    private NullFileReporter()
+    {
+        super( null, null );
+    }
+
+    @Override
+    public void testSetCompleted( WrappedReportEntry report, TestSetStats testSetStats, List<String> testResults )
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/fd9f6e55/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java
new file mode 100644
index 0000000..5895c8a
--- /dev/null
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java
@@ -0,0 +1,48 @@
+package org.apache.maven.plugin.surefire.report;
+
+/*
+ * 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.
+ */
+
+/**
+ * FileReporter doing nothing rather than using null.
+ *
+ * @author <a href="mailto:britter@apache.org">Benedikt Ritter</a>
+ * @since 2.19.2
+ */
+class NullStatelessXmlReporter
+    extends StatelessXmlReporter
+{
+
+    static final NullStatelessXmlReporter INSTANCE = new NullStatelessXmlReporter();
+
+    private NullStatelessXmlReporter()
+    {
+        super( null, null, false, 0, null, null );
+    }
+
+    @Override
+    public void testSetCompleted( WrappedReportEntry testSetReportEntry, TestSetStats testSetStats )
+    {
+    }
+
+    @Override
+    public void cleanTestHistoryMap()
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/fd9f6e55/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatisticsReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatisticsReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatisticsReporter.java
new file mode 100644
index 0000000..5e355ca
--- /dev/null
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatisticsReporter.java
@@ -0,0 +1,66 @@
+package org.apache.maven.plugin.surefire.report;
+
+/*
+ * 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.plugin.surefire.runorder.StatisticsReporter;
+import org.apache.maven.surefire.report.ReportEntry;
+
+/**
+ * StatisticsReporter doing nothing rather than using null.
+ *
+ * @author <a href="mailto:britter@apache.org">Benedikt Ritter</a>
+ * @since 2.19.2
+ */
+class NullStatisticsReporter
+    extends StatisticsReporter
+{
+
+    static final NullStatisticsReporter INSTANCE = new NullStatisticsReporter();
+
+    private NullStatisticsReporter()
+    {
+        super( null, null, null );
+    }
+
+    @Override
+    public synchronized void testSetCompleted()
+    {
+    }
+
+    @Override
+    public void testSucceeded( ReportEntry report )
+    {
+    }
+
+    @Override
+    public void testSkipped( ReportEntry report )
+    {
+    }
+
+    @Override
+    public void testError( ReportEntry report )
+    {
+    }
+
+    @Override
+    public void testFailed( ReportEntry report )
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/fd9f6e55/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
index 4b12884..dbc802c 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
@@ -24,8 +24,8 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
 import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
+import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
 import org.apache.maven.surefire.report.ConsoleOutputReceiver;
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.RunListener;
@@ -88,50 +88,32 @@ public class TestSetRunListener
 
     public void debug( String message )
     {
-        if ( consoleReporter != null )
-        {
-            consoleReporter.getConsoleLogger().debug( trimTrailingNewLine( message ) );
-        }
+        consoleReporter.getConsoleLogger().debug( trimTrailingNewLine( message ) );
     }
 
     public void info( String message )
     {
-        if ( consoleReporter != null )
-        {
-            consoleReporter.getConsoleLogger().info( trimTrailingNewLine( message ) );
-        }
+        consoleReporter.getConsoleLogger().info( trimTrailingNewLine( message ) );
     }
 
     public void warning( String message )
     {
-        if ( consoleReporter != null )
-        {
-            consoleReporter.getConsoleLogger().warning( trimTrailingNewLine( message ) );
-        }
+        consoleReporter.getConsoleLogger().warning( trimTrailingNewLine( message ) );
     }
 
     public void error( String message )
     {
-        if ( consoleReporter != null )
-        {
-            consoleReporter.getConsoleLogger().error( trimTrailingNewLine( message ) );
-        }
+        consoleReporter.getConsoleLogger().error( trimTrailingNewLine( message ) );
     }
 
     public void error( String message, Throwable t )
     {
-        if ( consoleReporter != null )
-        {
-            consoleReporter.getConsoleLogger().error( message, t );
-        }
+        consoleReporter.getConsoleLogger().error( message, t );
     }
 
     public void error( Throwable t )
     {
-        if ( consoleReporter != null )
-        {
-            consoleReporter.getConsoleLogger().error( t );
-        }
+        consoleReporter.getConsoleLogger().error( t );
     }
 
     public void writeTestOutput( byte[] buf, int off, int len, boolean stdout )
@@ -157,10 +139,7 @@ public class TestSetRunListener
     public void testSetStarting( ReportEntry report )
     {
         detailsForThis.testSetStart();
-        if ( consoleReporter != null )
-        {
-            consoleReporter.testSetStarting( report );
-        }
+        consoleReporter.testSetStarting( report );
         consoleOutputReceiver.testSetStarting( report );
     }
 
@@ -175,27 +154,12 @@ public class TestSetRunListener
         final WrappedReportEntry wrap = wrapTestSet( report );
         final List<String> testResults =
                 briefOrPlainFormat ? detailsForThis.getTestResults() : Collections.<String>emptyList();
-        if ( fileReporter != null )
-        {
-            fileReporter.testSetCompleted( wrap, detailsForThis, testResults );
-        }
-        if ( simpleXMLReporter != null )
-        {
-            simpleXMLReporter.testSetCompleted( wrap, detailsForThis );
-        }
-        if ( statisticsReporter != null )
-        {
-            statisticsReporter.testSetCompleted();
-        }
-        if ( consoleReporter != null )
-        {
-            consoleReporter.testSetCompleted( wrap, detailsForThis, testResults );
-        }
+        fileReporter.testSetCompleted( wrap, detailsForThis, testResults );
+        simpleXMLReporter.testSetCompleted( wrap, detailsForThis );
+        statisticsReporter.testSetCompleted();
+        consoleReporter.testSetCompleted( wrap, detailsForThis, testResults );
         consoleOutputReceiver.testSetCompleted( wrap );
-        if ( consoleReporter != null )
-        {
-            consoleReporter.reset();
-        }
+        consoleReporter.reset();
 
         wrap.getStdout().free();
         wrap.getStdErr().free();
@@ -218,10 +182,7 @@ public class TestSetRunListener
     {
         WrappedReportEntry wrapped = wrap( reportEntry, SUCCESS );
         detailsForThis.testSucceeded( wrapped );
-        if ( statisticsReporter != null )
-        {
-            statisticsReporter.testSucceeded( reportEntry );
-        }
+        statisticsReporter.testSucceeded( reportEntry );
         clearCapture();
     }
 
@@ -229,10 +190,7 @@ public class TestSetRunListener
     {
         WrappedReportEntry wrapped = wrap( reportEntry, ERROR );
         detailsForThis.testError( wrapped );
-        if ( statisticsReporter != null )
-        {
-            statisticsReporter.testError( reportEntry );
-        }
+        statisticsReporter.testError( reportEntry );
         clearCapture();
     }
 
@@ -240,10 +198,7 @@ public class TestSetRunListener
     {
         WrappedReportEntry wrapped = wrap( reportEntry, FAILURE );
         detailsForThis.testFailure( wrapped );
-        if ( statisticsReporter != null )
-        {
-            statisticsReporter.testFailed( reportEntry );
-        }
+        statisticsReporter.testFailed( reportEntry );
         clearCapture();
     }
 
@@ -256,10 +211,7 @@ public class TestSetRunListener
         WrappedReportEntry wrapped = wrap( reportEntry, SKIPPED );
 
         detailsForThis.testSkipped( wrapped );
-        if ( statisticsReporter != null )
-        {
-            statisticsReporter.testSkipped( reportEntry );
-        }
+        statisticsReporter.testSkipped( reportEntry );
         clearCapture();
     }
 
@@ -303,10 +255,7 @@ public class TestSetRunListener
 
     public void close()
     {
-        if ( consoleOutputReceiver != null )
-        {
-            consoleOutputReceiver.close();
-        }
+        consoleOutputReceiver.close();
     }
 
     public void  addTestMethodStats()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/fd9f6e55/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/runorder/StatisticsReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/runorder/StatisticsReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/runorder/StatisticsReporter.java
index 9dd3380..a53db02 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/runorder/StatisticsReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/runorder/StatisticsReporter.java
@@ -28,7 +28,7 @@ import static org.apache.maven.plugin.surefire.runorder.RunEntryStatisticsMap.fr
 /**
  * @author Kristian Rosenvold
  */
-public final class StatisticsReporter
+public class StatisticsReporter
 {
     private final RunEntryStatisticsMap existing;
 
@@ -38,9 +38,14 @@ public final class StatisticsReporter
 
     public StatisticsReporter( File dataFile )
     {
+        this( dataFile, fromFile( dataFile ), new RunEntryStatisticsMap() );
+    }
+
+    protected StatisticsReporter( File dataFile, RunEntryStatisticsMap existing, RunEntryStatisticsMap newRestuls )
+    {
         this.dataFile = dataFile;
-        existing = fromFile( dataFile );
-        newResults = new RunEntryStatisticsMap();
+        this.existing = existing;
+        this.newResults = newRestuls;
     }
 
     public synchronized void testSetCompleted()


[09/25] maven-surefire git commit: [SUREFIRE] refactoring

Posted by ti...@apache.org.
[SUREFIRE] 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/4f3f59e2
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/4f3f59e2
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/4f3f59e2

Branch: refs/heads/junit5
Commit: 4f3f59e2dcdeba154c7d22dea05f906e6f54d0e7
Parents: 02a8a59
Author: Tibor17 <ti...@lycos.com>
Authored: Sat Oct 1 02:32:11 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Oct 2 11:12:37 2016 +0200

----------------------------------------------------------------------
 .../maven/plugin/surefire/report/StatelessXmlReporter.java    | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4f3f59e2/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
index 9e22f1e..f30e54f 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
@@ -293,7 +293,6 @@ public class StatelessXmlReporter
 
         try
         {
-
             return new FileOutputStream( reportFile );
         }
         catch ( Exception e )
@@ -322,9 +321,9 @@ public class StatelessXmlReporter
     private static File getReportFile( ReportEntry report, File reportsDirectory, String reportNameSuffix )
     {
         String reportName = "TEST-" + report.getName();
-        return isNotBlank( reportNameSuffix )
-            ? new File( reportsDirectory, stripIllegalFilenameChars( reportName + "-" + reportNameSuffix + ".xml" ) )
-            : new File( reportsDirectory, stripIllegalFilenameChars( reportName + ".xml" ) );
+        String reportFileName =
+                isNotBlank( reportNameSuffix ) ? reportName + "-" + reportNameSuffix + ".xml" : reportName + ".xml";
+        return new File( reportsDirectory, stripIllegalFilenameChars( reportFileName ) );
     }
 
     private static void startTestElement( XMLWriter ppw, WrappedReportEntry report, String reportNameSuffix,


[08/25] maven-surefire git commit: [SUREFIRE] refactoring

Posted by ti...@apache.org.
[SUREFIRE] 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/02a8a599
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/02a8a599
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/02a8a599

Branch: refs/heads/junit5
Commit: 02a8a599aa9d73b799e8de9899a2eec4735936ad
Parents: 308d941
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Sep 25 11:32:43 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Oct 2 11:12:36 2016 +0200

----------------------------------------------------------------------
 .../plugin/surefire/report/ConsoleOutputFileReporter.java     | 5 +++--
 .../maven/plugin/surefire/report/WrappedReportEntry.java      | 4 ++--
 .../plugin/surefire/booterclient/ForkingRunListenerTest.java  | 7 +++++--
 .../apache/maven/surefire/report/ConsoleOutputCapture.java    | 3 +--
 .../org/apache/maven/surefire/util/internal/StringUtils.java  | 2 ++
 5 files changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/02a8a599/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
index d7e0df7..f9e59fe 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
@@ -25,6 +25,8 @@ import java.io.IOException;
 
 import org.apache.maven.surefire.report.ReportEntry;
 
+import static org.apache.maven.plugin.surefire.report.FileReporter.getReportFile;
+
 /**
  * Surefire output consumer proxy that writes test output to a {@link java.io.File} for each test suite.
  * <p/>
@@ -88,8 +90,7 @@ public class ConsoleOutputFileReporter
                     //noinspection ResultOfMethodCallIgnored
                     reportsDirectory.mkdirs();
                 }
-                File file =
-                    FileReporter.getReportFile( reportsDirectory, reportEntryName, reportNameSuffix, "-output.txt" );
+                File file = getReportFile( reportsDirectory, reportEntryName, reportNameSuffix, "-output.txt" );
                 fileOutputStream = new FileOutputStream( file );
             }
             fileOutputStream.write( buf, off, len );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/02a8a599/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
index 12f63e5..2394ff0 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
@@ -22,14 +22,14 @@ package org.apache.maven.plugin.surefire.report;
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.StackTraceWriter;
 
+import static org.apache.maven.surefire.util.internal.StringUtils.NL;
+
 /**
  * @author Kristian Rosenvold
  */
 public class WrappedReportEntry
     implements ReportEntry
 {
-    private static final String NL = System.getProperty( "line.separator" );
-
     private final ReportEntry original;
 
     private final ReportEntryType reportEntryType;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/02a8a599/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java
index cccb14b..5b8867b 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java
@@ -268,8 +268,11 @@ public class ForkingRunListenerTest
         ReportEntry expected = createDefaultReportEntry();
         final SimpleReportEntry secondExpected = createAnotherDefaultReportEntry();
 
-        new ForkingRunListener( printStream, defaultChannel, false ).testStarting( expected );
-        new ForkingRunListener( printStream, anotherChannel, false ).testSkipped( secondExpected );
+        new ForkingRunListener( printStream, defaultChannel, false )
+                .testStarting( expected );
+
+        new ForkingRunListener( printStream, anotherChannel, false )
+                .testSkipped( secondExpected );
 
         TestSetMockReporterFactory providerReporterFactory = new TestSetMockReporterFactory();
         NullConsoleLogger log = new NullConsoleLogger();

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/02a8a599/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputCapture.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputCapture.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputCapture.java
index bb33b3a..b583593 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputCapture.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputCapture.java
@@ -25,6 +25,7 @@ import java.io.PrintStream;
 
 import static java.lang.System.setErr;
 import static java.lang.System.setOut;
+import static org.apache.maven.surefire.util.internal.StringUtils.NL;
 
 /**
  * Deals with system.out/err.
@@ -41,8 +42,6 @@ public class ConsoleOutputCapture
     private static class ForwardingPrintStream
         extends PrintStream
     {
-        private static final String NL = System.getProperty( "line.separator" );
-
         private final boolean isStdout;
         private final ConsoleOutputReceiver target;
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/02a8a599/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
index c5f48c1..07722a1 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
@@ -57,6 +57,8 @@ import java.util.StringTokenizer;
  */
 public class StringUtils
 {
+    public static final String NL = System.getProperty( "line.separator" );
+
     private static final byte[] HEX_CHARS = new byte[] {
         '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
         'A', 'B', 'C', 'D', 'E', 'F' };


[02/25] maven-surefire git commit: [SUREFIRE-1246] Surefire + Cobertura: Shutdown of Forked JVM timeouts before all thread ends

Posted by ti...@apache.org.
[SUREFIRE-1246] Surefire + Cobertura: Shutdown of Forked JVM timeouts before all thread ends


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

Branch: refs/heads/junit5
Commit: 2c6105c5e5a1d148e2edcbc385bb2ed66969e667
Parents: 61c7257
Author: Tibor17 <ti...@lycos.com>
Authored: Sat Sep 24 10:30:30 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sat Sep 24 10:38:17 2016 +0200

----------------------------------------------------------------------
 .../plugin/failsafe/IntegrationTestMojo.java    | 22 ++++++++++++++++++++
 .../plugin/surefire/AbstractSurefireMojo.java   |  3 ++-
 .../surefire/SurefireExecutionParameters.java   |  4 ++++
 .../surefire/booterclient/BooterSerializer.java |  4 +++-
 ...erDeserializerProviderConfigurationTest.java |  2 +-
 ...terDeserializerStartupConfigurationTest.java |  2 +-
 .../maven/plugin/surefire/SurefirePlugin.java   | 22 ++++++++++++++++++++
 .../src/site/apt/examples/shutdown.apt.vm       |  3 ++-
 .../surefire/booter/BaseProviderFactory.java    | 12 +++++++++++
 .../surefire/booter/SurefireReflector.java      | 12 +++++------
 .../providerapi/ProviderParameters.java         |  2 ++
 .../maven/surefire/booter/BooterConstants.java  |  1 +
 .../surefire/booter/BooterDeserializer.java     |  7 ++++++-
 .../maven/surefire/booter/ForkedBooter.java     | 16 +++++++-------
 .../surefire/booter/ProviderConfiguration.java  | 19 ++++++++++++++---
 .../maven/surefire/booter/ProviderFactory.java  |  5 ++++-
 16 files changed, 112 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
index 78a3cd7..9f30534 100644
--- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
+++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
@@ -154,6 +154,18 @@ public class IntegrationTestMojo
     private int forkedProcessTimeoutInSeconds;
 
     /**
+     * Forked process is normally terminated without any significant delay after given tests have completed.
+     * If the particular tests started non-daemon Thread(s), the process hangs instead of been properly terminated
+     * by <em>System.exit()</em>. Use this parameter in order to determine the timeout of terminating the process.
+     * <a href="http://maven.apache.org/surefire/maven-failsafe-plugin/examples/shutdown.html">see the documentation:
+     * http://maven.apache.org/surefire/maven-failsafe-plugin/examples/shutdown.html</a>
+     *
+     * @since 2.19.2
+     */
+    @Parameter( property = "failsafe.exitTimeout", defaultValue = "30" )
+    private int forkedProcessExitTimeoutInSeconds;
+
+    /**
      * Stop executing queued parallel JUnit tests after a certain number of seconds.
      * <br/>
      * Example values: "3.5", "4"<br/>
@@ -563,6 +575,16 @@ public class IntegrationTestMojo
         this.forkedProcessTimeoutInSeconds = forkedProcessTimeoutInSeconds;
     }
 
+    public int getForkedProcessExitTimeoutInSeconds()
+    {
+        return forkedProcessExitTimeoutInSeconds;
+    }
+
+    public void setForkedProcessExitTimeoutInSeconds( int forkedProcessExitTimeoutInSeconds )
+    {
+        this.forkedProcessExitTimeoutInSeconds = forkedProcessExitTimeoutInSeconds;
+    }
+
     public double getParallelTestsTimeoutInSeconds()
     {
         return parallelTestsTimeoutInSeconds;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/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 cd27edf..5e22b70 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
@@ -1543,7 +1543,8 @@ public abstract class AbstractSurefireMojo
                                           testNg, // Not really used in provider. Limited to de/serializer.
                                           testSuiteDefinition, providerProperties, null,
                                           false, cli, getSkipAfterFailureCount(),
-                                          Shutdown.parameterOf( getShutdown() ) );
+                                          Shutdown.parameterOf( getShutdown() ),
+                                          getForkedProcessExitTimeoutInSeconds() );
     }
 
     private static Map<String, String> toStringProperties( Properties properties )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java
index 247f5e8..96fb09e 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java
@@ -99,6 +99,10 @@ public interface SurefireExecutionParameters
 
     void setForkedProcessTimeoutInSeconds( int forkedProcessTimeoutInSeconds );
 
+    int getForkedProcessExitTimeoutInSeconds();
+
+    void setForkedProcessExitTimeoutInSeconds( int forkedProcessTerminationTimeoutInSeconds );
+
     double getParallelTestsTimeoutInSeconds();
 
     void setParallelTestsTimeoutInSeconds( double parallelTestsTimeoutInSeconds );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
index e67efb0..2aac04b 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
@@ -139,11 +139,13 @@ class BooterSerializer
             properties.addList( mainCliOptions, MAIN_CLI_OPTIONS );
         }
 
+        properties.setNullableProperty( SYSTEM_EXIT_TIMEOUT,
+                                              String.valueOf( booterConfiguration.getSystemExitTimeout() ) );
+
         return SystemPropertyManager.writePropertiesFile( properties, forkConfiguration.getTempDirectory(),
                                                           "surefire", forkConfiguration.isDebug() );
     }
 
-
     private String getTypeEncoded( Object value )
     {
         if ( value == null )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java
index 623edf3..6759367 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java
@@ -237,7 +237,7 @@ public class BooterDeserializerProviderConfigurationTest
         RunOrderParameters runOrderParameters = new RunOrderParameters( RunOrder.DEFAULT, null );
         return new ProviderConfiguration( directoryScannerParameters, runOrderParameters, true, reporterConfiguration,
                 new TestArtifactInfo( "5.0", "ABC" ), testSuiteDefinition, new HashMap<String, String>(), aTestTyped,
-                readTestsFromInStream, cli, 0, Shutdown.DEFAULT );
+                readTestsFromInStream, cli, 0, Shutdown.DEFAULT, 0 );
     }
 
     private StartupConfiguration getTestStartupConfiguration( ClassLoaderConfiguration classLoaderConfiguration )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java
index 007640d..1ca20d2 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java
@@ -144,7 +144,7 @@ public class BooterDeserializerStartupConfigurationTest
         RunOrderParameters runOrderParameters = new RunOrderParameters( RunOrder.DEFAULT, null );
         return new ProviderConfiguration( directoryScannerParameters, runOrderParameters, true, reporterConfiguration,
                 new TestArtifactInfo( "5.0", "ABC" ), testSuiteDefinition, new HashMap<String, String>(),
-                BooterDeserializerProviderConfigurationTest.aTestTyped, true, cli, 0, Shutdown.DEFAULT );
+                BooterDeserializerProviderConfigurationTest.aTestTyped, true, cli, 0, Shutdown.DEFAULT, 0 );
     }
 
     private StartupConfiguration getTestStartupConfiguration( ClassLoaderConfiguration classLoaderConfiguration )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
----------------------------------------------------------------------
diff --git a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
index bfb68e0..f508372 100644
--- a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
+++ b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
@@ -138,6 +138,18 @@ public class SurefirePlugin
     private int forkedProcessTimeoutInSeconds;
 
     /**
+     * Forked process is normally terminated without any significant delay after given tests have completed.
+     * If the particular tests started non-daemon Thread(s), the process hangs instead of been properly terminated
+     * by <em>System.exit()</em>. Use this parameter in order to determine the timeout of terminating the process.
+     * <a href="http://maven.apache.org/surefire/maven-surefire-plugin/examples/shutdown.html">see the documentation:
+     * http://maven.apache.org/surefire/maven-surefire-plugin/examples/shutdown.html</a>
+     *
+     * @since 2.19.2
+     */
+    @Parameter( property = "surefire.exitTimeout", defaultValue = "30" )
+    private int forkedProcessExitTimeoutInSeconds;
+
+    /**
      * Stop executing queued parallel JUnit tests after a certain number of seconds.
      * <br/>
      * Example values: "3.5", "4"<br/>
@@ -536,6 +548,16 @@ public class SurefirePlugin
         this.forkedProcessTimeoutInSeconds = forkedProcessTimeoutInSeconds;
     }
 
+    public int getForkedProcessExitTimeoutInSeconds()
+    {
+        return forkedProcessExitTimeoutInSeconds;
+    }
+
+    public void setForkedProcessExitTimeoutInSeconds( int forkedProcessExitTimeoutInSeconds )
+    {
+        this.forkedProcessExitTimeoutInSeconds = forkedProcessExitTimeoutInSeconds;
+    }
+
     public double getParallelTestsTimeoutInSeconds()
     {
         return parallelTestsTimeoutInSeconds;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/maven-surefire-plugin/src/site/apt/examples/shutdown.apt.vm
----------------------------------------------------------------------
diff --git a/maven-surefire-plugin/src/site/apt/examples/shutdown.apt.vm b/maven-surefire-plugin/src/site/apt/examples/shutdown.apt.vm
index b9c3fd3..7e943a5 100644
--- a/maven-surefire-plugin/src/site/apt/examples/shutdown.apt.vm
+++ b/maven-surefire-plugin/src/site/apt/examples/shutdown.apt.vm
@@ -34,7 +34,8 @@ Shutdown of Forked JVM
   <<<java.lang.System.exit(0)>>> which starts shutdown hooks. At this point
   the process may run next 30 seconds until all non daemon Threads die.
   After the period of time has elapsed, the process kills itself by
-  <<<java.lang.Runtime.halt(0)>>>.
+  <<<java.lang.Runtime.halt(0)>>>. The timeout of 30 seconds can be
+  customized by configuration parameter <<<forkedProcessExitTimeoutInSeconds>>>.
 
 * Pinging forked JVM
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
----------------------------------------------------------------------
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 66f28ad..2a713ef 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
@@ -77,6 +77,8 @@ public class BaseProviderFactory
 
     private Shutdown shutdown;
 
+    private Integer systemExitTimeout;
+
     public BaseProviderFactory( ReporterFactory reporterFactory, boolean insideFork )
     {
         this.reporterFactory = reporterFactory;
@@ -221,4 +223,14 @@ public class BaseProviderFactory
     {
         this.shutdown = shutdown;
     }
+
+    public Integer getSystemExitTimeout()
+    {
+        return systemExitTimeout;
+    }
+
+    public void setSystemExitTimeout( Integer systemExitTimeout )
+    {
+        this.systemExitTimeout = systemExitTimeout;
+    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
index b25c04b..958a23a 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
@@ -20,7 +20,6 @@ package org.apache.maven.surefire.booter;
  */
 
 import java.io.File;
-import java.io.PrintStream;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
@@ -261,12 +260,6 @@ public class SurefireReflector
         return newInstance( constructor, reporterConfig.getReportsDirectory(), reporterConfig.isTrimStackTrace() );
     }
 
-    public static ReporterFactory createForkingReporterFactoryInCurrentClassLoader( boolean trimStackTrace,
-                                                                                    PrintStream originalSystemOut )
-    {
-        return new ForkingReporterFactory( trimStackTrace, originalSystemOut );
-    }
-
     public Object createBooterConfiguration( ClassLoader surefireClassLoader, Object factoryInstance,
                                              boolean insideFork )
     {
@@ -324,6 +317,11 @@ public class SurefireReflector
         }
     }
 
+    public void setSystemExitTimeout( Object o, Integer systemExitTimeout )
+    {
+        invokeSetter( o, "setSystemExitTimeout", Integer.class, systemExitTimeout );
+    }
+
     public void setDirectoryScannerParameters( Object o, DirectoryScannerParameters dirScannerParams )
     {
         Object param = createDirectoryScannerParameters( dirScannerParams );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java b/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java
index e8c5a84..9ef7a94 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java
@@ -147,4 +147,6 @@ public interface ProviderParameters
     boolean isInsideFork();
 
     Shutdown getShutdown();
+
+    Integer getSystemExitTimeout();
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java
index d310b9a..c21edf8 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java
@@ -55,4 +55,5 @@ public final class BooterConstants
     public static final String MAIN_CLI_OPTIONS = "mainCliOptions";
     public static final String FAIL_FAST_COUNT = "failFastCount";
     public static final String SHUTDOWN = "shutdown";
+    public static final String SYSTEM_EXIT_TIMEOUT = "systemExitTimeout";
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
index 02fde8f..208a4be 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
@@ -102,10 +102,15 @@ public class BooterDeserializer
 
         Shutdown shutdown = Shutdown.valueOf( properties.getProperty( SHUTDOWN ) );
 
+        String systemExitTimeoutAsString = properties.getProperty( SYSTEM_EXIT_TIMEOUT );
+        Integer systemExitTimeout =
+                systemExitTimeoutAsString == null ? null : Integer.valueOf( systemExitTimeoutAsString );
+
         return new ProviderConfiguration( dirScannerParams, runOrderParameters,
                                           properties.getBooleanProperty( FAILIFNOTESTS ), reporterConfiguration, testNg,
                                           testSuiteDefinition, properties.getProperties(), typeEncodedTestForFork,
-                                          preferTestsFromInStream, fromStrings( cli ), failFastCount, shutdown );
+                                          preferTestsFromInStream, fromStrings( cli ), failFastCount, shutdown,
+                                          systemExitTimeout );
     }
 
     public StartupConfiguration getProviderConfiguration()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/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 f95291b..bc8f487 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
@@ -49,7 +49,6 @@ import static org.apache.maven.surefire.booter.Shutdown.KILL;
 import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_BYE;
 import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_ERROR;
 import static org.apache.maven.surefire.booter.ForkingRunListener.encode;
-import static org.apache.maven.surefire.booter.SurefireReflector.createForkingReporterFactoryInCurrentClassLoader;
 import static org.apache.maven.surefire.booter.SystemPropertyManager.setSystemProperties;
 import static org.apache.maven.surefire.util.ReflectionUtils.instantiateOneArg;
 import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDaemonThreadFactory;
@@ -68,11 +67,12 @@ import static java.util.concurrent.TimeUnit.SECONDS;
  */
 public final class ForkedBooter
 {
-    private static final long SYSTEM_EXIT_TIMEOUT_IN_SECONDS = 30;
+    private static final long DEFAULT_SYSTEM_EXIT_TIMEOUT_IN_SECONDS = 30;
     private static final long PING_TIMEOUT_IN_SECONDS = 20;
-
     private static final ScheduledExecutorService JVM_TERMINATOR = createJvmTerminator();
 
+    private static volatile long systemExitTimeoutInSeconds = DEFAULT_SYSTEM_EXIT_TIMEOUT_IN_SECONDS;
+
     /**
      * This method is invoked when Surefire is forked - this method parses and organizes the arguments passed to it and
      * then calls the Surefire class' run method. <p/> The system exit code will be 1 if an exception is thrown.
@@ -96,7 +96,8 @@ public final class ForkedBooter
             BooterDeserializer booterDeserializer = new BooterDeserializer( stream );
             ProviderConfiguration providerConfiguration = booterDeserializer.deserialize();
             final StartupConfiguration startupConfiguration = booterDeserializer.getProviderConfiguration();
-
+            systemExitTimeoutInSeconds =
+                    providerConfiguration.systemExitTimeout( DEFAULT_SYSTEM_EXIT_TIMEOUT_IN_SECONDS );
             TypeEncodedValue forkedTestSet = providerConfiguration.getTestForFork();
             boolean readTestsFromInputStream = providerConfiguration.isReadTestsFromInStream();
 
@@ -255,13 +256,13 @@ public final class ForkedBooter
                                                                  PrintStream originalSystemOut )
     {
         final boolean trimStackTrace = providerConfiguration.getReporterConfiguration().isTrimStackTrace();
-        return createForkingReporterFactoryInCurrentClassLoader( trimStackTrace, originalSystemOut );
+        return new ForkingReporterFactory( trimStackTrace, originalSystemOut );
     }
 
     private static ScheduledExecutorService createJvmTerminator()
     {
         ThreadFactory threadFactory = newDaemonThreadFactory( "last-ditch-daemon-shutdown-thread-"
-                                                            + SYSTEM_EXIT_TIMEOUT_IN_SECONDS
+                                                            + systemExitTimeoutInSeconds
                                                             + "s" );
         ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor( 1, threadFactory );
         executor.setMaximumPoolSize( 1 );
@@ -278,7 +279,7 @@ public final class ForkedBooter
             {
                 Runtime.getRuntime().halt( returnCode );
             }
-        }, SYSTEM_EXIT_TIMEOUT_IN_SECONDS, SECONDS );
+        }, systemExitTimeoutInSeconds, SECONDS );
     }
 
     private static RunResult invokeProviderInSameClassLoader( Object testSet, Object factory,
@@ -325,6 +326,7 @@ public final class ForkedBooter
         bpf.setMainCliOptions( providerConfiguration.getMainCliOptions() );
         bpf.setSkipAfterFailureCount( providerConfiguration.getSkipAfterFailureCount() );
         bpf.setShutdown( providerConfiguration.getShutdown() );
+        bpf.setSystemExitTimeout( providerConfiguration.getSystemExitTimeout() );
         String providerClass = startupConfiguration.getActualClassName();
         return (SurefireProvider) instantiateOneArg( classLoader, providerClass, ProviderParameters.class, bpf );
     }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
index d6d5237..c2d61e0 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
@@ -66,9 +66,11 @@ public class ProviderConfiguration
 
     private final List<CommandLineOption> mainCliOptions;
 
-    private int skipAfterFailureCount;
+    private final int skipAfterFailureCount;
 
-    private Shutdown shutdown;
+    private final Shutdown shutdown;
+
+    private final Integer systemExitTimeout;
 
     @SuppressWarnings( "checkstyle:parameternumber" )
     public ProviderConfiguration( DirectoryScannerParameters directoryScannerParameters,
@@ -77,7 +79,7 @@ public class ProviderConfiguration
                                   TestRequest testSuiteDefinition, Map<String, String> providerProperties,
                                   TypeEncodedValue typeEncodedTestSet, boolean readTestsFromInStream,
                                   List<CommandLineOption> mainCliOptions, int skipAfterFailureCount,
-                                  Shutdown shutdown )
+                                  Shutdown shutdown, Integer systemExitTimeout )
     {
         this.runOrderParameters = runOrderParameters;
         this.providerProperties = providerProperties;
@@ -91,6 +93,7 @@ public class ProviderConfiguration
         this.mainCliOptions = mainCliOptions;
         this.skipAfterFailureCount = skipAfterFailureCount;
         this.shutdown = shutdown;
+        this.systemExitTimeout = systemExitTimeout;
     }
 
     public ReporterConfiguration getReporterConfiguration()
@@ -171,4 +174,14 @@ public class ProviderConfiguration
     {
         return shutdown;
     }
+
+    public Integer getSystemExitTimeout()
+    {
+        return systemExitTimeout;
+    }
+
+    public long systemExitTimeout( long fallback )
+    {
+        return systemExitTimeout == null ? fallback : systemExitTimeout;
+    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/2c6105c5/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
index a29eb14..36f823b 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
@@ -109,6 +109,10 @@ public class ProviderFactory
         surefireReflector.setMainCliOptions( o, providerConfiguration.getMainCliOptions() );
         surefireReflector.setSkipAfterFailureCount( o, providerConfiguration.getSkipAfterFailureCount() );
         surefireReflector.setShutdown( o, providerConfiguration.getShutdown() );
+        if ( isInsideFork )
+        {
+            surefireReflector.setSystemExitTimeout( o, providerConfiguration.getSystemExitTimeout() );
+        }
 
         Object provider = surefireReflector.instantiateProvider( startupConfiguration.getActualClassName(), o );
         currentThread.setContextClassLoader( systemClassLoader );
@@ -116,7 +120,6 @@ public class ProviderFactory
         return new ProviderProxy( provider, classLoader );
     }
 
-
     private final class ProviderProxy
         implements SurefireProvider
     {


[07/25] maven-surefire git commit: [SUREFIRE-1280] Replace "http://jira.codehaus.org" with "https://issues.apache.org/jira"

Posted by ti...@apache.org.
[SUREFIRE-1280] Replace "http://jira.codehaus.org" with
"https://issues.apache.org/jira"

Updated links present in the documentation as well.

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

Branch: refs/heads/junit5
Commit: 308d941c9b6ebb695aba9630f81fc5b400f21322
Parents: 432231e
Author: Tunaki <gu...@orange.fr>
Authored: Sun Sep 25 14:00:49 2016 +0200
Committer: Tunaki <gu...@orange.fr>
Committed: Sun Sep 25 14:00:49 2016 +0200

----------------------------------------------------------------------
 .../site/apt/examples/fork-options-and-parallel-execution.apt.vm   | 2 +-
 maven-surefire-plugin/src/site/markdown/multilineexceptions.md     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/308d941c/maven-surefire-plugin/src/site/apt/examples/fork-options-and-parallel-execution.apt.vm
----------------------------------------------------------------------
diff --git a/maven-surefire-plugin/src/site/apt/examples/fork-options-and-parallel-execution.apt.vm b/maven-surefire-plugin/src/site/apt/examples/fork-options-and-parallel-execution.apt.vm
index eebe525..2f9429c 100644
--- a/maven-surefire-plugin/src/site/apt/examples/fork-options-and-parallel-execution.apt.vm
+++ b/maven-surefire-plugin/src/site/apt/examples/fork-options-and-parallel-execution.apt.vm
@@ -323,4 +323,4 @@ Fork Options and Parallel Test Execution
 
  * <<<$\{surefire.forkNumber\}>>> is properly propagated within <<<workingDirectory>>>
  since ${project.artifactId}:2.19, more details in
- {{{https://jira.codehaus.org/browse/SUREFIRE-1136}SUREFIRE-1136}}
+ {{{https://issues.apache.org/jira/browse/SUREFIRE-1136}SUREFIRE-1136}}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/308d941c/maven-surefire-plugin/src/site/markdown/multilineexceptions.md
----------------------------------------------------------------------
diff --git a/maven-surefire-plugin/src/site/markdown/multilineexceptions.md b/maven-surefire-plugin/src/site/markdown/multilineexceptions.md
index 69c70c8..4421d49 100644
--- a/maven-surefire-plugin/src/site/markdown/multilineexceptions.md
+++ b/maven-surefire-plugin/src/site/markdown/multilineexceptions.md
@@ -34,4 +34,4 @@ becomes:
          May not contain whitespace
 
 The plugin supports Groovy assertion output.
-For more information see the issue https://jira.codehaus.org/browse/SUREFIRE-986.
+For more information see the issue https://issues.apache.org/jira/browse/SUREFIRE-986.


[16/25] maven-surefire git commit: [SUREFIRE-1287] Improve logging to understand why test run failed and report the right failed category

Posted by ti...@apache.org.
[SUREFIRE-1287] Improve logging to understand why test run failed and report the right failed category


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

Branch: refs/heads/junit5
Commit: e0ce6cb021d42d021704f77a689e3b663aebf084
Parents: 4b43807
Author: Tibor17 <ti...@lycos.com>
Authored: Tue Oct 4 01:06:18 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Tue Oct 4 01:06:18 2016 +0200

----------------------------------------------------------------------
 .../surefire/booterclient/ForkStarter.java      | 33 +++++++++----
 .../booterclient/output/ForkClient.java         |  1 +
 .../maven/surefire/booter/ForkedBooter.java     |  6 +--
 .../booter/SurefireBooterForkException.java     | 51 ++++++++++++++++++++
 4 files changed, 79 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e0ce6cb0/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
index 57c31b6..2eb8259 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
@@ -567,7 +567,7 @@ public class ForkStarter
         log.debug( "Forking command line: " + cli );
 
         RunResult runResult = null;
-
+        SurefireBooterForkException booterForkException = null;
         try
         {
             CommandLineCallable future =
@@ -585,13 +585,17 @@ public class ForkStarter
             }
             else if ( result != SUCCESS )
             {
-                throw new SurefireBooterForkException( "Error occurred in starting fork, check output in log" );
+                booterForkException =
+                        new SurefireBooterForkException( "Error occurred in starting fork, check output in log" );
             }
         }
         catch ( CommandLineException e )
         {
             runResult = failure( forkClient.getDefaultReporterFactory().getGlobalRunStatistics().getRunResult(), e );
-            throw new SurefireBooterForkException( "Error while executing forked tests.", e.getCause() );
+            String cliErr = e.getLocalizedMessage();
+            Throwable cause = e.getCause();
+            booterForkException =
+                    new SurefireBooterForkException( "Error while executing forked tests.", cliErr, cause, runResult );
         }
         finally
         {
@@ -600,25 +604,36 @@ public class ForkStarter
             {
                 runResult = forkClient.getDefaultReporterFactory().getGlobalRunStatistics().getRunResult();
             }
+            forkClient.close( runResult.isTimeout() );
 
             if ( !runResult.isTimeout() )
             {
-                StackTraceWriter errorInFork = forkClient.getErrorInFork();
-                if ( errorInFork != null )
+                Throwable cause = booterForkException == null ? null : booterForkException.getCause();
+                String detail = booterForkException == null ? "" : "\n" + booterForkException.getMessage();
+
+                if ( forkClient.isErrorInFork() )
                 {
+                    StackTraceWriter errorInFork = forkClient.getErrorInFork();
                     // noinspection ThrowFromFinallyBlock
-                    throw new RuntimeException(
-                        "There was an error in the forked process\n" + errorInFork.writeTraceToString() );
+                    throw new RuntimeException( "There was an error in the forked process"
+                                                        + detail
+                                                        + '\n'
+                                                        + errorInFork.writeTraceToString(), cause );
                 }
                 if ( !forkClient.isSaidGoodBye() )
                 {
                     // noinspection ThrowFromFinallyBlock
                     throw new RuntimeException(
                         "The forked VM terminated without properly saying goodbye. VM crash or System.exit called?"
-                            + "\nCommand was " + cli.toString() );
+                            + "\nCommand was " + cli.toString() + detail, cause );
                 }
             }
-            forkClient.close( runResult.isTimeout() );
+
+            if ( booterForkException != null )
+            {
+                // noinspection ThrowFromFinallyBlock
+                throw booterForkException;
+            }
         }
 
         return runResult;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e0ce6cb0/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
index d59fdd0..e6e5a6e 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
@@ -394,6 +394,7 @@ public class ForkClient
 
     public void close( boolean hadTimeout )
     {
+        // no op
     }
 
     public final boolean isSaidGoodBye()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e0ce6cb0/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 bc8f487..98040db 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
@@ -131,15 +131,15 @@ public final class ForkedBooter
             }
             catch ( InvocationTargetException t )
             {
-                LegacyPojoStackTraceWriter stackTraceWriter =
-                    new LegacyPojoStackTraceWriter( "test subystem", "no method", t.getTargetException() );
+                StackTraceWriter stackTraceWriter =
+                    new LegacyPojoStackTraceWriter( "test subsystem", "no method", t.getTargetException() );
                 StringBuilder stringBuilder = new StringBuilder();
                 encode( stringBuilder, stackTraceWriter, false );
                 encodeAndWriteToOutput( ( (char) BOOTERCODE_ERROR ) + ",0," + stringBuilder + "\n" , originalOut );
             }
             catch ( Throwable t )
             {
-                StackTraceWriter stackTraceWriter = new LegacyPojoStackTraceWriter( "test subystem", "no method", t );
+                StackTraceWriter stackTraceWriter = new LegacyPojoStackTraceWriter( "test subsystem", "no method", t );
                 StringBuilder stringBuilder = new StringBuilder();
                 encode( stringBuilder, stackTraceWriter, false );
                 encodeAndWriteToOutput( ( (char) BOOTERCODE_ERROR ) + ",0," + stringBuilder + "\n", originalOut );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e0ce6cb0/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooterForkException.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooterForkException.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooterForkException.java
index 9571c92..5f78ef5 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooterForkException.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooterForkException.java
@@ -20,12 +20,26 @@ package org.apache.maven.surefire.booter;
  */
 
 
+import org.apache.maven.surefire.suite.RunResult;
+
+import static org.apache.maven.surefire.util.internal.StringUtils.isNotBlank;
+
 /**
  * Encapsulates exceptions thrown during Surefire forking.
  */
 public class SurefireBooterForkException
     extends Exception
 {
+    public SurefireBooterForkException( String message, RunResult runResult )
+    {
+        this( message, null, null, runResult );
+    }
+
+    public SurefireBooterForkException( String message, String rethrownMessage, Throwable rethrownCause,
+                                        RunResult runResult )
+    {
+        super( toString( message, rethrownMessage, rethrownCause, runResult ), rethrownCause );
+    }
 
     public SurefireBooterForkException( String message, Throwable cause )
     {
@@ -36,4 +50,41 @@ public class SurefireBooterForkException
     {
         super( msg );
     }
+
+    private static String toString( String message, String rethrownMessage, Throwable rethrownCause,
+                                    RunResult runResult )
+    {
+        return toNewLines( message,
+                                 rethrownMessage,
+                                 rethrownCause == null ? null : rethrownCause.getLocalizedMessage(),
+                                 runResult == null ? null : runResult.getFailure(),
+                                 runResult == null ? null : toString( runResult ) );
+    }
+
+    private static String toString( RunResult runResult )
+    {
+        return "Fatal Tests run: " + runResult.getCompletedCount()
+                       + ", Failures: " + runResult.getFailures()
+                       + ", Errors: " + runResult.getErrors()
+                       + ", Skipped: " + runResult.getSkipped()
+                       + ", Flakes: " + runResult.getFlakes()
+                       + ", Elapsed timeout: " + runResult.isTimeout();
+    }
+
+    private static String toNewLines( String... messages )
+    {
+        StringBuilder result = new StringBuilder();
+        for ( String message : messages )
+        {
+            if ( isNotBlank( message ) )
+            {
+                if ( result.length() == 0 )
+                {
+                    result.append( '\n' );
+                }
+                result.append( message );
+            }
+        }
+        return result.toString();
+    }
 }


[12/25] maven-surefire git commit: [SUREFIRE-1290] Orphan Fork JVMs should be killed after any previous finished with fatal error

Posted by ti...@apache.org.
[SUREFIRE-1290] Orphan Fork JVMs should be killed after any previous finished with fatal 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/33a32d13
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/33a32d13
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/33a32d13

Branch: refs/heads/junit5
Commit: 33a32d132922e3ab22502f95bb42aeecfe1531fb
Parents: b2488b6
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Oct 2 12:33:42 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Oct 2 12:33:42 2016 +0200

----------------------------------------------------------------------
 .../plugin/surefire/AbstractSurefireMojo.java      | 17 ++++++++++++++---
 .../plugin/surefire/booterclient/ForkStarter.java  |  8 ++++++++
 .../surefire/booterclient/output/ForkClient.java   |  8 ++++++++
 3 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/33a32d13/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 1dd80b2..a3ab13e 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
@@ -1048,13 +1048,24 @@ public abstract class AbstractSurefireMojo
             }
 
             Properties originalSystemProperties = (Properties) System.getProperties().clone();
+            ForkStarter forkStarter = null;
             try
             {
-                ForkStarter forkStarter =
-                    createForkStarter( provider, forkConfiguration, classLoaderConfiguration, runOrderParameters,
-                                       getConsoleLogger() );
+                forkStarter = createForkStarter( provider, forkConfiguration, classLoaderConfiguration,
+                                                       runOrderParameters, getConsoleLogger() );
+
                 return forkStarter.run( effectiveProperties, scanResult );
             }
+            catch ( SurefireExecutionException e )
+            {
+                forkStarter.killOrphanForks();
+                throw e;
+            }
+            catch ( SurefireBooterForkException e )
+            {
+                forkStarter.killOrphanForks();
+                throw e;
+            }
             finally
             {
                 System.setProperties( originalSystemProperties );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/33a32d13/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
index baea043..57c31b6 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
@@ -237,6 +237,14 @@ public class ForkStarter
         }
     }
 
+    public void killOrphanForks()
+    {
+        for ( ForkClient fork : currentForkClients )
+        {
+            fork.kill();
+        }
+    }
+
     private RunResult run( SurefireProperties effectiveSystemProperties, Map<String, String> providerProperties )
             throws SurefireBooterForkException
     {

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/33a32d13/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
index be3b09f..d59fdd0 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
@@ -112,6 +112,14 @@ public class ForkClient
     {
     }
 
+    public void kill()
+    {
+        if ( !saidGoodBye )
+        {
+            notifiableTestStream.shutdown( KILL );
+        }
+    }
+
     /**
      * Called in concurrent Thread.
      */