maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1057317 - 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/common-junit4/src/test/java/org/...
Date Mon, 10 Jan 2011 19:09:13 GMT
Author: krosenvold
Date: Mon Jan 10 19:09:12 2011
New Revision: 1057317

URL: http://svn.apache.org/viewvc?rev=1057317&view=rev
Log:
o Further cleaned up and simplifed

Added:
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportWriter.java
      - copied, changed from r1056827, maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java
    maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java   (contents, props changed)
      - copied, changed from r1056827, maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java
    maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/common/
    maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/common/junit4/
    maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/common/junit4/JUnit4RunListenerTest.java   (with props)
Removed:
    maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java
Modified:
    maven/surefire/trunk/.gitignore
    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/Reporter.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
    maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.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/SurefireTestSet.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/main/java/org/apache/maven/surefire/junitcore/TestSet.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/ConfigurationAwareTestNGReporter.java
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/SynchronizedReporterManager.java
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java

Modified: maven/surefire/trunk/.gitignore
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/.gitignore?rev=1057317&r1=1057316&r2=1057317&view=diff
==============================================================================
--- maven/surefire/trunk/.gitignore (original)
+++ maven/surefire/trunk/.gitignore Mon Jan 10 19:09:12 2011
@@ -2,5 +2,5 @@
 *.ipr
 target
 *.iws
-surefire-api/dependency-reduced-pom.xml
 .classpath
+dependency-reduced-pom.xml

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=1057317&r1=1057316&r2=1057317&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 Mon Jan 10 19:09:12 2011
@@ -27,7 +27,7 @@ import java.util.Locale;
  * @version $Id$
  */
 public abstract class AbstractReporter
-    implements Reporter
+    implements Reporter, ReportWriter
 {
     protected int completedCount;
 
@@ -206,4 +206,16 @@ public abstract class AbstractReporter
         final Integer clientSpecifiedElapsed = reportEntry.getElapsed();
         return clientSpecifiedElapsed != null ? clientSpecifiedElapsed.intValue() : endTime - startTime;
     }
+
+    // @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.
+    }
 }

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=1057317&r1=1057316&r2=1057317&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 Mon Jan 10 19:09:12 2011
@@ -28,7 +28,7 @@ import java.util.List;
  * @author Kristian Rosenvold
  */
 public class MulticastingReporter
-    implements Reporter, RunReporter
+    implements Reporter, RunReporter, ReportWriter
 {
     private final List target;
 
@@ -42,7 +42,7 @@ public class MulticastingReporter
     {
         for ( Iterator it = target.iterator(); it.hasNext(); )
         {
-            ( (Reporter) it.next() ).testSetStarting( report );
+            ( (ReportWriter) it.next() ).testSetStarting( report );
         }
     }
 
@@ -52,7 +52,7 @@ public class MulticastingReporter
         {
             try
             {
-                ( (Reporter) it.next() ).testSetCompleted( report );
+                ( (ReportWriter) it.next() ).testSetCompleted( report );
             }
             catch ( ReporterException e )
             {
@@ -92,7 +92,7 @@ public class MulticastingReporter
     {
         for ( Iterator it = target.iterator(); it.hasNext(); )
         {
-            ( (Reporter) it.next() ).testStarting( report );
+            ( (ReportWriter) it.next() ).testStarting( report );
         }
     }
 
@@ -100,7 +100,7 @@ public class MulticastingReporter
     {
         for ( Iterator it = target.iterator(); it.hasNext(); )
         {
-            ( (Reporter) it.next() ).testSucceeded( report );
+            ( (ReportWriter) it.next() ).testSucceeded( report );
         }
     }
 
@@ -108,7 +108,7 @@ public class MulticastingReporter
     {
         for ( Iterator it = target.iterator(); it.hasNext(); )
         {
-            ( (Reporter) it.next() ).testError( report, stdOut, stdErr );
+            ( (ReportWriter) it.next() ).testError( report, stdOut, stdErr );
         }
     }
 
@@ -116,7 +116,7 @@ public class MulticastingReporter
     {
         for ( Iterator it = target.iterator(); it.hasNext(); )
         {
-            ( (Reporter) it.next() ).testFailed( report, stdOut, stdErr );
+            ( (ReportWriter) it.next() ).testFailed( report, stdOut, stdErr );
         }
     }
 
@@ -124,7 +124,7 @@ public class MulticastingReporter
     {
         for ( Iterator it = target.iterator(); it.hasNext(); )
         {
-            ( (Reporter) it.next() ).testSkipped( report );
+            ( (ReportWriter) it.next() ).testSkipped( report );
         }
     }
 
@@ -132,7 +132,7 @@ public class MulticastingReporter
     {
         for ( Iterator it = target.iterator(); it.hasNext(); )
         {
-            Reporter reporter = ( (Reporter) it.next() );
+            ReportWriter reporter = ( (ReportWriter) it.next() );
             // Todo: Really need to find out how the surefire4.x provider manages to avoid printing to this one.
             if ( !( reporter instanceof BriefFileReporter ) )
             {
@@ -145,7 +145,7 @@ public class MulticastingReporter
     {
         for ( Iterator it = target.iterator(); it.hasNext(); )
         {
-            Reporter reporter = ( (Reporter) it.next() );
+            ReportWriter reporter = ( (ReportWriter) it.next() );
             reporter.writeDetailMessage( message );
         }
     }
@@ -154,7 +154,7 @@ public class MulticastingReporter
     {
         for ( Iterator it = target.iterator(); it.hasNext(); )
         {
-            ( (Reporter) it.next() ).writeMessage( message );
+            ( (ReportWriter) it.next() ).writeMessage( message );
         }
     }
 
@@ -162,7 +162,7 @@ public class MulticastingReporter
     {
         for ( Iterator it = target.iterator(); it.hasNext(); )
         {
-            ( (Reporter) it.next() ).writeFooter( footer );
+            ( (ReportWriter) it.next() ).writeFooter( footer );
         }
     }
 
@@ -170,7 +170,23 @@ public class MulticastingReporter
     {
         for ( Iterator it = target.iterator(); it.hasNext(); )
         {
-            ( (Reporter) it.next() ).reset();
+            ( (ReportWriter) it.next() ).reset();
+        }
+    }
+
+    public void testError( ReportEntry report )
+    {
+        for ( Iterator it = target.iterator(); it.hasNext(); )
+        {
+            ( (ReportWriter) it.next() ).testError( report );
+        }
+    }
+
+    public void testFailed( ReportEntry report )
+    {
+        for ( Iterator it = target.iterator(); it.hasNext(); )
+        {
+            ( (ReportWriter) it.next() ).testFailed( report );
         }
     }
 }

Copied: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportWriter.java (from r1056827, 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/ReportWriter.java?p2=maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportWriter.java&p1=maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java&r1=1056827&r2=1057317&rev=1057317&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/ReportWriter.java Mon Jan 10 19:09:12 2011
@@ -20,19 +20,19 @@ package org.apache.maven.surefire.report
  */
 
 /**
- * Used by providers to report results.
- * Using this interface integrates the providers together into a common reporting infrastructure.
+ * Persists reports somewhere
  * <p/>
  * An instance of a reporter is not guaranteed to be thread-safe and concurrent test frameworks
  * must request an instance of a reporter per-thread from the ReporterFactory.
  */
-public interface Reporter
+public interface ReportWriter
 {
     /**
      * Indicates the start of a given test-set
      *
      * @param report the report entry describing the testset
-     * @throws ReporterException When reporting fails
+     * @throws org.apache.maven.surefire.report.ReporterException
+     *          When reporting fails
      */
     void testSetStarting( ReportEntry report )
         throws ReporterException;
@@ -41,7 +41,8 @@ public interface Reporter
      * Indicates end of a given test-set
      *
      * @param report the report entry describing the testset
-     * @throws ReporterException When reporting fails
+     * @throws org.apache.maven.surefire.report.ReporterException
+     *          When reporting fails
      */
     void testSetCompleted( ReportEntry report )
         throws ReporterException;
@@ -66,8 +67,26 @@ public interface Reporter
      * Event fired when a test ended with an error (non anticipated problem)
      *
      * @param report The report entry to log for
+     */
+    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 testSkipped( ReportEntry report );
+
+    /**
+     * Event fired when a test ended with an error (non anticipated problem)
+     *
+     * @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 );
 
@@ -77,12 +96,10 @@ public interface Reporter
      * @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 );
 
-    void testSkipped( ReportEntry report );
-
-
     /**
      * Writes a message that will be displayed in all free-text format reporters.
      * These messages will be output regardless, as opposed to #writeDetailMessage,

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=1057317&r1=1057316&r2=1057317&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 Mon Jan 10 19:09:12 2011
@@ -66,8 +66,26 @@ public interface Reporter
      * Event fired when a test ended with an error (non anticipated problem)
      *
      * @param report The report entry to log for
+     */
+    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 testSkipped( ReportEntry report );
+
+    /**
+     * Event fired when a test ended with an error (non anticipated problem)
+     *
+     * @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 );
 
@@ -77,18 +95,17 @@ public interface Reporter
      * @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 );
 
-    void testSkipped( ReportEntry report );
-
-
     /**
      * Writes a message that will be displayed in all free-text format reporters.
      * These messages will be output regardless, as opposed to #writeDetailMessage,
      * which is controlled by reportFormat.
      *
      * @param message The message to write.
+     * @deprecated remove when building with 2.7.2
      */
     void writeMessage( String message );
 
@@ -97,14 +114,19 @@ public interface Reporter
      * This is controlled by reportFormat attribute on the plugin.
      *
      * @param message The message to write
+     * @deprecated remove when building with 2.7.2
      */
     void writeDetailMessage( String message );
 
     /**
      * 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();
 
+    /**
+     * @deprecated remove when building with 2.7.2
+     */
     void writeFooter( String footer );
 }

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=1057317&r1=1057316&r2=1057317&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 Mon Jan 10 19:09:12 2011
@@ -53,23 +53,11 @@ public class ReporterManager
         this.runStatisticsForThis = runStatisticsForThis;
     }
 
-    protected ReporterManager( ReporterManager other )
-    {
-        this.multicastingReporter = other.multicastingReporter;
-        this.runStatisticsForThis = other.runStatisticsForThis;
-        this.consoleCapturer = other.consoleCapturer;
-    }
-
     public void writeMessage( String message )
     {
         multicastingReporter.writeMessage( message );
     }
 
-    public void writeConsoleMessage( String message )
-    {
-        multicastingReporter.writeConsoleMessage( message );
-    }
-
     public void writeDetailMessage( String message )
     {
         multicastingReporter.writeDetailMessage( message );
@@ -128,6 +116,7 @@ public class ReporterManager
     public void testSetCompleted( ReportEntry report )
     {
         multicastingReporter.testSetCompleted( report );
+        multicastingReporter.reset();
     }
 
     // ----------------------------------------------------------------------

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java?rev=1057317&r1=1057316&r2=1057317&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManagerFactory.java Mon Jan 10 19:09:12 2011
@@ -59,6 +59,8 @@ public class ReporterManagerFactory
 
     protected final Object lock = new Object();
 
+    private List reports;
+
     private final SystemStreamCapturer systemStreamCapturer = new SystemStreamCapturer();
 
     public ReporterManagerFactory( List reportDefinitions, ClassLoader surefireClassLoader,
@@ -67,6 +69,7 @@ public class ReporterManagerFactory
         this.reportDefinitions = reportDefinitions;
         this.surefireClassLoader = surefireClassLoader;
         this.reporterConfiguration = reporterConfiguration;
+        this.reports = instantiateReportsNewStyle( reportDefinitions, reporterConfiguration, surefireClassLoader );
     }
 
     public ReporterManagerFactory( ClassLoader surefireClassLoader, ReporterConfiguration reporterConfiguration )
@@ -79,17 +82,9 @@ public class ReporterManagerFactory
         return globalRunStatistics;
     }
 
-    public ReporterManager createReporterManager()
-    {
-        final List reports = instantiateReports( reportDefinitions, surefireClassLoader );
-        return (ReporterManager) setupReporter( reports );
-
-    }
-
     public Reporter createReporter()
     {
-        final List reports =
-            instantiateReportsNewStyle( reportDefinitions, reporterConfiguration, surefireClassLoader );
+        reports = instantiateReportsNewStyle( reportDefinitions, reporterConfiguration, surefireClassLoader );
         return setupReporter( reports );
     }
 
@@ -128,15 +123,6 @@ public class ReporterManagerFactory
         }
     }
 
-    private List instantiateReports( List reportDefinitions, ClassLoader classLoader )
-    {
-        if ( reportDefinitions.size() == 0 )
-        {
-            return new ArrayList();
-        }
-        return instantiateReportsNewStyle( reportDefinitions, reporterConfiguration, classLoader );
-    }
-
     protected List instantiateReportsNewStyle( List reportDefinitions, ReporterConfiguration reporterConfiguration,
                                                ClassLoader classLoader )
     {
@@ -189,7 +175,7 @@ public class ReporterManagerFactory
     {
         if ( getGlobalRunStatistics().getRunResult().getCompletedCount() == 0 )
         {
-            createReporterManager().writeMessage( "There are no tests to run." );
+            new MulticastingReporter( reports ).writeMessage( "There are no tests to run." );
         }
     }
 }

Copied: maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java (from r1056827, maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java?p2=maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java&r1=1056827&r2=1057317&rev=1057317&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java (original)
+++ maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java Mon Jan 10 19:09:12 2011
@@ -1,4 +1,4 @@
-package org.apache.maven.surefire.junit4;
+package org.apache.maven.surefire.common.junit4;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -19,30 +19,25 @@ package org.apache.maven.surefire.junit4
  * under the License.
  */
 
-import org.apache.maven.surefire.common.junit4.JUnit4StackTraceWriter;
 import org.apache.maven.surefire.report.ReportEntry;
-import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.SimpleReportEntry;
 import org.junit.runner.Description;
-import org.junit.runner.Result;
 import org.junit.runner.notification.Failure;
 import org.junit.runner.notification.RunListener;
 
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-public class JUnit4TestSetReporter
+public class JUnit4RunListener
     extends RunListener
 {
     private static final Pattern PARENS = Pattern.compile( "^" + "[^\\(\\)]+" //non-parens
-                                                + "\\((" // then an open-paren (start matching a group)
-                                                + "[^\\\\(\\\\)]+" //non-parens
-                                                + ")\\)" + "$" ); // then a close-paren (end group match)
+                                                               + "\\((" // then an open-paren (start matching a group)
+                                                               + "[^\\\\(\\\\)]+" //non-parens
+                                                               + ")\\)" + "$" ); // then a close-paren (end group match)
 
-    // Member Variables
-    private Class testSet;
-
-    private ReporterManager reportMgr;
+    protected final Reporter reportMgr;
 
     /**
      * This flag is set after a failure has occurred so that a <code>testSucceeded</code> event is not fired.
@@ -53,42 +48,14 @@ public class JUnit4TestSetReporter
     /**
      * Constructor.
      *
-     * @param testClass     the specific test set that this will report on as it is
-     *                      executed
      * @param reportManager the report manager to log testing events to
      */
-    JUnit4TestSetReporter( Class testClass, ReporterManager reportManager )
+    public JUnit4RunListener( Reporter reportManager )
     {
-        this.testSet = testClass;
         this.reportMgr = reportManager;
     }
 
-    /**
-     * 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
-    {
-        ReportEntry report = new SimpleReportEntry( testSet.getName(), testSet.getName() );
-
-        this.reportMgr.testSetStarting( report );
-    }
-
-    /**
-     * Called right after all tests from a specific class are run.
-     *
-     * @see org.junit.runner.notification.RunListener#testRunFinished(org.junit.runner.Result)
-     */
-    public void testRunFinished( Result result )
-        throws Exception
-    {
-        ReportEntry report = new SimpleReportEntry( testSet.getName(), testSet.getName() );
-
-        this.reportMgr.testSetCompleted( report );
-        this.reportMgr.reset();
-    }
+    // Testrun methods are not invoked when using the runner
 
     /**
      * Called when a specific test has been skipped (for whatever reason).
@@ -98,9 +65,7 @@ public class JUnit4TestSetReporter
     public void testIgnored( Description description )
         throws Exception
     {
-        ReportEntry report = new SimpleReportEntry( extractClassName( description ), description.getDisplayName() );
-
-        this.reportMgr.testSkipped( report );
+        reportMgr.testSkipped( createReportEntry( description ) );
     }
 
     /**
@@ -111,11 +76,8 @@ public class JUnit4TestSetReporter
     public void testStarted( Description description )
         throws Exception
     {
-        ReportEntry report = new SimpleReportEntry( extractClassName( description ), description.getDisplayName() );
-
-        this.reportMgr.testStarting( report );
-
-        this.failureFlag = false;
+        reportMgr.testStarting( createReportEntry( description ) );
+        failureFlag = false;
     }
 
     /**
@@ -153,13 +115,20 @@ public class JUnit4TestSetReporter
     {
         if ( !failureFlag )
         {
-            ReportEntry report = new SimpleReportEntry( extractClassName( description ), description.getDisplayName() );
-
-            this.reportMgr.testSucceeded( report );
+            reportMgr.testSucceeded( createReportEntry( description ) );
         }
     }
 
-    private String extractClassName( Description description )
+    private SimpleReportEntry createReportEntry( Description description )
+    {
+        return new SimpleReportEntry( extractClassName( description ), description.getDisplayName() );
+    }
+
+    public void testAssumptionFailure( Failure failure )
+    {
+    }
+
+    protected String extractClassName( Description description )
     {
         String displayName = description.getDisplayName();
         Matcher m = PARENS.matcher( displayName );
@@ -169,14 +138,4 @@ public class JUnit4TestSetReporter
         }
         return m.group( 1 );
     }
-
-    public void setTestSet( Class testSet )
-    {
-        this.testSet = testSet;
-    }
-
-    public void setReportMgr( ReporterManager reportMgr )
-    {
-        this.reportMgr = reportMgr;
-    }
 }

Propchange: maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/common/junit4/JUnit4RunListenerTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/common/junit4/JUnit4RunListenerTest.java?rev=1057317&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/common/junit4/JUnit4RunListenerTest.java (added)
+++ maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/common/junit4/JUnit4RunListenerTest.java Mon Jan 10 19:09:12 2011
@@ -0,0 +1,66 @@
+package org.apache.maven.surefire.common.junit4;
+
+/*
+ * 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.report.MulticastingReporter;
+import org.junit.Test;
+import org.junit.runner.Request;
+import org.junit.runner.Runner;
+import org.junit.runner.notification.RunListener;
+import org.junit.runner.notification.RunNotifier;
+
+import java.util.Collections;
+
+/**
+ * @author Kristian Rosenvold
+ */
+public class JUnit4RunListenerTest
+{
+    @Test
+    public void testTestStarted()
+        throws Exception
+    {
+        RunListener jUnit4TestSetReporter =
+            new JUnit4RunListener( new MulticastingReporter( Collections.emptyList() ) );
+        Runner junitTestRunner = Request.classes( "abc", STest1.class, STest2.class ).getRunner();
+        RunNotifier runNotifier = new RunNotifier();
+        runNotifier.addListener( jUnit4TestSetReporter );
+        junitTestRunner.run( runNotifier );
+    }
+
+
+    public static class STest1
+    {
+        @Test
+        public void testSomething()
+        {
+
+        }
+    }
+
+    public static class STest2
+    {
+        @Test
+        public void testSomething2()
+        {
+
+        }
+    }
+}

Propchange: maven/surefire/trunk/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/common/junit4/JUnit4RunListenerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java?rev=1057317&r1=1057316&r2=1057317&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java Mon Jan 10 19:09:12 2011
@@ -24,9 +24,9 @@ import org.apache.maven.surefire.common.
 import org.apache.maven.surefire.providerapi.ProviderParameters;
 import org.apache.maven.surefire.providerapi.SurefireProvider;
 import org.apache.maven.surefire.report.ReportEntry;
+import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.ReporterException;
 import org.apache.maven.surefire.report.ReporterFactory;
-import org.apache.maven.surefire.report.ReporterManager;
 import org.apache.maven.surefire.report.SimpleReportEntry;
 import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.testset.TestSetFailedException;
@@ -75,7 +75,7 @@ public class JUnit3Provider
             testsToRun = forkTestSet == null ? scanClassPath() : TestsToRun.fromClass( (Class) forkTestSet );
         }
 
-        ReporterManager reporter = (ReporterManager) reporterFactory.createReporter();
+        Reporter reporter = reporterFactory.createReporter();
 
         for ( Iterator iter = testsToRun.iterator(); iter.hasNext(); )
         {
@@ -96,19 +96,17 @@ public class JUnit3Provider
 
     }
 
-    private void executeTestSet( SurefireTestSet testSet, ReporterManager reporterManager, ClassLoader classLoader )
+    private void executeTestSet( SurefireTestSet testSet, Reporter reporter, ClassLoader classLoader )
         throws ReporterException, TestSetFailedException
     {
 
         ReportEntry report = new SimpleReportEntry( this.getClass().getName(), testSet.getName() );
 
-        reporterManager.testSetStarting( report );
+        reporter.testSetStarting( report );
 
-        testSet.execute( reporterManager, classLoader );
+        testSet.execute( reporter, classLoader );
 
-        reporterManager.testSetCompleted( report );
-
-        reporterManager.reset();
+        reporter.testSetCompleted( report );
     }
 
     private TestsToRun scanClassPath()

Modified: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java?rev=1057317&r1=1057316&r2=1057317&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java Mon Jan 10 19:09:12 2011
@@ -20,7 +20,7 @@ package org.apache.maven.surefire.junit;
  */
 
 import org.apache.maven.surefire.common.junit3.JUnit3Reflector;
-import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
 import java.lang.reflect.InvocationTargetException;
@@ -72,7 +72,7 @@ public final class JUnitTestSet
     }
 
 
-    public void execute( ReporterManager reportManager, ClassLoader loader )
+    public void execute( Reporter reportManager, ClassLoader loader )
         throws TestSetFailedException
     {
         Class testClass = getTestClass();

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=1057317&r1=1057316&r2=1057317&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 Mon Jan 10 19:09:12 2011
@@ -21,7 +21,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.ReporterManager;
+import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.SimpleReportEntry;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
@@ -69,7 +69,7 @@ public class PojoTestSet
         }
     }
 
-    public void execute( ReporterManager reportManager, ClassLoader loader )
+    public void execute( Reporter reportManager, ClassLoader loader )
         throws TestSetFailedException
     {
         if ( reportManager == null )
@@ -80,7 +80,7 @@ public class PojoTestSet
         executeTestMethods( reportManager );
     }
 
-    protected void executeTestMethods( ReporterManager reportManager )
+    protected void executeTestMethods( Reporter reportManager )
     {
         if ( reportManager == null )
         {
@@ -103,7 +103,7 @@ public class PojoTestSet
     /**
      * @noinspection CatchGenericClass, OverlyBroadCatchBlock, MethodWithMultipleReturnPoints
      */
-    protected boolean executeTestMethod( Method method, Object[] args, ReporterManager reportManager )
+    protected boolean executeTestMethod( Method method, Object[] args, Reporter reportManager )
     {
         if ( method == null || args == null || reportManager == null )
         {

Modified: maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java?rev=1057317&r1=1057316&r2=1057317&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/SurefireTestSet.java Mon Jan 10 19:09:12 2011
@@ -19,12 +19,12 @@ package org.apache.maven.surefire.junit;
  * under the License.
  */
 
-import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
 public interface SurefireTestSet
 {
-    void execute( ReporterManager reportManager, ClassLoader loader )
+    void execute( Reporter reportManager, ClassLoader loader )
         throws TestSetFailedException;
 
     String getName();

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=1057317&r1=1057316&r2=1057317&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 Mon Jan 10 19:09:12 2011
@@ -20,7 +20,7 @@ package org.apache.maven.surefire.junit;
  */
 
 import org.apache.maven.surefire.report.ReportEntry;
-import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.SimpleReportEntry;
 
 import java.lang.reflect.InvocationHandler;
@@ -43,7 +43,7 @@ public class TestListenerInvocationHandl
 
     private Set failedTestsSet = new HashSet();
 
-    private ReporterManager reportManager;
+    private Reporter reportManager;
 
     private static final Class[] EMPTY_CLASS_ARRAY = new Class[]{ };
 
@@ -103,8 +103,7 @@ public class TestListenerInvocationHandl
         }
     }
 
-    public TestListenerInvocationHandler( ReporterManager reportManager, Object instanceOfTestResult,
-                                          ClassLoader loader )
+    public TestListenerInvocationHandler( Reporter reportManager, Object instanceOfTestResult, ClassLoader loader )
     {
         if ( reportManager == null )
         {

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=1057317&r1=1057316&r2=1057317&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 Mon Jan 10 19:09:12 2011
@@ -20,12 +20,14 @@ package org.apache.maven.surefire.junit4
  */
 
 import org.apache.maven.surefire.Surefire;
+import org.apache.maven.surefire.common.junit4.JUnit4RunListener;
+import org.apache.maven.surefire.common.junit4.JUnit4TestChecker;
 import org.apache.maven.surefire.providerapi.ProviderParameters;
 import org.apache.maven.surefire.providerapi.SurefireProvider;
 import org.apache.maven.surefire.report.ReportEntry;
+import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.ReporterException;
 import org.apache.maven.surefire.report.ReporterFactory;
-import org.apache.maven.surefire.report.ReporterManager;
 import org.apache.maven.surefire.report.SimpleReportEntry;
 import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.testset.TestSetFailedException;
@@ -33,15 +35,15 @@ import org.apache.maven.surefire.util.De
 import org.apache.maven.surefire.util.DirectoryScanner;
 import org.apache.maven.surefire.util.ReflectionUtils;
 import org.apache.maven.surefire.util.TestsToRun;
-import org.apache.maven.surefire.common.junit4.JUnit4TestChecker;
-import org.junit.runner.notification.RunListener;
-import org.junit.runner.notification.RunNotifier;
 
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.ResourceBundle;
 
+import org.junit.runner.notification.RunListener;
+import org.junit.runner.notification.RunNotifier;
+
 
 /**
  * @author Kristian Rosenvold
@@ -87,13 +89,12 @@ public class JUnit4Provider
 
         upgradeCheck();
 
-        ReporterManager reporter = (ReporterManager) reporterFactory.createReporter();
-        JUnit4TestSetReporter jUnit4TestSetReporter = new JUnit4TestSetReporter( null, reporter );
+        Reporter reporter = reporterFactory.createReporter();
+        JUnit4RunListener jUnit4TestSetReporter = new JUnit4RunListener( reporter );
         RunNotifier runNotifer = getRunNotifer( jUnit4TestSetReporter, customRunListeners );
 
         for ( Class clazz : testsToRun.getLocatedClasses() )
         {
-            jUnit4TestSetReporter.setTestSet( clazz );
             executeTestSet( clazz, reporter, testClassLoader, runNotifer );
         }
 
@@ -103,7 +104,7 @@ public class JUnit4Provider
 
     }
 
-    private void executeTestSet( Class clazz, ReporterManager reporter, ClassLoader classLoader, RunNotifier listeners )
+    private void executeTestSet( Class clazz, Reporter reporter, ClassLoader classLoader, RunNotifier listeners )
         throws ReporterException, TestSetFailedException
     {
         final ReportEntry report = new SimpleReportEntry( this.getClass().getName(), clazz.getName() );
@@ -113,8 +114,6 @@ public class JUnit4Provider
         JUnit4TestSet.execute( clazz, listeners );
 
         reporter.testSetCompleted( report );
-
-        reporter.reset();
     }
 
     private RunNotifier getRunNotifer( RunListener main, List<RunListener> others )

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=1057317&r1=1057316&r2=1057317&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 Mon Jan 10 19:09:12 2011
@@ -85,8 +85,6 @@ public class TestSet
             report = createReportEntry( "testSetCompletedNormally", elapsed );
 
             target.testSetCompleted( report );
-
-            target.reset();
         }
         catch ( Exception e )
         {

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=1057317&r1=1057316&r2=1057317&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 Mon Jan 10 19:09:12 2011
@@ -159,4 +159,12 @@ public class MockReporter
     public void writeConsoleMessage( String message )
     {
     }
+
+    public void testError( ReportEntry report )
+    {
+    }
+
+    public void testFailed( ReportEntry report )
+    {
+    }
 }

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/ConfigurationAwareTestNGReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/ConfigurationAwareTestNGReporter.java?rev=1057317&r1=1057316&r2=1057317&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/ConfigurationAwareTestNGReporter.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/ConfigurationAwareTestNGReporter.java Mon Jan 10 19:09:12 2011
@@ -20,11 +20,13 @@ package org.apache.maven.surefire.testng
  */
 
 
-import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.report.Reporter;
+
 import org.testng.internal.IResultListener;
 
-/** Just like TestNGReporter, but explicitly implements IResultListener; this interface is new in TestNG 5.5
- * 
+/**
+ * Just like TestNGReporter, but explicitly implements IResultListener; this interface is new in TestNG 5.5
+ *
  * @author Dan Fabulich
  * @noinspection UnusedDeclaration
  */
@@ -33,7 +35,7 @@ public class ConfigurationAwareTestNGRep
     implements IResultListener
 {
 
-    public ConfigurationAwareTestNGReporter( ReporterManager reportManager, TestNgTestSuite source )
+    public ConfigurationAwareTestNGReporter( Reporter reportManager, TestNgTestSuite source )
     {
         super( reportManager );
     }

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=1057317&r1=1057316&r2=1057317&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 Mon Jan 10 19:09:12 2011
@@ -20,8 +20,8 @@ package org.apache.maven.surefire.testng
  */
 
 import org.apache.maven.surefire.report.ReportEntry;
+import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.ReporterException;
-import org.apache.maven.surefire.report.ReporterManager;
 
 /**
  * A proxy that imposes synchronization on the Reporter.
@@ -53,83 +53,84 @@ import org.apache.maven.surefire.report.
  * should probably be correct.
  * <p/>
  * <p/>
+ * @noinspection deprecation
  */
 class SynchronizedReporterManager
-    extends ReporterManager
+    implements Reporter
 {
-    public SynchronizedReporterManager( ReporterManager target )
-    {
-        super( target );
-    }
 
-    public synchronized void runStarting()
-    {
-        super.runStarting();
-    }
+    private final Reporter target;
 
-    public synchronized void runCompleted()
+    public SynchronizedReporterManager( Reporter target )
     {
-        super.runCompleted();
+        this.target = target;
     }
 
     public synchronized void testSetStarting( ReportEntry report )
         throws ReporterException
     {
-        super.testSetStarting( report );
+        target.testSetStarting( report );
     }
 
     public synchronized void testSetCompleted( ReportEntry report )
+        throws ReporterException
     {
-        super.testSetCompleted( report );
+        target.testSetCompleted( report );
     }
 
     public synchronized void testStarting( ReportEntry report )
     {
-        super.testStarting( report );
+        target.testStarting( report );
     }
 
     public synchronized void testSucceeded( ReportEntry report )
     {
-        super.testSucceeded( report );
+        target.testSucceeded( report );
     }
 
     public synchronized void testError( ReportEntry report, String stdOut, String stdErr )
     {
-        super.testError( report, stdOut, stdErr );
+        target.testError( report, stdOut, stdErr );
     }
 
     public synchronized void testFailed( ReportEntry report, String stdOut, String stdErr )
     {
-        super.testFailed( report, stdOut, stdErr );
+        target.testFailed( report, stdOut, stdErr );
     }
 
     public synchronized void testSkipped( ReportEntry report )
     {
-        super.testSkipped( report );
+        target.testSkipped( report );
     }
 
     public synchronized void reset()
     {
-        super.reset();
+        target.reset();
     }
 
     public synchronized void writeMessage( String message )
     {
-        super.writeMessage( message );
+        target.writeMessage( message );
     }
 
-    public synchronized void writeConsoleMessage( String message )
-    {
-        super.writeConsoleMessage( message );
-    }
 
     public synchronized void testError( ReportEntry reportEntry )
     {
-        super.testError( reportEntry );
+        target.testError( reportEntry );
     }
 
     public synchronized void testFailed( ReportEntry reportEntry )
     {
-        super.testFailed( reportEntry );
+        target.testFailed( reportEntry );
+    }
+
+    public synchronized void writeDetailMessage( String message )
+    {
+        target.writeDetailMessage( message );
+    }
+
+    public synchronized void writeFooter( String footer )
+    {
+        target.writeFooter( footer );
     }
 }

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java?rev=1057317&r1=1057316&r2=1057317&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java Mon Jan 10 19:09:12 2011
@@ -23,9 +23,9 @@ import org.apache.maven.artifact.version
 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
 import org.apache.maven.surefire.NonAbstractClassFilter;
 import org.apache.maven.surefire.report.ReportEntry;
+import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.ReporterException;
 import org.apache.maven.surefire.report.ReporterFactory;
-import org.apache.maven.surefire.report.ReporterManager;
 import org.apache.maven.surefire.report.ReporterManagerFactory;
 import org.apache.maven.surefire.report.SimpleReportEntry;
 import org.apache.maven.surefire.testset.TestSetFailedException;
@@ -100,16 +100,16 @@ public class TestNGDirectoryTestSuite
             return;
         }
 
-        ReporterManager reporterManager = (ReporterManager) reporterManagerFactory.createReporter();
-        startTestSuite( reporterManager, this );
+        Reporter reporter = reporterManagerFactory.createReporter();
+        startTestSuite( reporter, this );
 
         TestNGExecutor.run( new Class[]{ (Class) testsToRun.iterator().next() }, this.testSourceDirectory, this.options,
-                            this.version, reporterManager, this, reportsDirectory );
+                            this.version, reporter, this, reportsDirectory );
 
-        finishTestSuite( reporterManager, this );
+        finishTestSuite( reporter, this );
     }
 
-    public void executeMulti( TestsToRun testsToRun, ReporterFactory reporterManagerFactory )
+    public void executeMulti( TestsToRun testsToRun, ReporterFactory reporterFactory )
         throws ReporterException, TestSetFailedException
     {
         Class junitTest;
@@ -145,8 +145,7 @@ public class TestNGDirectoryTestSuite
             junitReportsDirectory = new File( reportsDirectory, "testng-junit-results" );
         }
 
-        ReporterManager reporterManager =
-            new SynchronizedReporterManager( (ReporterManager) reporterManagerFactory.createReporter() );
+        Reporter reporterManager = new SynchronizedReporterManager( reporterFactory.createReporter() );
         startTestSuite( reporterManager, this );
 
         Class[] testClasses = (Class[]) testNgTestClasses.toArray( new Class[testNgTestClasses.size()] );
@@ -189,22 +188,22 @@ public class TestNGDirectoryTestSuite
             throw new TestSetFailedException( "Unable to find test set '" + testSetName + "' in suite" );
         }
 
-        ReporterManager reporterManager = reporterManagerFactory.createReporterManager();
-        startTestSuite( reporterManager, this );
+        Reporter reporter = reporterManagerFactory.createReporter();
+        startTestSuite( reporter, this );
 
         TestNGExecutor.run( new Class[]{ testSet.getTestClass() }, this.testSourceDirectory, this.options, this.version,
-                            reporterManager, this, reportsDirectory );
+                            reporter, this, reportsDirectory );
 
-        finishTestSuite( reporterManager, this );
+        finishTestSuite( reporter, this );
     }
 
-    public static void startTestSuite( ReporterManager reporterManager, Object suite )
+    public static void startTestSuite( Reporter reporter, Object suite )
     {
         ReportEntry report = new SimpleReportEntry( suite.getClass().getName(), getSuiteName( suite ) );
 
         try
         {
-            reporterManager.testSetStarting( report );
+            reporter.testSetStarting( report );
         }
         catch ( ReporterException e )
         {
@@ -212,13 +211,12 @@ public class TestNGDirectoryTestSuite
         }
     }
 
-    public static void finishTestSuite( ReporterManager reporterManager, Object suite )
+    public static void finishTestSuite( Reporter reporterManager, Object suite )
+        throws ReporterException
     {
         ReportEntry report = new SimpleReportEntry( suite.getClass().getName(), getSuiteName( suite ) );
 
         reporterManager.testSetCompleted( report );
-
-        reporterManager.reset();
     }
 
     public String getSuiteName()

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java?rev=1057317&r1=1057316&r2=1057317&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java Mon Jan 10 19:09:12 2011
@@ -22,19 +22,20 @@ package org.apache.maven.surefire.testng
 import org.apache.maven.artifact.versioning.ArtifactVersion;
 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
 import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.testng.conf.Configurator;
 import org.apache.maven.surefire.testng.conf.TestNG4751Configurator;
 import org.apache.maven.surefire.testng.conf.TestNG52Configurator;
 import org.apache.maven.surefire.testng.conf.TestNGMapConfigurator;
 import org.apache.maven.surefire.testset.TestSetFailedException;
-import org.testng.TestNG;
 
 import java.io.File;
 import java.lang.reflect.Constructor;
 import java.util.List;
 import java.util.Map;
 
+import org.testng.TestNG;
+
 /**
  * Contains utility methods for executing TestNG.
  *
@@ -48,7 +49,7 @@ public class TestNGExecutor
     }
 
     public static void run( Class[] testClasses, String testSourceDirectory, Map options, ArtifactVersion version,
-                            ReporterManager reportManager, TestNgTestSuite suite, File reportsDirectory )
+                            Reporter reportManager, TestNgTestSuite suite, File reportsDirectory )
         throws TestSetFailedException
     {
         TestNG testng = new TestNG( true );
@@ -60,7 +61,7 @@ public class TestNGExecutor
     }
 
     public static void run( List suiteFiles, String testSourceDirectory, Map options, ArtifactVersion version,
-                            ReporterManager reportManager, TestNgTestSuite suite, File reportsDirectory )
+                            Reporter reportManager, TestNgTestSuite suite, File reportsDirectory )
         throws TestSetFailedException
     {
         TestNG testng = new TestNG( true );
@@ -101,7 +102,8 @@ public class TestNGExecutor
     }
 
 
-    private static void postConfigure( TestNG testNG, String sourcePath, ReporterManager reportManager, TestNgTestSuite suite, File reportsDirectory )
+    private static void postConfigure( TestNG testNG, String sourcePath, Reporter reportManager, TestNgTestSuite suite,
+                                       File reportsDirectory )
         throws TestSetFailedException
     {
         // turn off all TestNG output
@@ -121,7 +123,7 @@ public class TestNGExecutor
 
     // If we have access to IResultListener, return a ConfigurationAwareTestNGReporter
     // But don't cause NoClassDefFoundErrors if it isn't available; just return a regular TestNGReporter instead
-    private static TestNGReporter createTestNGReporter( ReporterManager reportManager, TestNgTestSuite suite )
+    private static TestNGReporter createTestNGReporter( Reporter reportManager, TestNgTestSuite suite )
     {
         try
         {
@@ -129,7 +131,7 @@ public class TestNGExecutor
             Class c = Class.forName( "org.apache.maven.surefire.testng.ConfigurationAwareTestNGReporter" );
             try
             {
-                Constructor ctor = c.getConstructor( new Class[]{ ReporterManager.class, TestNgTestSuite.class } );
+                Constructor ctor = c.getConstructor( new Class[]{ Reporter.class, TestNgTestSuite.class } );
                 return (TestNGReporter) ctor.newInstance( new Object[]{ reportManager, suite } );
             }
             catch ( Exception e )

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java?rev=1057317&r1=1057316&r2=1057317&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java Mon Jan 10 19:09:12 2011
@@ -20,11 +20,21 @@ package org.apache.maven.surefire.testng
  */
 
 import org.apache.maven.surefire.Surefire;
-import org.apache.maven.surefire.report.*;
-import org.testng.*;
+import org.apache.maven.surefire.report.CategorizedReportEntry;
+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.SimpleReportEntry;
 
 import java.util.ResourceBundle;
 
+import org.testng.ISuite;
+import org.testng.ISuiteListener;
+import org.testng.ITestContext;
+import org.testng.ITestListener;
+import org.testng.ITestResult;
+import org.testng.TestNG;
+
 /**
  * Listens for and provides and adaptor layer so that
  * TestNG tests can report their status to the current
@@ -41,7 +51,7 @@ public class TestNGReporter
     /**
      * core Surefire reporting
      */
-    protected ReporterManager reportManager;
+    protected Reporter reporter;
 
     /**
      * Constructs a new instance that will listen to
@@ -53,9 +63,9 @@ public class TestNGReporter
      *
      * @param reportManager Instance to report suite status to
      */
-    public TestNGReporter( ReporterManager reportManager )
+    public TestNGReporter( Reporter reportManager )
     {
-        this.reportManager = reportManager;
+        this.reporter = reportManager;
 
         if ( reportManager == null )
         {
@@ -70,7 +80,7 @@ public class TestNGReporter
         String group = groupString( result.getMethod().getGroups(), result.getTestClass().getName() );
         ReportEntry report =
             new CategorizedReportEntry( getSource( result ), getUserFriendlyTestName( result ), group, rawString );
-        reportManager.testStarting( report );
+        reporter.testStarting( report );
     }
 
     private String getSource( ITestResult result )
@@ -81,7 +91,7 @@ public class TestNGReporter
     public void onTestSuccess( ITestResult result )
     {
         ReportEntry report = new SimpleReportEntry( getSource( result ), getUserFriendlyTestName( result ) );
-        reportManager.testSucceeded( report );
+        reporter.testSucceeded( report );
     }
 
     public void onTestFailure( ITestResult result )
@@ -91,7 +101,7 @@ public class TestNGReporter
                                                         result.getTestClass().getRealClass().getName(),
                                                         result.getMethod().getMethodName(), result.getThrowable() ) );
 
-        reportManager.testFailed( report );
+        reporter.testFailed( report );
     }
 
     private static String getUserFriendlyTestName( ITestResult result )
@@ -104,7 +114,7 @@ public class TestNGReporter
     {
         ReportEntry report = new SimpleReportEntry( getSource( result ), getUserFriendlyTestName( result ) );
 
-        reportManager.testSkipped( report );
+        reporter.testSkipped( report );
     }
 
     public void onTestFailedButWithinSuccessPercentage( ITestResult result )
@@ -114,7 +124,7 @@ public class TestNGReporter
                                                         result.getTestClass().getRealClass().getName(),
                                                         result.getMethod().getMethodName(), result.getThrowable() ) );
 
-        reportManager.testError( report );
+        reporter.testError( report );
     }
 
     public void onStart( ITestContext context )
@@ -142,7 +152,7 @@ public class TestNGReporter
      * Creates a string out of the list of testng groups in the
      * form of <pre>"group1,group2,group3"</pre>.
      *
-     * @param groups The groups being run
+     * @param groups       The groups being run
      * @param defaultValue The default to use if no groups
      * @return a string describing the groups
      */

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java?rev=1057317&r1=1057316&r2=1057317&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java Mon Jan 10 19:09:12 2011
@@ -21,8 +21,8 @@ package org.apache.maven.surefire.testng
 
 import org.apache.maven.artifact.versioning.ArtifactVersion;
 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
+import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.ReporterException;
-import org.apache.maven.surefire.report.ReporterManager;
 import org.apache.maven.surefire.report.ReporterManagerFactory;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
@@ -83,12 +83,11 @@ public class TestNGXmlTestSuite
         {
             throw new IllegalStateException( "You must call locateTestSets before calling execute" );
         }
-        ReporterManager reporterManager =
-            new SynchronizedReporterManager( reporterManagerFactory.createReporterManager() );
-        TestNGDirectoryTestSuite.startTestSuite( reporterManager, this );
-        TestNGExecutor.run( this.suiteFilePaths, this.testSourceDirectory, this.options, this.version, reporterManager,
+        Reporter reporter = new SynchronizedReporterManager( reporterManagerFactory.createReporter() );
+        TestNGDirectoryTestSuite.startTestSuite( reporter, this );
+        TestNGExecutor.run( this.suiteFilePaths, this.testSourceDirectory, this.options, this.version, reporter,
                             this, reportsDirectory );
-        TestNGDirectoryTestSuite.finishTestSuite( reporterManager, this );
+        TestNGDirectoryTestSuite.finishTestSuite( reporter, this );
     }
 
     public void execute( String testSetName, ReporterManagerFactory reporterManagerFactory, ClassLoader classLoader )



Mime
View raw message