maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1373909 [1/2] - in /maven/surefire/trunk: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ maven-surefire-common/src/main/java/o...
Date Thu, 16 Aug 2012 16:38:35 GMT
Author: krosenvold
Date: Thu Aug 16 16:38:34 2012
New Revision: 1373909

URL: http://svn.apache.org/viewvc?rev=1373909&view=rev
Log:
o Refactored all the duplicated shared state out of the reporters

Added:
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/RunStatistics.java
      - copied, changed from r1373562, maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/RunStatistics.java
    maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/RunStatisticsTest.java
      - copied, changed from r1373562, maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/RunStatisticsTest.java
Removed:
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/AbstractConsoleReporter.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/AbstractFileReporter.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/BriefConsoleReporter.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/BriefFileReporter.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DetailedConsoleReporter.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/RunStatistics.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/TestSetStatistics.java
    maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/RunStatisticsTest.java
Modified:
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/AbstractTextReporter.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/MulticastingReporter.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java
    maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/XMLReporterTest.java
    maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.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/SimpleReportEntry.java
    maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
    maven/surefire/trunk/surefire-providers/surefire-junit3/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-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTest.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit48RunnerTest.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/StartupReportConfiguration.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java Thu Aug 16 16:38:34 2012
@@ -61,9 +61,9 @@ public class StartupReportConfiguration
 
     private final Properties testVmSystemProperties = new Properties();
 
-    public static final String BRIEF_REPORT_FORMAT = "brief";
+    public static final String BRIEF_REPORT_FORMAT = AbstractTextReporter.BRIEF;
 
-    public static final String PLAIN_REPORT_FORMAT = "plain";
+    public static final String PLAIN_REPORT_FORMAT = AbstractTextReporter.PLAIN;
 
     public StartupReportConfiguration( boolean useFile, boolean printSummary, String reportFormat,
                                        boolean redirectTestOutputToFile, boolean disableXmlReport,
@@ -142,36 +142,36 @@ public class StartupReportConfiguration
         return null;
     }
 
-    public AbstractFileReporter instantiateFileReporter()
+    public FileReporter instantiateFileReporter()
     {
         if ( isUseFile() )
         {
             if ( BRIEF_REPORT_FORMAT.equals( getReportFormat() ) )
             {
-                return new BriefFileReporter( reportsDirectory, getReportNameSuffix() );
+                return new FileReporter( AbstractTextReporter.BRIEF, reportsDirectory, getReportNameSuffix() );
             }
             else if ( PLAIN_REPORT_FORMAT.equals( getReportFormat() ) )
             {
-                return new FileReporter( reportsDirectory, getReportNameSuffix() );
+                return new FileReporter( AbstractTextReporter.PLAIN, reportsDirectory, getReportNameSuffix() );
             }
         }
         return null;
     }
 
 
-    public AbstractConsoleReporter instantiateConsoleReporter()
+    public ConsoleReporter instantiateConsoleReporter()
     {
         if ( isUseFile() )
         {
-            return isPrintSummary() ? new ConsoleReporter() : null;
+            return isPrintSummary() ? new ConsoleReporter( AbstractTextReporter.SUMMARY ) : null;
         }
         else if ( isRedirectTestOutputToFile() || BRIEF_REPORT_FORMAT.equals( getReportFormat() ) )
         {
-            return new BriefConsoleReporter();
+            return new ConsoleReporter( AbstractTextReporter.BRIEF );
         }
         else if ( PLAIN_REPORT_FORMAT.equals( getReportFormat() ) )
         {
-            return new DetailedConsoleReporter();
+            return new ConsoleReporter( AbstractTextReporter.PLAIN );
         }
         return null;
     }

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java Thu Aug 16 16:38:34 2012
@@ -88,28 +88,28 @@ public class ForkClient
             switch ( operationId )
             {
                 case ForkingRunListener.BOOTERCODE_TESTSET_STARTING:
-                    getOrCreateReporter(channelNumber).testSetStarting( createReportEntry( remaining ) );
+                    getOrCreateReporter( channelNumber ).testSetStarting( createReportEntry( remaining ) );
                     break;
                 case ForkingRunListener.BOOTERCODE_TESTSET_COMPLETED:
-                    getOrCreateReporter(channelNumber).testSetCompleted( createReportEntry( remaining ) );
+                    getOrCreateReporter( channelNumber ).testSetCompleted( createReportEntry( remaining ) );
                     break;
                 case ForkingRunListener.BOOTERCODE_TEST_STARTING:
-                    getOrCreateReporter(channelNumber).testStarting( createReportEntry( remaining ) );
+                    getOrCreateReporter( channelNumber ).testStarting( createReportEntry( remaining ) );
                     break;
                 case ForkingRunListener.BOOTERCODE_TEST_SUCCEEDED:
-                    getOrCreateReporter(channelNumber).testSucceeded( createReportEntry( remaining ) );
+                    getOrCreateReporter( channelNumber ).testSucceeded( createReportEntry( remaining ) );
                     break;
                 case ForkingRunListener.BOOTERCODE_TEST_FAILED:
-                    getOrCreateReporter(channelNumber).testFailed( createReportEntry( remaining ) );
+                    getOrCreateReporter( channelNumber ).testFailed( createReportEntry( remaining ) );
                     break;
                 case ForkingRunListener.BOOTERCODE_TEST_SKIPPED:
-                    getOrCreateReporter(channelNumber).testSkipped( createReportEntry( remaining ) );
+                    getOrCreateReporter( channelNumber ).testSkipped( createReportEntry( remaining ) );
                     break;
                 case ForkingRunListener.BOOTERCODE_TEST_ERROR:
-                    getOrCreateReporter(channelNumber).testError( createReportEntry( remaining ) );
+                    getOrCreateReporter( channelNumber ).testError( createReportEntry( remaining ) );
                     break;
                 case ForkingRunListener.BOOTERCODE_TEST_ASSUMPTIONFAILURE:
-                    getOrCreateReporter(channelNumber).testAssumptionFailure( createReportEntry( remaining ) );
+                    getOrCreateReporter( channelNumber ).testAssumptionFailure( createReportEntry( remaining ) );
                     break;
                 case ForkingRunListener.BOOTERCODE_SYSPROPS:
                     int keyEnd = remaining.indexOf( "," );
@@ -126,15 +126,15 @@ public class ForkClient
                 case ForkingRunListener.BOOTERCODE_STDOUT:
                     byte[] bytes = new byte[remaining.length() * 2];
                     int len = StringUtils.unescapeJava( bytes, remaining );
-                    getOrCreateConsoleOutputReceiver(channelNumber).writeTestOutput( bytes, 0, len, true );
+                    getOrCreateConsoleOutputReceiver( channelNumber ).writeTestOutput( bytes, 0, len, true );
                     break;
                 case ForkingRunListener.BOOTERCODE_STDERR:
                     bytes = new byte[remaining.length() * 2];
                     len = StringUtils.unescapeJava( bytes, remaining );
-                    getOrCreateConsoleOutputReceiver(channelNumber).writeTestOutput( bytes, 0, len, false );
+                    getOrCreateConsoleOutputReceiver( channelNumber ).writeTestOutput( bytes, 0, len, false );
                     break;
                 case ForkingRunListener.BOOTERCODE_CONSOLE:
-                    getOrCreateConsoleLogger(channelNumber).info( createConsoleMessage( remaining ) );
+                    getOrCreateConsoleLogger( channelNumber ).info( createConsoleMessage( remaining ) );
                     break;
                 case ForkingRunListener.BOOTERCODE_BYE:
                     saidGoodBye = true;
@@ -183,9 +183,7 @@ public class ForkClient
             final StackTraceWriter stackTraceWriter =
                 tokens.hasMoreTokens() ? deserializeStackStraceWriter( tokens ) : null;
 
-            return group != null
-                ? new CategorizedReportEntry( source, name, group, stackTraceWriter, elapsed, message )
-                : new SimpleReportEntry( source, name, stackTraceWriter, elapsed, message );
+            return CategorizedReportEntry.reportEntry( source, name, group, stackTraceWriter, elapsed, message );
         }
         catch ( RuntimeException e )
         {
@@ -228,10 +226,11 @@ public class ForkClient
      */
     public RunListener getReporter( Integer channelNumber )
     {
-        return testSetReporters.get(channelNumber);
+        return testSetReporters.get( channelNumber );
     }
 
-    private RunListener getOrCreateReporter(Integer channelNumber) {
+    private RunListener getOrCreateReporter( Integer channelNumber )
+    {
         RunListener reporter = testSetReporters.get( channelNumber );
         if ( reporter == null )
         {
@@ -241,12 +240,14 @@ public class ForkClient
         return reporter;
     }
 
-    private ConsoleOutputReceiver getOrCreateConsoleOutputReceiver(Integer channelNumber){
-        return (ConsoleOutputReceiver) getOrCreateReporter(channelNumber);
+    private ConsoleOutputReceiver getOrCreateConsoleOutputReceiver( Integer channelNumber )
+    {
+        return (ConsoleOutputReceiver) getOrCreateReporter( channelNumber );
     }
 
-    private ConsoleLogger getOrCreateConsoleLogger(Integer channelNumber){
-        return (ConsoleLogger) getOrCreateReporter(channelNumber);
+    private ConsoleLogger getOrCreateConsoleLogger( Integer channelNumber )
+    {
+        return (ConsoleLogger) getOrCreateReporter( channelNumber );
     }
 
     public void close()

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/AbstractTextReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/AbstractTextReporter.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/AbstractTextReporter.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/AbstractTextReporter.java Thu Aug 16 16:38:34 2012
@@ -19,12 +19,11 @@ package org.apache.maven.plugin.surefire
  * under the License.
  */
 
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.ReporterException;
 
+import java.io.PrintWriter;
+
 /**
  * Text based reporter.
  *
@@ -33,11 +32,11 @@ import org.apache.maven.surefire.report.
 public abstract class AbstractTextReporter
     implements Reporter
 {
-    static final String BRIEF = "brief";
+    public static final String BRIEF = "brief";
 
-    static final String PLAIN = "plain";
+    public static final String PLAIN = "plain";
 
-    static final String SUMMARY = "summary";
+    public static final String SUMMARY = "summary";
 
     private final boolean isPlain;
 
@@ -45,9 +44,6 @@ public abstract class AbstractTextReport
 
     protected PrintWriter writer;
 
-    private List<String> testResults;
-
-
     protected AbstractTextReporter( String format )
     {
         isPlain = PLAIN.equals( format );
@@ -76,62 +72,47 @@ public abstract class AbstractTextReport
         }
     }
 
-    public void testSucceeded( ReportEntry report, TestSetStats testSetStats )
+
+    public void testSetCompleted( ReportEntry report, TestSetStats testSetStats )
+        throws ReporterException
     {
-        if ( isPlain )
+        writeMessage( testSetStats.getTestSetSummary( report.getElapsed() ) );
+
+        if ( isBrief || isPlain )
         {
-            testResults.add( testSetStats.getElapsedTimeSummary( report ) );
+            for ( String testResult : testSetStats.getTestResults() )
+            {
+                writeMessage( testResult );
+            }
         }
     }
 
-    public void testSkipped( ReportEntry report, TestSetStats testSetStats )
+
+    public void reset()
     {
-        if ( isPlain )
+        if ( writer != null )
         {
-            testResults.add( report.getName() + " skipped" );
+            writer.flush();
         }
     }
 
-    public void testError( ReportEntry report, String stdOut, String stdErr, TestSetStats testSetStats )
+    public void testSucceeded( ReportEntry report, TestSetStats testSetStats )
     {
-        testResults.add( testSetStats.getOutput( report, "ERROR" ) );
     }
 
-    public void testFailed( ReportEntry report, String stdOut, String stdErr, TestSetStats testSetStats )
+    public void testSkipped( ReportEntry report, TestSetStats testSetStats )
     {
-        testResults.add( testSetStats.getOutput( report, "FAILURE" ) );
     }
 
-    public void testSetStarting( ReportEntry report )
-        throws ReporterException
+    public void testError( ReportEntry report, String stdOut, String stdErr, TestSetStats testSetStats )
     {
-        testResults = new ArrayList<String>();
     }
 
-    public void testSetCompleted( ReportEntry report, TestSetStats testSetStats )
-        throws ReporterException
+    public void testFailed( ReportEntry report, String stdOut, String stdErr, TestSetStats testSetStats )
     {
-        writeMessage( testSetStats.getTestSetSummary( report.getElapsed() ) );
-
-        if ( isBrief || isPlain )
-        {
-            for ( String testResult : testResults )
-            {
-                writeMessage( testResult );
-            }
-        }
     }
 
     public void testStarting( ReportEntry report )
     {
     }
-
-
-    public void reset()
-    {
-        if ( writer != null )
-        {
-            writer.flush();
-        }
-    }
 }

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java Thu Aug 16 16:38:34 2012
@@ -67,10 +67,11 @@ public class ConsoleOutputFileReporter
 
     public void writeMessage( byte[] b, int off, int len )
     {
-        writeTestOutput(b, off,len, true);
+        writeTestOutput( b, off, len, true );
     }
 
-    public void writeTestOutput(byte[] buf, int off, int len, boolean stdout) {
+    public void writeTestOutput( byte[] buf, int off, int len, boolean stdout )
+    {
         try
         {
             if ( printWriter == null )
@@ -80,8 +81,8 @@ public class ConsoleOutputFileReporter
                     //noinspection ResultOfMethodCallIgnored
                     reportsDirectory.mkdirs();
                 }
-                File file = AbstractFileReporter.getReportFile( reportsDirectory, reportEntryName, reportNameSuffix,
-                        "-output.txt" );
+                File file =
+                    FileReporter.getReportFile( reportsDirectory, reportEntryName, reportNameSuffix, "-output.txt" );
                 printWriter = new PrintWriter( new BufferedWriter( new FileWriter( file ) ) );
             }
             printWriter.write( new String( buf, off, len ) );

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java Thu Aug 16 16:38:34 2012
@@ -1,36 +1,88 @@
-package org.apache.maven.plugin.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.
- */
-
-/**
- * Console reporter.
- *
- * @author <a href="mailto:jruiz@exist.com">Johnny R. Ruiz III</a>
- * @version $Id$
- */
-public class ConsoleReporter
-    extends AbstractConsoleReporter
-{
-
-    public ConsoleReporter()
-    {
-        super(SUMMARY );
-    }
-}
+package org.apache.maven.plugin.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 java.io.BufferedOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import org.apache.maven.surefire.report.ReportEntry;
+import org.apache.maven.surefire.report.ReporterException;
+
+/**
+ * Base class for console reporters.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class ConsoleReporter
+    extends AbstractTextReporter
+{
+    private static final String TEST_SET_STARTING_PREFIX = "Running ";
+
+    private static final String TEST_SET_STARTING_GROUP_PREFIX = " (of ";
+
+    private static final String TEST_SET_STARTING_GROUP_SUFIX = ")";
+
+    private static final int BUFFER_SIZE = 4096;
+
+    private static final PrintStream ORIGINAL_SYSTEM_OUT = System.out;
+
+    public ConsoleReporter( String format )
+    {
+        super( getPrintWriter(), format );
+    }
+
+    private static PrintWriter getPrintWriter()
+    {
+        return new PrintWriter(
+            new OutputStreamWriter( new BufferedOutputStream( ORIGINAL_SYSTEM_OUT, BUFFER_SIZE ) ) );
+    }
+
+    public void testSetStarting( ReportEntry report )
+        throws ReporterException
+    {
+        writeMessage( getTestSetStartingMessage( report ) );
+    }
+
+    /**
+     * Get the test set starting message for a report.
+     * eg. "Running org.foo.BarTest ( of group )"
+     *
+     * @param report report whose test set is starting
+     * @return the message
+     */
+    static String getTestSetStartingMessage( ReportEntry report )
+    {
+        StringBuilder message = new StringBuilder();
+        message.append( TEST_SET_STARTING_PREFIX );
+        message.append( report.getName() );
+
+        if ( report.getGroup() != null && !report.getName().equals( report.getGroup() ) )
+        {
+            message.append( TEST_SET_STARTING_GROUP_PREFIX );
+            message.append( report.getGroup() );
+            message.append( TEST_SET_STARTING_GROUP_SUFIX );
+        }
+
+        message.append( "\n" );
+        return message.toString();
+    }
+
+}

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java Thu Aug 16 16:38:34 2012
@@ -72,7 +72,8 @@ public class DefaultReporterFactory
                                        reportConfiguration.instantiateFileReporter(),
                                        reportConfiguration.instantiateXmlReporter(),
                                        reportConfiguration.instantiateConsoleOutputFileReporter(),
-                                       statisticsReporter, globalStats, reportConfiguration.isTrimStackTrace() );
+                                       statisticsReporter, globalStats, reportConfiguration.isTrimStackTrace(),
+                AbstractTextReporter.PLAIN.equals(reportConfiguration.getReportFormat()));
     }
 
     private List<Reporter> instantiateReports()

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java Thu Aug 16 16:38:34 2012
@@ -20,19 +20,93 @@ package org.apache.maven.plugin.surefire
  */
 
 import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import org.apache.maven.surefire.report.ReportEntry;
+import org.apache.maven.surefire.report.ReporterException;
 
 /**
- * Text file reporter.
+ * Base class for file reporters.
  *
- * @author <a href="mailto:jruiz@exist.com">Johnny R. Ruiz III</a>
- * @version $Id$
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  */
 public class FileReporter
-    extends AbstractFileReporter
+    extends AbstractTextReporter
 {
+    private final File reportsDirectory;
 
-    public FileReporter( File reportsDirectory, String reportNamePrefix )
+    private final boolean deleteOnStarting;
+
+    private final String reportNameSuffix;
+
+    public FileReporter( String format, File reportsDirectory, String reportNameSuffix )
+    {
+        super( format );
+        this.reportsDirectory = reportsDirectory;
+        this.deleteOnStarting = false;
+        this.reportNameSuffix = reportNameSuffix;
+    }
+
+    public void testSetStarting( ReportEntry report )
+        throws ReporterException
     {
-        super(PLAIN, reportsDirectory, reportNamePrefix );
+        File reportFile = getReportFile( reportsDirectory, report.getName(), reportNameSuffix, ".txt" );
+
+        File reportDir = reportFile.getParentFile();
+
+        //noinspection ResultOfMethodCallIgnored
+        reportDir.mkdirs();
+
+        if ( deleteOnStarting && reportFile.exists() )
+        {
+            //noinspection ResultOfMethodCallIgnored
+            reportFile.delete();
+        }
+
+        try
+        {
+            PrintWriter writer = new PrintWriter( new FileWriter( reportFile ) );
+
+            writer.println( "-------------------------------------------------------------------------------" );
+
+            writer.println( "Test set: " + report.getName() );
+
+            writer.println( "-------------------------------------------------------------------------------" );
+
+            setWriter( writer );
+        }
+        catch ( IOException e )
+        {
+            throw new ReporterException( "Unable to create file for report: " + e.getMessage(), e );
+        }
+    }
+
+    public static File getReportFile( File reportsDirectory, String reportEntryName, String reportNameSuffix,
+                                      String fileExtension )
+    {
+        File reportFile;
+
+        if ( reportNameSuffix != null && reportNameSuffix.length() > 0 )
+        {
+            reportFile = new File( reportsDirectory, reportEntryName + "-" + reportNameSuffix + fileExtension );
+        }
+        else
+        {
+            reportFile = new File( reportsDirectory, reportEntryName + fileExtension );
+        }
+        return reportFile;
+    }
+
+    public void testSetCompleted( ReportEntry report, TestSetStats testSetStats )
+        throws ReporterException
+    {
+        super.testSetCompleted( report, testSetStats );
+
+        writer.flush();
+
+        writer.close();
+
+        writer = null;
     }
 }

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/MulticastingReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/MulticastingReporter.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/MulticastingReporter.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/MulticastingReporter.java Thu Aug 16 16:38:34 2012
@@ -19,10 +19,10 @@ package org.apache.maven.plugin.surefire
  * under the License.
  */
 
-import java.util.List;
-import org.apache.maven.surefire.report.CategorizedReportEntry;
 import org.apache.maven.surefire.report.ReportEntry;
 
+import java.util.List;
+
 /**
  * A reporter that broadcasts to other reporters
  *
@@ -35,8 +35,6 @@ public class MulticastingReporter
 
     private final int size;
 
-    private volatile long lastStartAt;
-
     public MulticastingReporter( List<Reporter> target )
     {
         size = target.size();
@@ -45,77 +43,59 @@ public class MulticastingReporter
 
     public void testSetStarting( ReportEntry report )
     {
-        lastStartAt = System.currentTimeMillis();
         for ( int i = 0; i < size; i++ )
         {
             target[i].testSetStarting( report );
         }
     }
 
-    public void testSetCompleted(ReportEntry report, TestSetStats testSetStats)
+    public void testSetCompleted( ReportEntry report, TestSetStats testSetStats )
     {
         for ( int i = 0; i < size; i++ )
         {
-            target[i].testSetCompleted( report, testSetStats);
+            target[i].testSetCompleted( report, testSetStats );
         }
     }
 
 
     public void testStarting( ReportEntry report )
     {
-        lastStartAt = System.currentTimeMillis();
         for ( int i = 0; i < size; i++ )
         {
             target[i].testStarting( report );
         }
     }
 
-    public void testSucceeded(ReportEntry report, TestSetStats testSetStats)
+    public void testSucceeded( ReportEntry report, TestSetStats testSetStats )
     {
-        ReportEntry wrapped = wrap( report );
         for ( int i = 0; i < size; i++ )
         {
-            target[i].testSucceeded( wrapped, testSetStats);
+            target[i].testSucceeded( report, testSetStats );
         }
     }
 
-    public void testError(ReportEntry report, String stdOut, String stdErr, TestSetStats testSetStats)
+    public void testError( ReportEntry report, String stdOut, String stdErr, TestSetStats testSetStats )
     {
-        ReportEntry wrapped = wrap( report );
         for ( int i = 0; i < size; i++ )
         {
-            target[i].testError( wrapped, stdOut, stdErr, testSetStats);
+            target[i].testError( report, stdOut, stdErr, testSetStats );
         }
     }
 
-    public void testFailed(ReportEntry report, String stdOut, String stdErr, TestSetStats testSetStats)
+    public void testFailed( ReportEntry report, String stdOut, String stdErr, TestSetStats testSetStats )
     {
-        ReportEntry wrapped = wrap( report );
         for ( int i = 0; i < size; i++ )
         {
-            target[i].testFailed( wrapped, stdOut, stdErr, testSetStats);
+            target[i].testFailed( report, stdOut, stdErr, testSetStats );
         }
     }
 
-    public void testSkipped(ReportEntry report, TestSetStats testSetStats)
+    public void testSkipped( ReportEntry report, TestSetStats testSetStats )
     {
-        ReportEntry wrapped = wrap( report );
         for ( int i = 0; i < size; i++ )
         {
-            target[i].testSkipped( wrapped, testSetStats);
-        }
-    }
-
-    private ReportEntry wrap( ReportEntry other )
-    {
-        if ( other.getElapsed() != null )
-        {
-            return other;
+            target[i].testSkipped( report, testSetStats );
         }
-        return new CategorizedReportEntry( other.getSourceName(), other.getName(), other.getGroup(),
-                                           other.getStackTraceWriter(),
-                                           (int) ( System.currentTimeMillis() - this.lastStartAt ),
-                                           other.getMessage() );
     }
 
     public void writeMessage( String message )

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java Thu Aug 16 16:38:34 2012
@@ -33,12 +33,11 @@ import org.apache.maven.surefire.util.in
 public class TestSetRunListener
     implements RunListener, ConsoleOutputReceiver, ConsoleLogger
 {
-    private final TestSetStatistics testSetStatistics;
-
     private final RunStatistics globalStatistics;
 
     private final TestSetStats detailsForThis;
 
+
     private final MulticastingReporter multicastingReporter;
 
     private final List<ByteBuffer> testStdOut = Collections.synchronizedList( new ArrayList<ByteBuffer>() );
@@ -47,12 +46,12 @@ public class TestSetRunListener
 
     private final TestcycleConsoleOutputReceiver consoleOutputReceiver;
 
-    public TestSetRunListener(AbstractConsoleReporter consoleReporter, AbstractFileReporter fileReporter,
-                              XMLReporter xmlReporter, TestcycleConsoleOutputReceiver consoleOutputReceiver, StatisticsReporter statisticsReporter,
-                              RunStatistics globalStats, boolean trimStackTrace)
+    public TestSetRunListener( ConsoleReporter consoleReporter, FileReporter fileReporter, XMLReporter xmlReporter,
+                               TestcycleConsoleOutputReceiver consoleOutputReceiver,
+                               StatisticsReporter statisticsReporter, RunStatistics globalStats, boolean trimStackTrace,
+                               boolean isPlainFormat )
     {
         List<Reporter> reporters = new ArrayList<Reporter>();
-        this.detailsForThis = new TestSetStats(trimStackTrace);
         if ( consoleReporter != null )
         {
             reporters.add( consoleReporter );
@@ -71,9 +70,8 @@ public class TestSetRunListener
         }
 
         this.consoleOutputReceiver = consoleOutputReceiver;
-
+        this.detailsForThis = new TestSetStats( trimStackTrace, isPlainFormat );
         multicastingReporter = new MulticastingReporter( reporters );
-        this.testSetStatistics = new TestSetStatistics();
         this.globalStatistics = globalStats;
     }
 
@@ -99,8 +97,8 @@ public class TestSetRunListener
     public void testSetStarting( ReportEntry report )
     {
         detailsForThis.testSetStart();
-        multicastingReporter.testSetStarting(report);
-        consoleOutputReceiver.testSetStarting( report);
+        multicastingReporter.testSetStarting( report );
+        consoleOutputReceiver.testSetStarting( report );
     }
 
     public void clearCapture()
@@ -111,12 +109,11 @@ public class TestSetRunListener
 
     public void testSetCompleted( ReportEntry report )
     {
-        multicastingReporter.testSetCompleted( report, detailsForThis);
-        consoleOutputReceiver.testSetCompleted( report);
+        multicastingReporter.testSetCompleted( report, detailsForThis );
+        consoleOutputReceiver.testSetCompleted( report );
+        globalStatistics.add( detailsForThis );
         detailsForThis.reset();
         multicastingReporter.reset();
-        globalStatistics.add(testSetStatistics);
-        testSetStatistics.reset();
     }
 
     // ----------------------------------------------------------------------
@@ -131,33 +128,26 @@ public class TestSetRunListener
 
     public void testSucceeded( ReportEntry reportEntry )
     {
-        detailsForThis.testEnd();
-        testSetStatistics.incrementCompletedCount();
-        multicastingReporter.testSucceeded( reportEntry, detailsForThis);
+        detailsForThis.testEnd( reportEntry );
+        multicastingReporter.testSucceeded( wrap( reportEntry ), detailsForThis );
         clearCapture();
     }
 
     public void testError( ReportEntry reportEntry )
     {
-        detailsForThis.incrementErrorsCount();
-        detailsForThis.testEnd();
-
-        multicastingReporter.testError( reportEntry, getAsString( testStdOut ), getAsString( testStdErr ), detailsForThis);
-        testSetStatistics.incrementErrorsCount();
-        testSetStatistics.incrementCompletedCount();
+        detailsForThis.testError( reportEntry );
+        multicastingReporter.testError( wrap( reportEntry ), getAsString( testStdOut ), getAsString( testStdErr ),
+                                        detailsForThis );
         globalStatistics.addErrorSource( reportEntry.getName(), reportEntry.getStackTraceWriter() );
         clearCapture();
     }
 
     public void testFailed( ReportEntry reportEntry )
     {
-        detailsForThis.incrementFailureCount();
-        detailsForThis.testEnd();
-
-        multicastingReporter.testFailed(reportEntry, getAsString(testStdOut), getAsString(testStdErr),  detailsForThis);
-        testSetStatistics.incrementFailureCount();
-        testSetStatistics.incrementCompletedCount();
-        globalStatistics.addFailureSource(reportEntry.getName(), reportEntry.getStackTraceWriter());
+        detailsForThis.testFailure( reportEntry );
+        multicastingReporter.testFailed( wrap( reportEntry ), getAsString( testStdOut ), getAsString( testStdErr ),
+                                         detailsForThis );
+        globalStatistics.addFailureSource( reportEntry.getName(), reportEntry.getStackTraceWriter() );
         clearCapture();
     }
 
@@ -167,18 +157,15 @@ public class TestSetRunListener
 
     public void testSkipped( ReportEntry reportEntry )
     {
-        detailsForThis.incrementSkippedCount();
-        detailsForThis.testEnd();
 
+        detailsForThis.testSkipped( reportEntry );
         clearCapture();
-        testSetStatistics.incrementSkippedCount();
-        testSetStatistics.incrementCompletedCount();
-        multicastingReporter.testSkipped(reportEntry,  detailsForThis);
+        multicastingReporter.testSkipped( wrap( reportEntry ), detailsForThis );
     }
 
     public void testAssumptionFailure( ReportEntry report )
     {
-        testSkipped(report);
+        testSkipped( report );
     }
 
     public String getAsString( List<ByteBuffer> byteBufferList )
@@ -193,4 +180,16 @@ public class TestSetRunListener
         }
         return stringBuffer.toString();
     }
+
+    private ReportEntry wrap( ReportEntry other )
+    {
+        if ( other.getElapsed() != null )
+        {
+            return other;
+        }
+        return CategorizedReportEntry.reportEntry( other.getSourceName(), other.getName(), other.getGroup(),
+                                                   other.getStackTraceWriter(),
+                                                   detailsForThis.getElapsedSinceLastStart(), other.getMessage() );
+    }
+
 }

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java Thu Aug 16 16:38:34 2012
@@ -22,12 +22,19 @@ import org.apache.maven.surefire.report.
 import org.apache.maven.surefire.report.StackTraceWriter;
 
 import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Locale;
 
+/**
+ * Maintains per-thread test result state. Not thread safe.
+ */
 public class TestSetStats
 {
     private final boolean trimStackTrace;
 
+    private final boolean plainFormat;
+
     private long testSetStartAt;
 
     private long testStartAt;
@@ -42,9 +49,14 @@ public class TestSetStats
 
     private int skipped;
 
-    public TestSetStats( boolean trimStackTrace )
+    private long lastStartAt;
+
+    private final List<String> testResults = new ArrayList<String>();
+
+    public TestSetStats( boolean trimStackTrace, boolean plainFormat )
     {
         this.trimStackTrace = trimStackTrace;
+        this.plainFormat = plainFormat;
     }
 
     public long getTestSetStartAt()
@@ -57,14 +69,21 @@ public class TestSetStats
         return (int) ( System.currentTimeMillis() - testSetStartAt );
     }
 
+    public int getElapsedSinceLastStart()
+    {
+        return (int) ( System.currentTimeMillis() - lastStartAt );
+    }
+
     public void testSetStart()
     {
-        testSetStartAt = System.currentTimeMillis();
+        lastStartAt = testSetStartAt = System.currentTimeMillis();
+        testResults.clear();
+
     }
 
     public void testStart()
     {
-        testStartAt = System.currentTimeMillis();
+        lastStartAt = testStartAt = System.currentTimeMillis();
     }
 
     public long testEnd()
@@ -80,27 +99,48 @@ public class TestSetStats
         return testEndAt - testStartAt;
     }
 
-    public synchronized void incrementCompletedCount()
+    public void testEnd( ReportEntry reportEntry )
+    {
+        testEnd();
+        if ( plainFormat )
+        {
+            addTestResult( reportEntry );
+        }
+    }
+
+
+    public void incrementCompletedCount()
     {
         completedCount += 1;
     }
 
-    public synchronized void incrementErrorsCount()
+    public void testError( ReportEntry reportEntry )
     {
         errors += 1;
+        testEnd();
+        testResults.add( getOutput( reportEntry, "ERROR" ) );
+
     }
 
-    public synchronized void incrementFailureCount()
+    public void testFailure( ReportEntry reportEntry )
     {
         failures += 1;
+        testEnd();
+        testResults.add( getOutput( reportEntry, "FAILURE" ) );
     }
 
-    public synchronized void incrementSkippedCount()
+    public void testSkipped( ReportEntry reportEntry )
     {
         skipped += 1;
+        testEnd();
+        if ( plainFormat )
+        {
+            testResults.add( reportEntry.getName() + " skipped" );
+        }
+
     }
 
-    public synchronized void reset()
+    public void reset()
     {
         completedCount = 0;
         errors = 0;
@@ -108,7 +148,7 @@ public class TestSetStats
         skipped = 0;
     }
 
-    public synchronized int getCompletedCount()
+    public int getCompletedCount()
     {
         return completedCount;
     }
@@ -161,7 +201,7 @@ public class TestSetStats
         buf.append( errors );
         buf.append( ", Skipped: " );
         buf.append( skipped );
-        buf.append( ", Time elaXpsed: " );
+        buf.append( ", Time elapsed: " );
         buf.append( elapsedTimeAsString( elapsed != null ? elapsed : getElapsedSinceTestSetStart() ) );
         buf.append( " sec" );
 
@@ -216,5 +256,13 @@ public class TestSetStats
         return this.trimStackTrace ? writer.writeTrimmedTraceToString() : writer.writeTraceToString();
     }
 
+    public void addTestResult( ReportEntry reportEntry )
+    {
+        testResults.add( getElapsedTimeSummary( reportEntry ) );
+    }
 
+    public List<String> getTestResults()
+    {
+        return testResults;
+    }
 }

Copied: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/RunStatistics.java (from r1373562, maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/RunStatistics.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/RunStatistics.java?p2=maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/RunStatistics.java&p1=maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/RunStatistics.java&r1=1373562&r2=1373909&rev=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/RunStatistics.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/RunStatistics.java Thu Aug 16 16:38:34 2012
@@ -1,110 +1,153 @@
-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 java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import org.apache.maven.surefire.util.internal.StringUtils;
-
-/**
- * @author Kristian Rosenvold
- */
-public class RunStatistics
-    extends TestSetStatistics
-{
-    /**
-     * Holds the source(s) that causes the error(s).
-     */
-    private final Sources errorSources = new Sources();
-
-    /**
-     * Holds the source(s) that causes the failure(s).
-     */
-    private final Sources failureSources = new Sources();
-
-
-    public void addErrorSource( String errorSource, StackTraceWriter stackTraceWriter )
-    {
-        errorSources.addSource( errorSource, stackTraceWriter );
-    }
-
-    public void addFailureSource( String failureSource, StackTraceWriter stackTraceWriter )
-    {
-        failureSources.addSource( failureSource, stackTraceWriter );
-    }
-
-    public Collection getErrorSources()
-    {
-        return errorSources.getListOfSources();
-    }
-
-    public Collection getFailureSources()
-    {
-        return failureSources.getListOfSources();
-    }
-
-
-    private static class Sources
-    {
-        private final Collection listOfSources = new ArrayList();
-
-        void addSource( String source )
-        {
-            synchronized ( listOfSources )
-            {
-                listOfSources.add( source );
-            }
-        }
-
-        void addSource( String source, StackTraceWriter stackTraceWriter )
-        {
-            String message = getMessageOfThrowable( stackTraceWriter );
-            String extendedSource =
-                StringUtils.isBlank( message ) ? source : source + ": " + trimToSingleLine( message );
-            addSource( extendedSource );
-        }
-
-        private String trimToSingleLine( String str )
-        {
-            int i = str.indexOf( "\n" );
-            return i >= 0 ? str.substring( 0, i ) + "(..)" : str;
-        }
-
-        Collection getListOfSources()
-        {
-            synchronized ( listOfSources )
-            {
-                return Collections.unmodifiableCollection( listOfSources );
-            }
-        }
-
-        private String getMessageOfThrowable( StackTraceWriter stackTraceWriter )
-        {
-            //noinspection ThrowableResultOfMethodCallIgnored
-            return stackTraceWriter != null ? getMessageOfThrowable( stackTraceWriter.getThrowable() ) : "";
-        }
-
-        private String getMessageOfThrowable( SafeThrowable throwable )
-        {
-            return throwable != null ? throwable.getLocalizedMessage() : "";
-        }
-    }
-}
+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 java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.apache.maven.plugin.surefire.report.TestSetStats;
+import org.apache.maven.surefire.suite.RunResult;
+import org.apache.maven.surefire.util.internal.StringUtils;
+
+/**
+ * @author Kristian Rosenvold
+ */
+public class RunStatistics {
+    /**
+     * Holds the source(s) that causes the error(s).
+     */
+    private final Sources errorSources = new Sources();
+
+    /**
+     * Holds the source(s) that causes the failure(s).
+     */
+    private final Sources failureSources = new Sources();
+    private int completedCount;
+    private int errors;
+    private int failures;
+    private int skipped;
+
+
+    public void addErrorSource( String errorSource, StackTraceWriter stackTraceWriter )
+    {
+        errorSources.addSource( errorSource, stackTraceWriter );
+    }
+
+    public void addFailureSource( String failureSource, StackTraceWriter stackTraceWriter )
+    {
+        failureSources.addSource( failureSource, stackTraceWriter );
+    }
+
+    public Collection getErrorSources()
+    {
+        return errorSources.getListOfSources();
+    }
+
+    public Collection getFailureSources()
+    {
+        return failureSources.getListOfSources();
+    }
+
+    public synchronized boolean hadFailures()
+    {
+        return failures > 0;
+    }
+
+    public synchronized boolean hadErrors()
+    {
+        return errors > 0;
+    }
+
+    public synchronized int getCompletedCount()
+    {
+        return completedCount;
+    }
+
+    public synchronized int getSkipped()
+    {
+        return skipped;
+    }
+
+    public synchronized void add( TestSetStats testSetStats){
+        this.completedCount += testSetStats.getCompletedCount();
+        this.errors += testSetStats.getErrors();
+        this.failures += testSetStats.getFailures();
+        this.skipped += testSetStats.getSkipped();
+    }
+
+    public synchronized RunResult getRunResult()
+    {
+        return new RunResult( completedCount, errors, failures, skipped );
+    }
+
+    public synchronized String getSummary()
+    {
+        return "Tests run: " + completedCount + ", Failures: " + failures + ", Errors: " + errors + ", Skipped: "
+            + skipped;
+    }
+
+
+    private static class Sources
+    {
+        private final Collection<String> listOfSources = new ArrayList<String>();
+
+        void addSource( String source )
+        {
+            synchronized ( listOfSources )
+            {
+                listOfSources.add( source );
+            }
+        }
+
+        void addSource( String source, StackTraceWriter stackTraceWriter )
+        {
+            String message = getMessageOfThrowable( stackTraceWriter );
+            String extendedSource =
+                StringUtils.isBlank( message ) ? source : source + ": " + trimToSingleLine( message );
+            addSource( extendedSource );
+        }
+
+        private String trimToSingleLine( String str )
+        {
+            int i = str.indexOf( "\n" );
+            return i >= 0 ? str.substring( 0, i ) + "(..)" : str;
+        }
+
+        Collection getListOfSources()
+        {
+            synchronized ( listOfSources )
+            {
+                return Collections.unmodifiableCollection( listOfSources );
+            }
+        }
+
+        private String getMessageOfThrowable( StackTraceWriter stackTraceWriter )
+        {
+            //noinspection ThrowableResultOfMethodCallIgnored
+            return stackTraceWriter != null ? getMessageOfThrowable( stackTraceWriter.getThrowable() ) : "";
+        }
+
+        private String getMessageOfThrowable( SafeThrowable throwable )
+        {
+            return throwable != null ? throwable.getLocalizedMessage() : "";
+        }
+    }
+}

Modified: maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/XMLReporterTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/XMLReporterTest.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/XMLReporterTest.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/XMLReporterTest.java Thu Aug 16 16:38:34 2012
@@ -49,7 +49,7 @@ public class XMLReporterTest
         message = "junit.framework.AssertionFailedError";
         reportEntry = new SimpleReportEntry( this.getClass().getName(), "XMLReporterTest",
                                              new PojoStackTraceWriter( "", "", new AssertionFailedError() ), 17 );
-        stats = new TestSetStats( false );
+        stats = new TestSetStats( false, true );
     }
 
     /*

Modified: maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java Thu Aug 16 16:38:34 2012
@@ -19,29 +19,30 @@ package org.apache.maven.surefire.report
  * under the License.
  */
 
-import java.io.File;
+import junit.framework.TestCase;
+
 import org.apache.maven.plugin.surefire.report.FileReporter;
+import org.apache.maven.plugin.surefire.report.Reporter;
 
-import junit.framework.TestCase;
+import java.io.File;
+
+import static org.apache.maven.plugin.surefire.report.AbstractTextReporter.PLAIN;
 
 public class FileReporterTest
     extends TestCase
 {
 
-    private FileReporter reporter;
+    private Reporter reporter;
 
     private ReportEntry reportEntry;
 
     private static final String testName = "org.apache.maven.surefire.report.FileReporterTest";
 
-    /*
-     * Test method for 'org.codehaus.surefire.report.FileReporter.testSetStarting(ReportEntry report)'
-     */
     public void testFileNameWithoutSuffix()
     {
         File reportDir = new File( "target" );
         reportEntry = new SimpleReportEntry( this.getClass().getName(), testName );
-        reporter = new FileReporter( reportDir, null );
+        reporter = new FileReporter( PLAIN, reportDir, null );
         reporter.testSetStarting( reportEntry );
 
         File expectedReportFile = new File( reportDir, testName + ".txt" );
@@ -50,15 +51,12 @@ public class FileReporterTest
         expectedReportFile.delete();
     }
 
-    /*
-     * Test method for 'org.codehaus.surefire.report.FileReporter.testSetStarting(ReportEntry report)'
-     */
     public void testFileNameWithSuffix()
     {
         File reportDir = new File( "target" );
         String suffixText = "sampleSuffixText";
         reportEntry = new SimpleReportEntry( this.getClass().getName(), testName );
-        reporter = new FileReporter( reportDir, suffixText );
+        reporter = new FileReporter( PLAIN, reportDir, suffixText );
         reporter.testSetStarting( reportEntry );
 
         File expectedReportFile = new File( reportDir, testName + "-" + suffixText + ".txt" );

Copied: maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/RunStatisticsTest.java (from r1373562, maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/RunStatisticsTest.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/RunStatisticsTest.java?p2=maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/RunStatisticsTest.java&p1=maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/RunStatisticsTest.java&r1=1373562&r2=1373909&rev=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/RunStatisticsTest.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/RunStatisticsTest.java Thu Aug 16 16:38:34 2012
@@ -1,120 +1,120 @@
-package org.apache.maven.surefire.report;
-
-import java.util.Collection;
-
-import junit.framework.TestCase;
-
-/*
- * Copyright 2002-2009 the original author or authors.
- *
- * Licensed 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.
- *
- */
-
-public class RunStatisticsTest
-    extends TestCase
-{
-    private static final String DUMMY_ERROR_SOURCE = "dummy error source";
-
-    private static final String DUMMY_FAILURE_SOURCE = "dummy failure source";
-
-    private static final String DUMMY_MESSAGE = "dummy message";
-
-    public void testAddErrorSourceWithThrowableMessage()
-    {
-        RuntimeException throwable = new RuntimeException( DUMMY_MESSAGE );
-        RunStatistics statistics = createRunStatisticsAndAddErrorSourceWithThrowable( throwable );
-        assertRunStatisticsHasErrorSource( statistics, DUMMY_ERROR_SOURCE + ": " + DUMMY_MESSAGE );
-    }
-
-    public void testAddErrorSourceWithoutStackTraceWriter()
-    {
-        RunStatistics statistics = new RunStatistics();
-        statistics.addErrorSource( DUMMY_ERROR_SOURCE, null );
-        assertRunStatisticsHasErrorSource( statistics, DUMMY_ERROR_SOURCE );
-    }
-
-    public void testAddErrorSourceWithoutThrowable()
-    {
-        RunStatistics statistics = createRunStatisticsAndAddErrorSourceWithThrowable( null );
-        assertRunStatisticsHasErrorSource( statistics, DUMMY_ERROR_SOURCE );
-    }
-
-    public void testAddErrorSourceWithThrowableWithoutMessage()
-    {
-        RuntimeException throwable = new RuntimeException();
-        RunStatistics statistics = createRunStatisticsAndAddErrorSourceWithThrowable( throwable );
-        assertRunStatisticsHasErrorSource( statistics, DUMMY_ERROR_SOURCE );
-    }
-
-    public void testAddFailureSourceWithThrowableMessage()
-    {
-        RuntimeException throwable = new RuntimeException( DUMMY_MESSAGE );
-        RunStatistics statistics = createRunStatisticsAndAddFailureSourceWithThrowable( throwable );
-        assertRunStatisticsHasFailureSource( statistics, DUMMY_FAILURE_SOURCE + ": " + DUMMY_MESSAGE );
-    }
-
-    public void testAddFailureSourceWithoutStackTraceWriter()
-    {
-        RunStatistics statistics = new RunStatistics();
-        statistics.addFailureSource( DUMMY_FAILURE_SOURCE, null );
-        assertRunStatisticsHasFailureSource( statistics, DUMMY_FAILURE_SOURCE );
-    }
-
-    public void testAddFailureSourceWithoutThrowable()
-    {
-        RunStatistics statistics = createRunStatisticsAndAddFailureSourceWithThrowable( null );
-        assertRunStatisticsHasFailureSource( statistics, DUMMY_FAILURE_SOURCE );
-    }
-
-    public void testAddFailureSourceWithThrowableWithoutMessage()
-    {
-        RuntimeException throwable = new RuntimeException();
-        RunStatistics statistics = createRunStatisticsAndAddFailureSourceWithThrowable( throwable );
-        assertRunStatisticsHasFailureSource( statistics, DUMMY_FAILURE_SOURCE );
-    }
-
-    private RunStatistics createRunStatisticsAndAddErrorSourceWithThrowable( Throwable throwable )
-    {
-        StackTraceWriter stackTraceWriter = new PojoStackTraceWriter( null, null, throwable );
-        RunStatistics statistics = new RunStatistics();
-        statistics.addErrorSource( DUMMY_ERROR_SOURCE, stackTraceWriter );
-
-        return statistics;
-    }
-
-    private RunStatistics createRunStatisticsAndAddFailureSourceWithThrowable( Throwable throwable )
-    {
-        StackTraceWriter stackTraceWriter = new PojoStackTraceWriter( null, null, throwable );
-        RunStatistics statistics = new RunStatistics();
-        statistics.addFailureSource( DUMMY_FAILURE_SOURCE, stackTraceWriter );
-
-        return statistics;
-    }
-
-    private void assertRunStatisticsHasErrorSource( RunStatistics statistics, String expectedErrorSource )
-    {
-        Collection errorSources = statistics.getErrorSources();
-        assertNotNull( "No error sources.", errorSources );
-        assertEquals( "Wrong number of error sources.", 1, errorSources.size() );
-        assertEquals( "Wrong error sources.", expectedErrorSource, errorSources.iterator().next() );
-    }
-
-    private void assertRunStatisticsHasFailureSource( RunStatistics statistics, String expectedFailureSource )
-    {
-        Collection failureSources = statistics.getFailureSources();
-        assertNotNull( "No failure sources.", failureSources );
-        assertEquals( "Wrong number of failure sources.", 1, failureSources.size() );
-        assertEquals( "Wrong failure sources.", expectedFailureSource, failureSources.iterator().next() );
-    }
-}
+package org.apache.maven.surefire.report;
+
+import java.util.Collection;
+
+import junit.framework.TestCase;
+
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * Licensed 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.
+ *
+ */
+
+public class RunStatisticsTest
+    extends TestCase
+{
+    private static final String DUMMY_ERROR_SOURCE = "dummy error source";
+
+    private static final String DUMMY_FAILURE_SOURCE = "dummy failure source";
+
+    private static final String DUMMY_MESSAGE = "dummy message";
+
+    public void testAddErrorSourceWithThrowableMessage()
+    {
+        RuntimeException throwable = new RuntimeException( DUMMY_MESSAGE );
+        RunStatistics statistics = createRunStatisticsAndAddErrorSourceWithThrowable( throwable );
+        assertRunStatisticsHasErrorSource( statistics, DUMMY_ERROR_SOURCE + ": " + DUMMY_MESSAGE );
+    }
+
+    public void testAddErrorSourceWithoutStackTraceWriter()
+    {
+        RunStatistics statistics = new RunStatistics();
+        statistics.addErrorSource( DUMMY_ERROR_SOURCE, null );
+        assertRunStatisticsHasErrorSource( statistics, DUMMY_ERROR_SOURCE );
+    }
+
+    public void testAddErrorSourceWithoutThrowable()
+    {
+        RunStatistics statistics = createRunStatisticsAndAddErrorSourceWithThrowable( null );
+        assertRunStatisticsHasErrorSource( statistics, DUMMY_ERROR_SOURCE );
+    }
+
+    public void testAddErrorSourceWithThrowableWithoutMessage()
+    {
+        RuntimeException throwable = new RuntimeException();
+        RunStatistics statistics = createRunStatisticsAndAddErrorSourceWithThrowable( throwable );
+        assertRunStatisticsHasErrorSource( statistics, DUMMY_ERROR_SOURCE );
+    }
+
+    public void testAddFailureSourceWithThrowableMessage()
+    {
+        RuntimeException throwable = new RuntimeException( DUMMY_MESSAGE );
+        RunStatistics statistics = createRunStatisticsAndAddFailureSourceWithThrowable( throwable );
+        assertRunStatisticsHasFailureSource( statistics, DUMMY_FAILURE_SOURCE + ": " + DUMMY_MESSAGE );
+    }
+
+    public void testAddFailureSourceWithoutStackTraceWriter()
+    {
+        RunStatistics statistics = new RunStatistics();
+        statistics.addFailureSource( DUMMY_FAILURE_SOURCE, null );
+        assertRunStatisticsHasFailureSource( statistics, DUMMY_FAILURE_SOURCE );
+    }
+
+    public void testAddFailureSourceWithoutThrowable()
+    {
+        RunStatistics statistics = createRunStatisticsAndAddFailureSourceWithThrowable( null );
+        assertRunStatisticsHasFailureSource( statistics, DUMMY_FAILURE_SOURCE );
+    }
+
+    public void testAddFailureSourceWithThrowableWithoutMessage()
+    {
+        RuntimeException throwable = new RuntimeException();
+        RunStatistics statistics = createRunStatisticsAndAddFailureSourceWithThrowable( throwable );
+        assertRunStatisticsHasFailureSource( statistics, DUMMY_FAILURE_SOURCE );
+    }
+
+    private RunStatistics createRunStatisticsAndAddErrorSourceWithThrowable( Throwable throwable )
+    {
+        StackTraceWriter stackTraceWriter = new PojoStackTraceWriter( null, null, throwable );
+        RunStatistics statistics = new RunStatistics();
+        statistics.addErrorSource( DUMMY_ERROR_SOURCE, stackTraceWriter );
+
+        return statistics;
+    }
+
+    private RunStatistics createRunStatisticsAndAddFailureSourceWithThrowable( Throwable throwable )
+    {
+        StackTraceWriter stackTraceWriter = new PojoStackTraceWriter( null, null, throwable );
+        RunStatistics statistics = new RunStatistics();
+        statistics.addFailureSource( DUMMY_FAILURE_SOURCE, stackTraceWriter );
+
+        return statistics;
+    }
+
+    private void assertRunStatisticsHasErrorSource( RunStatistics statistics, String expectedErrorSource )
+    {
+        Collection errorSources = statistics.getErrorSources();
+        assertNotNull( "No error sources.", errorSources );
+        assertEquals( "Wrong number of error sources.", 1, errorSources.size() );
+        assertEquals( "Wrong error sources.", expectedErrorSource, errorSources.iterator().next() );
+    }
+
+    private void assertRunStatisticsHasFailureSource( RunStatistics statistics, String expectedFailureSource )
+    {
+        Collection failureSources = statistics.getFailureSources();
+        assertNotNull( "No failure sources.", failureSources );
+        assertEquals( "Wrong number of failure sources.", 1, failureSources.size() );
+        assertEquals( "Wrong failure sources.", expectedFailureSource, failureSources.iterator().next() );
+    }
+}

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java Thu Aug 16 16:38:34 2012
@@ -19,12 +19,12 @@ package org.apache.maven.surefire.booter
  * under the License.
  */
 
-import java.io.PrintStream;
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.RunListener;
-import org.apache.maven.surefire.report.RunStatistics;
 import org.apache.maven.surefire.suite.RunResult;
 
+import java.io.PrintStream;
+
 /**
  * Creates ForkingReporters, which are typically one instance per TestSet or thread.
  * This factory is only used inside forks.
@@ -58,10 +58,4 @@ public class ForkingReporterFactory
     {
         return new RunResult( 17, 17, 17, 17 );
     }
-
-    public RunStatistics getGlobalRunStatistics()
-    {
-        return new RunStatistics();
-    }
-
 }

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java Thu Aug 16 16:38:34 2012
@@ -47,6 +47,14 @@ public class CategorizedReportEntry
         this.group = group;
     }
 
+    public static ReportEntry reportEntry( String source, String name, String group, StackTraceWriter stackTraceWriter,
+                                           Integer elapsed, String message )
+    {
+        return group != null
+            ? new CategorizedReportEntry( source, name, group, stackTraceWriter, elapsed, message )
+            : new SimpleReportEntry( source, name, stackTraceWriter, elapsed, message );
+    }
+
     public String getGroup()
     {
         return group;

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=1373909&r1=1373908&r2=1373909&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 Thu Aug 16 16:38:34 2012
@@ -50,7 +50,9 @@ public interface ReportEntry
     public StackTraceWriter getStackTraceWriter();
 
     /**
-     * @deprecated
+     * Gets the runtime for the item. Optional parameter. If the value is not set, it will be determined within
+     * the reporting subsustem. Some providers like to calculate this value themselves, and it gets the
+     * most accurate value.
      */
     public Integer getElapsed();
 

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java Thu Aug 16 16:38:34 2012
@@ -40,12 +40,7 @@ public class SimpleReportEntry
         this( source, name, null, null );
     }
 
-    public SimpleReportEntry( String source, String name, String message )
-    {
-        this( source, name, null, null, message );
-    }
-
-    public SimpleReportEntry( String source, String name, StackTraceWriter stackTraceWriter )
+    private SimpleReportEntry( String source, String name, StackTraceWriter stackTraceWriter )
     {
         this( source, name, stackTraceWriter, null );
     }
@@ -55,13 +50,27 @@ public class SimpleReportEntry
         this( source, name, null, elapsed );
     }
 
-    protected SimpleReportEntry( String name )
+    protected SimpleReportEntry( String source, String name, StackTraceWriter stackTraceWriter, Integer elapsed,
+                                 String message )
     {
+        if ( source == null )
+        {
+            throw new NullPointerException( "source is null" );
+        }
+        if ( name == null )
+        {
+            throw new NullPointerException( "name is null" );
+        }
+
+        this.source = source;
+
         this.name = name;
-        this.stackTraceWriter = null;
-        this.message = null;
-        this.elapsed = null;
-        this.source = null;
+
+        this.stackTraceWriter = stackTraceWriter;
+
+        this.message = message;
+
+        this.elapsed = elapsed;
     }
 
 
@@ -71,6 +80,16 @@ public class SimpleReportEntry
         this( source, name, stackTraceWriter, elapsed, safeGetMessage( stackTraceWriter ) );
     }
 
+    public static SimpleReportEntry ignored( String source, String name, String message )
+    {
+        return new SimpleReportEntry( source, name, null, null, message );
+    }
+
+    public static SimpleReportEntry withException( String source, String name, StackTraceWriter stackTraceWriter )
+    {
+        return new SimpleReportEntry( source, name, stackTraceWriter );
+    }
+
     private static String safeGetMessage( StackTraceWriter stackTraceWriter )
     {
         try
@@ -85,29 +104,6 @@ public class SimpleReportEntry
         }
     }
 
-    public SimpleReportEntry( String source, String name, StackTraceWriter stackTraceWriter, Integer elapsed,
-                              String message )
-    {
-        if ( source == null )
-        {
-            throw new NullPointerException( "source is null" );
-        }
-        if ( name == null )
-        {
-            throw new NullPointerException( "name is null" );
-        }
-
-        this.source = source;
-
-        this.name = name;
-
-        this.stackTraceWriter = stackTraceWriter;
-
-        this.message = message;
-
-        this.elapsed = elapsed;
-    }
-
     public String getSourceName()
     {
         return source;

Modified: maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java (original)
+++ maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java Thu Aug 16 16:38:34 2012
@@ -72,7 +72,7 @@ public class JUnit4RunListener
     {
         final String reason = jUnit4Reflector.getAnnotatedIgnoreValue( description );
         final SimpleReportEntry report =
-            new SimpleReportEntry( extractClassName( description ), description.getDisplayName(), reason );
+            SimpleReportEntry.ignored( extractClassName( description ), description.getDisplayName(), reason );
         reporter.testSkipped( report );
     }
 
@@ -98,8 +98,8 @@ public class JUnit4RunListener
         throws Exception
     {
         ReportEntry report =
-            new SimpleReportEntry( extractClassName( failure.getDescription() ), failure.getTestHeader(),
-                                   new JUnit4StackTraceWriter( failure ) );
+            SimpleReportEntry.withException( extractClassName( failure.getDescription() ), failure.getTestHeader(),
+                                             new JUnit4StackTraceWriter( failure ) );
 
         if ( failure.getException() instanceof AssertionError )
         {

Modified: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java Thu Aug 16 16:38:34 2012
@@ -130,9 +130,10 @@ public class PojoTestSet
         }
         catch ( Throwable e )
         {
-            report = new SimpleReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
-                                            new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(),
-                                                                      e ) );
+            report =
+                SimpleReportEntry.withException( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
+                                                 new PojoStackTraceWriter( testObject.getClass().getName(),
+                                                                           method.getName(), e ) );
 
             reportManager.testFailed( report );
 
@@ -157,9 +158,10 @@ public class PojoTestSet
         {
             Throwable t = ite.getTargetException();
 
-            report = new SimpleReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
-                                            new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(),
-                                                                      t ) );
+            report =
+                SimpleReportEntry.withException( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
+                                                 new PojoStackTraceWriter( testObject.getClass().getName(),
+                                                                           method.getName(), t ) );
 
             reportManager.testFailed( report );
             // Don't return  here, because tearDownFixture should be called even
@@ -167,9 +169,10 @@ public class PojoTestSet
         }
         catch ( Throwable t )
         {
-            report = new SimpleReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
-                                            new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(),
-                                                                      t ) );
+            report =
+                SimpleReportEntry.withException( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
+                                                 new PojoStackTraceWriter( testObject.getClass().getName(),
+                                                                           method.getName(), t ) );
 
             reportManager.testFailed( report );
             // Don't return  here, because tearDownFixture should be called even
@@ -183,9 +186,10 @@ public class PojoTestSet
         catch ( Throwable t )
         {
             // Treat any exception from tearDownFixture as a failure of the test.
-            report = new SimpleReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
-                                            new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(),
-                                                                      t ) );
+            report =
+                SimpleReportEntry.withException( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
+                                                 new PojoStackTraceWriter( testObject.getClass().getName(),
+                                                                           method.getName(), t ) );
 
             reportManager.testFailed( report );
 

Modified: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java Thu Aug 16 16:38:34 2012
@@ -149,8 +149,8 @@ public class TestListenerInvocationHandl
     private void handleAddError( Object[] args )
         throws IllegalAccessException, InvocationTargetException
     {
-        ReportEntry report =
-            new SimpleReportEntry( args[0].getClass().getName(), args[0].toString(), getStackTraceWriter( args ) );
+        ReportEntry report = SimpleReportEntry.withException( args[0].getClass().getName(), args[0].toString(),
+                                                              getStackTraceWriter( args ) );
 
         reporter.testError( report );
 
@@ -178,8 +178,8 @@ public class TestListenerInvocationHandl
     private void handleAddFailure( Object[] args )
         throws IllegalAccessException, InvocationTargetException
     {
-        ReportEntry report =
-            new SimpleReportEntry( args[0].getClass().getName(), args[0].toString(), getStackTraceWriter( args ) );
+        ReportEntry report = SimpleReportEntry.withException( args[0].getClass().getName(), args[0].toString(),
+                                                              getStackTraceWriter( args ) );
 
         reporter.testFailed( 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=1373909&r1=1373908&r2=1373909&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 Aug 16 16:38:34 2012
@@ -147,9 +147,9 @@ public class JUnit4Provider
         }
         catch ( Throwable e )
         {
-            reporter.testError( new SimpleReportEntry( report.getSourceName(), report.getName(),
-                                                       new PojoStackTraceWriter( report.getSourceName(),
-                                                                                 report.getName(), e ) ) );
+            reporter.testError( SimpleReportEntry.withException( report.getSourceName(), report.getName(),
+                                                                 new PojoStackTraceWriter( report.getSourceName(),
+                                                                                           report.getName(), e ) ) );
         }
         finally
         {

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTest.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTest.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTest.java Thu Aug 16 16:38:34 2012
@@ -113,7 +113,6 @@ public class MavenSurefireJUnit47RunnerT
 
         Assert.assertEquals( "JUnit should report correctly number of test ran(Finished)", 0, result.getRunCount() );
 
-        // Sys.out swallowed in ConsoleReporter..
         for ( Failure failure : result.getFailures() )
         {
             System.out.println( failure.getException().getMessage() );

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit48RunnerTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit48RunnerTest.java?rev=1373909&r1=1373908&r2=1373909&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit48RunnerTest.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit48RunnerTest.java Thu Aug 16 16:38:34 2012
@@ -113,7 +113,6 @@ public class MavenSurefireJUnit48RunnerT
 
         Assert.assertEquals( "JUnit should report correctly number of test ran(Finished)", 0, result.getRunCount() );
 
-        // Sys.out swallowed in ConsoleReporter..
         for ( Failure failure : result.getFailures() )
         {
             System.out.println( failure.getException().getMessage() );



Mime
View raw message