maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agud...@apache.org
Subject git commit: SUREFIRE-1096 Fix ClassCastException when configuring forkCount>1 and reuseForks=true together with suiteXmlFiles. For now, surefire falls back to using 1 fork only in that case.
Date Sat, 27 Sep 2014 23:59:58 GMT
Repository: maven-surefire
Updated Branches:
  refs/heads/master f305e2ab2 -> 4287465b6


SUREFIRE-1096 Fix ClassCastException when configuring forkCount>1 and reuseForks=true together
with suiteXmlFiles. For now, surefire falls back to using 1 fork only in that case.


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

Branch: refs/heads/master
Commit: 4287465b663091b27364c81141a1152238a4c0b5
Parents: f305e2a
Author: Andreas Gudian <agudian@apache.org>
Authored: Sun Sep 28 01:54:51 2014 +0200
Committer: Andreas Gudian <agudian@apache.org>
Committed: Sun Sep 28 01:54:51 2014 +0200

----------------------------------------------------------------------
 .../surefire/booterclient/ForkStarter.java      | 10 ++++++-
 .../surefire/its/CheckTestNgSuiteXmlIT.java     | 12 +++++---
 .../src/test/resources/testng-suite-xml/pom.xml |  3 +-
 .../testng-suite-xml/src/test-data/testng.xml   | 30 --------------------
 .../testng-suite-xml/src/test-data/testng1.xml  | 30 ++++++++++++++++++++
 .../testng-suite-xml/src/test-data/testng2.xml  | 30 ++++++++++++++++++++
 6 files changed, 79 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4287465b/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 315c19d..df4325b 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
@@ -64,6 +64,7 @@ import org.apache.maven.surefire.booter.SystemPropertyManager;
 import org.apache.maven.surefire.providerapi.SurefireProvider;
 import org.apache.maven.surefire.report.StackTraceWriter;
 import org.apache.maven.surefire.suite.RunResult;
+import org.apache.maven.surefire.testset.TestRequest;
 import org.apache.maven.surefire.util.DefaultScanResult;
 
 import static org.apache.maven.surefire.booter.Classpath.join;
@@ -185,7 +186,14 @@ public class ForkStarter
 
     private boolean isForkOnce()
     {
-        return forkConfiguration.isReuseForks() && 1 == forkConfiguration.getForkCount();
+        return forkConfiguration.isReuseForks() && ( 1 == forkConfiguration.getForkCount()
|| hasSuiteXmlFiles() );
+    }
+
+    private boolean hasSuiteXmlFiles()
+    {
+        TestRequest testSuiteDefinition = providerConfiguration.getTestSuiteDefinition();
+        return testSuiteDefinition != null && testSuiteDefinition.getSuiteXmlFiles()
!= null
+            && !testSuiteDefinition.getSuiteXmlFiles().isEmpty();
     }
 
     private RunResult runSuitesForkOnceMultiple( final SurefireProperties effectiveSystemProperties,
int forkCount )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4287465b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java
index d0d30bc..7e0653d 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java
@@ -34,19 +34,23 @@ public class CheckTestNgSuiteXmlIT
     @Test
     public void suiteXml()
     {
-        unpack().executeTest().verifyErrorFree( 1 );
+        unpack().executeTest().verifyErrorFree( 2 );
     }
 
     @Test
     public void suiteXmlForkModeAlways()
     {
-        unpack().forkAlways().executeTest().verifyErrorFree( 1 );
+        unpack().forkAlways().executeTest().verifyErrorFree( 2 );
+    }
+
+    @Test
+    public void suiteXmlForkCountTwoReuse()
+    {
+        unpack().forkCount( 2 ).reuseForks( true ).executeTest().verifyErrorFree( 2 );
     }
 
     private SurefireLauncher unpack()
     {
         return unpack( "testng-suite-xml" );
     }
-
-
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4287465b/surefire-integration-tests/src/test/resources/testng-suite-xml/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/testng-suite-xml/pom.xml b/surefire-integration-tests/src/test/resources/testng-suite-xml/pom.xml
index bbccdde..c43c10b 100644
--- a/surefire-integration-tests/src/test/resources/testng-suite-xml/pom.xml
+++ b/surefire-integration-tests/src/test/resources/testng-suite-xml/pom.xml
@@ -71,7 +71,8 @@
         <version>${surefire.version}</version>
         <configuration>
           <suiteXmlFiles>
-            <file>src/test-data/testng.xml</file>
+            <file>src/test-data/testng1.xml</file>
+            <file>src/test-data/testng2.xml</file>
           </suiteXmlFiles>
         </configuration>
       </plugin>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4287465b/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test-data/testng.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test-data/testng.xml
b/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test-data/testng.xml
deleted file mode 100644
index 1655967..0000000
--- a/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test-data/testng.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
-
-<suite name="Suite 1 Test" verbose="4">
-
-  <test name="Sample Test">
-    <classes>
-      <class name="testng.suiteXml.TestNGSuiteTest"/>
-    </classes>
-  </test>
-
-</suite>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4287465b/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test-data/testng1.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test-data/testng1.xml
b/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test-data/testng1.xml
new file mode 100644
index 0000000..1655967
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test-data/testng1.xml
@@ -0,0 +1,30 @@
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+
+<suite name="Suite 1 Test" verbose="4">
+
+  <test name="Sample Test">
+    <classes>
+      <class name="testng.suiteXml.TestNGSuiteTest"/>
+    </classes>
+  </test>
+
+</suite>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4287465b/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test-data/testng2.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test-data/testng2.xml
b/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test-data/testng2.xml
new file mode 100644
index 0000000..3f0749a
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test-data/testng2.xml
@@ -0,0 +1,30 @@
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+
+<suite name="Suite 2 Test" verbose="4">
+
+  <test name="Sample Test">
+    <classes>
+      <class name="testng.suiteXml.TestNGSuiteTest"/>
+    </classes>
+  </test>
+
+</suite>
\ No newline at end of file


Mime
View raw message