maven-surefire git commit: [SUREFIRE-1310] ForkClient should handle only one channel-id
Repository: maven-surefire Updated Branches: refs/heads/master df7e143c2 -> 27fbe2c19 [SUREFIRE-1310] ForkClient should handle only one channel-id Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/27fbe2c1 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/27fbe2c1 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/27fbe2c1 Branch: refs/heads/master Commit: 27fbe2c190a204e19dc42c86e9769bf384e7ec91 Parents: df7e143 Author: Tibor17 Authored: Sat Dec 31 06:46:06 2016 +0100 Committer: Tibor17 Committed: Sat Dec 31 06:46:06 2016 +0100 -- .../booterclient/output/ForkClient.java | 37 1 file changed, 23 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/27fbe2c1/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 d0aecf9..68ce40d 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 @@ -79,8 +79,6 @@ public class ForkClient private static final long START_TIME_ZERO = 0L; private static final long START_TIME_NEGATIVE_TIMEOUT = -1L; -private final RunListener testSetReporter; - private final DefaultReporterFactory defaultReporterFactory; private final Properties testVmSystemProperties; @@ -97,6 +95,8 @@ public class ForkClient private final ConsoleLogger log; +private RunListener testSetReporter; + private volatile boolean saidGoodBye; private volatile StackTraceWriter errorInFork; @@ -104,7 +104,6 @@ public class ForkClient public ForkClient( DefaultReporterFactory defaultReporterFactory, Properties testVmSystemProperties, NotifiableTestStream notifiableTestStream, ConsoleLogger log ) { -testSetReporter = defaultReporterFactory.createReporter(); this.defaultReporterFactory = defaultReporterFactory; this.testVmSystemProperties = testVmSystemProperties; this.notifiableTestStream = notifiableTestStream; @@ -168,6 +167,15 @@ public class ForkClient return testSetStartedAt.get() == START_TIME_NEGATIVE_TIMEOUT; } +private RunListener getTestSetReporter() +{ +if ( testSetReporter == null ) +{ +testSetReporter = defaultReporterFactory.createReporter(); +} +return testSetReporter; +} + private void processLine( String s ) { try @@ -185,49 +193,49 @@ public class ForkClient switch ( operationId ) { case BOOTERCODE_TESTSET_STARTING: -testSetReporter.testSetStarting( createReportEntry( remaining ) ); +getTestSetReporter().testSetStarting( createReportEntry( remaining ) ); setCurrentStartTime(); break; case BOOTERCODE_TESTSET_COMPLETED: testsInProgress.clear(); -testSetReporter.testSetCompleted( createReportEntry( remaining ) ); +getTestSetReporter().testSetCompleted( createReportEntry( remaining ) ); break; case BOOTERCODE_TEST_STARTING: ReportEntry reportEntry = createReportEntry( remaining ); testsInProgress.offer( reportEntry.getSourceName() ); -testSetReporter.testStarting( createReportEntry( remaining ) ); +getTestSetReporter().testStarting( createReportEntry( remaining ) ); break; case BOOTERCODE_TEST_SUCCEEDED: reportEntry = createReportEntry( remaining ); testsInProgress.remove( reportEntry.getSourceName() ); -testSetReporter.testSucceeded( createReportEntry( remaining ) ); +getTestSetReporter().testSucceeded( createReportEntry( remaining ) ); break; case BOOTERCODE_TEST_FAILED: reportEntry = createReportEntry( remaining ); testsInProgress.remove( reportEntry.getSourceName() ); -testSetReporter.testFailed( createReportEntry( re
[2/2] maven-surefire git commit: [SUREFIRE-1310] ForkClient should handle only one channel-id
[SUREFIRE-1310] ForkClient should handle only one channel-id Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/a1ecfc02 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/a1ecfc02 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/a1ecfc02 Branch: refs/heads/master Commit: a1ecfc022de22ac891cfaa95b752869554544122 Parents: db251b3 Author: Tibor17 Authored: Wed Nov 30 20:11:48 2016 +0100 Committer: Tibor17 Committed: Wed Nov 30 20:11:48 2016 +0100 -- .../booterclient/output/ForkClient.java | 100 +++ .../booterclient/ForkingRunListenerTest.java| 59 ++- 2 files changed, 68 insertions(+), 91 deletions(-) -- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a1ecfc02/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 e6e5a6e..475b9ff 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 @@ -19,29 +19,26 @@ package org.apache.maven.plugin.surefire.booterclient.output; * under the License. */ -import java.io.BufferedReader; -import java.io.IOException; -import java.io.StringReader; -import java.nio.ByteBuffer; -import java.util.NoSuchElementException; -import java.util.Properties; -import java.util.StringTokenizer; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.atomic.AtomicLong; - import org.apache.maven.plugin.surefire.booterclient.lazytestprovider.NotifiableTestStream; +import org.apache.maven.plugin.surefire.log.api.ConsoleLogger; import org.apache.maven.plugin.surefire.report.DefaultReporterFactory; import org.apache.maven.shared.utils.cli.StreamConsumer; -import org.apache.maven.plugin.surefire.log.api.ConsoleLogger; import org.apache.maven.surefire.report.ConsoleOutputReceiver; import org.apache.maven.surefire.report.ReportEntry; import org.apache.maven.surefire.report.ReporterException; import org.apache.maven.surefire.report.RunListener; import org.apache.maven.surefire.report.StackTraceWriter; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.StringReader; +import java.nio.ByteBuffer; +import java.util.NoSuchElementException; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.concurrent.atomic.AtomicLong; + import static java.lang.Integer.decode; -import static java.lang.Integer.parseInt; import static java.lang.System.currentTimeMillis; import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_BYE; import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_CONSOLE; @@ -52,14 +49,14 @@ import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_STD import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_STDOUT; import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_STOP_ON_NEXT_TEST; import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_SYSPROPS; +import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_TESTSET_COMPLETED; +import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_TESTSET_STARTING; import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_TEST_ASSUMPTIONFAILURE; import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_TEST_ERROR; import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_TEST_FAILED; import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_TEST_SKIPPED; import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_TEST_STARTING; import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_TEST_SUCCEEDED; -import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_TESTSET_COMPLETED; -import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_TESTSET_STARTING; import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_WARNING; import static org.apache.maven.surefire.booter.Shutdown.KILL; import static org.apache.maven.surefire.report.CategorizedReportEntry.reportEntry; @@ -78,7 +75,7 @@ public class ForkClient private static final long START_TIME