maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1102792 - in /maven/surefire/trunk: surefire-api/src/main/java/org/apache/maven/plugin/surefire/report/ surefire-api/src/main/java/org/apache/maven/surefire/booter/ surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ surefire...
Date Fri, 13 May 2011 15:33:01 GMT
Author: krosenvold
Date: Fri May 13 15:33:00 2011
New Revision: 1102792

URL: http://svn.apache.org/viewvc?rev=1102792&view=rev
Log:
o Split console logger from report result logging

No functional change.

Modified:
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterFactory.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.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/ConcurrentReporterManager.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/MethodsParallelRunListener.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTest.java

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterFactory.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterFactory.java?rev=1102792&r1=1102791&r2=1102792&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterFactory.java
(original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterFactory.java
Fri May 13 15:33:00 2011
@@ -25,8 +25,8 @@ import java.util.List;
 import org.apache.maven.surefire.booter.StartupReportConfiguration;
 import org.apache.maven.surefire.report.AbstractConsoleReporter;
 import org.apache.maven.surefire.report.AbstractFileReporter;
-import org.apache.maven.surefire.report.DefaultDirectConsoleReporter;
 import org.apache.maven.surefire.report.ConsoleLogger;
+import org.apache.maven.surefire.report.DefaultDirectConsoleReporter;
 import org.apache.maven.surefire.report.MulticastingReporter;
 import org.apache.maven.surefire.report.Reporter;
 import org.apache.maven.surefire.report.ReporterConfiguration;
@@ -59,15 +59,16 @@ public class FileReporterFactory
     public FileReporterFactory( StartupReportConfiguration reportConfiguration )
     {
         this.reportConfiguration = reportConfiguration;
-        this.reporterConfiguration = getReporterConfiguration(  );
+        this.reporterConfiguration = getReporterConfiguration();
         multicastingReporter = new MulticastingReporter( instantiateReports() );
         runStarting();
     }
 
-    private ReporterConfiguration getReporterConfiguration( )
+    private ReporterConfiguration getReporterConfiguration()
     {
         //noinspection BooleanConstructorCall
-        return new ReporterConfiguration( reportConfiguration.getReportsDirectory(), new
Boolean( reportConfiguration.isTrimStackTrace() ));
+        return new ReporterConfiguration( reportConfiguration.getReportsDirectory(),
+                                          new Boolean( reportConfiguration.isTrimStackTrace()
) );
     }
 
     public RunListener createReporter()
@@ -99,7 +100,7 @@ public class FileReporterFactory
 
     private List instantiateReports()
     {
-        List result = new ArrayList( );
+        List result = new ArrayList();
         addIfNotNull( result, instantiateConsoleReporter() );
         addIfNotNull( result, instantiateFileReporter() );
         addIfNotNull( result, instantiateXmlReporter() );
@@ -107,8 +108,12 @@ public class FileReporterFactory
         return result;
     }
 
-    private void addIfNotNull( List result, Reporter reporter){
-        if (reporter != null) result.add(  reporter );
+    private void addIfNotNull( List result, Reporter reporter )
+    {
+        if ( reporter != null )
+        {
+            result.add( reporter );
+        }
     }
 
     public RunResult close()
@@ -117,7 +122,7 @@ public class FileReporterFactory
         return globalStats.getRunResult();
     }
 
-    public ConsoleLogger createConsoleLogger()
+    private ConsoleLogger createConsoleLogger()
     {
         return new DefaultDirectConsoleReporter( reporterConfiguration.getOriginalSystemOut()
);
     }
@@ -133,30 +138,30 @@ public class FileReporterFactory
 
     private void runCompleted()
     {
-        final ConsoleLogger consoleReporter = createConsoleLogger();
-        consoleReporter.info( "" );
-        consoleReporter.info( "Results :" );
-        consoleReporter.info( "" );
+        final ConsoleLogger logger = createConsoleLogger();
+        logger.info( "" );
+        logger.info( "Results :" );
+        logger.info( "" );
         if ( globalStats.hadFailures() )
         {
             multicastingReporter.writeMessage( "Failed tests: " );
             for ( Iterator iterator = this.globalStats.getFailureSources().iterator(); iterator.hasNext();
)
             {
-                consoleReporter.info( "  " + iterator.next() );
+                logger.info( "  " + iterator.next() );
             }
-            consoleReporter.info( "" );
+            logger.info( "" );
         }
         if ( globalStats.hadErrors() )
         {
-            consoleReporter.info( "Tests in error: " );
+            logger.info( "Tests in error: " );
             for ( Iterator iterator = this.globalStats.getErrorSources().iterator(); iterator.hasNext();
)
             {
-                consoleReporter.info( "  " + iterator.next() );
+                logger.info( "  " + iterator.next() );
             }
-            consoleReporter.info( "" );
+            logger.info( "" );
         }
-        consoleReporter.info( globalStats.getSummary() );
-        consoleReporter.info( "" );
+        logger.info( globalStats.getSummary() );
+        logger.info( "" );
     }
 
     public RunStatistics getGlobalRunStatistics()

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java?rev=1102792&r1=1102791&r2=1102792&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
(original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
Fri May 13 15:33:00 2011
@@ -20,7 +20,10 @@ package org.apache.maven.surefire.booter
  */
 
 import java.util.Properties;
+import org.apache.maven.plugin.surefire.report.FileReporterFactory;
 import org.apache.maven.surefire.providerapi.ProviderParameters;
+import org.apache.maven.surefire.report.ConsoleLogger;
+import org.apache.maven.surefire.report.DefaultDirectConsoleReporter;
 import org.apache.maven.surefire.report.ReporterConfiguration;
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.testset.DirectoryScannerParameters;
@@ -48,6 +51,8 @@ public class BaseProviderFactory
 
     private TestArtifactInfo testArtifactInfo;
 
+    private static final Integer ROOT_CHANNEl = new Integer( 0 );
+
 
     private final ReporterFactory reporterFactory;
 
@@ -88,6 +93,17 @@ public class BaseProviderFactory
         this.testClassLoader = testClassLoader;
     }
 
+    public ConsoleLogger getConsoleLogger()
+    {
+        // Maybe a somewhat odd way to determine if we're forking
+        if ( getReporterFactory() instanceof FileReporterFactory )
+        {
+            return new DefaultDirectConsoleReporter( reporterConfiguration.getOriginalSystemOut()
);
+        }
+        return new ForkingRunListener( reporterConfiguration.getOriginalSystemOut(), ROOT_CHANNEl.intValue(),
+                                       reporterConfiguration.isTrimStackTrace().booleanValue()
);
+    }
+
     public void setTestRequest( TestRequest testRequest )
     {
         this.testRequest = testRequest;

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java?rev=1102792&r1=1102791&r2=1102792&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java
(original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java
Fri May 13 15:33:00 2011
@@ -20,7 +20,6 @@ package org.apache.maven.surefire.booter
  */
 
 import java.io.PrintStream;
-import org.apache.maven.surefire.report.ConsoleLogger;
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.RunListener;
 import org.apache.maven.surefire.report.RunStatistics;
@@ -44,8 +43,6 @@ public class ForkingReporterFactory
 
     private volatile int testSetChannelId = 1;
 
-    private static final Integer ROOT_CHANNEl = new Integer( 0 );
-
     public ForkingReporterFactory( Boolean trimstackTrace, PrintStream originalSystemOut
)
     {
         isTrimstackTrace = trimstackTrace;
@@ -67,8 +64,4 @@ public class ForkingReporterFactory
         return new RunStatistics();
     }
 
-    public ConsoleLogger createConsoleLogger()
-    {
-        return new ForkingRunListener( originalSystemOut, ROOT_CHANNEl.intValue(), isTrimstackTrace.booleanValue()
);
-    }
 }

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java?rev=1102792&r1=1102791&r2=1102792&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java
(original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/ProviderParameters.java
Fri May 13 15:33:00 2011
@@ -20,6 +20,7 @@ package org.apache.maven.surefire.provid
  */
 
 import java.util.Properties;
+import org.apache.maven.surefire.report.ConsoleLogger;
 import org.apache.maven.surefire.report.ReporterConfiguration;
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.testset.DirectoryScannerParameters;
@@ -55,6 +56,16 @@ public interface ProviderParameters
     ReporterFactory getReporterFactory();
 
     /**
+     * Gets a logger intended for console output.
+     * <p/>
+     * This output is inteded for provider-oriented messages that are not attached to a single
test-set
+     * and will normally be written to something console-like immediately.
+     *
+     * @return A console logger
+     */
+    ConsoleLogger getConsoleLogger();
+
+    /**
      * The raw parameters used in creating the directory scanner
      *
      * @return The parameters

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java?rev=1102792&r1=1102791&r2=1102792&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java
(original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterFactory.java
Fri May 13 15:33:00 2011
@@ -35,14 +35,6 @@ public interface ReporterFactory
     RunListener createReporter();
 
     /**
-     * Creates a ConsoleLogger, that allows providers to write messages to the running maven
console.
-     * This output is not associated with any thread/test and appears immediately.
-     *
-     * @return a ConsoleReporter
-     */
-    ConsoleLogger createConsoleLogger();
-
-    /**
      * Closes the factory, freeing resources allocated in the factory.
      *
      * @return The run result

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=1102792&r1=1102791&r2=1102792&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
Fri May 13 15:33:00 2011
@@ -20,6 +20,7 @@ package org.apache.maven.surefire.junitc
  */
 
 import java.util.Map;
+import org.apache.maven.surefire.report.ConsoleLogger;
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
@@ -29,10 +30,11 @@ import org.apache.maven.surefire.testset
 public class ClassesParallelRunListener
     extends ConcurrentReporterManager
 {
-    public ClassesParallelRunListener( Map<String, TestSet> classMethodCounts, ReporterFactory
reporterFactory )
+    public ClassesParallelRunListener( Map<String, TestSet> classMethodCounts, ReporterFactory
reporterFactory,
+                                       ConsoleLogger consoleLogger )
         throws TestSetFailedException
     {
-        super( reporterFactory, false, classMethodCounts );
+        super( reporterFactory, consoleLogger, false, classMethodCounts );
     }
 
     @Override
@@ -41,7 +43,7 @@ public class ClassesParallelRunListener
         TestSet currentlyAttached = TestSet.getThreadTestSet();
         if ( currentlyAttached != null && currentlyAttached != testSetForTest )
         {
-            currentlyAttached.setAllScheduled( getReporterManager() );
+            currentlyAttached.setAllScheduled( getRunListener() );
         }
     }
 }

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManager.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManager.java?rev=1102792&r1=1102791&r2=1102792&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManager.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManager.java
Fri May 13 15:33:00 2011
@@ -20,6 +20,7 @@ package org.apache.maven.surefire.junitc
  */
 
 import java.util.Map;
+import org.apache.maven.surefire.report.ConsoleLogger;
 import org.apache.maven.surefire.report.ConsoleOutputReceiver;
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.ReporterFactory;
@@ -41,18 +42,16 @@ public abstract class ConcurrentReporter
 
     private final ReporterFactory reporterFactory;
 
-    ConcurrentReporterManager( ReporterFactory reporterFactory, boolean reportImmediately,
+    private final ConsoleLogger consoleLogger;
+
+    ConcurrentReporterManager( ReporterFactory reporterFactory, ConsoleLogger consoleLogger,
boolean reportImmediately,
                                Map<String, TestSet> classMethodCounts )
         throws TestSetFailedException
     {
         this.reportImmediately = reportImmediately;
         this.reporterFactory = reporterFactory;
         this.classMethodCounts = classMethodCounts;
-
-        // We must create the first reporterManager here, even though we will never use it.
-        // There is some room for improvement here
-        // todo: Find out if needed for 2.8.1
-        this.reporterFactory.createReporter();
+        this.consoleLogger = consoleLogger;
     }
 
     public void testSetStarting( ReportEntry description )
@@ -61,7 +60,7 @@ public abstract class ConcurrentReporter
 
     public void testSetCompleted( ReportEntry result )
     {
-        final RunListener reporterManager = getReporterManager();
+        final RunListener reporterManager = getRunListener();
         for ( TestSet testSet : classMethodCounts.values() )
         {
             testSet.replay( reporterManager );
@@ -83,7 +82,7 @@ public abstract class ConcurrentReporter
         TestSet testSet = getTestSet( description );
         TestMethod testMethod = getTestSet( description ).createTestMethod( description );
         testMethod.testIgnored( description );
-        testSet.incrementFinishedTests( getReporterManager(), reportImmediately );
+        testSet.incrementFinishedTests( getRunListener(), reportImmediately );
     }
 
     public void testAssumptionFailure( ReportEntry failure )
@@ -104,7 +103,7 @@ public abstract class ConcurrentReporter
     public void testSucceeded( ReportEntry report )
     {
         getTestMethod().testFinished();
-        TestSet.getThreadTestSet().incrementFinishedTests( getReporterManager(), reportImmediately
);
+        TestSet.getThreadTestSet().incrementFinishedTests( getRunListener(), reportImmediately
);
         detachTestMethodFromThread();
     }
 
@@ -136,26 +135,29 @@ public abstract class ConcurrentReporter
         return classMethodCounts.get( description.getSourceName() );
     }
 
-    RunListener getReporterManager()
+    RunListener getRunListener()
     {
-        RunListener reporterManager = reporterManagerThreadLocal.get();
-        if ( reporterManager == null )
+        RunListener runListener = reporterManagerThreadLocal.get();
+        if ( runListener == null )
         {
-            reporterManager = reporterFactory.createReporter();
-            reporterManagerThreadLocal.set( reporterManager );
+            runListener = reporterFactory.createReporter();
+            reporterManagerThreadLocal.set( runListener );
         }
-        return reporterManager;
+        return runListener;
     }
 
     public static ConcurrentReporterManager createInstance( Map<String, TestSet> classMethodCounts,
-                                                            ReporterFactory reporterManagerFactory,
boolean parallelClasses, boolean parallelBoth )
+                                                            ReporterFactory reporterManagerFactory,
+                                                            boolean parallelClasses, boolean
parallelBoth,
+                                                            ConsoleLogger consoleLogger )
         throws TestSetFailedException
     {
         if ( parallelClasses )
         {
-            return new ClassesParallelRunListener( classMethodCounts, reporterManagerFactory
);
+            return new ClassesParallelRunListener( classMethodCounts, reporterManagerFactory,
consoleLogger );
         }
-        return new MethodsParallelRunListener( classMethodCounts, reporterManagerFactory,
!parallelBoth );
+        return new MethodsParallelRunListener( classMethodCounts, reporterManagerFactory,
!parallelBoth,
+                                               consoleLogger );
     }
 
 
@@ -169,8 +171,8 @@ public abstract class ConcurrentReporter
         }
         else
         {
-            // No test running, just dump the message "somewhere"
-            reporterFactory.createConsoleLogger().info( new String( buf, off, len ) );
+            // Not able to assocaite output with any thread. Just dump to console
+            consoleLogger.info( new String( buf, off, len ) );
         }
     }
 

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=1102792&r1=1102791&r2=1102792&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
Fri May 13 15:33:00 2011
@@ -27,6 +27,7 @@ import org.apache.maven.surefire.common.
 import org.apache.maven.surefire.common.junit4.JUnit4TestChecker;
 import org.apache.maven.surefire.providerapi.AbstractProvider;
 import org.apache.maven.surefire.providerapi.ProviderParameters;
+import org.apache.maven.surefire.report.ConsoleLogger;
 import org.apache.maven.surefire.report.ConsoleOutputCapture;
 import org.apache.maven.surefire.report.ConsoleOutputReceiver;
 import org.apache.maven.surefire.report.ReporterException;
@@ -59,15 +60,16 @@ public class JUnitCoreProvider
 
     private TestsToRun testsToRun;
 
-    public JUnitCoreProvider( ProviderParameters booterParameters )
+
+    public JUnitCoreProvider( ProviderParameters providerParameters )
     {
-        this.providerParameters = booterParameters;
-        this.testClassLoader = booterParameters.getTestClassLoader();
-        this.directoryScanner = booterParameters.getDirectoryScanner();
-        this.jUnitCoreParameters = new JUnitCoreParameters( booterParameters.getProviderProperties()
);
+        this.providerParameters = providerParameters;
+        this.testClassLoader = providerParameters.getTestClassLoader();
+        this.directoryScanner = providerParameters.getDirectoryScanner();
+        this.jUnitCoreParameters = new JUnitCoreParameters( providerParameters.getProviderProperties()
);
         this.scannerFilter = new JUnit4TestChecker( testClassLoader );
         customRunListeners = JUnit4RunListenerFactory.
-            createCustomListeners( booterParameters.getProviderProperties().getProperty(
"listener" ) );
+            createCustomListeners( providerParameters.getProviderProperties().getProperty(
"listener" ) );
 
     }
 
@@ -88,7 +90,8 @@ public class JUnitCoreProvider
         final String message = "Concurrency config is " + jUnitCoreParameters.toString()
+ "\n";
         final ReporterFactory reporterFactory = providerParameters.getReporterFactory();
 
-        reporterFactory.createConsoleLogger().info( message );
+        final ConsoleLogger consoleLogger = providerParameters.getConsoleLogger();
+        consoleLogger.info( message );
 
         if ( testsToRun == null )
         {
@@ -96,11 +99,12 @@ public class JUnitCoreProvider
         }
         final Map<String, TestSet> testSetMap = new ConcurrentHashMap<String, TestSet>();
 
-        RunListener listener =
-            ConcurrentReporterManager.createInstance( testSetMap, reporterFactory, jUnitCoreParameters.isParallelClasses(),
-                                                      jUnitCoreParameters.isParallelBoth()
);
+        RunListener listener = ConcurrentReporterManager.createInstance( testSetMap, reporterFactory,
+                                                                         jUnitCoreParameters.isParallelClasses(),
+                                                                         jUnitCoreParameters.isParallelBoth(),
+                                                                         consoleLogger );
 
-        ConsoleOutputCapture.startCapture((ConsoleOutputReceiver) listener);
+        ConsoleOutputCapture.startCapture( (ConsoleOutputReceiver) listener );
 
         org.junit.runner.notification.RunListener jUnit4RunListener = new JUnitCoreRunListener(
listener, testSetMap );
         customRunListeners.add( 0, jUnit4RunListener );

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=1102792&r1=1102791&r2=1102792&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
Fri May 13 15:33:00 2011
@@ -20,6 +20,7 @@ package org.apache.maven.surefire.junitc
  */
 
 import java.util.Map;
+import org.apache.maven.surefire.report.ConsoleLogger;
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
@@ -33,10 +34,11 @@ public class MethodsParallelRunListener
 
     private final Object lock = new Object();
 
-    public MethodsParallelRunListener( Map<String, TestSet> classMethodCounts, ReporterFactory
reporterFactory, boolean reportImmediately )
+    public MethodsParallelRunListener( Map<String, TestSet> classMethodCounts, ReporterFactory
reporterFactory,
+                                       boolean reportImmediately, ConsoleLogger consoleLogger
)
         throws TestSetFailedException
     {
-        super( reporterFactory, reportImmediately, classMethodCounts );
+        super( reporterFactory, consoleLogger, reportImmediately, classMethodCounts );
     }
 
     @Override
@@ -48,7 +50,7 @@ public class MethodsParallelRunListener
             {
                 if ( lastStarted != null )
                 {
-                    lastStarted.setAllScheduled( getReporterManager() );
+                    lastStarted.setAllScheduled( getRunListener() );
                 }
                 lastStarted = testSetForTest;
             }

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java?rev=1102792&r1=1102791&r2=1102792&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java
Fri May 13 15:33:00 2011
@@ -27,6 +27,7 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.maven.plugin.surefire.report.FileReporterFactory;
 import org.apache.maven.surefire.booter.StartupReportConfiguration;
+import org.apache.maven.surefire.report.DefaultConsoleReporter;
 import org.apache.maven.surefire.report.ReporterConfiguration;
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.RunListener;
@@ -152,16 +153,16 @@ public class ConcurrentReporterManagerTe
     {
         ReporterFactory reporterFactory = createReporterFactory();
         HashMap<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
+        final DefaultConsoleReporter defaultConsoleReporter = new DefaultConsoleReporter(
System.out );
         RunListener reporter =
-            new ClassesParallelRunListener( classMethodCounts, reporterFactory );
+            new ClassesParallelRunListener( classMethodCounts, reporterFactory, defaultConsoleReporter
);
         JUnitCoreRunListener runListener = new JUnitCoreRunListener( reporter, classMethodCounts
);
         RunStatistics result = runClasses( reporterFactory, runListener, classes );
         assertReporter( result, success, ignored, failure, "classes" );
         classMethodCounts.clear();
 
         reporterFactory = createReporterFactory();
-        reporter =
-            new MethodsParallelRunListener( classMethodCounts, reporterFactory, true );
+        reporter = new MethodsParallelRunListener( classMethodCounts, reporterFactory, true,
defaultConsoleReporter );
         runListener = new JUnitCoreRunListener( reporter, classMethodCounts );
         result = runClasses( reporterFactory, runListener, classes );
         assertReporter( result, success, ignored, failure, "methods" );
@@ -205,7 +206,8 @@ public class ConcurrentReporterManagerTe
         throws TestSetFailedException
     {
         return new JUnitCoreRunListener(
-            new ClassesParallelRunListener( testSetMap, reporterFactory ), testSetMap );
+            new ClassesParallelRunListener( testSetMap, reporterFactory, new DefaultConsoleReporter(
System.out ) ),
+            testSetMap );
     }
 
 

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTest.java?rev=1102792&r1=1102791&r2=1102792&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTest.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/MavenSurefireJUnit47RunnerTest.java
Fri May 13 15:33:00 2011
@@ -20,6 +20,7 @@ import java.io.File;
 import java.util.HashMap;
 import org.apache.maven.plugin.surefire.report.FileReporterFactory;
 import org.apache.maven.surefire.booter.StartupReportConfiguration;
+import org.apache.maven.surefire.report.DefaultConsoleReporter;
 import org.apache.maven.surefire.report.ReporterConfiguration;
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.RunListener;
@@ -117,12 +118,12 @@ public class MavenSurefireJUnit47RunnerT
     public void testSurefireShouldBeAbleToReportRunStatusEvenWithFailingTests()
         throws Exception
     {
-        ReporterFactory reporterManagerFactory =
-            new FileReporterFactory( StartupReportConfiguration.defaultNoXml() );
+        ReporterFactory reporterManagerFactory = new FileReporterFactory( StartupReportConfiguration.defaultNoXml()
);
 
         final HashMap<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
-        RunListener reporter = ConcurrentReporterManager.createInstance( classMethodCounts,
reporterManagerFactory,
-                                                                         false, false );
+        RunListener reporter =
+            ConcurrentReporterManager.createInstance( classMethodCounts, reporterManagerFactory,
false, false,
+                                                      new DefaultConsoleReporter( System.out
) );
 
         org.junit.runner.notification.RunListener concurrentReportingRunListener =
             new JUnitCoreRunListener( reporter, classMethodCounts );



Mime
View raw message