maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1044651 [1/2] - in /maven/surefire/trunk: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ maven-surefire-common/src/test/java/org/apac...
Date Sat, 11 Dec 2010 13:28:40 GMT
Author: krosenvold
Date: Sat Dec 11 13:28:38 2010
New Revision: 1044651

URL: http://svn.apache.org/viewvc?rev=1044651&view=rev
Log:
o Extracted interfaces for the reporter function

Added:
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/DefaultReportEntry.java
      - copied, changed from r1044155, maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/RunReporter.java
      - copied, changed from r1044155, maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/SurefireConfigurationException.java   (with props)
Removed:
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory2.java
Modified:
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
    maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingStreamConsumerTest.java
    maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/AbstractOutputConsumerTestCase.java
    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/AbstractConsoleReporter.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/MulticastingReporter.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterConfiguration.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/PojoTestSet.java
    maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/AbstractConsoleReporterTestCase.java
    maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/XMLReporterTest.java
    maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java
    maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
    maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
    maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
    maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ClassesParallelRunListener.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReportingRunListener.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreWrapper.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/LogicalStream.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/MethodsParallelRunListener.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestSet.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReportingRunListenerTest.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTestCase.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MockReporter.java
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/SynchronizedReporterManager.java
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java Sat Dec 11 13:28:38 2010
@@ -821,20 +821,14 @@ public abstract class AbstractSurefireMo
     private List getReporters( boolean forking )
     {
         List reports = new ArrayList();
-        if ( isUseFile() )
+        final String consoleReporter = getConsoleReporter( forking );
+        if ( consoleReporter != null )
         {
-            if ( isPrintSummary() )
-            {
-                if ( forking )
-                {
-                    reports.add( ForkingConsoleReporter.class.getName() );
-                }
-                else
-                {
-                    reports.add( ConsoleReporter.class.getName() );
-                }
-            }
+            reports.add( consoleReporter );
+        }
 
+        if ( isUseFile() )
+        {
             if ( BRIEF_REPORT_FORMAT.equals( getReportFormat() ) )
             {
                 reports.add( BriefFileReporter.class.getName() );
@@ -844,17 +838,6 @@ public abstract class AbstractSurefireMo
                 reports.add( FileReporter.class.getName() );
             }
         }
-        else
-        {
-            if ( BRIEF_REPORT_FORMAT.equals( getReportFormat() ) )
-            {
-                reports.add( BriefConsoleReporter.class.getName() );
-            }
-            else if ( PLAIN_REPORT_FORMAT.equals( getReportFormat() ) )
-            {
-                reports.add( DetailedConsoleReporter.class.getName() );
-            }
-        }
 
         if ( !isDisableXmlReport() )
         {
@@ -863,6 +846,30 @@ public abstract class AbstractSurefireMo
         return reports;
     }
 
+
+    /**
+     * Returns the reporter that will write to the console
+     *
+     * @param forking forking
+     * @return a console reporter of null if no console reporting
+     */
+    private String getConsoleReporter( boolean forking )
+    {
+        if ( isUseFile() && isPrintSummary() )
+        {
+            return forking ? ForkingConsoleReporter.class.getName() : ConsoleReporter.class.getName();
+        }
+        else if ( BRIEF_REPORT_FORMAT.equals( getReportFormat() ) )
+        {
+            return BriefConsoleReporter.class.getName();
+        }
+        else if ( PLAIN_REPORT_FORMAT.equals( getReportFormat() ) )
+        {
+            return DetailedConsoleReporter.class.getName();
+        }
+        return null;
+    }
+
     protected void ensureWorkingDirectoryExists()
         throws MojoFailureException
     {

Modified: maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingStreamConsumerTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingStreamConsumerTest.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingStreamConsumerTest.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingStreamConsumerTest.java Sat Dec 11 13:28:38 2010
@@ -19,8 +19,8 @@ package org.apache.maven.plugin.surefire
  * under the License.
  */
 
-import org.apache.maven.plugin.surefire.booterclient.ForkingStreamConsumer;
 import org.apache.maven.plugin.surefire.booterclient.output.OutputConsumer;
+import org.apache.maven.surefire.report.DefaultReportEntry;
 import org.apache.maven.surefire.report.ForkingConsoleReporter;
 import org.apache.maven.surefire.report.ReportEntry;
 import org.jmock.Mock;
@@ -51,9 +51,7 @@ public class ForkingStreamConsumerTest
         outputConsumerMock = new Mock( OutputConsumer.class );
         streamConsumer = new ForkingStreamConsumer( (OutputConsumer) outputConsumerMock.proxy() );
         message = "message";
-        reportEntry = new ReportEntry();
-        reportEntry.setGroup( "group" );
-        reportEntry.setName( "name" );
+        reportEntry = DefaultReportEntry.nameGroup( "name", "group" );
     }
 
     public void testConsumeHeaderLine()

Modified: maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/AbstractOutputConsumerTestCase.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/AbstractOutputConsumerTestCase.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/AbstractOutputConsumerTestCase.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/AbstractOutputConsumerTestCase.java Sat Dec 11 13:28:38 2010
@@ -20,6 +20,7 @@ package org.apache.maven.plugin.surefire
  */
 
 import junit.framework.TestCase;
+import org.apache.maven.surefire.report.DefaultReportEntry;
 import org.apache.maven.surefire.report.ReportEntry;
 
 /**
@@ -42,9 +43,7 @@ public abstract class AbstractOutputCons
     {
         super.setUp();
         setLine( "line" );
-        setReportEntry( new ReportEntry() );
-        getReportEntry().setGroup( "group" );
-        getReportEntry().setName( "name" );
+        setReportEntry( DefaultReportEntry.nameGroup( "name", "group" ) );
     }
 
     public void setOutputConsumer( OutputConsumer outputConsumer )

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=1044651&r1=1044650&r2=1044651&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 Sat Dec 11 13:28:38 2010
@@ -22,7 +22,6 @@ 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;
 import org.apache.maven.surefire.testset.TestArtifactInfo;
 import org.apache.maven.surefire.testset.TestRequest;
@@ -67,7 +66,7 @@ public class BaseProviderFactory
     public ReporterFactory getReporterFactory()
     {
         ReporterFactory reporterManagerFactory =
-            new ReporterManagerFactory2( surefireClassLoader, reporterConfiguration );
+            new ReporterManagerFactory( surefireClassLoader, reporterConfiguration );
         if ( providerProperties != null )
         {
             reporterManagerFactory.getGlobalRunStatistics().initResultsFromProperties( providerProperties );

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=1044651&r1=1044650&r2=1044651&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 Sat Dec 11 13:28:38 2010
@@ -2,7 +2,6 @@ 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.testset.DirectoryScannerParameters;
 import org.apache.maven.surefire.testset.TestArtifactInfo;
 import org.apache.maven.surefire.testset.TestRequest;
@@ -20,30 +19,35 @@ public interface ProviderParameters
     /**
      * Provides a directory scanner that enforces the includes/excludes parameters that were passed to surefire.
      * See #getDirectoryScannerParameters for details
+     *
      * @return The directory scanner
      */
     DirectoryScanner getDirectoryScanner();
 
     /**
      * Provides features for creating reporting objects
-     * @return A ReporterManagerFactory that allows the creation of one or more ReporterManagers
+     *
+     * @return A ReporterFactory that allows the creation of one or more ReporterManagers
      */
     ReporterFactory getReporterFactory();
 
     /**
      * The raw parameters used in creating the directory scanner
+     *
      * @return The parameters
      */
     DirectoryScannerParameters getDirectoryScannerParameters();
 
     /**
      * The raw parameters used in creating the ReporterManagerFactory
+     *
      * @return The reporter configuration
      */
     ReporterConfiguration getReporterConfiguration();
 
     /**
      * Contains information about requested test suites or individual tests from the command line.
+     *
      * @return The testRequest
      */
 
@@ -51,18 +55,21 @@ public interface ProviderParameters
 
     /**
      * The class loader for the tests
+     *
      * @return the classloader
      */
     ClassLoader getTestClassLoader();
 
     /**
      * The per-provider specific properties that may come all the way from the plugin's properties setting.
+     *
      * @return the provider specific properties
      */
     Properties getProviderProperties();
 
     /**
      * Artifact info about the artifact used to autodetect provider
+     *
      * @return The artifactinfo, or null if autodetect was not used.
      */
     TestArtifactInfo getTestArtifactInfo();

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java Sat Dec 11 13:28:38 2010
@@ -31,6 +31,7 @@ import java.io.PrintWriter;
  */
 public abstract class AbstractConsoleReporter
     extends AbstractTextReporter
+    implements RunReporter
 {
     private static final String TEST_SET_STARTING_PREFIX = "Running ";
 
@@ -45,16 +46,18 @@ public abstract class AbstractConsoleRep
     protected AbstractConsoleReporter( String format, ReporterConfiguration reporterConfiguration )
     {
         // TODO: use logger
-        super( new PrintWriter( new OutputStreamWriter( new BufferedOutputStream( originalSystemOut, BUFFER_SIZE ) ) ), format,
-               reporterConfiguration );
+        super( new PrintWriter( new OutputStreamWriter( new BufferedOutputStream( originalSystemOut, BUFFER_SIZE ) ) ),
+               format, reporterConfiguration );
     }
 
-    /** @deprecated Can be removed once we build surefire with 2.7 */
+    /**
+     * @deprecated Can be removed once we build surefire with 2.7
+     */
     protected AbstractConsoleReporter( String format, Boolean trimStackTrace )
     {
         // TODO: use logger
-        super( new PrintWriter( new OutputStreamWriter( new BufferedOutputStream( originalSystemOut, BUFFER_SIZE ) ) ), format,
-               trimStackTrace );
+        super( new PrintWriter( new OutputStreamWriter( new BufferedOutputStream( originalSystemOut, BUFFER_SIZE ) ) ),
+               format, trimStackTrace );
     }
 
     public void testSetStarting( ReportEntry report )
@@ -131,7 +134,8 @@ public abstract class AbstractConsoleRep
      */
     public static ReportEntry parseTestSetStartingMessage( String message )
     {
-        ReportEntry reportEntry = new ReportEntry();
+        String name;
+        String group = null;
         int i = message.indexOf( TEST_SET_STARTING_GROUP_PREFIX );
         int j;
         if ( i >= 0 )
@@ -141,7 +145,7 @@ public abstract class AbstractConsoleRep
             {
                 throw new RuntimeException( "Message provided can not be parsed" );
             }
-            reportEntry.setGroup( message.substring( i + TEST_SET_STARTING_GROUP_PREFIX.length(), j ) );
+            group = message.substring( i + TEST_SET_STARTING_GROUP_PREFIX.length(), j );
         }
         else
         {
@@ -151,8 +155,8 @@ public abstract class AbstractConsoleRep
                 throw new RuntimeException( "Message provided can not be parsed" );
             }
         }
-        reportEntry.setName( message.substring( TEST_SET_STARTING_PREFIX.length(), i ) );
-        return reportEntry;
+        name = message.substring( TEST_SET_STARTING_PREFIX.length(), i );
+        return DefaultReportEntry.nameGroup( name, group );
     }
 
     /**

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java Sat Dec 11 13:28:38 2010
@@ -53,7 +53,9 @@ public abstract class AbstractTextReport
         this.format = format;
     }
 
-    /** @deprecated Can be removed once we build Surefire with 2.7 */
+    /**
+     * @deprecated Can be removed once we build Surefire with 2.7
+     */
     protected AbstractTextReporter( String format, Boolean trimStackTrace )
     {
         super( trimStackTrace );
@@ -61,7 +63,9 @@ public abstract class AbstractTextReport
         this.format = format;
     }
 
-    /** @deprecated Can be removed once we build Surefire with 2.7 */
+    /**
+     * @deprecated Can be removed once we build Surefire with 2.7
+     */
     protected AbstractTextReporter( PrintWriter writer, String format, Boolean trimStackTrace )
     {
         super( trimStackTrace );
@@ -96,6 +100,11 @@ public abstract class AbstractTextReport
         }
     }
 
+    public void writeDetailMessage( String message )
+    {
+        writeMessage( message );
+    }
+
     public void testSucceeded( ReportEntry report )
     {
         super.testSucceeded( report );

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java Sat Dec 11 13:28:38 2010
@@ -35,9 +35,15 @@ public class BriefFileReporter
         super( reporterConfiguration, BRIEF );
     }
 
-    /** @deprecated Can be removed once we build Surefire with 2.7 */
+    /**
+     * @deprecated Can be removed once we build Surefire with 2.7
+     */
     public BriefFileReporter( File reportsDirectory, Boolean trimStackTrace )
     {
         super( reportsDirectory, BRIEF, trimStackTrace );
     }
+
+    public void writeDetailMessage( String message )
+    {
+    }
 }

Copied: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/DefaultReportEntry.java (from r1044155, 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/DefaultReportEntry.java?p2=maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/DefaultReportEntry.java&p1=maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java&r1=1044155&r2=1044651&rev=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/DefaultReportEntry.java Sat Dec 11 13:28:38 2010
@@ -19,21 +19,27 @@ package org.apache.maven.surefire.report
  * under the License.
  */
 
-
-import org.apache.maven.surefire.suite.RunResult;
-import org.apache.maven.surefire.testset.TestSetFailedException;
-
 /**
  * @author Kristian Rosenvold
  */
-public interface ReporterFactory
+public class DefaultReportEntry extends ReportEntry
 {
-    public RunStatistics getGlobalRunStatistics();
-
-    public RunResult close();
-
-    public void warnIfNoTests() throws TestSetFailedException;
-
-    public ReporterManager createReporterManager() throws TestSetFailedException;
-
+    public DefaultReportEntry( String source, String name, String message )
+    {
+        super( source, name, null, message, null );
+    }
+
+    public DefaultReportEntry( String source, String name, String group, String message )
+    {
+        super( source, name, group, message, null );
+    }
+
+    public DefaultReportEntry( String source, String name, String message, StackTraceWriter stackTraceWriter )
+    {
+        super( source, name, null, message, stackTraceWriter );
+    }
+
+    public static ReportEntry nameGroup(String name, String group){
+        return new ReportEntry( name, group);
+    }
 }

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/MulticastingReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/MulticastingReporter.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/MulticastingReporter.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/MulticastingReporter.java Sat Dec 11 13:28:38 2010
@@ -28,7 +28,7 @@ import java.util.List;
  * @author Kristian Rosenvold
  */
 public class MulticastingReporter
-    implements Reporter
+    implements Reporter, RunReporter
 {
     private final List target;
 
@@ -67,7 +67,11 @@ public class MulticastingReporter
     {
         for ( Iterator it = target.iterator(); it.hasNext(); )
         {
-            ( (Reporter) it.next() ).runStarting();
+            Object next = it.next();
+            if ( next instanceof RunReporter )
+            {
+                ( (RunReporter) next ).runStarting();
+            }
         }
     }
 
@@ -75,7 +79,11 @@ public class MulticastingReporter
     {
         for ( Iterator it = target.iterator(); it.hasNext(); )
         {
-            ( (Reporter) it.next() ).runCompleted();
+            Object next = it.next();
+            if ( next instanceof RunReporter )
+            {
+                ( (RunReporter) next ).runCompleted();
+            }
         }
     }
 
@@ -133,6 +141,15 @@ public class MulticastingReporter
         }
     }
 
+    public void writeDetailMessage( String message )
+    {
+        for ( Iterator it = target.iterator(); it.hasNext(); )
+        {
+            Reporter reporter = ( (Reporter) it.next() );
+            reporter.writeDetailMessage( message );
+        }
+    }
+
     public void writeMessage( String message )
     {
         for ( Iterator it = target.iterator(); it.hasNext(); )

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java Sat Dec 11 13:28:38 2010
@@ -23,58 +23,34 @@ import org.apache.commons.lang.builder.E
 import org.apache.commons.lang.builder.HashCodeBuilder;
 import org.apache.commons.lang.builder.ToStringBuilder;
 
+// todo: Make this an interface when surefire 2.7.1 compiles with surefire 2.7.0
 public class ReportEntry
 {
-    private String source;
+    private final String source;
 
-    private String name;
+    private final String name;
 
-    private String group;
+    private final String group;
 
-    private String message;
+    private final String message;
 
-    private StackTraceWriter stackTraceWriter;
+    private final StackTraceWriter stackTraceWriter;
 
-    public ReportEntry()
+    protected ReportEntry( String name, String group )
     {
+        this.name = name;
+        this.group = group;
+        this.stackTraceWriter = null;
+        this.message = null;
+        this.source = null;
     }
 
-    public ReportEntry( Object source, String name, String message )
-    {
-        this( source.getClass().getName(), name, null, message );
-    }
-
-    public ReportEntry( Object source, String name, String group, String message )
-    {
-        this( source.getClass().getName(), name, group, message, null );
-    }
-
-    public ReportEntry( Object source, String name, String message, StackTraceWriter stackTraceWriter )
-    {
-        this( source.getClass().getName(), name, null, message, stackTraceWriter );
-    }
-
-    public ReportEntry( Object source, String name, String group, String message, StackTraceWriter stackTraceWriter )
-    {
-        this( source.getClass().getName(), name, group, message, stackTraceWriter );
-    }
-    
     public ReportEntry( String source, String name, String message )
     {
-        this( source, name, null, message );
-    }
-
-    public ReportEntry( String source, String name, String group, String message )
-    {
-        this( source, name, group, message, null );
+        this( source, name, null, message, null );
     }
 
-    public ReportEntry( String source, String name, String message, StackTraceWriter stackTraceWriter )
-    {
-        this( source, name, null, message, stackTraceWriter );
-    }
-
-    public ReportEntry( String source, String name, String group, String message, StackTraceWriter stackTraceWriter )
+    protected ReportEntry( String source, String name, String group, String message, StackTraceWriter stackTraceWriter )
     {
         if ( source == null )
         {
@@ -89,28 +65,15 @@ public class ReportEntry
             throw new NullPointerException( "message is null" );
         }
 
-        this.setSource( source );
-
-        this.setName( name );
+        this.source = source;
 
-        this.setGroup( group );
+        this.name = name;
 
-        this.setMessage( message );
+        this.group = group;
 
-        this.setStackTraceWriter( stackTraceWriter );
-    }
+        this.message = message;
 
-    public void setSource( String source )
-    {
-        this.source = source;
-    }
-    
-    /**
-     * @deprecated Use {@link #getSourceName()} instead
-     */
-    public Object getSource()
-    {
-        return getSourceName();
+        this.stackTraceWriter = stackTraceWriter;
     }
 
     public String getSourceName()
@@ -118,41 +81,21 @@ public class ReportEntry
         return source;
     }
 
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
     public String getName()
     {
         return name;
     }
 
-    public void setGroup( String group )
-    {
-        this.group = group;
-    }
-
     public String getGroup()
     {
         return group;
     }
 
-    public void setMessage( String message )
-    {
-        this.message = message;
-    }
-
     public String getMessage()
     {
         return message;
     }
 
-    public void setStackTraceWriter( StackTraceWriter stackTraceWriter )
-    {
-        this.stackTraceWriter = stackTraceWriter;
-    }
-
     public StackTraceWriter getStackTraceWriter()
     {
         return stackTraceWriter;
@@ -169,24 +112,17 @@ public class ReportEntry
             return true;
         }
         ReportEntry rhs = (ReportEntry) obj;
-        return new EqualsBuilder()
-            .append( getSourceName(), rhs.getSourceName() )
-            .append( getName(), rhs.getName() )
-            .append( getGroup(), rhs.getGroup() )
-            .append( getMessage(), rhs.getMessage() )
-            .append( getStackTraceWriter(), rhs.getStackTraceWriter() )
-            .isEquals();
+        return new EqualsBuilder().append( getSourceName(), rhs.getSourceName() ).append( getName(),
+                                                                                          rhs.getName() ).append(
+            getGroup(), rhs.getGroup() ).append( getMessage(), rhs.getMessage() ).append( getStackTraceWriter(),
+                                                                                          rhs.getStackTraceWriter() ).isEquals();
     }
 
     public String toString()
     {
-        return new ToStringBuilder( this )
-            .append( "source", getSourceName() )
-            .append( "name", getName() )
-            .append( "group", getGroup() )
-            .append( "message", getMessage() )
-            .append( "stackTraceWriter", getStackTraceWriter() )
-            .toString();
+        return new ToStringBuilder( this ).append( "source", getSourceName() ).append( "name", getName() ).append(
+            "group", getGroup() ).append( "message", getMessage() ).append( "stackTraceWriter",
+                                                                            getStackTraceWriter() ).toString();
     }
 
     public int hashCode()
@@ -194,13 +130,8 @@ public class ReportEntry
         // you pick a hard-coded, randomly chosen, non-zero, odd number
         // ideally different for each class
         // good resource at http://primes.utm.edu/lists/small/1000.txt
-        return new HashCodeBuilder( 5897, 6653 )
-            .append( getSourceName() )
-            .append( getName() )
-            .append( getGroup() )
-            .append( getMessage() )
-            .append( getStackTraceWriter() )
-            .toHashCode();
+        return new HashCodeBuilder( 5897, 6653 ).append( getSourceName() ).append( getName() ).append(
+            getGroup() ).append( getMessage() ).append( getStackTraceWriter() ).toHashCode();
     }
 
 }

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java Sat Dec 11 13:28:38 2010
@@ -20,21 +20,27 @@ package org.apache.maven.surefire.report
  */
 
 /**
- * Contract between the different implementations of the Surefire reporters
- *
- * @version $Id$
+ * Used by providers to report results.
+ * Using this interface integrates the providers together into a common reporting infrastructure.
+ * <p/>
+ * An instance of a reporter is not guaranteed to be thread-safe and concurrent test frameworks
+ * must request an instance of a reporter per-thread from the ReporterFactory.
  */
 public interface Reporter
 {
-    // The entire run
-    void runStarting();
-
-    void runCompleted();
-
-    // Test Sets
+    /**
+     * Indicates the start of a given test-set
+     *
+     * @param report the report entry describing the testset
+     */
     void testSetStarting( ReportEntry report )
         throws ReporterException;
 
+    /**
+     * Indicates end of a given test-set
+     *
+     * @param report the report entry describing the testset
+     */
     void testSetCompleted( ReportEntry report )
         throws ReporterException;
 
@@ -74,11 +80,29 @@ public interface Reporter
 
     void testSkipped( ReportEntry report );
 
-    // Counters
-    void reset();
 
+    /**
+     * Writes a message that will be displayed in all free-text format reporters.
+     * These messages will be output regardless, as opposed to #writeDetailMessage,
+     * which is controlled by reportFormat.
+     *
+     * @param message The message to write.
+     */
     void writeMessage( String message );
 
-    void writeFooter( String footer );
+    /**
+     * Writes a detailed message that will not necessarily be displayed in all channels.
+     * This is controlled by reportFormat attribute on the plugin.
+     *
+     * @param message The message to write
+     */
+    void writeDetailMessage( String message );
 
+    /**
+     * Restores the instance of the reporter, making the instance re-usable for a subsequent run in the
+     * same thread.
+     */
+    void reset();
+
+    void writeFooter( String footer );
 }

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterConfiguration.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterConfiguration.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterConfiguration.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterConfiguration.java Sat Dec 11 13:28:38 2010
@@ -20,6 +20,7 @@ package org.apache.maven.surefire.report
  */
 
 import java.io.File;
+import java.io.PrintStream;
 import java.util.List;
 
 /**
@@ -31,6 +32,10 @@ public class ReporterConfiguration
 
     private final File reportsDirectory;
 
+    private final PrintStream originalSystemOut;
+
+    private final PrintStream originalSystemErr;
+
     /**
      * A non-null Boolean value
      */
@@ -41,10 +46,18 @@ public class ReporterConfiguration
         this.reports = reports;
         this.reportsDirectory = reportsDirectory;
         this.trimStackTrace = trimStackTrace;
+        /*
+        * While this may seem slightly odd, when this object is constructted no user code has been run
+        * (including classloading), and we can be guaranteed that no-one has modified System.out/System.err.
+        * As soon as we start loading user code, all h*ll breaks loose in this respect.
+         */
+        this.originalSystemOut = System.out;
+        this.originalSystemErr = System.err;
     }
 
     /**
      * The directory where reports will be created, normally ${project.build.directory}/surefire-reports
+     *
      * @return A file pointing at the specified directory
      */
     public File getReportsDirectory()
@@ -54,6 +67,7 @@ public class ReporterConfiguration
 
     /**
      * Indicates if reporting should trim the stack traces.
+     *
      * @return true if stacktraces should be trimmed in reporting
      */
     public Boolean isTrimStackTrace()
@@ -63,11 +77,34 @@ public class ReporterConfiguration
 
     /**
      * A list of classnames representing runnable reports for this test-run.
+     *
      * @return A list of strings, each string is a classname of a class
-     * implementing the org.apache.maven.surefire.report.Reporter interface
+     *         implementing the org.apache.maven.surefire.report.Reporter interface
      */
     public List getReports()
     {
         return reports;
     }
+
+    /**
+     * The original system out belonging to the (possibly forked) surefire process.
+     * Note that users of Reporter/ReporterFactory should normally not be using this.
+     *
+     * @return A printstream.
+     */
+    public PrintStream getOriginalSystemOut()
+    {
+        return originalSystemOut;
+    }
+
+    /**
+     * The original system err belonging to the (possibly forked) surefire process.
+     * Note that users of Reporter/ReporterFactory should normally not be using this.
+     *
+     * @return A printstream.
+     */
+    public PrintStream getOriginalSystemErr()
+    {
+        return originalSystemErr;
+    }
 }

Modified: 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=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java Sat Dec 11 13:28:38 2010
@@ -30,10 +30,13 @@ public interface ReporterFactory
 {
     public RunStatistics getGlobalRunStatistics();
 
-    public RunResult close();
-
-    public void warnIfNoTests() throws TestSetFailedException;
+    /**
+     * Creates a (non-thread-safe) reporter
+     *
+     * @return A reporter instance
+     */
+    public Reporter createReporter();
 
-    public ReporterManager createReporterManager() throws TestSetFailedException;
+    public RunResult close();
 
 }

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java Sat Dec 11 13:28:38 2010
@@ -37,25 +37,29 @@ import java.util.List;
  * <p/>
  */
 public class ReporterManager
+    implements Reporter, RunReporter
 {
     private final RunStatistics runStatisticsForThis;
 
     private final MulticastingReporter multicastingReporter;
 
+    private final RunReporter runReporter;
+
     private final SystemStreamCapturer consoleCapturer;
 
     public ReporterManager( List reports, RunStatistics runStatisticsForThis )
     {
-        this.consoleCapturer =  new SystemStreamCapturer();
-        multicastingReporter = new MulticastingReporter( reports );
+        this.consoleCapturer = new SystemStreamCapturer();
+        runReporter = multicastingReporter = new MulticastingReporter( reports );
         this.runStatisticsForThis = runStatisticsForThis;
     }
 
     protected ReporterManager( ReporterManager other )
     {
         this.multicastingReporter = other.multicastingReporter;
+        this.runReporter = other.multicastingReporter;
         this.runStatisticsForThis = other.runStatisticsForThis;
-        this.consoleCapturer =  other.consoleCapturer;
+        this.consoleCapturer = other.consoleCapturer;
     }
 
     public void writeMessage( String message )
@@ -68,6 +72,11 @@ public class ReporterManager
         multicastingReporter.writeConsoleMessage( message );
     }
 
+    public void writeDetailMessage( String message )
+    {
+        multicastingReporter.writeDetailMessage( message );
+    }
+
     // ----------------------------------------------------------------------
     // Run
     // ----------------------------------------------------------------------

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java Sat Dec 11 13:28:38 2010
@@ -20,7 +20,9 @@ package org.apache.maven.surefire.report
  */
 
 import org.apache.maven.surefire.suite.RunResult;
+import org.apache.maven.surefire.testset.SurefireConfigurationException;
 import org.apache.maven.surefire.testset.TestSetFailedException;
+import org.apache.maven.surefire.util.NestedRuntimeException;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
@@ -42,10 +44,10 @@ import java.util.List;
  */
 
 /**
- * NOTE: The ReporterManagerFactory2 should take over for this once we build surefire with 2.7,
- * just merge it into this class, this is just a hack to be able to build 2.7 with 2.5
+ * Note; this class contains "old" and "new" style instantiation, "old" style can be removed once we build 2.7.X + with 2.7
  */
 public class ReporterManagerFactory
+    implements ReporterFactory
 {
     protected final List reportDefinitions;
 
@@ -53,17 +55,30 @@ public class ReporterManagerFactory
 
     protected final RunStatistics globalRunStatistics = new RunStatistics();
 
-    protected ReporterManager first;
+    private final ReporterConfiguration reporterConfiguration;
+
+    protected RunReporter first;
 
     protected final Object lock = new Object();
 
 
     public ReporterManagerFactory( List reportDefinitions, ClassLoader surefireClassLoader )
     {
+        this( reportDefinitions, surefireClassLoader, null );
+    }
+
+    public ReporterManagerFactory( List reportDefinitions, ClassLoader surefireClassLoader,
+                                   ReporterConfiguration reporterConfiguration )
+    {
         this.reportDefinitions = reportDefinitions;
         this.surefireClassLoader = surefireClassLoader;
+        this.reporterConfiguration = reporterConfiguration;
     }
 
+    public ReporterManagerFactory( ClassLoader surefireClassLoader, ReporterConfiguration reporterConfiguration )
+    {
+        this( reporterConfiguration.getReports(), surefireClassLoader, reporterConfiguration );
+    }
 
     public RunStatistics getGlobalRunStatistics()
     {
@@ -74,6 +89,20 @@ public class ReporterManagerFactory
         throws TestSetFailedException
     {
         final List reports = instantiateReports( reportDefinitions, surefireClassLoader );
+        return (ReporterManager) setupReporter( reports );
+
+    }
+
+    public Reporter createReporter()
+    {
+        final List reports =
+            instantiateReportsNewStyle( reportDefinitions, reporterConfiguration, surefireClassLoader );
+        return setupReporter( reports );
+    }
+
+
+    private Reporter setupReporter( List reports )
+    {
         // Note, if we ever start making >1 reporter Managers, we have to aggregate run statistics
         // i.e. we cannot use a single "globalRunStatistics"
         final ReporterManager reporterManager = new ReporterManager( reports, globalRunStatistics );
@@ -91,8 +120,10 @@ public class ReporterManagerFactory
         return reporterManager;
     }
 
+
     public RunResult close()
     {
+        warnIfNoTests();
         synchronized ( lock )
         {
             if ( first != null )
@@ -103,10 +134,26 @@ public class ReporterManagerFactory
         }
     }
 
-
     private List instantiateReports( List reportDefinitions, ClassLoader classLoader )
         throws TestSetFailedException
     {
+        if ( reportDefinitions.size() == 0 )
+        {
+            return new ArrayList();
+        }
+        if ( reportDefinitions.iterator().next() instanceof String )
+        {
+            return instantiateReportsNewStyle( reportDefinitions, reporterConfiguration, classLoader );
+        }
+        else
+        {
+            return instantiateReportsOldStyle( reportDefinitions, classLoader );
+        }
+    }
+
+    private List instantiateReportsOldStyle( List reportDefinitions, ClassLoader classLoader )
+        throws TestSetFailedException
+    {
         List reports = new ArrayList();
 
         for ( Iterator i = reportDefinitions.iterator(); i.hasNext(); )
@@ -124,6 +171,81 @@ public class ReporterManagerFactory
         return reports;
     }
 
+    protected List instantiateReportsNewStyle( List reportDefinitions, ReporterConfiguration reporterConfiguration,
+                                               ClassLoader classLoader )
+    {
+        List reports = new ArrayList();
+
+        for ( Iterator i = reportDefinitions.iterator(); i.hasNext(); )
+        {
+
+            String className = (String) i.next();
+
+            Reporter report = instantiateReportNewStyle( className, reporterConfiguration, classLoader );
+
+            reports.add( report );
+        }
+
+        return reports;
+    }
+
+    private static Reporter instantiateReportNewStyle( String className, ReporterConfiguration params,
+                                                       ClassLoader classLoader )
+    {
+        try
+        {
+            return (Reporter) instantiateObject( className, params, classLoader );
+        }
+        catch ( ClassNotFoundException e )
+        {
+            throw new SurefireConfigurationException( "Unable to find class to create report '" + className + "'", e );
+        }
+        catch ( NoSuchMethodException e )
+        {
+            throw new SurefireConfigurationException(
+                "Unable to find appropriate constructor to create report: " + e.getMessage(), e );
+        }
+    }
+
+
+    private static Object instantiateObject( String className, ReporterConfiguration params, ClassLoader classLoader )
+        throws SurefireConfigurationException, ClassNotFoundException, NoSuchMethodException
+    {
+        Class clazz = classLoader.loadClass( className );
+
+        Object object;
+        try
+        {
+            if ( params != null )
+            {
+                Class[] paramTypes = new Class[1];
+                paramTypes[0] = classLoader.loadClass( ReporterConfiguration.class.getName() );
+
+                Constructor constructor = clazz.getConstructor( paramTypes );
+
+                object = constructor.newInstance( new Object[]{ params } );
+            }
+            else
+            {
+                object = clazz.newInstance();
+            }
+        }
+        catch ( IllegalAccessException e )
+        {
+            throw new SurefireConfigurationException( "Unable to instantiate object: " + e.getMessage(), e );
+        }
+        catch ( InvocationTargetException e )
+        {
+            throw new SurefireConfigurationException( e.getTargetException().getMessage(), e.getTargetException() );
+        }
+        catch ( InstantiationException e )
+        {
+            throw new SurefireConfigurationException( "Unable to instantiate object: " + e.getMessage(), e );
+        }
+        return object;
+    }
+
+
     private static Reporter instantiateReport( String className, Object[] params, ClassLoader classLoader )
         throws TestSetFailedException
     {
@@ -190,12 +312,18 @@ public class ReporterManagerFactory
         return object;
     }
 
-    public void warnIfNoTests()
-        throws TestSetFailedException
+    private void warnIfNoTests()
     {
         if ( getGlobalRunStatistics().getRunResult().getCompletedCount() == 0 )
         {
-            createReporterManager().writeMessage( "There are no tests to run." );
+            try
+            {
+                createReporterManager().writeMessage( "There are no tests to run." );
+            }
+            catch ( TestSetFailedException e )
+            {
+                throw new NestedRuntimeException( e );
+            }
         }
     }
 }

Copied: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/RunReporter.java (from r1044155, 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/RunReporter.java?p2=maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/RunReporter.java&p1=maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java&r1=1044155&r2=1044651&rev=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/RunReporter.java Sat Dec 11 13:28:38 2010
@@ -19,21 +19,20 @@ package org.apache.maven.surefire.report
  * under the License.
  */
 
-
-import org.apache.maven.surefire.suite.RunResult;
-import org.apache.maven.surefire.testset.TestSetFailedException;
-
 /**
- * @author Kristian Rosenvold
+ * A reporter that is aware of run start/run finished events
  */
-public interface ReporterFactory
+public interface RunReporter
 {
-    public RunStatistics getGlobalRunStatistics();
-
-    public RunResult close();
-
-    public void warnIfNoTests() throws TestSetFailedException;
-
-    public ReporterManager createReporterManager() throws TestSetFailedException;
-
+    /**
+     * Indicates the start of the entire test run.
+     * Only called on the first provider, and just by the ReporterFactory
+     */
+    void runStarting();
+
+    /**
+     * Indicates the end of the entire test run
+     * Only called on the first provider, and just by the ReporterFactory
+     */
+    void runCompleted();
 }

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java Sat Dec 11 13:28:38 2010
@@ -61,7 +61,9 @@ public class XMLReporter
         this.reportsDirectory = reporterConfiguration.getReportsDirectory();
     }
 
-    /** @deprecated Can be removed once we build surfire with 2.7 */
+    /**
+     * @deprecated Can be removed once we build surfire with 2.7
+     */
     public XMLReporter( File reportsDirectory, Boolean trimStackTrace )
     {
         super( trimStackTrace );
@@ -74,6 +76,10 @@ public class XMLReporter
     {
     }
 
+    public void writeDetailMessage( String message )
+    {
+    }
+
     public void testSetCompleted( ReportEntry report )
         throws ReporterException
     {
@@ -172,7 +178,7 @@ public class XMLReporter
         testCase.setAttribute( "time", elapsedTimeAsString( runTime ) );
         return testCase;
     }
-    
+
     private Xpp3Dom createTestSuiteElement( ReportEntry report, long runTime )
     {
         Xpp3Dom testCase = new Xpp3Dom( "testsuite" );
@@ -198,7 +204,7 @@ public class XMLReporter
 
         writeTestProblems( report, stdOut, stdErr, "failure" );
     }
-    
+
     public void testSkipped( ReportEntry report )
     {
         super.testSkipped( report );
@@ -231,8 +237,8 @@ public class XMLReporter
                 element.setAttribute( "message", message );
 
                 element.setAttribute( "type", ( stackTrace.indexOf( ":" ) > -1
-                                                ? stackTrace.substring( 0, stackTrace.indexOf( ":" ) )
-                                                : stackTrace ) );
+                    ? stackTrace.substring( 0, stackTrace.indexOf( ":" ) )
+                    : stackTrace ) );
             }
             else
             {

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java Sat Dec 11 13:28:38 2010
@@ -21,6 +21,7 @@ package org.apache.maven.surefire.suite;
 
 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.ReporterManager;
@@ -127,7 +128,7 @@ public abstract class AbstractDirectoryT
 
         String rawString = bundle.getString( "testSetStarting" );
 
-        ReportEntry report = new ReportEntry( this.getClass().getName(), testSet.getName(), rawString );
+        ReportEntry report = new DefaultReportEntry( this.getClass().getName(), testSet.getName(), rawString );
 
         reporterManager.testSetStarting( report );
 
@@ -135,7 +136,7 @@ public abstract class AbstractDirectoryT
 
         rawString = bundle.getString( "testSetCompletedNormally" );
 
-        report = new ReportEntry( this.getClass().getName(), testSet.getName(), rawString );
+        report = new DefaultReportEntry( this.getClass().getName(), testSet.getName(), rawString );
 
         reporterManager.testSetCompleted( report );
 

Modified: 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-api/src/main/java/org/apache/maven/surefire/testset/PojoTestSet.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/PojoTestSet.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/PojoTestSet.java Sat Dec 11 13:28:38 2010
@@ -20,6 +20,7 @@ package org.apache.maven.surefire.testse
  */
 
 import org.apache.maven.surefire.Surefire;
+import org.apache.maven.surefire.report.DefaultReportEntry;
 import org.apache.maven.surefire.report.PojoStackTraceWriter;
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.ReporterManager;
@@ -96,7 +97,7 @@ public class PojoTestSet
     }
 
     /**
-     * @noinspection CatchGenericClass,OverlyBroadCatchBlock,MethodWithMultipleReturnPoints
+     * @noinspection CatchGenericClass, OverlyBroadCatchBlock, MethodWithMultipleReturnPoints
      */
     protected boolean executeTestMethod( Method method, Object[] args, ReporterManager reportManager )
     {
@@ -114,8 +115,8 @@ public class PojoTestSet
 
         userFriendlyMethodName += ')';
 
-        ReportEntry report = new ReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
-                                              getName() );
+        ReportEntry report =
+            new DefaultReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ), getName() );
 
         reportManager.testStarting( report );
 
@@ -130,13 +131,13 @@ public class PojoTestSet
 
             MessageFormat msgFmt = new MessageFormat( rawString );
 
-            Object[] stringArgs = {method.getName()};
+            Object[] stringArgs = { method.getName() };
 
             String stringToPrint = msgFmt.format( stringArgs );
 
-            report = new ReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
-                                      stringToPrint, new PojoStackTraceWriter( testObject.getClass().getName(),
-                                                                               method.getName(), e ) );
+            report = new DefaultReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
+                                             stringToPrint, new PojoStackTraceWriter( testObject.getClass().getName(),
+                                                                                      method.getName(), e ) );
 
             reportManager.testFailed( report );
 
@@ -153,8 +154,8 @@ public class PojoTestSet
         {
             method.invoke( testObject, args );
 
-            report = new ReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
-                                      getName() );
+            report = new DefaultReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
+                                             getName() );
 
             reportManager.testSucceeded( report );
         }
@@ -169,8 +170,10 @@ public class PojoTestSet
                 msg = t.toString();
             }
 
-            report = new ReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ), msg,
-                new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(), t ) );
+            report =
+                new DefaultReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ), msg,
+                                        new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(),
+                                                                  t ) );
 
             reportManager.testFailed( report );
             // Don't return  here, because tearDownFixture should be called even
@@ -185,8 +188,10 @@ public class PojoTestSet
                 msg = t.toString();
             }
 
-            report = new ReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ), msg,
-                new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(), t ) );
+            report =
+                new DefaultReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ), msg,
+                                        new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(),
+                                                                  t ) );
 
             reportManager.testFailed( report );
             // Don't return  here, because tearDownFixture should be called even
@@ -204,13 +209,13 @@ public class PojoTestSet
 
             MessageFormat msgFmt = new MessageFormat( rawString );
 
-            Object[] stringArgs = {method.getName()};
+            Object[] stringArgs = { method.getName() };
 
             String stringToPrint = msgFmt.format( stringArgs );
 
-            report = new ReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
-                                      stringToPrint, new PojoStackTraceWriter( testObject.getClass().getName(),
-                                                                               method.getName(), t ) );
+            report = new DefaultReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
+                                             stringToPrint, new PojoStackTraceWriter( testObject.getClass().getName(),
+                                                                                      method.getName(), t ) );
 
             reportManager.testFailed( report );
 

Added: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/SurefireConfigurationException.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/SurefireConfigurationException.java?rev=1044651&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/SurefireConfigurationException.java (added)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/SurefireConfigurationException.java Sat Dec 11 13:28:38 2010
@@ -0,0 +1,59 @@
+package org.apache.maven.surefire.testset;
+
+/*
+ * 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.util.NestedRuntimeException;
+
+/**
+ * Exception indicating that surefire cannot be set up properly. This may be due
+ * to incorrect configuration or incorrect dependencies.
+ *
+ * @author Kristian Rosenvold
+ */
+public class SurefireConfigurationException
+    extends NestedRuntimeException
+{
+    /**
+     * Create a <code>SurefireConfigurationException</code> with the specified detail
+     * message and cause.
+     * <p/>
+     * <p>Note that the detail message associated with cause is
+     * <em>not</em> automatically incorporated in this throwable's detail
+     * message.
+     *
+     * @param message A detail message for this <code>SurefireConfigurationException</code>, or <code>null</code>.
+     * @param cause   the cause, which is saved for later retrieval by the <code>getCause</code> method.
+     *                (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
+     */
+    public SurefireConfigurationException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    /**
+     * Create a <code>SurefireConfigurationException</code> with the specified cause.  The
+     * <code>getMessage</code> method of this exception object will return
+     * <code>(cause == null ? "" : cause.toString())</code>.
+     */
+    public SurefireConfigurationException( Throwable cause )
+    {
+        super( cause == null ? "" : cause.toString(), cause );
+    }
+}

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

Modified: maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/AbstractConsoleReporterTestCase.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/AbstractConsoleReporterTestCase.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/AbstractConsoleReporterTestCase.java (original)
+++ maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/AbstractConsoleReporterTestCase.java Sat Dec 11 13:28:38 2010
@@ -39,9 +39,7 @@ public abstract class AbstractConsoleRep
         throws Exception
     {
         super.setUp();
-        report = new ReportEntry();
-        report.setGroup( "group" );
-        report.setName( "name" );
+        report = DefaultReportEntry.nameGroup( "name", "group" );
     }
 
     protected void setConsoleReporter( AbstractConsoleReporter consoleReporter )
@@ -66,7 +64,8 @@ public abstract class AbstractConsoleRep
         String message = AbstractConsoleReporter.getTestSetStartingMessage( report );
         assertEquals( "Running name (of group)", message );
 
-        report.setGroup( null );
+        report = DefaultReportEntry.nameGroup( "name", null );
+
         message = AbstractConsoleReporter.getTestSetStartingMessage( report );
         assertEquals( "Running name", message );
     }
@@ -77,11 +76,6 @@ public abstract class AbstractConsoleRep
         String message = "Running name (of group)";
         ReportEntry actualReport = AbstractConsoleReporter.parseTestSetStartingMessage( message );
         assertEquals( report, actualReport );
-
-        report.setGroup( null );
-        message = "Running name";
-        actualReport = AbstractConsoleReporter.parseTestSetStartingMessage( message );
-        assertEquals( report, actualReport );
     }
 
     public void testIsTestSetStartingMessage()

Modified: maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/XMLReporterTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/XMLReporterTest.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/XMLReporterTest.java (original)
+++ maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/XMLReporterTest.java Sat Dec 11 13:28:38 2010
@@ -37,10 +37,10 @@ public class XMLReporterTest
         throws Exception
     {
         super.setUp();
-        reporter = new XMLReporter( ForkingConsoleReporterTest.getTestReporterConfiguration());
+        reporter = new XMLReporter( ForkingConsoleReporterTest.getTestReporterConfiguration() );
         message = "junit.framework.AssertionFailedError";
-        reportEntry = new ReportEntry( this.getClass().getName(), "XMLReporterTest", message,
-                                       new PojoStackTraceWriter( "", "", new AssertionFailedError() ) );
+        reportEntry = new DefaultReportEntry( this.getClass().getName(), "XMLReporterTest", message,
+                                              new PojoStackTraceWriter( "", "", new AssertionFailedError() ) );
     }
 
     /*

Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java (original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java Sat Dec 11 13:28:38 2010
@@ -24,6 +24,7 @@ import org.apache.maven.surefire.report.
 import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
+import java.io.PrintStream;
 import java.util.Properties;
 
 /**
@@ -72,8 +73,7 @@ public class SurefireStarter
         // separate the TestNG classloader
         ClassLoader testsClassLoader = createInProcessTestClassLoader();
 
-        final ClasspathConfiguration classpathConfiguration =
-            startupConfiguration.getClasspathConfiguration();
+        final ClasspathConfiguration classpathConfiguration = startupConfiguration.getClasspathConfiguration();
 
         ClassLoader surefireClassLoader = classpathConfiguration.createSurefireClassLoader( testsClassLoader );
 
@@ -124,8 +124,12 @@ public class SurefireStarter
 
     private RunResult invokeProvider( Object testSet, ClassLoader testsClassLoader, ClassLoader surefireClassLoader )
     {
-        ProviderFactory providerFactory = new ProviderFactory( startupConfiguration, providerConfiguration,
-                                                               surefireClassLoader );
+        final PrintStream orgSystemOut = System.out;
+        final PrintStream orgSystemErr = System.err;
+        // Note that System.out/System.err are also read in the "ReporterConfiguration" instatiation
+        // in createProvider below. These are the same values as here.
+        ProviderFactory providerFactory =
+            new ProviderFactory( startupConfiguration, providerConfiguration, surefireClassLoader );
         final SurefireProvider provider = providerFactory.createProvider( testsClassLoader );
 
         try
@@ -140,6 +144,11 @@ public class SurefireStarter
         {
             throw new RuntimeException( e );
         }
+        finally
+        {
+            System.setOut( orgSystemOut );
+            System.setErr( orgSystemErr );
+        }
     }
 
     /**

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=1044651&r1=1044650&r2=1044651&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 Sat Dec 11 13:28:38 2010
@@ -63,9 +63,6 @@ public class JUnit3Provider
         {
             suite.execute( (ReporterManagerFactory) reporterFactory, testClassLoader );
         }
-
-        reporterFactory.warnIfNoTests();
-
         return reporterFactory.close();
     }
 

Modified: maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java Sat Dec 11 13:28:38 2010
@@ -19,6 +19,7 @@ package org.apache.maven.surefire.junit;
  * under the License.
  */
 
+import org.apache.maven.surefire.report.DefaultReportEntry;
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.ReporterManager;
 
@@ -44,9 +45,9 @@ public class TestListenerInvocationHandl
 
     private ReporterManager reportManager;
 
-    private static final Class[] EMPTY_CLASS_ARRAY = new Class[]{};
+    private static final Class[] EMPTY_CLASS_ARRAY = new Class[]{ };
 
-    private static final String[] EMPTY_STRING_ARRAY = new String[]{};
+    private static final String[] EMPTY_STRING_ARRAY = new String[]{ };
 
     private static class FailedTest
     {
@@ -151,7 +152,8 @@ public class TestListenerInvocationHandl
     // Handler for TestListener.startTest(Test)
     public void handleStartTest( Object[] args )
     {
-        ReportEntry report = new ReportEntry( args[0].getClass().getName(), args[0].toString(), args[0].getClass().getName() );
+        ReportEntry report =
+            new DefaultReportEntry( args[0].getClass().getName(), args[0].toString(), args[0].getClass().getName() );
 
         reportManager.testStarting( report );
     }
@@ -161,7 +163,8 @@ public class TestListenerInvocationHandl
         throws IllegalAccessException, InvocationTargetException
     {
         ReportEntry report =
-            new ReportEntry( args[0].getClass().getName(), args[0].toString(), args[1].toString(), getStackTraceWriter( args ) );
+            new DefaultReportEntry( args[0].getClass().getName(), args[0].toString(), args[1].toString(),
+                                    getStackTraceWriter( args ) );
 
         reportManager.testError( report );
 
@@ -190,7 +193,8 @@ public class TestListenerInvocationHandl
         throws IllegalAccessException, InvocationTargetException
     {
         ReportEntry report =
-            new ReportEntry( args[0].getClass().getName(), args[0].toString(), args[1].toString(), getStackTraceWriter( args ) );
+            new DefaultReportEntry( args[0].getClass().getName(), args[0].toString(), args[1].toString(),
+                                    getStackTraceWriter( args ) );
 
         reportManager.testFailed( report );
 
@@ -203,7 +207,8 @@ public class TestListenerInvocationHandl
 
         if ( !testHadFailed )
         {
-            ReportEntry report = new ReportEntry( args[0].getClass().getName(), args[0].toString(), args[0].getClass().getName() );
+            ReportEntry report = new DefaultReportEntry( args[0].getClass().getName(), args[0].toString(),
+                                                         args[0].getClass().getName() );
 
             reportManager.testSucceeded( report );
         }

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=1044651&r1=1044650&r2=1044651&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 Sat Dec 11 13:28:38 2010
@@ -59,14 +59,12 @@ public class JUnit4Provider
         suite.locateTestSets( testClassLoader );
         if ( forkTestSet != null )
         {
-            suite.execute( (String) forkTestSet, ( ReporterManagerFactory)reporterFactory, testClassLoader );
+            suite.execute( (String) forkTestSet, (ReporterManagerFactory) reporterFactory, testClassLoader );
         }
         else
         {
-            suite.execute( ( ReporterManagerFactory)reporterFactory, testClassLoader );
+            suite.execute( (ReporterManagerFactory) reporterFactory, testClassLoader );
         }
-        reporterFactory.warnIfNoTests();
-
         return reporterFactory.close();
     }
 

Modified: maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java Sat Dec 11 13:28:38 2010
@@ -24,6 +24,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 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.ReporterManager;
 import org.junit.runner.Description;
@@ -69,7 +70,7 @@ public class JUnit4TestSetReporter
         throws Exception
     {
         String rawString = bundle.getString( "testSetStarting" );
-        ReportEntry report = new ReportEntry( testSet.getName(), testSet.getName(), rawString );
+        ReportEntry report = new DefaultReportEntry( testSet.getName(), testSet.getName(), rawString );
 
         this.reportMgr.testSetStarting( report );
     }
@@ -83,7 +84,7 @@ public class JUnit4TestSetReporter
         throws Exception
     {
         String rawString = bundle.getString( "testSetCompletedNormally" );
-        ReportEntry report = new ReportEntry( testSet.getName(), testSet.getName(), rawString );
+        ReportEntry report = new DefaultReportEntry( testSet.getName(), testSet.getName(), rawString );
 
         this.reportMgr.testSetCompleted( report );
         this.reportMgr.reset();
@@ -98,7 +99,8 @@ public class JUnit4TestSetReporter
         throws Exception
     {
         String rawString = bundle.getString( "testSkipped" );
-        ReportEntry report = new ReportEntry( extractClassName( description ), description.getDisplayName(), rawString );
+        ReportEntry report =
+            new DefaultReportEntry( extractClassName( description ), description.getDisplayName(), rawString );
 
         this.reportMgr.testSkipped( report );
     }
@@ -112,7 +114,8 @@ public class JUnit4TestSetReporter
         throws Exception
     {
         String rawString = bundle.getString( "testStarting" );
-        ReportEntry report = new ReportEntry( extractClassName( description ), description.getDisplayName(), rawString );
+        ReportEntry report =
+            new DefaultReportEntry( extractClassName( description ), description.getDisplayName(), rawString );
 
         this.reportMgr.testStarting( report );
 
@@ -124,12 +127,14 @@ public class JUnit4TestSetReporter
      *
      * @see org.junit.runner.notification.RunListener#testFailure(org.junit.runner.notification.Failure)
      */
+    @SuppressWarnings( { "ThrowableResultOfMethodCallIgnored" } )
     public void testFailure( Failure failure )
         throws Exception
     {
         String rawString = bundle.getString( "executeException" );
         ReportEntry report =
-            new ReportEntry( extractClassName( failure.getDescription() ), failure.getTestHeader(), rawString, new JUnit4StackTraceWriter( failure ) );
+            new DefaultReportEntry( extractClassName( failure.getDescription() ), failure.getTestHeader(), rawString,
+                                    new JUnit4StackTraceWriter( failure ) );
 
         if ( failure.getException() instanceof AssertionError )
         {
@@ -151,27 +156,28 @@ public class JUnit4TestSetReporter
     public void testFinished( Description description )
         throws Exception
     {
-        if ( failureFlag == false )
+        if ( !failureFlag )
         {
             String rawString = bundle.getString( "testSuccessful" );
-            ReportEntry report = new ReportEntry( extractClassName( description ), description.getDisplayName(), rawString );
+            ReportEntry report =
+                new DefaultReportEntry( extractClassName( description ), description.getDisplayName(), rawString );
 
             this.reportMgr.testSucceeded( report );
         }
     }
-    
+
     private String extractClassName( Description description )
     {
         String displayName = description.getDisplayName();
-        final Pattern PARENS = Pattern.compile(
-                "^" +
-                "[^\\(\\)]+" + //non-parens
-        		"\\((" + // then an open-paren (start matching a group)
-        		"[^\\\\(\\\\)]+" + //non-parens
-        		")\\)" +
-        		"$" ); // then a close-paren (end group match)
+        final Pattern PARENS = Pattern.compile( "^" + "[^\\(\\)]+" + //non-parens
+                                                    "\\((" + // then an open-paren (start matching a group)
+                                                    "[^\\\\(\\\\)]+" + //non-parens
+                                                    ")\\)" + "$" ); // then a close-paren (end group match)
         Matcher m = PARENS.matcher( displayName );
-        if (!m.find()) return displayName;
+        if ( !m.find() )
+        {
+            return displayName;
+        }
         return m.group( 1 );
     }
 }

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ClassesParallelRunListener.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ClassesParallelRunListener.java?rev=1044651&r1=1044650&r2=1044651&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ClassesParallelRunListener.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ClassesParallelRunListener.java Sat Dec 11 13:28:38 2010
@@ -18,19 +18,20 @@ package org.apache.maven.surefire.junitc
  * under the License.
  */
 
-import org.apache.maven.surefire.report.ReporterManagerFactory;
+import org.apache.maven.surefire.report.ReporterConfiguration;
+import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
 /**
-* @author Kristian Rosenvold
-*/
+ * @author Kristian Rosenvold
+ */
 public class ClassesParallelRunListener
     extends ConcurrentReportingRunListener
 {
-    public ClassesParallelRunListener( ReporterManagerFactory reporterFactory )
+    public ClassesParallelRunListener( ReporterFactory reporterFactory, ReporterConfiguration reporterConfiguration )
         throws TestSetFailedException
     {
-        super( reporterFactory, false );
+        super( reporterFactory, false, reporterConfiguration );
     }
 
     @Override



Mime
View raw message