maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1057886 - in /maven/surefire/trunk: surefire-api/src/main/java/org/apache/maven/surefire/report/ surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/ surefire-providers/surefire-junit3/src/main/java/org/a...
Date Tue, 11 Jan 2011 21:47:47 GMT
Author: krosenvold
Date: Tue Jan 11 21:47:46 2011
New Revision: 1057886

URL: http://svn.apache.org/viewvc?rev=1057886&view=rev
Log:
o Aligned reporting in 47 provider with the existing design for the other providers

This will eventually allow the TestNG provider to use the same support for parallel running

Added:
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManager.java   (contents, props changed)
      - copied, changed from r1057317, 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/JUnitCoreRunListener.java   (with props)
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java   (contents, props changed)
      - copied, changed from r1057317, 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/JUnitCoreRunListenerTest.java   (with props)
Removed:
    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/test/java/org/apache/maven/surefire/junitcore/ConcurrentReportingRunListenerTest.java
Modified:
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.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/ReportWriter.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/ReporterManager.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-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/JUnitCoreProvider.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/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

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java?rev=1057886&r1=1057885&r2=1057886&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java Tue Jan 11 21:47:46 2011
@@ -210,12 +210,15 @@ public abstract class AbstractReporter
     // @deprecated dont use.  TODO remove for 2.7.2
     public void testError( ReportEntry report )
     {
-        //To change body of implemented methods use File | Settings | File Templates.
     }
 
     // @deprecated dont use.  TODO remove for 2.7.2
     public void testFailed( ReportEntry report )
     {
-        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    // @deprecated dont use.  TODO remove for 2.7.2
+    public void testAssumptionFailure( ReportEntry report )
+    {
     }
 }

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=1057886&r1=1057885&r2=1057886&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 Tue Jan 11 21:47:46 2011
@@ -189,4 +189,9 @@ public class MulticastingReporter
             ( (ReportWriter) it.next() ).testFailed( report );
         }
     }
+
+    public void testAssumptionFailure( ReportEntry report )
+    {
+        // Do nothing right now.
+    }
 }

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportWriter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportWriter.java?rev=1057886&r1=1057885&r2=1057886&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportWriter.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportWriter.java Tue Jan 11 21:47:46 2011
@@ -86,7 +86,6 @@ public interface ReportWriter
      * @param report The report entry to log for
      * @param stdOut standard output from the test case
      * @param stdErr error output from the test case
-     * @deprecated remove when building with 2.7.2
      */
     void testError( ReportEntry report, String stdOut, String stdErr );
 
@@ -96,7 +95,6 @@ public interface ReportWriter
      * @param report The report entry to log for
      * @param stdOut standard output from the test case
      * @param stdErr error output from the test case
-     * @deprecated remove when building with 2.7.2
      */
     void testFailed( ReportEntry report, String stdOut, String stdErr );
 

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=1057886&r1=1057885&r2=1057886&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 Tue Jan 11 21:47:46 2011
@@ -63,18 +63,27 @@ public interface Reporter
     void testSucceeded( ReportEntry report );
 
     /**
+     * Event fired when a test assumption failure was encountered.
+     * An assumption failure indicates that the test is not relevant
+     *
+     * @param report The report entry to log for
+     */
+    void testAssumptionFailure( ReportEntry report );
+
+
+    /**
      * Event fired when a test ended with an error (non anticipated problem)
      *
      * @param report The report entry to log for
      */
-    void testError( ReportEntry report);
+    void testError( ReportEntry report );
 
     /**
      * Event fired when a test ended with a failure (anticipated problem)
      *
      * @param report The report entry to log for
      */
-    void testFailed( ReportEntry report);
+    void testFailed( ReportEntry report );
 
 
     void testSkipped( ReportEntry report );
@@ -121,6 +130,7 @@ public interface Reporter
     /**
      * Restores the instance of the reporter, making the instance re-usable for a subsequent run in the
      * same thread.
+     *
      * @deprecated remove when building with 2.7.2
      */
     void reset();

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=1057886&r1=1057885&r2=1057886&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 Tue Jan 11 21:47:46 2011
@@ -37,7 +37,7 @@ import java.util.List;
  * <p/>
  */
 public class ReporterManager
-    implements Reporter, RunReporter
+    implements Reporter, RunReporter, ReportWriter
 {
     private final RunStatistics runStatisticsForThis;
 
@@ -181,4 +181,8 @@ public class ReporterManager
         multicastingReporter.reset();
     }
 
+    public void testAssumptionFailure( ReportEntry report )
+    {
+        // Ignore for now.
+    }
 }

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=1057886&r1=1057885&r2=1057886&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 Tue Jan 11 21:47:46 2011
@@ -22,13 +22,14 @@ package org.apache.maven.surefire.common
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.SimpleReportEntry;
-import org.junit.runner.Description;
-import org.junit.runner.notification.Failure;
-import org.junit.runner.notification.RunListener;
 
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.junit.runner.Description;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
+
 public class JUnit4RunListener
     extends RunListener
 {
@@ -37,7 +38,7 @@ public class JUnit4RunListener
                                                                + "[^\\\\(\\\\)]+" //non-parens
                                                                + ")\\)" + "$" ); // then a close-paren (end group match)
 
-    protected final Reporter reportMgr;
+    protected final Reporter reporter;
 
     /**
      * This flag is set after a failure has occurred so that a <code>testSucceeded</code> event is not fired.
@@ -48,11 +49,11 @@ public class JUnit4RunListener
     /**
      * Constructor.
      *
-     * @param reportManager the report manager to log testing events to
+     * @param reporter the reporter to log testing events to
      */
-    public JUnit4RunListener( Reporter reportManager )
+    public JUnit4RunListener( Reporter reporter )
     {
-        this.reportMgr = reportManager;
+        this.reporter = reporter;
     }
 
     // Testrun methods are not invoked when using the runner
@@ -65,7 +66,7 @@ public class JUnit4RunListener
     public void testIgnored( Description description )
         throws Exception
     {
-        reportMgr.testSkipped( createReportEntry( description ) );
+        reporter.testSkipped( createReportEntry( description ) );
     }
 
     /**
@@ -76,7 +77,7 @@ public class JUnit4RunListener
     public void testStarted( Description description )
         throws Exception
     {
-        reportMgr.testStarting( createReportEntry( description ) );
+        reporter.testStarting( createReportEntry( description ) );
         failureFlag = false;
     }
 
@@ -95,11 +96,11 @@ public class JUnit4RunListener
 
         if ( failure.getException() instanceof AssertionError )
         {
-            this.reportMgr.testFailed( report );
+            this.reporter.testFailed( report );
         }
         else
         {
-            this.reportMgr.testError( report );
+            this.reporter.testError( report );
         }
 
         failureFlag = true;
@@ -115,7 +116,7 @@ public class JUnit4RunListener
     {
         if ( !failureFlag )
         {
-            reportMgr.testSucceeded( createReportEntry( description ) );
+            reporter.testSucceeded( createReportEntry( description ) );
         }
     }
 
@@ -124,8 +125,10 @@ public class JUnit4RunListener
         return new SimpleReportEntry( extractClassName( description ), description.getDisplayName() );
     }
 
+
     public void testAssumptionFailure( Failure failure )
     {
+        this.reporter.testAssumptionFailure( createReportEntry( failure.getDescription() ) );
     }
 
     protected String extractClassName( Description description )

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=1057886&r1=1057885&r2=1057886&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 Tue Jan 11 21:47:46 2011
@@ -22,6 +22,7 @@ package org.apache.maven.surefire.junit;
 import org.apache.maven.surefire.report.PojoStackTraceWriter;
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.Reporter;
+import org.apache.maven.surefire.report.ReporterManager;
 import org.apache.maven.surefire.report.SimpleReportEntry;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
@@ -134,7 +135,7 @@ public class PojoTestSet
                                             new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(),
                                                                       e ) );
 
-            reportManager.testFailed( report );
+            ( (ReporterManager) reportManager ).testFailed( report );
 
             // A return value of true indicates to this class's executeTestMethods
             // method that it should abort and not attempt to execute
@@ -161,7 +162,7 @@ public class PojoTestSet
                                             new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(),
                                                                       t ) );
 
-            reportManager.testFailed( report );
+            ( (ReporterManager) reportManager ).testFailed( report );
             // Don't return  here, because tearDownFixture should be called even
             // if the test method throws an exception.
         }
@@ -171,7 +172,7 @@ public class PojoTestSet
                                             new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(),
                                                                       t ) );
 
-            reportManager.testFailed( report );
+            ( (ReporterManager) reportManager ).testFailed( report );
             // Don't return  here, because tearDownFixture should be called even
             // if the test method throws an exception.
         }
@@ -187,7 +188,7 @@ public class PojoTestSet
                                             new PojoStackTraceWriter( testObject.getClass().getName(), method.getName(),
                                                                       t ) );
 
-            reportManager.testFailed( report );
+            ( (ReporterManager) reportManager ).testFailed( report );
 
             // A return value of true indicates to this class's executeTestMethods
             // method that it should abort and not attempt to execute

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=1057886&r1=1057885&r2=1057886&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 Tue Jan 11 21:47:46 2011
@@ -21,6 +21,7 @@ package org.apache.maven.surefire.junit;
 
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.Reporter;
+import org.apache.maven.surefire.report.ReporterManager;
 import org.apache.maven.surefire.report.SimpleReportEntry;
 
 import java.lang.reflect.InvocationHandler;
@@ -43,7 +44,7 @@ public class TestListenerInvocationHandl
 
     private Set failedTestsSet = new HashSet();
 
-    private Reporter reportManager;
+    private ReporterManager reportManager;  // todo: Switch to ReportWriter for 2.7.2
 
     private static final Class[] EMPTY_CLASS_ARRAY = new Class[]{ };
 
@@ -120,7 +121,7 @@ public class TestListenerInvocationHandl
             throw new NullPointerException( "loader is null" );
         }
 
-        this.reportManager = reportManager;
+        this.reportManager = (ReporterManager) reportManager;
     }
 
     public Object invoke( Object proxy, Method method, Object[] args )
@@ -163,7 +164,7 @@ public class TestListenerInvocationHandl
         ReportEntry report =
             new SimpleReportEntry( args[0].getClass().getName(), args[0].toString(), getStackTraceWriter( args ) );
 
-        reportManager.testError( report );
+        ( (ReporterManager) reportManager ).testError( report );
 
         failedTestsSet.add( new FailedTest( args[0], Thread.currentThread() ) );
     }

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=1057886&r1=1057885&r2=1057886&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 Tue Jan 11 21:47:46 2011
@@ -23,21 +23,23 @@ import org.apache.maven.surefire.report.
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
+import java.util.Map;
+
 /**
  * @author Kristian Rosenvold
  */
 public class ClassesParallelRunListener
-    extends ConcurrentReportingRunListener
+    extends ConcurrentReporterManager
 {
-    public ClassesParallelRunListener( ReporterFactory reporterFactory, ReporterConfiguration reporterConfiguration )
+    public ClassesParallelRunListener( Map<String, TestSet> classMethodCounts, ReporterFactory reporterFactory,
+                                       ReporterConfiguration reporterConfiguration )
         throws TestSetFailedException
     {
-        super( reporterFactory, false, reporterConfiguration );
+        super( reporterFactory, false, reporterConfiguration, classMethodCounts );
     }
 
     @Override
     public void checkIfTestSetCanBeReported( TestSet testSetForTest )
-        throws TestSetFailedException
     {
         TestSet currentlyAttached = TestSet.getThreadTestSet();
         if ( currentlyAttached != null && currentlyAttached != testSetForTest )

Copied: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManager.java (from r1057317, maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReportingRunListener.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManager.java?p2=maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManager.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReportingRunListener.java&r1=1057317&r2=1057886&rev=1057886&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReportingRunListener.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManager.java Tue Jan 11 21:47:46 2011
@@ -19,25 +19,23 @@ package org.apache.maven.surefire.junitc
  * under the License.
  */
 
+import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.ReporterConfiguration;
+import org.apache.maven.surefire.report.ReporterException;
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.testset.TestSetFailedException;
-import org.junit.runner.Description;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.junit.runner.notification.RunListener;
 
+import java.io.IOException;
 import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * @author Kristian Rosenvold
  */
-public abstract class ConcurrentReportingRunListener
-    extends RunListener
+public abstract class ConcurrentReporterManager
+    implements Reporter
 {
-    protected Map<Class, TestSet> classMethodCounts = new ConcurrentHashMap<Class, TestSet>();
+    protected Map<String, TestSet> classMethodCounts;
 
     private final ReporterConfiguration reporterConfiguration;
 
@@ -51,13 +49,15 @@ public abstract class ConcurrentReportin
 
     private ReporterFactory reporterFactory;
 
-    public ConcurrentReportingRunListener( ReporterFactory reporterFactory, boolean reportImmediately,
-                                           ReporterConfiguration reporterConfiguration )
+    public ConcurrentReporterManager( ReporterFactory reporterFactory, boolean reportImmediately,
+                                      ReporterConfiguration reporterConfiguration,
+                                      Map<String, TestSet> classMethodCounts )
         throws TestSetFailedException
     {
         this.reportImmediately = reportImmediately;
         this.reporterFactory = reporterFactory;
         this.reporterConfiguration = reporterConfiguration;
+        this.classMethodCounts = classMethodCounts;
 
         // We must create the first reporterManager here, even though we will never use it.
         // There is some room for improvement here
@@ -69,74 +69,68 @@ public abstract class ConcurrentReportin
         System.setErr( err );
     }
 
-
-    protected Reporter getReporterManager()
-        throws TestSetFailedException
+    public void testSetStarting( ReportEntry description )
     {
-        Reporter reporterManager = reporterManagerThreadLocal.get();
-        if ( reporterManager == null )
-        {
-            reporterManager = reporterFactory.createReporter();
-            reporterManagerThreadLocal.set( reporterManager );
-        }
-        return reporterManager;
     }
 
-    public static ConcurrentReportingRunListener createInstance( ReporterFactory reporterManagerFactory,
-                                                                 ReporterConfiguration reporterConfiguration,
-                                                                 boolean parallelClasses, boolean parallelBoth )
-        throws TestSetFailedException
+    public void testSetCompleted( ReportEntry result )
+        throws ReporterException
     {
-        if ( parallelClasses )
+        for ( TestSet testSet : classMethodCounts.values() )
+        {
+            testSet.replay( getReporterManager() );
+        }
+        try
         {
-            return new ClassesParallelRunListener( reporterManagerFactory, reporterConfiguration );
+            out.writeTo( reporterConfiguration.getOriginalSystemOut() );
+            err.writeTo( reporterConfiguration.getOriginalSystemErr() );
+        }
+        catch ( IOException e )
+        {
+            throw new ReporterException( "When writing reports", e );
         }
-        return new MethodsParallelRunListener( reporterManagerFactory, reporterConfiguration, !parallelBoth );
     }
 
-
-    @Override
-    public void testRunStarted( Description description )
-        throws Exception
+    public void testAssumptionFailure( ReportEntry failure )
     {
-        TestMethod.fillTestCountMap( description, classMethodCounts );
+        getOrCreateTestMethod( failure ).testAssumptionFailure( failure );
     }
 
-    @Override
-    public void testRunFinished( Result result )
-        throws Exception
+    public void testFailed( ReportEntry failure )
     {
-        for ( TestSet testSet : classMethodCounts.values() )
-        {
-            testSet.replay( getReporterManager() );
-        }
-        out.writeTo( reporterConfiguration.getOriginalSystemOut() );
-        err.writeTo( reporterConfiguration.getOriginalSystemErr() );
+        getOrCreateTestMethod( failure ).testFailure( failure );
     }
 
-    protected TestMethod getTestMethod()
+    public void testError( ReportEntry failure )
     {
-        return TestMethod.getThreadTestMethod();
+        getOrCreateTestMethod( failure ).testError( failure );
     }
 
-    protected void detachTestMethodFromThread()
+
+    public void testSkipped( ReportEntry description )
     {
-        TestMethod.detachFromCurrentThread();
+        TestSet testSet = getTestSet( description );
+        TestMethod testMethod = getTestSet( description ).createTestMethod( description );
+        testMethod.testIgnored( description );
+        testSet.incrementFinishedTests( getReporterManager(), reportImmediately );
     }
 
-    protected TestSet getTestSet( Description description )
+    public void testStarting( ReportEntry description )
     {
-        return classMethodCounts.get( description.getTestClass() );
+        TestSet testSet = getTestSet( description );
+        testSet.createTestMethod( description ).attachToThread();
+        checkIfTestSetCanBeReported( testSet );
+        testSet.attachToThread();
     }
 
-    @Override
-    public void testFailure( Failure failure )
-        throws Exception
+    public void testSucceeded( ReportEntry report )
     {
-        getOrCreateTestMethod( failure.getDescription() ).testFailure( failure );
+        getTestMethod().testFinished();
+        TestSet.getThreadTestSet().incrementFinishedTests( getReporterManager(), reportImmediately );
+        detachTestMethodFromThread();
     }
 
-    private TestMethod getOrCreateTestMethod( Description description )
+    private TestMethod getOrCreateTestMethod( ReportEntry description )
     {
         TestMethod threadTestMethod = TestMethod.getThreadTestMethod();
         if ( threadTestMethod != null )
@@ -147,43 +141,76 @@ public abstract class ConcurrentReportin
         return testSet.createTestMethod( description );
     }
 
-    @Override
-    public void testAssumptionFailure( Failure failure )
+    public abstract void checkIfTestSetCanBeReported( TestSet testSetForTest );
+
+    public void writeFooter( String footer )
     {
-        TestMethod.getThreadTestMethod().testAssumptionFailure( failure );
+        throw new UnsupportedOperationException();
     }
 
-    @Override
-    public void testIgnored( Description description )
-        throws Exception
+    public void writeMessage( String message )
     {
-        TestSet testSet = getTestSet( description );
-        TestMethod testMethod = getTestSet( description ).createTestMethod( description );
-        testMethod.testIgnored( description );
-        testSet.incrementFinishedTests( getReporterManager(), reportImmediately );
+        throw new UnsupportedOperationException();
     }
 
-    @Override
-    public void testStarted( Description description )
-        throws Exception
+    public void reset()
     {
-        TestSet testSet = getTestSet( description );
-        testSet.createTestMethod( description ).attachToThread();
-        checkIfTestSetCanBeReported( testSet );
-        testSet.attachToThread();
+        throw new UnsupportedOperationException();
     }
 
-    public abstract void checkIfTestSetCanBeReported( TestSet testSetForTest )
-        throws TestSetFailedException;
+    public void testFailed( ReportEntry report, String stdOut, String stdErr )
+    {
+        throw new UnsupportedOperationException();
+    }
 
-    @Override
-    public void testFinished( Description description )
-        throws Exception
+    public void writeDetailMessage( String message )
     {
-        getTestMethod().testFinished();
-        TestSet.getThreadTestSet().incrementFinishedTests( getReporterManager(), reportImmediately );
-        detachTestMethodFromThread();
+        throw new UnsupportedOperationException();
+    }
+
+    public void testError( ReportEntry failure, String out, String err )
+    {
+        throw new UnsupportedOperationException();
     }
 
+    protected TestMethod getTestMethod()
+    {
+        return TestMethod.getThreadTestMethod();
+    }
+
+    protected void detachTestMethodFromThread()
+    {
+        TestMethod.detachFromCurrentThread();
+    }
+
+    protected TestSet getTestSet( ReportEntry description )
+    {
+        return classMethodCounts.get( description.getSourceName() );
+    }
+
+    protected Reporter getReporterManager()
+    {
+        Reporter reporterManager = reporterManagerThreadLocal.get();
+        if ( reporterManager == null )
+        {
+            reporterManager = reporterFactory.createReporter();
+            reporterManagerThreadLocal.set( reporterManager );
+        }
+        return reporterManager;
+    }
+
+    public static ConcurrentReporterManager createInstance( Map<String, TestSet> classMethodCounts,
+                                                            ReporterFactory reporterManagerFactory,
+                                                            ReporterConfiguration reporterConfiguration,
+                                                            boolean parallelClasses, boolean parallelBoth )
+        throws TestSetFailedException
+    {
+        if ( parallelClasses )
+        {
+            return new ClassesParallelRunListener( classMethodCounts, reporterManagerFactory, reporterConfiguration );
+        }
+        return new MethodsParallelRunListener( classMethodCounts, reporterManagerFactory, reporterConfiguration,
+                                               !parallelBoth );
+    }
 
 }

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java?rev=1057886&r1=1057885&r2=1057886&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java Tue Jan 11 21:47:46 2011
@@ -22,6 +22,7 @@ package org.apache.maven.surefire.junitc
 import org.apache.maven.surefire.NonAbstractClassFilter;
 import org.apache.maven.surefire.providerapi.ProviderParameters;
 import org.apache.maven.surefire.providerapi.SurefireProvider;
+import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.ReporterConfiguration;
 import org.apache.maven.surefire.report.ReporterException;
 import org.apache.maven.surefire.report.ReporterFactory;
@@ -30,11 +31,14 @@ import org.apache.maven.surefire.testset
 import org.apache.maven.surefire.util.DirectoryScanner;
 import org.apache.maven.surefire.util.ReflectionUtils;
 import org.apache.maven.surefire.util.TestsToRun;
-import org.junit.runner.notification.RunListener;
 
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.junit.runner.notification.RunListener;
 
 /**
  * @author Kristian Rosenvold
@@ -93,11 +97,14 @@ public class JUnitCoreProvider
         {
             testsToRun = forkTestSet == null ? scanClassPath() : TestsToRun.fromClass( (Class) forkTestSet );
         }
-        ConcurrentReportingRunListener listener =
-            ConcurrentReportingRunListener.createInstance( this.reporterFactory, this.reporterConfiguration,
+        final Map<String, TestSet> testSetMap = new ConcurrentHashMap<String, TestSet>();
+
+        Reporter listener =
+            ConcurrentReporterManager.createInstance( testSetMap, this.reporterFactory, this.reporterConfiguration,
                                                            jUnitCoreParameters.isParallelClasses(),
                                                            jUnitCoreParameters.isParallelBoth() );
-        customRunListeners.add( 0, listener );
+        RunListener jUnit4RunListener = new JUnitCoreRunListener( listener, testSetMap);
+        customRunListeners.add( 0, jUnit4RunListener );
 
         JUnitCoreWrapper.execute( testsToRun, jUnitCoreParameters, customRunListeners );
         return reporterFactory.close();

Added: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListener.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListener.java?rev=1057886&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListener.java (added)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListener.java Tue Jan 11 21:47:46 2011
@@ -0,0 +1,92 @@
+package org.apache.maven.surefire.junitcore;
+
+/*
+ * 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.common.junit4.JUnit4RunListener;
+import org.apache.maven.surefire.report.Reporter;
+
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.junit.runner.Description;
+import org.junit.runner.Result;
+
+public class JUnitCoreRunListener
+    extends JUnit4RunListener
+{
+    private final Map<String, TestSet> classMethodCounts;
+
+    /**
+     * @param reporter          the report manager to log testing events to
+     * @param classMethodCounts A map of methods
+     */
+    public JUnitCoreRunListener( Reporter reporter, Map<String, TestSet> classMethodCounts )
+    {
+        super( reporter );
+        this.classMethodCounts = classMethodCounts;
+    }
+
+    /**
+     * Called right before any tests from a specific class are run.
+     *
+     * @see org.junit.runner.notification.RunListener#testRunStarted(org.junit.runner.Description)
+     */
+    public void testRunStarted( Description description )
+        throws Exception
+    {
+        fillTestCountMap( description );
+        reporter.testSetStarting( null ); // Not entirely meaningful as we can see
+    }
+
+    @Override
+    public void testRunFinished( Result result )
+        throws Exception
+    {
+        reporter.testSetCompleted( null );
+    }
+
+    private void fillTestCountMap( Description description )
+    {
+        final ArrayList<Description> children = description.getChildren();
+
+        TestSet testSet = new TestSet( description );
+        Class<?> itemTestClass = null;
+        for ( Description item : children )
+        {
+            if ( item.isTest() )
+            {
+                testSet.incrementTestMethodCount();
+                if ( itemTestClass == null )
+                {
+                    itemTestClass = item.getTestClass();
+                }
+            }
+            else if ( item.getChildren().size() > 0 )
+            {
+                fillTestCountMap( item );
+            }
+        }
+        if ( itemTestClass != null )
+        {
+            classMethodCounts.put( itemTestClass.getName(), testSet );
+        }
+    }
+
+}

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/LogicalStream.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/LogicalStream.java?rev=1057886&r1=1057885&r2=1057886&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/LogicalStream.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/LogicalStream.java Tue Jan 11 21:47:46 2011
@@ -19,7 +19,7 @@ package org.apache.maven.surefire.junitc
  * under the License.
  */
 
-import org.apache.maven.surefire.report.Reporter;
+import org.apache.maven.surefire.report.ReportWriter;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -54,7 +54,7 @@ public class LogicalStream
         }
 
 
-        public void writeDetails( Reporter reporter )
+        public void writeDetails( ReportWriter reporter )
         {
             reporter.writeDetailMessage( value );
         }
@@ -80,7 +80,7 @@ public class LogicalStream
         }
     }
 
-    public void writeDetails( Reporter reporter )
+    public void writeDetails( ReportWriter reporter )
     {
         for ( Entry entry : output )
         {

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/MethodsParallelRunListener.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/MethodsParallelRunListener.java?rev=1057886&r1=1057885&r2=1057886&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/MethodsParallelRunListener.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/MethodsParallelRunListener.java Tue Jan 11 21:47:46 2011
@@ -23,26 +23,27 @@ import org.apache.maven.surefire.report.
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
+import java.util.Map;
+
 /**
  * @author Kristian Rosenvold
  */
 public class MethodsParallelRunListener
-    extends ConcurrentReportingRunListener
+    extends ConcurrentReporterManager
 {
     private volatile TestSet lastStarted;
 
     private final Object lock = new Object();
 
-    public MethodsParallelRunListener( ReporterFactory reporterFactory, ReporterConfiguration reporterConfiguration,
-                                       boolean reportImmediately )
+    public MethodsParallelRunListener( Map<String, TestSet> classMethodCounts, ReporterFactory reporterFactory,
+                                       ReporterConfiguration reporterConfiguration, boolean reportImmediately )
         throws TestSetFailedException
     {
-        super( reporterFactory, reportImmediately, reporterConfiguration );
+        super( reporterFactory, reportImmediately, reporterConfiguration, classMethodCounts );
     }
 
     @Override
     public void checkIfTestSetCanBeReported( TestSet testSetForTest )
-        throws TestSetFailedException
     {
         synchronized ( lock )
         {

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java?rev=1057886&r1=1057885&r2=1057886&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java Tue Jan 11 21:47:46 2011
@@ -19,17 +19,8 @@ package org.apache.maven.surefire.junitc
  * under the License.
  */
 
-import org.apache.maven.surefire.Surefire;
-import org.apache.maven.surefire.common.junit4.JUnit4StackTraceWriter;
 import org.apache.maven.surefire.report.ReportEntry;
-import org.apache.maven.surefire.report.Reporter;
-import org.apache.maven.surefire.report.SimpleReportEntry;
-import org.junit.runner.Description;
-import org.junit.runner.notification.Failure;
-
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.ResourceBundle;
+import org.apache.maven.surefire.report.ReportWriter;
 
 /**
  * Represents the test-state of a single test method that is run.
@@ -39,54 +30,55 @@ import java.util.ResourceBundle;
  */
 class TestMethod
 {
-    private final Description description;
+    private final ReportEntry description;
 
     private final long startTime;
 
     private long endTime;
 
-    private volatile Failure testFailure;
+    private volatile ReportEntry testFailure;
 
-    private volatile Failure testAssumptionFailure;
+    private volatile ReportEntry testError;
 
-    private volatile Description ignored;
+    private volatile ReportEntry testAssumptionFailure;
+
+    private volatile ReportEntry ignored;
 
     private static final InheritableThreadLocal<TestMethod> TEST_METHOD = new InheritableThreadLocal<TestMethod>();
 
     private volatile LogicalStream output;
 
-    public TestMethod( Description description )
+    public TestMethod( ReportEntry description )
     {
         this.description = description;
         startTime = System.currentTimeMillis();
     }
 
-
     public void testFinished()
-        throws Exception
     {
         setEndTime();
     }
 
-
-    public void testIgnored( Description description )
-        throws Exception
+    public void testIgnored( ReportEntry description )
     {
         ignored = description;
         setEndTime();
     }
 
-    public void testFailure( Failure failure )
-        throws Exception
+    public void testFailure( ReportEntry failure )
     {
         this.testFailure = failure;
-        setEndTime();
     }
 
+    public void testAssumptionFailure( ReportEntry testAssumptionFailure )
+    {
+        this.testAssumptionFailure = testAssumptionFailure;
+        setEndTime();
+    }
 
-    public void testAssumptionFailure( Failure failure )
+    public void testError( ReportEntry failure )
     {
-        this.testAssumptionFailure = failure;
+        this.testError = failure;
         setEndTime();
     }
 
@@ -101,7 +93,7 @@ class TestMethod
     }
 
 
-    public void replay( Reporter reporter )
+    public void replay( ReportWriter reporter )
         throws Exception
     {
 
@@ -116,19 +108,14 @@ class TestMethod
         {
             output.writeDetails( reporter );
         }
+
         if ( testFailure != null )
         {
-            ReportEntry report = createFailureEntry( testFailure );
-            //noinspection ThrowableResultOfMethodCallIgnored
-            if ( testFailure.getException() instanceof AssertionError )
-            {
-                reporter.testFailed( report, getStdout(), getStdErr() );
-            }
-            else
-            {
-                reporter.testError( report, getStdout(), getStdErr() );
-            }
-
+            reporter.testFailed( testFailure, getStdout(), getStdErr() );
+        }
+        else if ( testError != null )
+        {
+            reporter.testError( testError, getStdout(), getStdErr() );
         }
         else if ( testAssumptionFailure != null )
         {
@@ -142,17 +129,9 @@ class TestMethod
 
     private ReportEntry createReportEntry()
     {
-        return new SimpleReportEntry( description.getTestClass().getCanonicalName(), description.getDisplayName(),
-                                      getElapsed() );
-    }
-
-    private ReportEntry createFailureEntry( Failure failure )
-    {
-        return new SimpleReportEntry( failure.getDescription().getTestClass().getCanonicalName(),
-                                      failure.getTestHeader(), new JUnit4StackTraceWriter( failure ), getElapsed() );
+        return this.description;
     }
 
-
     public void attachToThread()
     {
         TEST_METHOD.set( this );
@@ -187,32 +166,4 @@ class TestMethod
     {
         return output != null ? output.getOutput( false ) : "";
     }
-
-    public static void fillTestCountMap( Description description, Map<Class, TestSet> methodCount )
-    {
-        final ArrayList<Description> children = description.getChildren();
-
-        TestSet testSet = new TestSet( description );
-        Class<?> itemTestClass = null;
-        for ( Description item : children )
-        {
-            if ( item.isTest() )
-            {
-                testSet.incrementTestMethodCount();
-                if ( itemTestClass == null )
-                {
-                    itemTestClass = item.getTestClass();
-                }
-            }
-            else if ( item.getChildren().size() > 0 )
-            {
-                fillTestCountMap( item, methodCount );
-            }
-        }
-        if ( itemTestClass != null )
-        {
-            methodCount.put( itemTestClass, testSet );
-        }
-    }
-
 }

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestSet.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestSet.java?rev=1057886&r1=1057885&r2=1057886&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestSet.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestSet.java Tue Jan 11 21:47:46 2011
@@ -19,19 +19,19 @@ package org.apache.maven.surefire.junitc
  * under the License.
  */
 
-import org.apache.maven.surefire.Surefire;
 import org.apache.maven.surefire.report.ReportEntry;
+import org.apache.maven.surefire.report.ReportWriter;
 import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.SimpleReportEntry;
-import org.junit.runner.Description;
 
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.ResourceBundle;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import org.junit.runner.Description;
+
 /**
  * * Represents the test-state of a testset that is run.
  */
@@ -74,15 +74,15 @@ public class TestSet
             {
                 elapsed += testMethod.getElapsed();
             }
-            ReportEntry report = createReportEntry( "testSetStarting", null );
+            ReportEntry report = createReportEntry( null );
 
             target.testSetStarting( report );
 
             for ( TestMethod testMethod : testMethods )
             {
-                testMethod.replay( target );
+                testMethod.replay( (ReportWriter) target );
             }
-            report = createReportEntry( "testSetCompletedNormally", elapsed );
+            report = createReportEntry( elapsed );
 
             target.testSetCompleted( report );
         }
@@ -92,14 +92,14 @@ public class TestSet
         }
     }
 
-    public TestMethod createTestMethod( Description description )
+    public TestMethod createTestMethod( ReportEntry description )
     {
         TestMethod testMethod = new TestMethod( description );
         addTestMethod( testMethod );
         return testMethod;
     }
 
-    private ReportEntry createReportEntry( String rawString2, Integer elapsed )
+    private ReportEntry createReportEntry( Integer elapsed )
     {
         boolean isJunit3 = testSetDescription.getTestClass() == null;
         String classNameToUse =

Copied: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java (from r1057317, maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReportingRunListenerTest.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java?p2=maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReportingRunListenerTest.java&r1=1057317&r2=1057886&rev=1057886&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReportingRunListenerTest.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java Tue Jan 11 21:47:46 2011
@@ -20,21 +20,30 @@
 package org.apache.maven.surefire.junitcore;
 
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.apache.maven.surefire.report.*;
+import org.apache.maven.surefire.report.ConsoleReporter;
+import org.apache.maven.surefire.report.Reporter;
+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.RunStatistics;
 import org.apache.maven.surefire.testset.TestSetFailedException;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.Computer;
-import org.junit.runner.JUnitCore;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.Computer;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.notification.RunListener;
 
 import static junit.framework.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -43,7 +52,7 @@ import static org.junit.Assert.assertNot
  * @author Kristian Rosenvold
  */
 
-public class ConcurrentReportingRunListenerTest
+public class ConcurrentReporterManagerTest
 {
     // Tests are in order of increasing complexity
     @Test
@@ -160,31 +169,29 @@ public class ConcurrentReportingRunListe
     private void runClasses( int success, int ignored, int failure, Class... classes )
         throws TestSetFailedException
     {
-        ReporterFactory reporterManagerFactory = createReporterFactory();
-        RunStatistics result = runClasses( reporterManagerFactory,
-                                           new ClassesParallelRunListener( reporterManagerFactory,
-                                                                           getReporterConfiguration() ), classes );
+        ReporterFactory reporterFactory = createReporterFactory();
+        HashMap<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
+        Reporter reporter =
+            new ClassesParallelRunListener( classMethodCounts, reporterFactory, getReporterConfiguration() );
+        JUnitCoreRunListener runListener = new JUnitCoreRunListener( reporter, classMethodCounts );
+        RunStatistics result = runClasses( reporterFactory, runListener, classes );
         assertReporter( result, success, ignored, failure, "classes" );
+        classMethodCounts.clear();
 
-        reporterManagerFactory = createReporterFactory();
-        result = runClasses( reporterManagerFactory,
-                             new MethodsParallelRunListener( reporterManagerFactory, getReporterConfiguration(), true ),
-                             classes );
-        assertReporter( result, success, ignored, failure, "methods" );
-
-        reporterManagerFactory = createReporterFactory();
-        result = runClasses( reporterManagerFactory,
-                             new MethodsParallelRunListener( reporterManagerFactory, getReporterConfiguration(),
-                                                             false ), classes );
+        reporterFactory = createReporterFactory();
+        reporter =
+            new MethodsParallelRunListener( classMethodCounts, reporterFactory, getReporterConfiguration(), true );
+        runListener = new JUnitCoreRunListener( reporter, classMethodCounts );
+        result = runClasses( reporterFactory, runListener, classes );
         assertReporter( result, success, ignored, failure, "methods" );
-
     }
 
     private RunStatistics runClasses( Class... classes )
         throws TestSetFailedException
     {
+        HashMap<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
         final ReporterFactory reporterManagerFactory = createReporterFactory();
-        ConcurrentReportingRunListener demultiplexingRunListener = createRunListener( reporterManagerFactory );
+        RunListener demultiplexingRunListener = createRunListener( reporterManagerFactory, classMethodCounts );
 
         JUnitCore jUnitCore = new JUnitCore();
 
@@ -195,8 +202,8 @@ public class ConcurrentReportingRunListe
         return reporterManagerFactory.getGlobalRunStatistics();
     }
 
-    private RunStatistics runClasses( ReporterFactory reporterManagerFactory,
-                                      ConcurrentReportingRunListener demultiplexingRunListener, Class... classes )
+    private RunStatistics runClasses( ReporterFactory reporterManagerFactory, RunListener demultiplexingRunListener,
+                                      Class... classes )
         throws TestSetFailedException
     {
 
@@ -209,10 +216,11 @@ public class ConcurrentReportingRunListe
         return reporterManagerFactory.getGlobalRunStatistics();
     }
 
-    private ConcurrentReportingRunListener createRunListener( ReporterFactory reporterFactory )
+    private RunListener createRunListener( ReporterFactory reporterFactory, Map<String, TestSet> testSetMap )
         throws TestSetFailedException
     {
-        return new ClassesParallelRunListener( reporterFactory, getReporterConfiguration() );
+        return new JUnitCoreRunListener(
+            new ClassesParallelRunListener( testSetMap, reporterFactory, getReporterConfiguration() ), testSetMap );
     }
 
     public ReporterConfiguration getReporterConfiguration()

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListenerTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListenerTest.java?rev=1057886&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListenerTest.java (added)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListenerTest.java Tue Jan 11 21:47:46 2011
@@ -0,0 +1,49 @@
+package org.apache.maven.surefire.junitcore;
+
+import org.apache.maven.surefire.report.MulticastingReporter;
+
+import java.util.Collections;
+import java.util.HashMap;
+
+import org.junit.Test;
+import org.junit.runner.Computer;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.RunListener;
+
+import static junit.framework.Assert.assertEquals;
+
+/**
+ * @author Kristian Rosenvold
+ */
+public class JUnitCoreRunListenerTest
+{
+    @Test
+    public void testTestRunStarted()
+        throws Exception
+    {
+        RunListener jUnit4TestSetReporter = new JUnitCoreRunListener( new MulticastingReporter( Collections.emptyList() ),
+                                                                      new HashMap<String, TestSet>(  ) );
+        JUnitCore core = new JUnitCore();
+        core.addListener(  jUnit4TestSetReporter );
+        Result result = core.run( new Computer(), STest1.class, STest2.class);
+        core.removeListener(  jUnit4TestSetReporter );
+        assertEquals(2, result.getRunCount());
+    }
+
+
+    public static class STest1
+    {
+        @Test
+        public void testSomething(){
+
+        }
+    }
+    public static class STest2
+    {
+        @Test
+        public void testSomething2(){
+
+        }
+    }
+}

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListenerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTestCase.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTestCase.java?rev=1057886&r1=1057885&r2=1057886&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTestCase.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTestCase.java Tue Jan 11 21:47:46 2011
@@ -16,19 +16,23 @@
  */
 package org.apache.maven.surefire.junitcore;
 
-import junit.framework.Assert;
+import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.ReporterConfiguration;
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.ReporterManagerFactory;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import junit.framework.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.Computer;
 import org.junit.runner.JUnitCore;
 import org.junit.runner.Result;
 import org.junit.runner.notification.Failure;
-
-import java.io.File;
-import java.util.ArrayList;
+import org.junit.runner.notification.RunListener;
 
 /**
  * TestCase that expose "No tests were executed!" on Test failure using Maven Surefire 2.6-SNAPSHOT
@@ -114,15 +118,16 @@ public class MavenSurefireJUnit47RunnerT
     public void surefireShouldBeAbleToReportRunStatusEvenWithFailingTests()
         throws Exception
     {
-        ReporterConfiguration reporterConfiguration = ConcurrentReportingRunListenerTest.getTestReporterConfiguration();
+        ReporterConfiguration reporterConfiguration = ConcurrentReporterManagerTest.getTestReporterConfiguration();
 
         ReporterFactory reporterManagerFactory =
             new ReporterManagerFactory( this.getClass().getClassLoader(), reporterConfiguration );
 
-        ConcurrentReportingRunListener concurrentReportingRunListener =
-            ConcurrentReportingRunListener.createInstance( reporterManagerFactory, getReporterConfiguration(), false,
-                                                           false );
+        final HashMap<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
+        Reporter reporter = ConcurrentReporterManager.createInstance( classMethodCounts, reporterManagerFactory,
+                                                                      getReporterConfiguration(), false, false );
 
+        RunListener concurrentReportingRunListener = new JUnitCoreRunListener( reporter, classMethodCounts );
         Computer computer = new Computer();
 
         JUnitCore junitCore = new JUnitCore();

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MockReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MockReporter.java?rev=1057886&r1=1057885&r2=1057886&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MockReporter.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MockReporter.java Tue Jan 11 21:47:46 2011
@@ -167,4 +167,8 @@ public class MockReporter
     public void testFailed( ReportEntry report )
     {
     }
+
+    public void testAssumptionFailure( ReportEntry report )
+    {
+    }
 }

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/SynchronizedReporterManager.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/SynchronizedReporterManager.java?rev=1057886&r1=1057885&r2=1057886&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/SynchronizedReporterManager.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/SynchronizedReporterManager.java Tue Jan 11 21:47:46 2011
@@ -53,6 +53,7 @@ import org.apache.maven.surefire.report.
  * should probably be correct.
  * <p/>
  * <p/>
+ *
  * @noinspection deprecation
  */
 class SynchronizedReporterManager
@@ -133,4 +134,9 @@ class SynchronizedReporterManager
     {
         target.writeFooter( footer );
     }
+
+    public synchronized void testAssumptionFailure( ReportEntry report )
+    {
+        target.testAssumptionFailure( report );
+    }
 }



Mime
View raw message