You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kr...@apache.org on 2012/12/19 11:38:29 UTC
git commit: o Renamed some classes so they're not all called:
Updated Branches:
refs/heads/master 349cff263 -> efd554f78
o Renamed some classes so they're not all called:
ReporterManager
ManagerReporter
FactoryFactory
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/efd554f7
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/efd554f7
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/efd554f7
Branch: refs/heads/master
Commit: efd554f78636959795027ba6268532bd65438658
Parents: 349cff2
Author: Kristian Rosenvold <kr...@apache.org>
Authored: Wed Dec 19 09:20:54 2012 +0100
Committer: Kristian Rosenvold <kr...@apache.org>
Committed: Wed Dec 19 11:38:10 2012 +0100
----------------------------------------------------------------------
.../plugin/surefire/booterclient/ForkStarter.java | 18 +-
.../surefire/booterclient/output/ForkClient.java | 12 +-
.../surefire/report/DefaultReporterFactory.java | 5 +
.../junitcore/ClassesParallelRunListener.java | 2 +-
.../junitcore/ConcurrentReporterManager.java | 210 --------
.../surefire/junitcore/ConcurrentRunListener.java | 210 ++++++++
.../surefire/junitcore/JUnitCoreProvider.java | 8 +-
.../junitcore/MethodsParallelRunListener.java | 2 +-
.../junitcore/ConcurrentReporterManagerTest.java | 395 ---------------
.../junitcore/ConcurrentRunListenerTest.java | 395 +++++++++++++++
.../maven/surefire/junitcore/JUnitCoreTester.java | 4 +-
.../maven/surefire/junitcore/Surefire746Test.java | 2 +-
12 files changed, 634 insertions(+), 629 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/efd554f7/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
index 590161a..620dfd4 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
@@ -90,7 +90,7 @@ public class ForkStarter
private final StartupReportConfiguration startupReportConfiguration;
- private final DefaultReporterFactory fileReporterFactory;
+ private final DefaultReporterFactory defaultReporterFactory;
private static volatile int systemPropertiesFileCounter = 0;
@@ -115,7 +115,7 @@ public class ForkStarter
this.forkedProcessTimeoutInSeconds = forkedProcessTimeoutInSeconds;
this.startupConfiguration = startupConfiguration;
this.startupReportConfiguration = startupReportConfiguration;
- fileReporterFactory = new DefaultReporterFactory( startupReportConfiguration );
+ defaultReporterFactory = new DefaultReporterFactory( startupReportConfiguration );
}
public RunResult run( SurefireProperties effectiveSystemProperties, DefaultScanResult scanResult,
@@ -130,7 +130,7 @@ public class ForkStarter
if ( ForkConfiguration.FORK_ONCE.equals( requestedForkMode ) )
{
final ForkClient forkClient =
- new ForkClient( fileReporterFactory, startupReportConfiguration.getTestVmSystemProperties() );
+ new ForkClient( defaultReporterFactory, startupReportConfiguration.getTestVmSystemProperties() );
result =
fork( null, new PropertiesWrapper( providerProperties ), forkClient, effectiveSystemProperties, 1,
null );
@@ -157,7 +157,7 @@ public class ForkStarter
}
finally
{
- fileReporterFactory.close();
+ defaultReporterFactory.close();
}
return result;
}
@@ -200,7 +200,7 @@ public class ForkStarter
new TestProvidingInputStream( messageQueue );
ForkClient forkClient =
- new ForkClient( fileReporterFactory, startupReportConfiguration.getTestVmSystemProperties(),
+ new ForkClient( defaultReporterFactory, startupReportConfiguration.getTestVmSystemProperties(),
testProvidingInputStream );
return fork( null, new PropertiesWrapper( providerConfiguration.getProviderProperties() ),
@@ -274,7 +274,7 @@ public class ForkStarter
"More threads than " + forkCount + " have been created by the ThreadPoolExecutor." );
}
- ForkClient forkClient = new ForkClient( fileReporterFactory,
+ ForkClient forkClient = new ForkClient( defaultReporterFactory,
startupReportConfiguration.getTestVmSystemProperties() );
return fork( testSet, new PropertiesWrapper( providerConfiguration.getProviderProperties() ),
forkClient, effectiveSystemProperties, thisThreadsThreadNumber, null );
@@ -414,11 +414,11 @@ public class ForkStarter
}
catch ( CommandLineTimeOutException e )
{
- runResult = RunResult.timeout( fileReporterFactory.getGlobalRunStatistics().getRunResult() );
+ runResult = RunResult.timeout( defaultReporterFactory.getGlobalRunStatistics().getRunResult() );
}
catch ( CommandLineException e )
{
- runResult = RunResult.failure( fileReporterFactory.getGlobalRunStatistics().getRunResult(), e );
+ runResult = RunResult.failure( defaultReporterFactory.getGlobalRunStatistics().getRunResult(), e );
throw new SurefireBooterForkException( "Error while executing forked tests.", e.getCause() );
}
finally
@@ -426,7 +426,7 @@ public class ForkStarter
threadedStreamConsumer.close();
if ( runResult == null )
{
- runResult = fileReporterFactory.getGlobalRunStatistics().getRunResult();
+ runResult = defaultReporterFactory.getGlobalRunStatistics().getRunResult();
}
if ( !runResult.isTimeout() )
{
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/efd554f7/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
index a14b7d4..9fde697 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
@@ -51,7 +51,7 @@ public class ForkClient
implements StreamConsumer
{
- private final DefaultReporterFactory providerReporterFactory;
+ private final DefaultReporterFactory defaultReporterFactory;
private final TestProvidingInputStream testProvidingInputStream;
@@ -64,15 +64,15 @@ public class ForkClient
private volatile StackTraceWriter errorInFork = null;
- public ForkClient( DefaultReporterFactory providerReporterFactory, Properties testVmSystemProperties )
+ public ForkClient( DefaultReporterFactory defaultReporterFactory, Properties testVmSystemProperties )
{
- this( providerReporterFactory, testVmSystemProperties, null );
+ this( defaultReporterFactory, testVmSystemProperties, null );
}
- public ForkClient( DefaultReporterFactory providerReporterFactory, Properties testVmSystemProperties,
+ public ForkClient( DefaultReporterFactory defaultReporterFactory, Properties testVmSystemProperties,
TestProvidingInputStream testProvidingInputStream )
{
- this.providerReporterFactory = providerReporterFactory;
+ this.defaultReporterFactory = defaultReporterFactory;
this.testVmSystemProperties = testVmSystemProperties;
this.testProvidingInputStream = testProvidingInputStream;
}
@@ -256,7 +256,7 @@ public class ForkClient
RunListener reporter = testSetReporters.get( channelNumber );
if ( reporter == null )
{
- reporter = providerReporterFactory.createReporter();
+ reporter = defaultReporterFactory.createReporter();
testSetReporters.put( channelNumber, reporter );
}
return reporter;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/efd554f7/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
index 2d28f02..1e29241 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
@@ -59,6 +59,11 @@ public class DefaultReporterFactory
public RunListener createReporter()
{
+ return createTestSetRunListener();
+ }
+
+ public RunListener createTestSetRunListener()
+ {
TestSetRunListener testSetRunListener =
new TestSetRunListener( reportConfiguration.instantiateConsoleReporter(),
reportConfiguration.instantiateFileReporter(),
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/efd554f7/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ClassesParallelRunListener.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ClassesParallelRunListener.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ClassesParallelRunListener.java
index 018da2d..518dd0d 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ClassesParallelRunListener.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ClassesParallelRunListener.java
@@ -28,7 +28,7 @@ import org.apache.maven.surefire.testset.TestSetFailedException;
* @author Kristian Rosenvold
*/
public class ClassesParallelRunListener
- extends ConcurrentReporterManager
+ extends ConcurrentRunListener
{
public ClassesParallelRunListener( Map<String, TestSet> classMethodCounts, ReporterFactory reporterFactory,
ConsoleLogger consoleLogger )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/efd554f7/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManager.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManager.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManager.java
deleted file mode 100644
index 69367f5..0000000
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManager.java
+++ /dev/null
@@ -1,210 +0,0 @@
-package org.apache.maven.surefire.junitcore;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import 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;
-import org.apache.maven.surefire.report.RunListener;
-import org.apache.maven.surefire.testset.TestSetFailedException;
-
-/**
- * Handles responses from concurrent junit
- * <p/>
- * Stuff to remember about JUnit threading:
- * parallel=classes; beforeClass/afterClass, constructor and all tests method run on same thread
- * parallel=methods; beforeClass/afterClass run on main thread, constructor + each test method run on same thread
- * parallel=both; same as parallel=methods
- *
- * @author Kristian Rosenvold
- */
-public abstract class ConcurrentReporterManager
- implements RunListener, ConsoleOutputReceiver
-{
- private final Map<String, TestSet> classMethodCounts;
-
- private final ThreadLocal<RunListener> reporterManagerThreadLocal; // = new ThreadLocal<RunListener>();
-
- private final boolean reportImmediately;
-
- private final ReporterFactory reporterFactory;
-
- 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;
- this.consoleLogger = consoleLogger;
-
- this.reporterManagerThreadLocal = new ThreadLocal<RunListener>()
- {
- @Override
- protected RunListener initialValue()
- {
- return ConcurrentReporterManager.this.reporterFactory.createReporter();
- }
- };
- }
-
- public void testSetStarting( ReportEntry description )
- {
- }
-
- public void testSetCompleted( ReportEntry result )
- {
- final RunListener reporterManager = getRunListener();
- for ( TestSet testSet : classMethodCounts.values() )
- {
- testSet.replay( reporterManager );
- }
- reporterManagerThreadLocal.remove();
- }
-
- public void testFailed( ReportEntry failure )
- {
- final TestMethod testMethod = getOrCreateThreadAttachedTestMethod( failure );
- if ( testMethod != null )
- {
- testMethod.testFailure( failure );
- testMethod.detachFromCurrentThread();
- }
- }
-
- public void testError( ReportEntry failure )
- {
- final TestMethod testMethod = getOrCreateThreadAttachedTestMethod( failure );
- if ( testMethod != null )
- {
- testMethod.testError( failure );
- testMethod.detachFromCurrentThread();
- }
- }
-
- public void testSkipped( ReportEntry description )
- {
- TestSet testSet = getTestSet( description );
- TestMethod testMethod = testSet.createThreadAttachedTestMethod( description );
- testMethod.testIgnored( description );
- testSet.incrementFinishedTests( getRunListener(), reportImmediately );
- testMethod.detachFromCurrentThread();
- }
-
- public void testAssumptionFailure( ReportEntry failure )
- {
- final TestMethod testMethod = getOrCreateThreadAttachedTestMethod( failure );
- if ( testMethod != null )
- {
- testMethod.testIgnored( failure );
- testMethod.detachFromCurrentThread();
- }
- }
-
- public void testStarting( ReportEntry description )
- {
- TestSet testSet = getTestSet( description );
- testSet.createThreadAttachedTestMethod( description );
-
- checkIfTestSetCanBeReported( testSet );
- testSet.attachToThread();
- }
-
- public void testSucceeded( ReportEntry report )
- {
- TestMethod testMethod = getTestMethod();
- testMethod.testFinished();
- testMethod.getTestSet().incrementFinishedTests( getRunListener(), reportImmediately );
- testMethod.detachFromCurrentThread();
- }
-
- private TestMethod getOrCreateThreadAttachedTestMethod( ReportEntry description )
- {
- TestMethod threadTestMethod = TestMethod.getThreadTestMethod();
- if ( threadTestMethod != null )
- {
- return threadTestMethod;
- }
- TestSet testSet = getTestSet( description );
- if ( testSet == null )
- {
- consoleLogger.info( description.getName() );
- consoleLogger.info( description.getStackTraceWriter().writeTraceToString() );
- return null;
- }
- else
- {
- return testSet.createThreadAttachedTestMethod( description );
- }
- }
-
- protected abstract void checkIfTestSetCanBeReported( TestSet testSetForTest );
-
- TestMethod getTestMethod()
- {
- return TestMethod.getThreadTestMethod();
- }
-
- TestSet getTestSet( ReportEntry description )
- {
- return classMethodCounts.get( description.getSourceName() );
- }
-
- RunListener getRunListener()
- {
- return reporterManagerThreadLocal.get();
- }
-
-
- public static ConcurrentReporterManager createInstance( Map<String, TestSet> classMethodCounts,
- ReporterFactory reporterManagerFactory,
- boolean parallelClasses, boolean parallelBoth,
- ConsoleLogger consoleLogger )
- throws TestSetFailedException
- {
- if ( parallelClasses )
- {
- return new ClassesParallelRunListener( classMethodCounts, reporterManagerFactory, consoleLogger );
- }
- return new MethodsParallelRunListener( classMethodCounts, reporterManagerFactory, !parallelBoth,
- consoleLogger );
- }
-
-
- public void writeTestOutput( byte[] buf, int off, int len, boolean stdout )
- {
- TestMethod threadTestMethod = TestMethod.getThreadTestMethod();
- if ( threadTestMethod != null )
- {
- final LogicalStream logicalStream = threadTestMethod.getLogicalStream();
- logicalStream.write( stdout, buf, off, len );
- }
- else
- {
- // Not able to assocaite output with any thread. Just dump to console
- consoleLogger.info( new String( buf, off, len ) );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/efd554f7/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentRunListener.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentRunListener.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentRunListener.java
new file mode 100644
index 0000000..7f1099b
--- /dev/null
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentRunListener.java
@@ -0,0 +1,210 @@
+package org.apache.maven.surefire.junitcore;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import 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;
+import org.apache.maven.surefire.report.RunListener;
+import org.apache.maven.surefire.testset.TestSetFailedException;
+
+/**
+ * Handles responses from concurrent junit
+ * <p/>
+ * Stuff to remember about JUnit threading:
+ * parallel=classes; beforeClass/afterClass, constructor and all tests method run on same thread
+ * parallel=methods; beforeClass/afterClass run on main thread, constructor + each test method run on same thread
+ * parallel=both; same as parallel=methods
+ *
+ * @author Kristian Rosenvold
+ */
+public abstract class ConcurrentRunListener
+ implements RunListener, ConsoleOutputReceiver
+{
+ private final Map<String, TestSet> classMethodCounts;
+
+ private final ThreadLocal<RunListener> reporterManagerThreadLocal; // = new ThreadLocal<RunListener>();
+
+ private final boolean reportImmediately;
+
+ private final ReporterFactory reporterFactory;
+
+ private final ConsoleLogger consoleLogger;
+
+ ConcurrentRunListener( ReporterFactory reporterFactory, ConsoleLogger consoleLogger, boolean reportImmediately,
+ Map<String, TestSet> classMethodCounts )
+ throws TestSetFailedException
+ {
+ this.reportImmediately = reportImmediately;
+ this.reporterFactory = reporterFactory;
+ this.classMethodCounts = classMethodCounts;
+ this.consoleLogger = consoleLogger;
+
+ this.reporterManagerThreadLocal = new ThreadLocal<RunListener>()
+ {
+ @Override
+ protected RunListener initialValue()
+ {
+ return ConcurrentRunListener.this.reporterFactory.createReporter();
+ }
+ };
+ }
+
+ public void testSetStarting( ReportEntry description )
+ {
+ }
+
+ public void testSetCompleted( ReportEntry result )
+ {
+ final RunListener reporterManager = getRunListener();
+ for ( TestSet testSet : classMethodCounts.values() )
+ {
+ testSet.replay( reporterManager );
+ }
+ reporterManagerThreadLocal.remove();
+ }
+
+ public void testFailed( ReportEntry failure )
+ {
+ final TestMethod testMethod = getOrCreateThreadAttachedTestMethod( failure );
+ if ( testMethod != null )
+ {
+ testMethod.testFailure( failure );
+ testMethod.detachFromCurrentThread();
+ }
+ }
+
+ public void testError( ReportEntry failure )
+ {
+ final TestMethod testMethod = getOrCreateThreadAttachedTestMethod( failure );
+ if ( testMethod != null )
+ {
+ testMethod.testError( failure );
+ testMethod.detachFromCurrentThread();
+ }
+ }
+
+ public void testSkipped( ReportEntry description )
+ {
+ TestSet testSet = getTestSet( description );
+ TestMethod testMethod = testSet.createThreadAttachedTestMethod( description );
+ testMethod.testIgnored( description );
+ testSet.incrementFinishedTests( getRunListener(), reportImmediately );
+ testMethod.detachFromCurrentThread();
+ }
+
+ public void testAssumptionFailure( ReportEntry failure )
+ {
+ final TestMethod testMethod = getOrCreateThreadAttachedTestMethod( failure );
+ if ( testMethod != null )
+ {
+ testMethod.testIgnored( failure );
+ testMethod.detachFromCurrentThread();
+ }
+ }
+
+ public void testStarting( ReportEntry description )
+ {
+ TestSet testSet = getTestSet( description );
+ testSet.createThreadAttachedTestMethod( description );
+
+ checkIfTestSetCanBeReported( testSet );
+ testSet.attachToThread();
+ }
+
+ public void testSucceeded( ReportEntry report )
+ {
+ TestMethod testMethod = getTestMethod();
+ testMethod.testFinished();
+ testMethod.getTestSet().incrementFinishedTests( getRunListener(), reportImmediately );
+ testMethod.detachFromCurrentThread();
+ }
+
+ private TestMethod getOrCreateThreadAttachedTestMethod( ReportEntry description )
+ {
+ TestMethod threadTestMethod = TestMethod.getThreadTestMethod();
+ if ( threadTestMethod != null )
+ {
+ return threadTestMethod;
+ }
+ TestSet testSet = getTestSet( description );
+ if ( testSet == null )
+ {
+ consoleLogger.info( description.getName() );
+ consoleLogger.info( description.getStackTraceWriter().writeTraceToString() );
+ return null;
+ }
+ else
+ {
+ return testSet.createThreadAttachedTestMethod( description );
+ }
+ }
+
+ protected abstract void checkIfTestSetCanBeReported( TestSet testSetForTest );
+
+ TestMethod getTestMethod()
+ {
+ return TestMethod.getThreadTestMethod();
+ }
+
+ TestSet getTestSet( ReportEntry description )
+ {
+ return classMethodCounts.get( description.getSourceName() );
+ }
+
+ RunListener getRunListener()
+ {
+ return reporterManagerThreadLocal.get();
+ }
+
+
+ public static ConcurrentRunListener createInstance( Map<String, TestSet> classMethodCounts,
+ ReporterFactory reporterManagerFactory,
+ boolean parallelClasses, boolean parallelBoth,
+ ConsoleLogger consoleLogger )
+ throws TestSetFailedException
+ {
+ if ( parallelClasses )
+ {
+ return new ClassesParallelRunListener( classMethodCounts, reporterManagerFactory, consoleLogger );
+ }
+ return new MethodsParallelRunListener( classMethodCounts, reporterManagerFactory, !parallelBoth,
+ consoleLogger );
+ }
+
+
+ public void writeTestOutput( byte[] buf, int off, int len, boolean stdout )
+ {
+ TestMethod threadTestMethod = TestMethod.getThreadTestMethod();
+ if ( threadTestMethod != null )
+ {
+ final LogicalStream logicalStream = threadTestMethod.getLogicalStream();
+ logicalStream.write( stdout, buf, off, len );
+ }
+ else
+ {
+ // Not able to assocaite output with any thread. Just dump to console
+ consoleLogger.info( new String( buf, off, len ) );
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/efd554f7/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
index 1f01e10..7ab2d56 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
@@ -154,10 +154,10 @@ public class JUnitCoreProvider
{
final Map<String, TestSet> testSetMap = new ConcurrentHashMap<String, TestSet>();
- RunListener listener = ConcurrentReporterManager.createInstance( testSetMap, reporterFactory,
- jUnitCoreParameters.isParallelClasses(),
- jUnitCoreParameters.isParallelBoth(),
- consoleLogger );
+ RunListener listener = ConcurrentRunListener.createInstance( testSetMap, reporterFactory,
+ jUnitCoreParameters.isParallelClasses(),
+ jUnitCoreParameters.isParallelBoth(),
+ consoleLogger );
ConsoleOutputCapture.startCapture( (ConsoleOutputReceiver) listener );
jUnit4RunListener = new JUnitCoreRunListener( listener, testSetMap );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/efd554f7/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/MethodsParallelRunListener.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/MethodsParallelRunListener.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/MethodsParallelRunListener.java
index 0aa531a..5e27669 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/MethodsParallelRunListener.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/MethodsParallelRunListener.java
@@ -28,7 +28,7 @@ import org.apache.maven.surefire.testset.TestSetFailedException;
* @author Kristian Rosenvold
*/
public class MethodsParallelRunListener
- extends ConcurrentReporterManager
+ extends ConcurrentRunListener
{
private volatile TestSet lastStarted;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/efd554f7/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java
deleted file mode 100644
index f978293..0000000
--- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java
+++ /dev/null
@@ -1,395 +0,0 @@
-package org.apache.maven.surefire.junitcore;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.maven.plugin.surefire.report.DefaultReporterFactory;
-import org.apache.maven.surefire.report.DefaultConsoleReporter;
-import org.apache.maven.surefire.report.ReporterFactory;
-import org.apache.maven.surefire.report.RunListener;
-import org.apache.maven.surefire.report.RunStatistics;
-import org.apache.maven.surefire.testset.TestSetFailedException;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.Computer;
-import org.junit.runner.JUnitCore;
-
-/*
- * @author Kristian Rosenvold
- */
-public class ConcurrentReporterManagerTest
- extends TestCase
-{
- // Tests are in order of increasing complexity
- public void testNoErrorsCounting()
- throws Exception
- {
- runClasses( 3, 0, 0, DummyAllOk.class );
- }
-
- public void testNoErrorsCounting2()
- throws Exception
- {
- runClasses( 2, 0, 0, Dummy3.class );
- }
-
- public void testOneIgnoreCounting()
- throws Exception
- {
- runClasses( 3, 1, 0, DummyWithOneIgnore.class );
- }
-
- public void testOneFailureCounting()
- throws Exception
- {
- runClasses( 3, 0, 1, DummyWithFailure.class );
- }
-
- public void testWithErrorsCountingDemultiplexed()
- throws Exception
- {
- runClasses( 6, 1, 1, DummyWithOneIgnore.class, DummyWithFailure.class );
- }
-
- public void testJunitResultCountingDemultiplexed()
- throws Exception
- {
- runClasses( 8, 1, 1, DummyWithOneIgnore.class, DummyWithFailure.class, Dummy3.class );
- }
-
- public void testJunitResultCountingJUnit3Demultiplexed()
- throws Exception
- {
- runClasses( 3, 0, 0, Junit3Tc1.class, Junit3Tc2.class );
- }
-
- public void testJunitResultCountingJUnit3OddTest()
- throws Exception
- {
- runClasses( 2, 0, 0, Junit3OddTest1.class );
- }
-
- public void testJunit3WithNestedSuite()
- throws TestSetFailedException
- {
- runClasses( 4, 0, 0, Junit3WithNestedSuite.class );
- }
-
- public void testJunit3NestedSuite()
- throws Exception
- {
- runClasses( 2, 0, 0, Junit3OddTest1.class );
- }
-
- public void testSimpleOutput()
- throws Exception
- {
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- PrintStream collector = new PrintStream( byteArrayOutputStream );
- PrintStream orgOur = System.out;
- System.setOut( collector );
-
- RunStatistics result = runClasses( Dummy3.class );
- assertReporter( result, 2, 0, 0, "msgs" );
-
- String foo = new String( byteArrayOutputStream.toByteArray() );
- assertNotNull( foo );
-
- System.setOut( orgOur );
- }
-
- public void testOutputOrdering()
- throws Exception
- {
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- PrintStream collector = new PrintStream( byteArrayOutputStream );
- PrintStream orgOur = System.out;
- System.setOut( collector );
-
- RunStatistics result = runClasses( DummyWithOneIgnore.class, DummyWithFailure.class, Dummy3.class );
- assertReporter( result, 8, 1, 1, "msgs" );
-
- String foo = new String( byteArrayOutputStream.toByteArray() );
- assertNotNull( foo );
-
- System.setOut( orgOur );
-
-// final List<String> stringList = result.getEvents();
-// assertEquals( 23, stringList.size() );
- }
-
- private void runClasses( int success, int ignored, int failure, Class<?>... classes )
- throws TestSetFailedException
- {
- DefaultReporterFactory reporterFactory = createReporterFactory();
- HashMap<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
- final DefaultConsoleReporter defaultConsoleReporter = new DefaultConsoleReporter( System.out );
- RunListener reporter =
- 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, defaultConsoleReporter );
- runListener = new JUnitCoreRunListener( reporter, classMethodCounts );
- result = runClasses( reporterFactory, runListener, classes );
- assertReporter( result, success, ignored, failure, "methods" );
- }
-
- private RunStatistics runClasses( Class<?>... classes )
- throws TestSetFailedException
- {
- HashMap<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
- final DefaultReporterFactory reporterManagerFactory = createReporterFactory();
- org.junit.runner.notification.RunListener demultiplexingRunListener =
- createRunListener( reporterManagerFactory, classMethodCounts );
-
- JUnitCore jUnitCore = new JUnitCore();
-
- jUnitCore.addListener( demultiplexingRunListener );
- Computer computer = new Computer();
-
- jUnitCore.run( computer, classes );
- reporterManagerFactory.close();
- return reporterManagerFactory.getGlobalRunStatistics();
- }
-
- private RunStatistics runClasses( DefaultReporterFactory reporterManagerFactory,
- org.junit.runner.notification.RunListener demultiplexingRunListener,
- Class<?>... classes )
- throws TestSetFailedException
- {
-
- JUnitCore jUnitCore = new JUnitCore();
-
- jUnitCore.addListener( demultiplexingRunListener );
- Computer computer = new Computer();
-
- jUnitCore.run( computer, classes );
- return reporterManagerFactory.getGlobalRunStatistics();
- }
-
- private org.junit.runner.notification.RunListener createRunListener( ReporterFactory reporterFactory,
- Map<String, TestSet> testSetMap )
- throws TestSetFailedException
- {
- return new JUnitCoreRunListener(
- new ClassesParallelRunListener( testSetMap, reporterFactory, new DefaultConsoleReporter( System.out ) ),
- testSetMap );
- }
-
-
- public static class DummyWithOneIgnore
- {
- @Test
- public void testNotMuch()
- {
- }
-
- @Ignore
- @Test
- public void testStub1()
- {
- }
-
- @Test
- public void testStub2()
- {
- }
- }
-
- public static class DummyWithFailure
- {
- @Test
- public void testBeforeFail()
- {
- }
-
- @Test
- public void testWillFail()
- {
- Assert.fail( "We will fail" );
- }
-
- @Test
- public void testAfterFail()
- {
- }
- }
-
- public static class DummyAllOk
- {
-
- @Test
- public void testNotMuchA()
- {
- }
-
- @Test
- public void testStub1A()
- {
- }
-
- @Test
- public void testStub2A()
- {
- }
- }
-
- public static class Dummy3
- {
-
- @Test
- public void testNotMuchA()
- {
- System.out.println( "tNMA1" );
- System.err.println( "tNMA1err" );
- }
-
- @Test
- public void testStub2A()
- {
- System.out.println( "tS2A" );
- System.err.println( "tS2AErr" );
- }
- }
-
- public static class Junit3Tc1
- extends TestCase
- {
-
- public Junit3Tc1()
- {
- super( "testNotMuchJunit3TC1" );
- }
-
- public void testNotMuchJunit3TC1()
- {
- System.out.println( "Junit3TC1" );
- }
-
-
- public static junit.framework.Test suite()
- {
- TestSuite suite = new TestSuite();
- suite.addTest( new Junit3Tc1() );
- return suite;
- }
- }
-
- public static class Junit3Tc2
- extends TestCase
- {
- public Junit3Tc2( String testMethod )
- {
- super( testMethod );
- }
-
- public void testNotMuchJunit3TC2()
- {
- System.out.println( "Junit3TC2" );
- }
-
- public void testStubJ3TC2A()
- {
- System.out.println( "testStubJ3TC2A" );
- }
-
- public static junit.framework.Test suite()
- {
- TestSuite suite = new TestSuite();
- suite.addTest( new Junit3Tc2( "testNotMuchJunit3TC2" ) );
- suite.addTest( new Junit3Tc2( "testStubJ3TC2A" ) );
- return suite;
- }
- }
-
- public static class Junit3OddTest1
- extends TestCase
- {
- public static junit.framework.Test suite()
- {
- TestSuite suite = new TestSuite();
-
- suite.addTest( new Junit3OddTest1( "testMe" ) );
- suite.addTest( new Junit3OddTest1( "testMe" ) );
-
- return suite;
- }
-
- public Junit3OddTest1( String name )
- {
- super( name );
- }
-
- public void testMe()
- {
- assertTrue( true );
- }
- }
-
- public static class Junit3WithNestedSuite
- extends TestCase
- {
- public static junit.framework.Test suite()
- {
- TestSuite suite = new TestSuite();
-
- suite.addTest( new Junit3WithNestedSuite( "testMe2" ) );
- suite.addTest( new Junit3WithNestedSuite( "testMe2" ) );
- suite.addTestSuite( Junit3Tc2.class );
- return suite;
- }
-
- public Junit3WithNestedSuite( String name )
- {
- super( name );
- }
-
- public void testMe2()
- {
- assertTrue( true );
- }
- }
-
-
- private DefaultReporterFactory createReporterFactory()
- {
- return DefaultReporterFactory.defaultNoXml();
- }
-
-
- private void assertReporter( RunStatistics result, int success, int ignored, int failure, String message )
- {
- assertEquals( message, success, result.getCompletedCount() );
- assertEquals( message, failure, result.getFailureSources().size() );
- assertEquals( message, ignored, result.getSkipped() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/efd554f7/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentRunListenerTest.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentRunListenerTest.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentRunListenerTest.java
new file mode 100644
index 0000000..f41554d
--- /dev/null
+++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentRunListenerTest.java
@@ -0,0 +1,395 @@
+package org.apache.maven.surefire.junitcore;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.maven.plugin.surefire.report.DefaultReporterFactory;
+import org.apache.maven.surefire.report.DefaultConsoleReporter;
+import org.apache.maven.surefire.report.ReporterFactory;
+import org.apache.maven.surefire.report.RunListener;
+import org.apache.maven.surefire.report.RunStatistics;
+import org.apache.maven.surefire.testset.TestSetFailedException;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.Computer;
+import org.junit.runner.JUnitCore;
+
+/*
+ * @author Kristian Rosenvold
+ */
+public class ConcurrentRunListenerTest
+ extends TestCase
+{
+ // Tests are in order of increasing complexity
+ public void testNoErrorsCounting()
+ throws Exception
+ {
+ runClasses( 3, 0, 0, DummyAllOk.class );
+ }
+
+ public void testNoErrorsCounting2()
+ throws Exception
+ {
+ runClasses( 2, 0, 0, Dummy3.class );
+ }
+
+ public void testOneIgnoreCounting()
+ throws Exception
+ {
+ runClasses( 3, 1, 0, DummyWithOneIgnore.class );
+ }
+
+ public void testOneFailureCounting()
+ throws Exception
+ {
+ runClasses( 3, 0, 1, DummyWithFailure.class );
+ }
+
+ public void testWithErrorsCountingDemultiplexed()
+ throws Exception
+ {
+ runClasses( 6, 1, 1, DummyWithOneIgnore.class, DummyWithFailure.class );
+ }
+
+ public void testJunitResultCountingDemultiplexed()
+ throws Exception
+ {
+ runClasses( 8, 1, 1, DummyWithOneIgnore.class, DummyWithFailure.class, Dummy3.class );
+ }
+
+ public void testJunitResultCountingJUnit3Demultiplexed()
+ throws Exception
+ {
+ runClasses( 3, 0, 0, Junit3Tc1.class, Junit3Tc2.class );
+ }
+
+ public void testJunitResultCountingJUnit3OddTest()
+ throws Exception
+ {
+ runClasses( 2, 0, 0, Junit3OddTest1.class );
+ }
+
+ public void testJunit3WithNestedSuite()
+ throws TestSetFailedException
+ {
+ runClasses( 4, 0, 0, Junit3WithNestedSuite.class );
+ }
+
+ public void testJunit3NestedSuite()
+ throws Exception
+ {
+ runClasses( 2, 0, 0, Junit3OddTest1.class );
+ }
+
+ public void testSimpleOutput()
+ throws Exception
+ {
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ PrintStream collector = new PrintStream( byteArrayOutputStream );
+ PrintStream orgOur = System.out;
+ System.setOut( collector );
+
+ RunStatistics result = runClasses( Dummy3.class );
+ assertReporter( result, 2, 0, 0, "msgs" );
+
+ String foo = new String( byteArrayOutputStream.toByteArray() );
+ assertNotNull( foo );
+
+ System.setOut( orgOur );
+ }
+
+ public void testOutputOrdering()
+ throws Exception
+ {
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ PrintStream collector = new PrintStream( byteArrayOutputStream );
+ PrintStream orgOur = System.out;
+ System.setOut( collector );
+
+ RunStatistics result = runClasses( DummyWithOneIgnore.class, DummyWithFailure.class, Dummy3.class );
+ assertReporter( result, 8, 1, 1, "msgs" );
+
+ String foo = new String( byteArrayOutputStream.toByteArray() );
+ assertNotNull( foo );
+
+ System.setOut( orgOur );
+
+// final List<String> stringList = result.getEvents();
+// assertEquals( 23, stringList.size() );
+ }
+
+ private void runClasses( int success, int ignored, int failure, Class<?>... classes )
+ throws TestSetFailedException
+ {
+ DefaultReporterFactory reporterFactory = createReporterFactory();
+ HashMap<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
+ final DefaultConsoleReporter defaultConsoleReporter = new DefaultConsoleReporter( System.out );
+ RunListener reporter =
+ 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, defaultConsoleReporter );
+ runListener = new JUnitCoreRunListener( reporter, classMethodCounts );
+ result = runClasses( reporterFactory, runListener, classes );
+ assertReporter( result, success, ignored, failure, "methods" );
+ }
+
+ private RunStatistics runClasses( Class<?>... classes )
+ throws TestSetFailedException
+ {
+ HashMap<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
+ final DefaultReporterFactory reporterManagerFactory = createReporterFactory();
+ org.junit.runner.notification.RunListener demultiplexingRunListener =
+ createRunListener( reporterManagerFactory, classMethodCounts );
+
+ JUnitCore jUnitCore = new JUnitCore();
+
+ jUnitCore.addListener( demultiplexingRunListener );
+ Computer computer = new Computer();
+
+ jUnitCore.run( computer, classes );
+ reporterManagerFactory.close();
+ return reporterManagerFactory.getGlobalRunStatistics();
+ }
+
+ private RunStatistics runClasses( DefaultReporterFactory reporterManagerFactory,
+ org.junit.runner.notification.RunListener demultiplexingRunListener,
+ Class<?>... classes )
+ throws TestSetFailedException
+ {
+
+ JUnitCore jUnitCore = new JUnitCore();
+
+ jUnitCore.addListener( demultiplexingRunListener );
+ Computer computer = new Computer();
+
+ jUnitCore.run( computer, classes );
+ return reporterManagerFactory.getGlobalRunStatistics();
+ }
+
+ private org.junit.runner.notification.RunListener createRunListener( ReporterFactory reporterFactory,
+ Map<String, TestSet> testSetMap )
+ throws TestSetFailedException
+ {
+ return new JUnitCoreRunListener(
+ new ClassesParallelRunListener( testSetMap, reporterFactory, new DefaultConsoleReporter( System.out ) ),
+ testSetMap );
+ }
+
+
+ public static class DummyWithOneIgnore
+ {
+ @Test
+ public void testNotMuch()
+ {
+ }
+
+ @Ignore
+ @Test
+ public void testStub1()
+ {
+ }
+
+ @Test
+ public void testStub2()
+ {
+ }
+ }
+
+ public static class DummyWithFailure
+ {
+ @Test
+ public void testBeforeFail()
+ {
+ }
+
+ @Test
+ public void testWillFail()
+ {
+ Assert.fail( "We will fail" );
+ }
+
+ @Test
+ public void testAfterFail()
+ {
+ }
+ }
+
+ public static class DummyAllOk
+ {
+
+ @Test
+ public void testNotMuchA()
+ {
+ }
+
+ @Test
+ public void testStub1A()
+ {
+ }
+
+ @Test
+ public void testStub2A()
+ {
+ }
+ }
+
+ public static class Dummy3
+ {
+
+ @Test
+ public void testNotMuchA()
+ {
+ System.out.println( "tNMA1" );
+ System.err.println( "tNMA1err" );
+ }
+
+ @Test
+ public void testStub2A()
+ {
+ System.out.println( "tS2A" );
+ System.err.println( "tS2AErr" );
+ }
+ }
+
+ public static class Junit3Tc1
+ extends TestCase
+ {
+
+ public Junit3Tc1()
+ {
+ super( "testNotMuchJunit3TC1" );
+ }
+
+ public void testNotMuchJunit3TC1()
+ {
+ System.out.println( "Junit3TC1" );
+ }
+
+
+ public static junit.framework.Test suite()
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest( new Junit3Tc1() );
+ return suite;
+ }
+ }
+
+ public static class Junit3Tc2
+ extends TestCase
+ {
+ public Junit3Tc2( String testMethod )
+ {
+ super( testMethod );
+ }
+
+ public void testNotMuchJunit3TC2()
+ {
+ System.out.println( "Junit3TC2" );
+ }
+
+ public void testStubJ3TC2A()
+ {
+ System.out.println( "testStubJ3TC2A" );
+ }
+
+ public static junit.framework.Test suite()
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest( new Junit3Tc2( "testNotMuchJunit3TC2" ) );
+ suite.addTest( new Junit3Tc2( "testStubJ3TC2A" ) );
+ return suite;
+ }
+ }
+
+ public static class Junit3OddTest1
+ extends TestCase
+ {
+ public static junit.framework.Test suite()
+ {
+ TestSuite suite = new TestSuite();
+
+ suite.addTest( new Junit3OddTest1( "testMe" ) );
+ suite.addTest( new Junit3OddTest1( "testMe" ) );
+
+ return suite;
+ }
+
+ public Junit3OddTest1( String name )
+ {
+ super( name );
+ }
+
+ public void testMe()
+ {
+ assertTrue( true );
+ }
+ }
+
+ public static class Junit3WithNestedSuite
+ extends TestCase
+ {
+ public static junit.framework.Test suite()
+ {
+ TestSuite suite = new TestSuite();
+
+ suite.addTest( new Junit3WithNestedSuite( "testMe2" ) );
+ suite.addTest( new Junit3WithNestedSuite( "testMe2" ) );
+ suite.addTestSuite( Junit3Tc2.class );
+ return suite;
+ }
+
+ public Junit3WithNestedSuite( String name )
+ {
+ super( name );
+ }
+
+ public void testMe2()
+ {
+ assertTrue( true );
+ }
+ }
+
+
+ private DefaultReporterFactory createReporterFactory()
+ {
+ return DefaultReporterFactory.defaultNoXml();
+ }
+
+
+ private void assertReporter( RunStatistics result, int success, int ignored, int failure, String message )
+ {
+ assertEquals( message, success, result.getCompletedCount() );
+ assertEquals( message, failure, result.getFailureSources().size() );
+ assertEquals( message, ignored, result.getSkipped() );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/efd554f7/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java
index 80146fd..c805037 100644
--- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java
+++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java
@@ -58,8 +58,8 @@ public class JUnitCoreTester
final HashMap<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
RunListener reporter =
- ConcurrentReporterManager.createInstance( classMethodCounts, reporterManagerFactory, parallelClasses, false,
- new DefaultConsoleReporter( System.out ) );
+ ConcurrentRunListener.createInstance( classMethodCounts, reporterManagerFactory, parallelClasses, false,
+ new DefaultConsoleReporter( System.out ) );
ConsoleOutputCapture.startCapture( (ConsoleOutputReceiver) reporter );
JUnitCoreRunListener runListener = new JUnitCoreRunListener( reporter, classMethodCounts );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/efd554f7/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java
index 0992e99..4ab068d 100644
--- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java
+++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java
@@ -95,7 +95,7 @@ public class Surefire746Test
final Map<String, TestSet> testSetMap = new ConcurrentHashMap<String, TestSet>();
RunListener listener =
- ConcurrentReporterManager.createInstance( testSetMap, reporterFactory, false, false, consoleLogger );
+ ConcurrentRunListener.createInstance( testSetMap, reporterFactory, false, false, consoleLogger );
TestsToRun testsToRun = new TestsToRun( Arrays.<Class<?>>asList( TestClassTest.class ) );