maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r383007 - in /maven/surefire/branches/surefire-testng: surefire-booter/src/main/java/org/apache/maven/surefire/booter/ surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/
Date Sat, 04 Mar 2006 03:07:26 GMT
Author: brett
Date: Fri Mar  3 19:07:24 2006
New Revision: 383007

URL: http://svn.apache.org/viewcvs?rev=383007&view=rev
Log:
[MSUREFIRE-23] get TestNG working under normal mode, and under forkMode=once

Modified:
    maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
    maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
    maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGTestSet.java

Modified: maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java?rev=383007&r1=383006&r2=383007&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
Fri Mar  3 19:07:24 2006
@@ -384,8 +384,13 @@
                 String typeProperty = params[0].getClass().getName();
                 for ( int j = 1; j < params.length; j++ )
                 {
-                    paramProperty += "|" + params[j].toString();
-                    typeProperty += "|" + params[j].getClass().getName();
+                    paramProperty += "|";
+                    typeProperty += "|";
+                    if ( params[j] != null )
+                    {
+                        paramProperty += params[j].toString();
+                        typeProperty += params[j].getClass().getName();
+                    }
                 }
                 properties.setProperty( propertyPrefix + i + ".params", paramProperty );
                 properties.setProperty( propertyPrefix + i + ".types", typeProperty );
@@ -559,7 +564,11 @@
 
             for ( int i = 0; i < types.length; i++ )
             {
-                if ( types[i].equals( String.class.getName() ) )
+                if ( types[i].length() == 0 )
+                {
+                    params[i] = null;
+                }
+                else if ( types[i].equals( String.class.getName() ) )
                 {
                     paramObjects[i] = params[i];
                 }
@@ -570,6 +579,14 @@
                 else if ( types[i].equals( ArrayList.class.getName() ) )
                 {
                     paramObjects[i] = processStringList( params[i] );
+                }
+                else if ( types[i].equals( Boolean.class.getName() ) )
+                {
+                    paramObjects[i] = Boolean.valueOf( params[i] );
+                }
+                else if ( types[i].equals( Integer.class.getName() ) )
+                {
+                    paramObjects[i] = Integer.valueOf( params[i] );
                 }
                 else
                 {

Modified: maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java?rev=383007&r1=383006&r2=383007&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
Fri Mar  3 19:07:24 2006
@@ -24,6 +24,7 @@
 import org.testng.ISuiteListener;
 import org.testng.ITestListener;
 import org.testng.TestNG;
+import org.testng.internal.TestNGClassFinder;
 import org.testng.internal.annotations.IAnnotationFinder;
 import org.testng.xml.XmlClass;
 import org.testng.xml.XmlSuite;
@@ -33,6 +34,7 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.Map;
 
 /**
  * Test suite for TestNG based on a directory of Java test classes. Can also execute JUnit
tests.
@@ -84,6 +86,15 @@
         annotationFinder = (IAnnotationFinder) annotationClass.newInstance();
     }
 
+    public Map locateTestSets( ClassLoader classLoader )
+        throws TestSetFailedException
+    {
+        // TODO: fix
+        // override classloader. That keeps us all together for now, which makes it work,
but could pose problems of
+        // classloader separation if the tests use plexus-utils.
+        return super.locateTestSets( getClass().getClassLoader() );
+    }
+
     protected SurefireTestSet createTestSet( Class testClass, ClassLoader classLoader )
     {
         return new TestNGTestSet( testClass );
@@ -98,7 +109,6 @@
         }
 
         XmlSuite suite = new XmlSuite();
-        // TODO: set name
         suite.setParallel( parallel );
         suite.setThreadCount( threadCount );
 
@@ -108,23 +118,18 @@
 
             XmlTest xmlTest = new XmlTest( suite );
             xmlTest.setName( testSet.getName() );
-            // TODO: should these be grouped into a single XmlTest?
             xmlTest.setXmlClasses( Collections.singletonList( new XmlClass( testSet.getTestClass()
) ) );
 
-/*
-            // TODO: not working, due to annotations being in a different classloader.
-            //   We could just check if it extends TestCase, but that would rule out non-TestNG
pojo handling
             if ( !TestNGClassFinder.isTestNGClass( testSet.getTestClass(), annotationFinder
) )
             {
-                // TODO: is this correct, or should it be a JUnitBattery?
                 xmlTest.setJUnit( true );
             }
-*/
         }
 
         TestNG testNG = new TestNG();
         // turn off all TestNG output
         testNG.setVerbose( 0 );
+
         // TODO: check these work, otherwise put them in the xmlTest instances
         if ( groups != null )
         {
@@ -135,6 +140,8 @@
             testNG.setExcludedGroups( excludedGroups );
         }
         testNG.setXmlSuites( Collections.singletonList( suite ) );
+
+        testNG.setListenerClasses( new ArrayList() );
 
         TestNGReporter reporter = new TestNGReporter( reporterManager, this );
         testNG.addListener( (ITestListener) reporter );

Modified: maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGTestSet.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGTestSet.java?rev=383007&r1=383006&r2=383007&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGTestSet.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGTestSet.java
Fri Mar  3 19:07:24 2006
@@ -42,6 +42,7 @@
 
     protected void discoverTestMethods()
     {
+        // TODO: This isn't correct. We really need to have TestNG do the counting for us.
         if ( testMethods == null )
         {
             testMethods = new ArrayList();



Mime
View raw message