maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dfabul...@apache.org
Subject svn commit: r652188 - in /maven/surefire/trunk: surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgSuiteXmlTest.java
Date Tue, 29 Apr 2008 23:28:18 GMT
Author: dfabulich
Date: Tue Apr 29 16:28:18 2008
New Revision: 652188

URL: http://svn.apache.org/viewvc?rev=652188&view=rev
Log:
[SUREFIRE-463] ClassCastException when using testng suiteXmlFile and forkMode=always
Submitted  by: Andreas Andreou

Modified:
    maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgSuiteXmlTest.java

Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java?rev=652188&r1=652187&r2=652188&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
(original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
Tue Apr 29 16:28:18 2008
@@ -407,7 +407,7 @@
 
             for ( Iterator j = testSets.keySet().iterator(); j.hasNext(); )
             {
-                String testSet = (String) j.next();
+                Object testSet = j.next();
                 boolean showFooter = !j.hasNext() && !i.hasNext();
                 int result = forkSuite( testSuite, testSet, showHeading, showFooter, properties
);
                 if ( result > globalResult )
@@ -479,13 +479,16 @@
         return fork( properties, showHeading, showFooter );
     }
 
-    private int forkSuite( Object[] testSuite, String testSet, boolean showHeading, boolean
showFooter,
+    private int forkSuite( Object[] testSuite, Object testSet, boolean showHeading, boolean
showFooter,
                                Properties properties )
         throws SurefireBooterForkException
     {
         setForkProperties( Collections.singletonList( testSuite ), properties );
 
-        properties.setProperty( "testSet", testSet );
+        if (testSet instanceof String)
+        {
+            properties.setProperty( "testSet", (String) testSet);
+        }
 
         return fork( properties, showHeading, showFooter );
     }

Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgSuiteXmlTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgSuiteXmlTest.java?rev=652188&r1=652187&r2=652188&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgSuiteXmlTest.java
(original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgSuiteXmlTest.java
Tue Apr 29 16:28:18 2008
@@ -6,6 +6,8 @@
 import org.apache.maven.it.util.ResourceExtractor;
 
 import java.io.File;
+import java.util.Arrays;
+import java.util.List;
 
 /**
  * Test simple TestNG suite XML file
@@ -28,4 +30,18 @@
         
         HelperAssertions.assertTestSuiteResults( 1, 0, 0, 0, testDir );
     }
+    
+    public void testTestNgSuiteXmlForkModeAlways()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/testng-suite-xml"
);
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        List goals = Arrays.asList( new String[] {"test", "-DforkMode=always"} );
+        verifier.executeGoals( goals );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        HelperAssertions.assertTestSuiteResults( 1, 0, 0, 0, testDir );
+    }
 }



Mime
View raw message