maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1044155 - in /maven/surefire/trunk: surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ surefire-api/src/main/java/org/apache/maven/surefire/report/ surefire-integration-tests/src/test/resources/surefire-141-pluggableprovider...
Date Thu, 09 Dec 2010 22:41:26 GMT
Author: krosenvold
Date: Thu Dec  9 22:41:25 2010
New Revision: 1044155

URL: http://svn.apache.org/viewvc?rev=1044155&view=rev
Log:
o Extracted an interface for ReporterFactory

Some of the old providers just cast this back to RMF, but it's
important to get interfaces in while it's still easy.

Added:
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java
  (with props)
Modified:
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/BaseProviderFactory.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory2.java
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java
    maven/surefire/trunk/surefire-providers/surefire-junit/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-api/src/main/java/org/apache/maven/surefire/providerapi/BaseProviderFactory.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/BaseProviderFactory.java?rev=1044155&r1=1044154&r2=1044155&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/BaseProviderFactory.java
(original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/BaseProviderFactory.java
Thu Dec  9 22:41:25 2010
@@ -20,6 +20,7 @@ package org.apache.maven.surefire.provid
  */
 
 import org.apache.maven.surefire.report.ReporterConfiguration;
+import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.ReporterManagerFactory;
 import org.apache.maven.surefire.report.ReporterManagerFactory2;
 import org.apache.maven.surefire.testset.DirectoryScannerParameters;
@@ -63,9 +64,9 @@ public class BaseProviderFactory
                                             directoryScannerParameters.getExcludes() );
     }
 
-    public ReporterManagerFactory getReporterManagerFactory()
+    public ReporterFactory getReporterFactory()
     {
-        ReporterManagerFactory reporterManagerFactory =
+        ReporterFactory reporterManagerFactory =
             new ReporterManagerFactory2( surefireClassLoader, reporterConfiguration );
         if ( providerProperties != null )
         {

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java?rev=1044155&r1=1044154&r2=1044155&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java
(original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java
Thu Dec  9 22:41:25 2010
@@ -1,6 +1,7 @@
 package org.apache.maven.surefire.providerapi;
 
 import org.apache.maven.surefire.report.ReporterConfiguration;
+import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.ReporterManagerFactory;
 import org.apache.maven.surefire.testset.DirectoryScannerParameters;
 import org.apache.maven.surefire.testset.TestArtifactInfo;
@@ -27,7 +28,7 @@ public interface ProviderParameters
      * Provides features for creating reporting objects
      * @return A ReporterManagerFactory that allows the creation of one or more ReporterManagers
      */
-    ReporterManagerFactory getReporterManagerFactory();
+    ReporterFactory getReporterFactory();
 
     /**
      * The raw parameters used in creating the directory scanner

Added: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java?rev=1044155&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java
(added)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java
Thu Dec  9 22:41:25 2010
@@ -0,0 +1,39 @@
+package org.apache.maven.surefire.report;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.maven.surefire.suite.RunResult;
+import org.apache.maven.surefire.testset.TestSetFailedException;
+
+/**
+ * @author Kristian Rosenvold
+ */
+public interface ReporterFactory
+{
+    public RunStatistics getGlobalRunStatistics();
+
+    public RunResult close();
+
+    public void warnIfNoTests() throws TestSetFailedException;
+
+    public ReporterManager createReporterManager() throws TestSetFailedException;
+
+}

Propchange: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory2.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory2.java?rev=1044155&r1=1044154&r2=1044155&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory2.java
(original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory2.java
Thu Dec  9 22:41:25 2010
@@ -40,7 +40,7 @@ import java.util.List;
  * @author Kristian Rosenvold (extracted factory)
  */
 public class ReporterManagerFactory2
-    extends ReporterManagerFactory
+    extends ReporterManagerFactory implements ReporterFactory
 {
     private final ReporterConfiguration reporterConfiguration;
 

Modified: maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java?rev=1044155&r1=1044154&r2=1044155&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java
(original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java
Thu Dec  9 22:41:25 2010
@@ -22,6 +22,7 @@ package org.apache.maven.surefire.testpr
 import org.apache.maven.surefire.providerapi.ProviderParameters;
 import org.apache.maven.surefire.providerapi.SurefireProvider;
 import org.apache.maven.surefire.report.ReporterException;
+import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.ReporterManagerFactory;
 import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.testset.TestSetFailedException;
@@ -34,12 +35,12 @@ import java.util.Iterator;
 public class TestProvider
     implements SurefireProvider
 {
-    private final ReporterManagerFactory reporterManagerFactory;
+    private final ReporterFactory reporterManagerFactory;
     private final ClassLoader testClassLoader;
 
     public TestProvider( ProviderParameters booterParameters )
     {
-        this.reporterManagerFactory = booterParameters.getReporterManagerFactory();
+        this.reporterManagerFactory = booterParameters.getReporterFactory();
         this.testClassLoader = booterParameters.getTestClassLoader();
     }
 

Modified: maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java?rev=1044155&r1=1044154&r2=1044155&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
Thu Dec  9 22:41:25 2010
@@ -22,6 +22,7 @@ package org.apache.maven.surefire.junit;
 import org.apache.maven.surefire.providerapi.ProviderParameters;
 import org.apache.maven.surefire.providerapi.SurefireProvider;
 import org.apache.maven.surefire.report.ReporterException;
+import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.ReporterManagerFactory;
 import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.testset.TestSetFailedException;
@@ -36,7 +37,7 @@ import java.util.Iterator;
 public class JUnit3Provider
     implements SurefireProvider
 {
-    private final ReporterManagerFactory reporterManagerFactory;
+    private final ReporterFactory reporterFactory;
 
     private final ClassLoader testClassLoader;
 
@@ -44,7 +45,7 @@ public class JUnit3Provider
 
     public JUnit3Provider( ProviderParameters booterParameters )
     {
-        this.reporterManagerFactory = booterParameters.getReporterManagerFactory();
+        this.reporterFactory = booterParameters.getReporterFactory();
         this.testClassLoader = booterParameters.getTestClassLoader();
         this.directoryScanner = booterParameters.getDirectoryScanner();
     }
@@ -56,16 +57,16 @@ public class JUnit3Provider
         suite.locateTestSets( testClassLoader );
         if ( forkTestSet != null )
         {
-            suite.execute( (String) forkTestSet, reporterManagerFactory, testClassLoader
);
+            suite.execute( (String) forkTestSet, (ReporterManagerFactory) reporterFactory,
testClassLoader );
         }
         else
         {
-            suite.execute( reporterManagerFactory, testClassLoader );
+            suite.execute( (ReporterManagerFactory) reporterFactory, testClassLoader );
         }
 
-        reporterManagerFactory.warnIfNoTests();
+        reporterFactory.warnIfNoTests();
 
-        return reporterManagerFactory.close();
+        return reporterFactory.close();
     }
 
     private JUnitDirectoryTestSuite getSuite()

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=1044155&r1=1044154&r2=1044155&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
Thu Dec  9 22:41:25 2010
@@ -22,6 +22,7 @@ package org.apache.maven.surefire.junit4
 import org.apache.maven.surefire.providerapi.ProviderParameters;
 import org.apache.maven.surefire.providerapi.SurefireProvider;
 import org.apache.maven.surefire.report.ReporterException;
+import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.ReporterManagerFactory;
 import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.testset.TestSetFailedException;
@@ -37,7 +38,7 @@ public class JUnit4Provider
     implements SurefireProvider
 {
 
-    private final ReporterManagerFactory reporterManagerFactory;
+    private final ReporterFactory reporterFactory;
 
     private final ClassLoader testClassLoader;
 
@@ -45,7 +46,7 @@ public class JUnit4Provider
 
     public JUnit4Provider( ProviderParameters booterParameters )
     {
-        this.reporterManagerFactory = booterParameters.getReporterManagerFactory();
+        this.reporterFactory = booterParameters.getReporterFactory();
         this.testClassLoader = booterParameters.getTestClassLoader();
         this.directoryScanner = booterParameters.getDirectoryScanner();
     }
@@ -58,15 +59,15 @@ public class JUnit4Provider
         suite.locateTestSets( testClassLoader );
         if ( forkTestSet != null )
         {
-            suite.execute( (String) forkTestSet, reporterManagerFactory, testClassLoader
);
+            suite.execute( (String) forkTestSet, ( ReporterManagerFactory)reporterFactory,
testClassLoader );
         }
         else
         {
-            suite.execute( reporterManagerFactory, testClassLoader );
+            suite.execute( ( ReporterManagerFactory)reporterFactory, testClassLoader );
         }
-        reporterManagerFactory.warnIfNoTests();
+        reporterFactory.warnIfNoTests();
 
-        return reporterManagerFactory.close();
+        return reporterFactory.close();
     }
 
     private JUnit4DirectoryTestSuite getSuite()

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=1044155&r1=1044154&r2=1044155&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
Thu Dec  9 22:41:25 2010
@@ -23,6 +23,7 @@ import org.apache.maven.surefire.NonAbst
 import org.apache.maven.surefire.providerapi.ProviderParameters;
 import org.apache.maven.surefire.providerapi.SurefireProvider;
 import org.apache.maven.surefire.report.ReporterException;
+import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.ReporterManagerFactory;
 import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.testset.TestSetFailedException;
@@ -37,7 +38,7 @@ import java.util.Iterator;
 public class JUnitCoreProvider
     implements SurefireProvider
 {
-    private final ReporterManagerFactory reporterManagerFactory;
+    private final ReporterFactory reporterFactory;
 
     private final ClassLoader testClassLoader;
 
@@ -52,7 +53,7 @@ public class JUnitCoreProvider
     @SuppressWarnings( { "UnusedDeclaration" } )
     public JUnitCoreProvider( ProviderParameters booterParameters )
     {
-        this.reporterManagerFactory = booterParameters.getReporterManagerFactory();
+        this.reporterFactory = booterParameters.getReporterFactory();
         this.testClassLoader = booterParameters.getTestClassLoader();
         this.directoryScanner = booterParameters.getDirectoryScanner();
         this.jUnitCoreParameters = new JUnitCoreParameters( booterParameters.getProviderProperties()
);
@@ -74,7 +75,7 @@ public class JUnitCoreProvider
         throws TestSetFailedException, ReporterException
     {
         final String message = "Concurrency config is " + jUnitCoreParameters.toString();
-        this.reporterManagerFactory.createReporterManager().writeConsoleMessage( message
);
+        this.reporterFactory.createReporterManager().writeConsoleMessage( message );
 
         if ( testsToRun == null )
         {
@@ -82,9 +83,9 @@ public class JUnitCoreProvider
                 ? scanClassPath()
                 : TestsToRun.fromClassName( (String) forkTestSet, testClassLoader );
         }
-        JUnitCoreWrapper.execute( testsToRun.getLocatedClasses(), this.reporterManagerFactory,
jUnitCoreParameters );
-        reporterManagerFactory.warnIfNoTests();
-        return reporterManagerFactory.close();
+        JUnitCoreWrapper.execute( testsToRun.getLocatedClasses(), ( ReporterManagerFactory)this.reporterFactory,
jUnitCoreParameters );
+        reporterFactory.warnIfNoTests();
+        return reporterFactory.close();
     }
 
     private TestsToRun scanClassPath()

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=1044155&r1=1044154&r2=1044155&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
Thu Dec  9 22:41:25 2010
@@ -23,6 +23,7 @@ import org.apache.maven.surefire.provide
 import org.apache.maven.surefire.providerapi.SurefireProvider;
 import org.apache.maven.surefire.report.ReporterConfiguration;
 import org.apache.maven.surefire.report.ReporterException;
+import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.ReporterManagerFactory;
 import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.suite.SurefireTestSuite;
@@ -49,7 +50,7 @@ public class TestNGProvider
 
     private final ReporterConfiguration reporterConfiguration;
 
-    private final ReporterManagerFactory reporterManagerFactory;
+    private final ReporterFactory reporterFactory;
 
     private final ClassLoader testClassLoader;
 
@@ -61,7 +62,7 @@ public class TestNGProvider
 
     public TestNGProvider( ProviderParameters booterParameters )
     {
-        this.reporterManagerFactory = booterParameters.getReporterManagerFactory();
+        this.reporterFactory = booterParameters.getReporterFactory();
         this.testClassLoader = booterParameters.getTestClassLoader();
         this.directoryScannerParameters = booterParameters.getDirectoryScannerParameters();
         this.providerProperties = booterParameters.getProviderProperties();
@@ -83,14 +84,14 @@ public class TestNGProvider
         suite.locateTestSets( testClassLoader );
         if ( forkTestSet != null && testRequest == null )
         {
-            suite.execute( (String) forkTestSet, reporterManagerFactory, testClassLoader
);
+            suite.execute( (String) forkTestSet, (ReporterManagerFactory)reporterFactory,
testClassLoader );
         }
         else
         {
-            suite.execute( reporterManagerFactory, testClassLoader );
+            suite.execute( (ReporterManagerFactory)reporterFactory, testClassLoader );
         }
-        reporterManagerFactory.warnIfNoTests();
-        return reporterManagerFactory.close();
+        reporterFactory.warnIfNoTests();
+        return reporterFactory.close();
     }
 
     boolean isTestNGXmlTestSuite( TestRequest testSuiteDefinition )



Mime
View raw message