maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1051292 [2/2] - in /maven/surefire/trunk: ./ maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/ maven-surefire-report-plugin/src/main/java/org/apache/...
Date Mon, 20 Dec 2010 21:09:06 GMT
Copied: maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
(from r1050729, maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/PojoTestSet.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java?p2=maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java&p1=maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/PojoTestSet.java&r1=1050729&r2=1051292&rev=1051292&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/PojoTestSet.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
Mon Dec 20 21:09:04 2010
@@ -1,4 +1,4 @@
-package org.apache.maven.surefire.testset;
+package org.apache.maven.surefire.junit;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -24,6 +24,7 @@ import org.apache.maven.surefire.report.
 import org.apache.maven.surefire.report.PojoStackTraceWriter;
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.testset.TestSetFailedException;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -34,7 +35,7 @@ import java.util.List;
 import java.util.ResourceBundle;
 
 public class PojoTestSet
-    extends AbstractTestSet
+    implements SurefireTestSet
 {
     private ResourceBundle bundle = ResourceBundle.getBundle( Surefire.SUREFIRE_BUNDLE_NAME
);
 
@@ -46,10 +47,17 @@ public class PojoTestSet
 
     protected List testMethods;
 
+    private Class testClass;
+
     public PojoTestSet( Class testClass )
         throws TestSetFailedException
     {
-        super( testClass );
+        if ( testClass == null )
+        {
+            throw new NullPointerException( "testClass is null" );
+        }
+
+        this.testClass = testClass;
 
         try
         {
@@ -295,4 +303,14 @@ public class PojoTestSet
 
         return isInstanceMethod && returnsVoid && hasNoParams;
     }
+
+    public String getName()
+    {
+        return testClass.getName();
+    }
+
+    public Class getTestClass()
+    {
+        return testClass;
+    }
 }

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java
(from r1050729, maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/SurefireTestSet.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java?p2=maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java&p1=maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/SurefireTestSet.java&r1=1050729&r2=1051292&rev=1051292&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/SurefireTestSet.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java
Mon Dec 20 21:09:04 2010
@@ -1,4 +1,4 @@
-package org.apache.maven.surefire.testset;
+package org.apache.maven.surefire.junit;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -20,6 +20,7 @@ package org.apache.maven.surefire.testse
  */
 
 import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.testset.TestSetFailedException;
 
 public interface SurefireTestSet
 {

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java?rev=1051292&r1=1051291&r2=1051292&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java
Mon Dec 20 21:09:04 2010
@@ -19,82 +19,13 @@ package org.apache.maven.surefire.junit4
  * under the License.
  */
 
-import org.apache.maven.surefire.report.ReporterManager;
-import org.apache.maven.surefire.testset.AbstractTestSet;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 import org.junit.runner.Request;
 import org.junit.runner.Runner;
-import org.junit.runner.notification.RunListener;
 import org.junit.runner.notification.RunNotifier;
 
-import java.util.ArrayList;
-import java.util.List;
-
 public class JUnit4TestSet
-    extends AbstractTestSet
 {
-    private final List<RunListener> customRunListeners;
-
-    /**
-     * Constructor.
-     *
-     * @param testClass          the class to be run as a test
-     * @param customRunListeners the custom run listeners to add
-     */
-    protected JUnit4TestSet( Class testClass, List<RunListener> customRunListeners
)
-    {
-        super( testClass );
-        this.customRunListeners = customRunListeners;
-    }
-
-    // Bogus constructor so we can build with 2.5. Remove for 2.7.1
-    protected JUnit4TestSet( Class testClass )
-    {
-        super( testClass );
-        this.customRunListeners = new ArrayList();
-    }
-
-    /**
-     * Actually runs the test and adds the tests results to the <code>reportManager</code>.
-     *
-     * @see org.apache.maven.surefire.testset.SurefireTestSet#execute(org.apache.maven.surefire.report.ReporterManager,
java.lang.ClassLoader)
-     */
-    public void execute( ReporterManager reportManager, ClassLoader loader )
-        throws TestSetFailedException
-    {
-        List<RunListener> listeners = new ArrayList<RunListener>();
-        listeners.add( new JUnit4TestSetReporter( getTestClass(), reportManager ) );
-        listeners.addAll( customRunListeners );
-        execute( getTestClass(), listeners );
-    }
-
-    /**
-     * Actually runs the test and adds the tests results to the <code>reportManager</code>.
-     *
-     * @param testClass    The test class to run
-     * @param runListeners The run listeners to attach
-     * @see org.apache.maven.surefire.testset.SurefireTestSet#execute(org.apache.maven.surefire.report.ReporterManager,
java.lang.ClassLoader)
-     */
-    public static void execute( Class testClass, List<RunListener> runListeners )
-        throws TestSetFailedException
-    {
-        RunNotifier fNotifier = new RunNotifier();
-        for ( RunListener listener : runListeners )
-        {
-            fNotifier.addListener( listener );
-        }
-        try
-        {
-            execute( testClass, fNotifier );
-        }
-        finally
-        {
-            for ( RunListener listener : runListeners )
-            {
-                fNotifier.removeListener( listener );
-            }
-        }
-    }
 
     public static void execute( Class testClass, RunNotifier fNotifier )
         throws TestSetFailedException

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/ConfigurationAwareTestNGReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/ConfigurationAwareTestNGReporter.java?rev=1051292&r1=1051291&r2=1051292&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/ConfigurationAwareTestNGReporter.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/ConfigurationAwareTestNGReporter.java
Mon Dec 20 21:09:04 2010
@@ -21,19 +21,19 @@ package org.apache.maven.surefire.testng
 
 
 import org.apache.maven.surefire.report.ReporterManager;
-import org.apache.maven.surefire.suite.SurefireTestSuite;
 import org.testng.internal.IResultListener;
 
 /** Just like TestNGReporter, but explicitly implements IResultListener; this interface is
new in TestNG 5.5
  * 
  * @author Dan Fabulich
+ * @noinspection UnusedDeclaration
  */
 public class ConfigurationAwareTestNGReporter
     extends TestNGReporter
     implements IResultListener
 {
 
-    public ConfigurationAwareTestNGReporter( ReporterManager reportManager, SurefireTestSuite
source )
+    public ConfigurationAwareTestNGReporter( ReporterManager reportManager, TestNgTestSuite
source )
     {
         super( reportManager );
     }

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java?rev=1051292&r1=1051291&r2=1051292&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
Mon Dec 20 21:09:04 2010
@@ -21,24 +21,30 @@ package org.apache.maven.surefire.testng
 
 import org.apache.maven.artifact.versioning.ArtifactVersion;
 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
+import org.apache.maven.surefire.NonAbstractClassFilter;
+import org.apache.maven.surefire.Surefire;
 import org.apache.maven.surefire.report.DefaultReportEntry;
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.ReporterException;
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.ReporterManager;
 import org.apache.maven.surefire.report.ReporterManagerFactory;
-import org.apache.maven.surefire.suite.AbstractDirectoryTestSuite;
-import org.apache.maven.surefire.testset.SurefireTestSet;
 import org.apache.maven.surefire.testset.TestSetFailedException;
+import org.apache.maven.surefire.util.DefaultDirectoryScanner;
+import org.apache.maven.surefire.util.DirectoryScanner;
 import org.apache.maven.surefire.util.TestsToRun;
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.ResourceBundle;
+import java.util.SortedMap;
+import java.util.TreeMap;
 
 /**
  * Test suite for TestNG based on a directory of Java test classes. Can also execute JUnit
tests.
@@ -47,8 +53,10 @@ import java.util.Properties;
  * @author <a href='mailto:the[dot]mindstorm[at]gmail[dot]com'>Alex Popescu</a>
  */
 public class TestNGDirectoryTestSuite
-    extends AbstractDirectoryTestSuite
+    implements TestNgTestSuite
 {
+    protected static ResourceBundle bundle = ResourceBundle.getBundle( Surefire.SUREFIRE_BUNDLE_NAME
);
+
     private ArtifactVersion version;
 
     private String classifier;
@@ -59,6 +67,10 @@ public class TestNGDirectoryTestSuite
 
     private File reportsDirectory;
 
+    protected SortedMap testSets;
+
+    private final DirectoryScanner surefireDirectoryScanner;
+
     public TestNGDirectoryTestSuite( File basedir, ArrayList includes, ArrayList excludes,
String testSourceDirectory,
                                      String artifactVersion, String artifactClassifier, Properties
confOptions,
                                      File reportsDirectory )
@@ -71,7 +83,8 @@ public class TestNGDirectoryTestSuite
                                      ArtifactVersion artifactVersion, String artifactClassifier,
Map confOptions,
                                      File reportsDirectory )
     {
-        super( basedir, includes, excludes );
+        this.surefireDirectoryScanner = new DefaultDirectoryScanner( basedir, includes, excludes,
+                                                                     "filesystem" );
 
         this.options = confOptions;
 
@@ -83,11 +96,6 @@ public class TestNGDirectoryTestSuite
 
     }
 
-    protected SurefireTestSet createTestSet( Class testClass, ClassLoader classLoader )
-    {
-        return new TestNGTestSet( testClass );
-    }
-
     public void execute( TestsToRun testsToRun, ReporterFactory reporterManagerFactory )
         throws ReporterException, TestSetFailedException
     {
@@ -127,8 +135,7 @@ public class TestNGDirectoryTestSuite
         List junitTestClasses = new ArrayList();
         for ( Iterator it = testsToRun.iterator(); it.hasNext(); )
         {
-            Class testSet = (Class) it.next();
-            Class c = testSet;
+            Class c = (Class) it.next();
             if ( junitTest != null && junitTest.isAssignableFrom( c ) )
             {
                 junitTestClasses.add( c );
@@ -151,14 +158,14 @@ public class TestNGDirectoryTestSuite
             new SynchronizedReporterManager( (ReporterManager) reporterManagerFactory.createReporter()
);
         startTestSuite( reporterManager, this );
 
-        Class[] testClasses = (Class[]) testNgTestClasses.toArray( new Class[0] );
+        Class[] testClasses = (Class[]) testNgTestClasses.toArray( new Class[testNgTestClasses.size()]
);
 
         TestNGExecutor.run( testClasses, this.testSourceDirectory, this.options, this.version,
this.classifier,
                             reporterManager, this, testNgReportsDirectory );
 
         if ( junitTestClasses.size() > 0 )
         {
-            testClasses = (Class[]) junitTestClasses.toArray( new Class[0] );
+            testClasses = (Class[]) junitTestClasses.toArray( new Class[junitTestClasses.size()]
);
 
             Map junitOptions = new HashMap();
             for ( Iterator it = this.options.keySet().iterator(); it.hasNext(); )
@@ -184,7 +191,7 @@ public class TestNGDirectoryTestSuite
         {
             throw new IllegalStateException( "You must call locateTestSets before calling
execute" );
         }
-        SurefireTestSet testSet = (SurefireTestSet) testSets.get( testSetName );
+        TestNGTestSet testSet = (TestNGTestSet) testSets.get( testSetName );
 
         if ( testSet == null )
         {
@@ -200,78 +207,6 @@ public class TestNGDirectoryTestSuite
         finishTestSuite( reporterManager, this );
     }
 
-    // todo: Delete as soon as we build surefire itself with 2.7
-    public void execute( ReporterManagerFactory reporterManagerFactory, ClassLoader classLoader
)
-        throws ReporterException, TestSetFailedException
-    {
-        if ( testSets == null )
-        {
-            throw new IllegalStateException( "You must call locateTestSets before calling
execute" );
-        }
-
-        Class junitTest;
-        try
-        {
-            junitTest = Class.forName( "junit.framework.Test" );
-        }
-        catch ( ClassNotFoundException e )
-        {
-            junitTest = null;
-        }
-
-        List testNgTestClasses = new ArrayList();
-        List junitTestClasses = new ArrayList();
-        for ( Iterator it = testSets.values().iterator(); it.hasNext(); )
-        {
-            SurefireTestSet testSet = (SurefireTestSet) it.next();
-            Class c = testSet.getTestClass();
-            if ( junitTest != null && junitTest.isAssignableFrom( c ) )
-            {
-                junitTestClasses.add( c );
-            }
-            else
-            {
-                testNgTestClasses.add( c );
-            }
-        }
-
-        File testNgReportsDirectory = reportsDirectory, junitReportsDirectory = reportsDirectory;
-
-        if ( junitTestClasses.size() > 0 && testNgTestClasses.size() > 0 )
-        {
-            testNgReportsDirectory = new File( reportsDirectory, "testng-native-results"
);
-            junitReportsDirectory = new File( reportsDirectory, "testng-junit-results" );
-        }
-
-        ReporterManager reporterManager =
-            new SynchronizedReporterManager( reporterManagerFactory.createReporterManager()
);
-        startTestSuite( reporterManager, this );
-
-        Class[] testClasses = (Class[]) testNgTestClasses.toArray( new Class[0] );
-
-        TestNGExecutor.run( testClasses, this.testSourceDirectory, this.options, this.version,
this.classifier,
-                            reporterManager, this, testNgReportsDirectory );
-
-        if ( junitTestClasses.size() > 0 )
-        {
-            testClasses = (Class[]) junitTestClasses.toArray( new Class[0] );
-
-            Map junitOptions = new HashMap();
-            for ( Iterator it = this.options.keySet().iterator(); it.hasNext(); )
-            {
-                Object key = it.next();
-                junitOptions.put( key, options.get( key ) );
-            }
-
-            junitOptions.put( "junit", Boolean.TRUE );
-
-            TestNGExecutor.run( testClasses, this.testSourceDirectory, junitOptions, this.version,
this.classifier,
-                                reporterManager, this, junitReportsDirectory );
-        }
-
-        finishTestSuite( reporterManager, this );
-    }
-
     public static void startTestSuite( ReporterManager reporterManager, Object suite )
     {
         String rawString = bundle.getString( "testSetStarting" );
@@ -327,4 +262,34 @@ public class TestNGDirectoryTestSuite
 
         return result;
     }
+
+    public Map locateTestSets( ClassLoader classLoader )
+        throws TestSetFailedException
+    {
+        if ( testSets != null )
+        {
+            throw new IllegalStateException( "You can't call locateTestSets twice" );
+        }
+        testSets = new TreeMap();
+
+        final TestsToRun testsToRun =
+            surefireDirectoryScanner.locateTestClasses( classLoader, new NonAbstractClassFilter()
);
+        Class[] locatedClasses = testsToRun.getLocatedClasses();
+
+        for ( int i = 0; i < locatedClasses.length; i++ )
+        {
+            Class testClass = locatedClasses[i];
+            TestNGTestSet testSet = new TestNGTestSet( testClass );
+
+            if ( testSets.containsKey( testSet.getName() ) )
+            {
+                throw new TestSetFailedException( "Duplicate test set '" + testSet.getName()
+ "'" );
+            }
+            testSets.put( testSet.getName(), testSet );
+
+        }
+
+        return Collections.unmodifiableSortedMap( testSets );
+    }
+
 }

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java?rev=1051292&r1=1051291&r2=1051292&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
Mon Dec 20 21:09:04 2010
@@ -19,16 +19,10 @@ package org.apache.maven.surefire.testng
  * under the License.
  */
 
-import java.io.File;
-import java.lang.reflect.Constructor;
-import java.util.List;
-import java.util.Map;
-
 import org.apache.maven.artifact.versioning.ArtifactVersion;
 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.surefire.report.ReporterManager;
-import org.apache.maven.surefire.suite.SurefireTestSuite;
 import org.apache.maven.surefire.testng.conf.Configurator;
 import org.apache.maven.surefire.testng.conf.TestNG4751Configurator;
 import org.apache.maven.surefire.testng.conf.TestNG52Configurator;
@@ -37,6 +31,11 @@ import org.apache.maven.surefire.testset
 import org.testng.IReporter;
 import org.testng.TestNG;
 
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.util.List;
+import java.util.Map;
+
 /**
  * Contains utility methods for executing TestNG.
  *
@@ -50,7 +49,7 @@ public class TestNGExecutor
     }
 
     public static void run( Class[] testClasses, String testSourceDirectory, Map options,
ArtifactVersion version,
-                            String classifier, ReporterManager reportManager, SurefireTestSuite
suite,
+                            String classifier, ReporterManager reportManager, TestNgTestSuite
suite,
                             File reportsDirectory )
         throws TestSetFailedException
     {
@@ -63,7 +62,7 @@ public class TestNGExecutor
     }
 
     public static void run( List suiteFiles, String testSourceDirectory, Map options, ArtifactVersion
version,
-                            String classifier, ReporterManager reportManager, SurefireTestSuite
suite,
+                            String classifier, ReporterManager reportManager, TestNgTestSuite
suite,
                             File reportsDirectory )
         throws TestSetFailedException
     {
@@ -105,8 +104,8 @@ public class TestNGExecutor
     }
 
 
-    private static void postConfigure( TestNG testNG, String sourcePath, String classifier,

-                                       ReporterManager reportManager, SurefireTestSuite suite,
File reportsDirectory )
+    private static void postConfigure( TestNG testNG, String sourcePath, String classifier,
+                                       ReporterManager reportManager, TestNgTestSuite suite,
File reportsDirectory )
         throws TestSetFailedException
     {
         // turn off all TestNG output
@@ -114,7 +113,7 @@ public class TestNGExecutor
 
         TestNGReporter reporter = createTestNGReporter( reportManager, suite );
         testNG.addListener( (Object) reporter );
-        
+
         // FIXME: use classifier to decide if we need to pass along the source dir (onyl
for JDK14)
         if ( sourcePath != null )
         {
@@ -126,7 +125,7 @@ public class TestNGExecutor
 
     // If we have access to IResultListener, return a ConfigurationAwareTestNGReporter
     // But don't cause NoClassDefFoundErrors if it isn't available; just return a regular
TestNGReporter instead
-    private static TestNGReporter createTestNGReporter( ReporterManager reportManager, SurefireTestSuite
suite )
+    private static TestNGReporter createTestNGReporter( ReporterManager reportManager, TestNgTestSuite
suite )
     {
         try
         {
@@ -134,8 +133,8 @@ public class TestNGExecutor
             Class c = Class.forName( "org.apache.maven.surefire.testng.ConfigurationAwareTestNGReporter"
);
             try
             {
-                Constructor ctor = c.getConstructor( new Class[] { ReporterManager.class,
SurefireTestSuite.class } );
-                return (TestNGReporter) ctor.newInstance( new Object[] { reportManager, suite
} );
+                Constructor ctor = c.getConstructor( new Class[]{ ReporterManager.class,
TestNgTestSuite.class } );
+                return (TestNGReporter) ctor.newInstance( new Object[]{ reportManager, suite
} );
             }
             catch ( Exception e )
             {

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java?rev=1051292&r1=1051291&r2=1051292&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
Mon Dec 20 21:09:04 2010
@@ -98,7 +98,7 @@ public class TestNGProvider
             }
             else
             {
-                testNGXmlTestSuite.execute( (ReporterManagerFactory) reporterFactory, testClassLoader
);
+                testNGXmlTestSuite.execute( (ReporterManagerFactory) reporterFactory );
             }
         }
         else

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGTestSet.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGTestSet.java?rev=1051292&r1=1051291&r2=1051292&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGTestSet.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGTestSet.java
Mon Dec 20 21:09:04 2010
@@ -19,9 +19,6 @@ package org.apache.maven.surefire.testng
  * under the License.
  */
 
-import org.apache.maven.surefire.report.ReporterManager;
-import org.apache.maven.surefire.testset.AbstractTestSet;
-
 /**
  * Main plugin point for running testng tests within the Surefire runtime
  * infrastructure.
@@ -29,20 +26,31 @@ import org.apache.maven.surefire.testset
  * @author jkuhnert
  */
 public class TestNGTestSet
-    extends AbstractTestSet
 {
+    private Class testClass;
+
     /**
      * Creates a new test testset that will process the class being
      * passed in to determine the testing configuration.
+     * @param testClass The test class
      */
     public TestNGTestSet( Class testClass )
     {
-        super( testClass );
+        if ( testClass == null )
+        {
+            throw new NullPointerException( "testClass is null" );
+        }
+
+        this.testClass = testClass;
+    }
+
+    public String getName()
+    {
+        return testClass.getName();
     }
 
-    public void execute( ReporterManager reportManager, ClassLoader loader )
+    public Class getTestClass()
     {
-        throw new UnsupportedOperationException(
-            "This should have been called directly from TestNGDirectoryTestSuite" );
+        return testClass;
     }
 }

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java?rev=1051292&r1=1051291&r2=1051292&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
Mon Dec 20 21:09:04 2010
@@ -32,7 +32,6 @@ import org.apache.maven.artifact.version
 import org.apache.maven.surefire.report.ReporterException;
 import org.apache.maven.surefire.report.ReporterManager;
 import org.apache.maven.surefire.report.ReporterManagerFactory;
-import org.apache.maven.surefire.suite.SurefireTestSuite;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
 /**
@@ -42,7 +41,7 @@ import org.apache.maven.surefire.testset
  * @author <a href='mailto:the[dot]mindstorm[at]gmail[dot]com'>Alex Popescu</a>
  */
 public class TestNGXmlTestSuite
-    implements SurefireTestSuite
+    implements TestNgTestSuite
 {
     private List suiteFiles;
 
@@ -81,7 +80,7 @@ public class TestNGXmlTestSuite
         this.reportsDirectory = reportsDirectory;
     }
 
-    public void execute( ReporterManagerFactory reporterManagerFactory, ClassLoader classLoader
)
+    public void execute( ReporterManagerFactory reporterManagerFactory )
         throws ReporterException, TestSetFailedException
     {
         if ( testSets == null )
@@ -102,16 +101,6 @@ public class TestNGXmlTestSuite
         throw new TestSetFailedException( "Cannot run individual test when suite files are
specified" );
     }
 
-    public int getNumTests()
-    {
-        return suiteFiles.size();
-    }
-
-    public List getClassesSkippedByValidation()
-    {
-        return new ArrayList(  );
-    }
-
     public Map locateTestSets( ClassLoader classLoader )
         throws TestSetFailedException
     {

Copied: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNgTestSuite.java
(from r1050729, maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/SurefireTestSuite.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNgTestSuite.java?p2=maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNgTestSuite.java&p1=maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/SurefireTestSuite.java&r1=1050729&r2=1051292&rev=1051292&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/SurefireTestSuite.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNgTestSuite.java
Mon Dec 20 21:09:04 2010
@@ -1,4 +1,4 @@
-package org.apache.maven.surefire.suite;
+package org.apache.maven.surefire.testng;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -23,7 +23,6 @@ import org.apache.maven.surefire.report.
 import org.apache.maven.surefire.report.ReporterManagerFactory;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -31,18 +30,12 @@ import java.util.Map;
  *
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  */
-public interface SurefireTestSuite
+public interface TestNgTestSuite
 {
-    void execute( ReporterManagerFactory reporterManagerFactory, ClassLoader classLoader
)
-        throws ReporterException, TestSetFailedException;
 
     void execute( String testSetName, ReporterManagerFactory reporterManagerFactory, ClassLoader
classLoader )
         throws ReporterException, TestSetFailedException;
 
-    int getNumTests();
-
-    List getClassesSkippedByValidation();
-
     Map locateTestSets( ClassLoader classLoader )
         throws TestSetFailedException;
 }

Propchange: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNgTestSuite.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNgTestSuite.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java?rev=1051292&r1=1051291&r2=1051292&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java
Mon Dec 20 21:09:04 2010
@@ -19,15 +19,15 @@ package org.apache.maven.surefire.testng
  * under the License.
  */
 
+import org.apache.maven.surefire.testset.TestSetFailedException;
+import org.testng.TestNG;
+
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
-import org.apache.maven.surefire.testset.TestSetFailedException;
-import org.testng.TestNG;
-
 /**
  * TestNG configurator for 5.3+ versions. TestNG exposes
  * a {@link org.testng.TestNG#configure(java.util.Map)} method.



Mime
View raw message