maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1077870 - in /maven/surefire/trunk/surefire-providers: surefire-junit3/src/main/java/org/apache/maven/surefire/junit/ surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/ surefire-junit47/src/main/java/org/apache/maven/surefire/...
Date Fri, 04 Mar 2011 11:03:19 GMT
Author: krosenvold
Date: Fri Mar  4 11:03:18 2011
New Revision: 1077870

URL: http://svn.apache.org/viewvc?rev=1077870&view=rev
Log:
[SUREFIRE-711] Take 2

Modified:
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
    maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java

Modified: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java?rev=1077870&r1=1077869&r2=1077870&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
Fri Mar  4 11:03:18 2011
@@ -39,10 +39,9 @@ import java.util.Iterator;
  * @author Kristian Rosenvold
  * @noinspection UnusedDeclaration
  */
-public class JUnit3Provider extends AbstractProvider
+public class JUnit3Provider
+    extends AbstractProvider
 {
-    private final ReporterFactory reporterFactory;
-
     private final ClassLoader testClassLoader;
 
     private final DirectoryScanner directoryScanner;
@@ -53,11 +52,13 @@ public class JUnit3Provider extends Abst
 
     private final JUnit3Reflector reflector;
 
+    private final ProviderParameters providerParameters;
+
     private TestsToRun testsToRun;
 
     public JUnit3Provider( ProviderParameters booterParameters )
     {
-        this.reporterFactory = booterParameters.getReporterFactory();
+        this.providerParameters = booterParameters;
         this.testClassLoader = booterParameters.getTestClassLoader();
         this.directoryScanner = booterParameters.getDirectoryScanner();
         this.reflector = new JUnit3Reflector( testClassLoader );
@@ -73,6 +74,8 @@ public class JUnit3Provider extends Abst
             testsToRun = forkTestSet == null ? scanClassPath() : TestsToRun.fromClass( (Class)
forkTestSet );
         }
 
+        ReporterFactory reporterFactory = providerParameters.getReporterFactory();
+
         Reporter reporter = reporterFactory.createReporter();
 
         for ( Iterator iter = testsToRun.iterator(); iter.hasNext(); )
@@ -115,10 +118,6 @@ public class JUnit3Provider extends Abst
     public Iterator getSuites()
     {
         testsToRun = scanClassPath();
-        // Added to free the streams when scanning the classpath.
-        // It is essentially wrong that the capture of stdout is embedded within the reporter
manager,
-        // which will change for 2.8.1+
-        reporterFactory.close();
         return testsToRun.iterator();
     }
 

Modified: maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java?rev=1077870&r1=1077869&r2=1077870&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
Fri Mar  4 11:03:18 2011
@@ -36,14 +36,13 @@ import org.apache.maven.surefire.testset
 import org.apache.maven.surefire.util.DefaultDirectoryScanner;
 import org.apache.maven.surefire.util.DirectoryScanner;
 import org.apache.maven.surefire.util.TestsToRun;
+import org.junit.runner.notification.RunListener;
+import org.junit.runner.notification.RunNotifier;
 
 import java.util.Iterator;
 import java.util.List;
 import java.util.ResourceBundle;
 
-import org.junit.runner.notification.RunListener;
-import org.junit.runner.notification.RunNotifier;
-
 
 /**
  * @author Kristian Rosenvold
@@ -54,8 +53,6 @@ public class JUnit4Provider extends Abst
 
     private static ResourceBundle bundle = ResourceBundle.getBundle( Surefire.SUREFIRE_BUNDLE_NAME
);
 
-    private final ReporterFactory reporterFactory;
-
     private final ClassLoader testClassLoader;
 
     private final DirectoryScanner directoryScanner;
@@ -68,9 +65,11 @@ public class JUnit4Provider extends Abst
 
     private TestsToRun testsToRun;
 
+    private final ProviderParameters providerParameters;
+
     public JUnit4Provider( ProviderParameters booterParameters )
     {
-        this.reporterFactory = booterParameters.getReporterFactory();
+        this.providerParameters = booterParameters;
         this.testClassLoader = booterParameters.getTestClassLoader();
         this.directoryScanner = booterParameters.getDirectoryScanner();
         customRunListeners = JUnit4RunListenerFactory.
@@ -91,6 +90,8 @@ public class JUnit4Provider extends Abst
 
         upgradeCheck();
 
+        final ReporterFactory reporterFactory = providerParameters.getReporterFactory();
+
         Reporter reporter = reporterFactory.createReporter();
         JUnit4RunListener jUnit4TestSetReporter = new JUnit4RunListener( reporter );
         RunNotifier runNotifer = getRunNotifer( jUnit4TestSetReporter, customRunListeners
);
@@ -159,11 +160,6 @@ public class JUnit4Provider extends Abst
     public Iterator getSuites()
     {
         testsToRun = scanClassPath();
-        // Added to free the streams when scanning the classpath.
-        // It is essentially wrong that the capture of stdout is embedded within the reporter
manager,
-        // which will change for 2.8.1+
-        reporterFactory.close();
-
         return testsToRun.iterator();
     }
 

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java?rev=1077870&r1=1077869&r2=1077870&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
Fri Mar  4 11:03:18 2011
@@ -23,7 +23,6 @@ import org.apache.maven.surefire.common.
 import org.apache.maven.surefire.common.junit4.JUnit4TestChecker;
 import org.apache.maven.surefire.providerapi.AbstractProvider;
 import org.apache.maven.surefire.providerapi.ProviderParameters;
-import org.apache.maven.surefire.providerapi.SurefireProvider;
 import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.ReporterConfiguration;
 import org.apache.maven.surefire.report.ReporterException;
@@ -33,22 +32,20 @@ import org.apache.maven.surefire.testset
 import org.apache.maven.surefire.util.DirectoryScanner;
 import org.apache.maven.surefire.util.ScannerFilter;
 import org.apache.maven.surefire.util.TestsToRun;
+import org.junit.runner.notification.RunListener;
 
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.junit.runner.notification.RunListener;
-
 /**
  * @author Kristian Rosenvold
  */
 @SuppressWarnings( { "UnusedDeclaration" } )
-public class JUnitCoreProvider extends AbstractProvider
+public class JUnitCoreProvider
+    extends AbstractProvider
 {
-    private final ReporterFactory reporterFactory;
-
     private final ClassLoader testClassLoader;
 
     private final DirectoryScanner directoryScanner;
@@ -59,18 +56,20 @@ public class JUnitCoreProvider extends A
 
     private final List<RunListener> customRunListeners;
 
+    private final ProviderParameters providerParameters;
+
     private TestsToRun testsToRun;
 
     private final ReporterConfiguration reporterConfiguration;
 
     public JUnitCoreProvider( ProviderParameters booterParameters )
     {
-        this.reporterFactory = booterParameters.getReporterFactory();
+        this.providerParameters = booterParameters;
         reporterConfiguration = booterParameters.getReporterConfiguration();
         this.testClassLoader = booterParameters.getTestClassLoader();
         this.directoryScanner = booterParameters.getDirectoryScanner();
         this.jUnitCoreParameters = new JUnitCoreParameters( booterParameters.getProviderProperties()
);
-        this.scannerFilter = new JUnit4TestChecker(testClassLoader);
+        this.scannerFilter = new JUnit4TestChecker( testClassLoader );
         customRunListeners = JUnit4RunListenerFactory.
             createCustomListeners( booterParameters.getProviderProperties().getProperty(
"listener" ) );
 
@@ -84,11 +83,6 @@ public class JUnitCoreProvider extends A
     public Iterator getSuites()
     {
         testsToRun = scanClassPath();
-        // Added to free the streams when scanning the classpath.
-        // It is essentially wrong that the capture of stdout is embedded within the reporter
manager,
-        // which will change for 2.8.1+
-        reporterFactory.close();
-
         return testsToRun.iterator();
     }
 
@@ -96,6 +90,8 @@ public class JUnitCoreProvider extends A
         throws TestSetFailedException, ReporterException
     {
         final String message = "Concurrency config is " + jUnitCoreParameters.toString();
+        final ReporterFactory reporterFactory = providerParameters.getReporterFactory();
+
         reporterFactory.createReporter().writeMessage( message );
 
         if ( testsToRun == null )
@@ -105,10 +101,10 @@ public class JUnitCoreProvider extends A
         final Map<String, TestSet> testSetMap = new ConcurrentHashMap<String, TestSet>();
 
         Reporter listener =
-            ConcurrentReporterManager.createInstance( testSetMap, this.reporterFactory, this.reporterConfiguration,
-                                                           jUnitCoreParameters.isParallelClasses(),
-                                                           jUnitCoreParameters.isParallelBoth()
);
-        RunListener jUnit4RunListener = new JUnitCoreRunListener( listener, testSetMap);
+            ConcurrentReporterManager.createInstance( testSetMap, reporterFactory, this.reporterConfiguration,
+                                                      jUnitCoreParameters.isParallelClasses(),
+                                                      jUnitCoreParameters.isParallelBoth()
);
+        RunListener jUnit4RunListener = new JUnitCoreRunListener( listener, testSetMap );
         customRunListeners.add( 0, jUnit4RunListener );
 
         JUnitCoreWrapper.execute( testsToRun, jUnitCoreParameters, customRunListeners );

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=1077870&r1=1077869&r2=1077870&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
Fri Mar  4 11:03:18 2011
@@ -52,8 +52,6 @@ public class TestNGProvider
 
     private final ReporterConfiguration reporterConfiguration;
 
-    private final ReporterFactory reporterFactory;
-
     private final ClassLoader testClassLoader;
 
     private final DirectoryScannerParameters directoryScannerParameters;
@@ -62,13 +60,15 @@ public class TestNGProvider
 
     private final TestRequest testRequest;
 
+    private final ProviderParameters providerParameters;
+
     private TestsToRun testsToRun;
 
     private final File basedir;
 
     public TestNGProvider( ProviderParameters booterParameters )
     {
-        this.reporterFactory = booterParameters.getReporterFactory();
+        this.providerParameters = booterParameters;
         this.testClassLoader = booterParameters.getTestClassLoader();
         this.directoryScannerParameters = booterParameters.getDirectoryScannerParameters();
         this.providerProperties = booterParameters.getProviderProperties();
@@ -88,6 +88,8 @@ public class TestNGProvider
         throws TestSetFailedException, ReporterException
     {
 
+        final ReporterFactory reporterFactory = providerParameters.getReporterFactory();
+
         if ( isTestNGXmlTestSuite( testRequest ) )
         {
             TestNGXmlTestSuite testNGXmlTestSuite = getXmlSuite();
@@ -117,8 +119,8 @@ public class TestNGProvider
 
     boolean isTestNGXmlTestSuite( TestRequest testSuiteDefinition )
     {
-        return testSuiteDefinition.getSuiteXmlFiles() != null && testSuiteDefinition.getSuiteXmlFiles().size()
> 0
-            && testSuiteDefinition.getRequestedTest() == null;
+        return testSuiteDefinition.getSuiteXmlFiles() != null && testSuiteDefinition.getSuiteXmlFiles().size()
> 0 &&
+            testSuiteDefinition.getRequestedTest() == null;
 
     }
 
@@ -147,11 +149,6 @@ public class TestNGProvider
         {
             try
             {
-                // Added to free the streams when scanning the classpath.
-                // It is essentially wrong that the capture of stdout is embedded within
the reporter manager,
-                // which will change for 2.8.1+
-                reporterFactory.close();
-
                 return getXmlSuite().locateTestSets( testClassLoader ).keySet().iterator();
             }
             catch ( TestSetFailedException e )
@@ -162,11 +159,6 @@ public class TestNGProvider
         else
         {
             testsToRun = scanClassPath();
-            // Added to free the streams when scanning the classpath.
-            // It is essentially wrong that the capture of stdout is embedded within the
reporter manager,
-            // which will change for 2.8.1+
-            reporterFactory.close();
-
             return testsToRun.iterator();
         }
     }



Mime
View raw message