You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2016/09/03 22:35:19 UTC

[01/14] maven-surefire git commit: refactoring

Repository: maven-surefire
Updated Branches:
  refs/heads/master 658230b69 -> 076d68f6e


refactoring


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/280333dd
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/280333dd
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/280333dd

Branch: refs/heads/master
Commit: 280333dd480f0dc4a71b1c94a9d01344475c4321
Parents: 8d22e16
Author: Tibor17 <ti...@lycos.com>
Authored: Wed Aug 24 23:43:31 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Wed Aug 24 23:43:31 2016 +0200

----------------------------------------------------------------------
 .../plugin/surefire/report/TestSetStats.java     | 19 +++++--------------
 .../maven/surefire/testset/ResolvedTest.java     |  4 ++--
 2 files changed, 7 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/280333dd/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java
index 2a1782e..e5b47d2 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java
@@ -164,26 +164,17 @@ public class TestSetStats
 
     public String getTestSetSummary( WrappedReportEntry reportEntry )
     {
-        String summary = "Tests run: ";
-        summary += completedCount;
-        summary += ", Failures: ";
-        summary += failures;
-        summary += ", Errors: ";
-        summary += errors;
-        summary += ", Skipped: ";
-        summary += skipped;
-        summary += ", ";
-        summary += reportEntry.getElapsedTimeVerbose();
+        String summary =
+                "Tests run: " + completedCount
+                        +  ", Failures: " + failures + ", Errors: " + errors + ", Skipped: " + skipped + ", "
+                        + reportEntry.getElapsedTimeVerbose();
 
         if ( failures > 0 || errors > 0 )
         {
             summary += " <<< FAILURE!";
         }
 
-        summary += " - in ";
-        summary += reportEntry.getNameWithGroup();
-
-        summary += "\n";
+        summary += " - in " + reportEntry.getNameWithGroup() + "\n";
 
         return summary;
     }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/280333dd/surefire-api/src/main/java/org/apache/maven/surefire/testset/ResolvedTest.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/testset/ResolvedTest.java b/surefire-api/src/main/java/org/apache/maven/surefire/testset/ResolvedTest.java
index 28794bc..8e46ccb 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/testset/ResolvedTest.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/testset/ResolvedTest.java
@@ -328,8 +328,8 @@ public final class ResolvedTest
         {
             if ( className.endsWith( JAVA_FILE_EXTENSION ) )
             {
-                className = className.substring( 0, className.length() - JAVA_FILE_EXTENSION.length() );
-                className += CLASS_FILE_EXTENSION;
+                className = className.substring( 0, className.length() - JAVA_FILE_EXTENSION.length() )
+                                    + CLASS_FILE_EXTENSION;
             }
             return className;
         }


[14/14] maven-surefire git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/maven-surefire

Posted by ti...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/maven-surefire


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/076d68f6
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/076d68f6
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/076d68f6

Branch: refs/heads/master
Commit: 076d68f6e7866b9077f5eb401643d67ec26f69ce
Parents: 319bd0e 658230b
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Sep 4 00:34:06 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Sep 4 00:34:06 2016 +0200

----------------------------------------------------------------------
 .../src/site/markdown/multilineexceptions.md    | 37 ++++++++++++++++++++
 maven-surefire-plugin/src/site/site.xml         |  1 +
 .../maven/surefire/junit4/JUnit4Provider.java   |  8 ++---
 .../surefire/junitcore/JUnitCoreProvider.java   | 10 ++----
 4 files changed, 44 insertions(+), 12 deletions(-)
----------------------------------------------------------------------



[12/14] maven-surefire git commit: refactoring

Posted by ti...@apache.org.
refactoring


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/468a1737
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/468a1737
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/468a1737

Branch: refs/heads/master
Commit: 468a1737a76237df1b5404ed02c0008188636315
Parents: b54aee0
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Aug 28 23:32:18 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Aug 28 23:32:18 2016 +0200

----------------------------------------------------------------------
 .../booterclient/output/ForkClient.java         | 25 ++++++++++----------
 1 file changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/468a1737/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 1a06c98..767962a 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
@@ -33,15 +33,15 @@ import java.util.concurrent.atomic.AtomicLong;
 import org.apache.maven.plugin.surefire.booterclient.lazytestprovider.NotifiableTestStream;
 import org.apache.maven.plugin.surefire.report.DefaultReporterFactory;
 import org.apache.maven.shared.utils.cli.StreamConsumer;
-import org.apache.maven.surefire.report.CategorizedReportEntry;
 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.ReporterException;
 import org.apache.maven.surefire.report.RunListener;
 import org.apache.maven.surefire.report.StackTraceWriter;
-import org.apache.maven.surefire.util.internal.StringUtils;
 
+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;
 import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_ERROR;
@@ -59,6 +59,8 @@ import static org.apache.maven.surefire.booter.ForkingRunListener.BOOTERCODE_TES
 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.Shutdown.KILL;
+import static org.apache.maven.surefire.report.CategorizedReportEntry.reportEntry;
+import static org.apache.maven.surefire.util.internal.StringUtils.isNotBlank;
 import static org.apache.maven.surefire.util.internal.StringUtils.unescapeBytes;
 import static org.apache.maven.surefire.util.internal.StringUtils.unescapeString;
 
@@ -127,7 +129,7 @@ public class ForkClient
 
     public final void consumeLine( String s )
     {
-        if ( StringUtils.isNotBlank( s ) )
+        if ( isNotBlank( s ) )
         {
             processLine( s );
         }
@@ -139,7 +141,7 @@ public class ForkClient
         {
             // Not necessary to call JNI library library #currentTimeMillis
             // which may waste 10 - 30 machine cycles in callback. Callbacks should be fast.
-            testSetStartedAt.compareAndSet( START_TIME_ZERO, System.currentTimeMillis() );
+            testSetStartedAt.compareAndSet( START_TIME_ZERO, currentTimeMillis() );
         }
     }
 
@@ -153,14 +155,14 @@ public class ForkClient
         try
         {
             final byte operationId = (byte) s.charAt( 0 );
-            int commma = s.indexOf( ",", 3 );
-            if ( commma < 0 )
+            int comma = s.indexOf( ",", 3 );
+            if ( comma < 0 )
             {
                 System.out.println( s );
                 return;
             }
-            final int channelNumber = Integer.parseInt( s.substring( 2, commma ), 16 );
-            int rest = s.indexOf( ",", commma );
+            final int channelNumber = parseInt( s.substring( 2, comma ), 16 );
+            int rest = s.indexOf( ",", comma );
             final String remaining = s.substring( rest + 1 );
 
             switch ( operationId )
@@ -296,7 +298,7 @@ public class ForkClient
             final StackTraceWriter stackTraceWriter =
                 tokens.hasMoreTokens() ? deserializeStackTraceWriter( tokens ) : null;
 
-            return CategorizedReportEntry.reportEntry( source, name, group, stackTraceWriter, elapsed, message );
+            return reportEntry( source, name, group, stackTraceWriter, elapsed, message );
         }
         catch ( RuntimeException e )
         {
@@ -309,9 +311,8 @@ public class ForkClient
         String stackTraceMessage = nullableCsv( tokens.nextToken() );
         String smartStackTrace = nullableCsv( tokens.nextToken() );
         String stackTrace = tokens.hasMoreTokens() ? nullableCsv( tokens.nextToken() ) : null;
-        return stackTrace != null
-            ? new DeserializedStacktraceWriter( stackTraceMessage, smartStackTrace, stackTrace )
-            : null;
+        boolean hasTrace = stackTrace != null;
+        return hasTrace ? new DeserializedStacktraceWriter( stackTraceMessage, smartStackTrace, stackTrace ) : null;
     }
 
     private String nullableCsv( String source )


[08/14] maven-surefire git commit: refactoring

Posted by ti...@apache.org.
refactoring


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/4e5bc168
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/4e5bc168
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/4e5bc168

Branch: refs/heads/master
Commit: 4e5bc1686178336a69eb0027eecb2e336ee6dec4
Parents: 949cb8d
Author: Tibor17 <ti...@lycos.com>
Authored: Fri Aug 26 23:22:58 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Fri Aug 26 23:22:58 2016 +0200

----------------------------------------------------------------------
 .../maven/plugin/surefire/report/DefaultReporterFactory.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4e5bc168/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 b7a30a9..e1ba809 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
@@ -38,7 +38,12 @@ import java.util.TreeMap;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
 import static org.apache.maven.plugin.surefire.report.ConsoleReporter.PLAIN;
-import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType.*;
+import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType.error;
+import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType.failure;
+import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType.flake;
+import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType.skipped;
+import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType.success;
+import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType.unknown;
 import static org.apache.maven.plugin.surefire.report.ReportEntryType.ERROR;
 import static org.apache.maven.plugin.surefire.report.ReportEntryType.FAILURE;
 import static org.apache.maven.plugin.surefire.report.ReportEntryType.SUCCESS;


[11/14] maven-surefire git commit: added TODO

Posted by ti...@apache.org.
added TODO


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/b54aee09
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/b54aee09
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/b54aee09

Branch: refs/heads/master
Commit: b54aee09b85b2a1383bcdff1dfc1fc4179fe8848
Parents: c155f17
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Aug 28 23:05:37 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Aug 28 23:05:37 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/maven/surefire/util/internal/StringUtils.java  | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b54aee09/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
index 06cd55e..c5f48c1 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
@@ -379,6 +379,7 @@ public class StringUtils
 
     /*
     * In JDK7 use java.util.Objects instead.
+    * todo
     * */
     public static <T> T requireNonNull( T obj, String message )
     {
@@ -391,6 +392,7 @@ public class StringUtils
 
     /*
     * In JDK7 use java.util.Objects instead.
+    * todo
     * */
     public static <T> T requireNonNull( T obj )
     {


[06/14] maven-surefire git commit: refactoring

Posted by ti...@apache.org.
refactoring


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/a63c6bb6
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/a63c6bb6
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/a63c6bb6

Branch: refs/heads/master
Commit: a63c6bb625a74f1e681f528876137d38b9fd98ad
Parents: b634646
Author: Tibor17 <ti...@lycos.com>
Authored: Fri Aug 26 22:57:41 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Fri Aug 26 22:57:41 2016 +0200

----------------------------------------------------------------------
 .../surefire/report/DefaultReporterFactory.java | 70 ++++++++++----------
 1 file changed, 36 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a63c6bb6/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 815e4c6..b7a30a9 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
@@ -21,6 +21,7 @@ package org.apache.maven.plugin.surefire.report;
 
 import org.apache.maven.plugin.surefire.StartupReportConfiguration;
 import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
+import org.apache.maven.surefire.report.ConsoleLogger;
 import org.apache.maven.surefire.report.DefaultDirectConsoleReporter;
 import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.RunListener;
@@ -37,6 +38,10 @@ import java.util.TreeMap;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
 import static org.apache.maven.plugin.surefire.report.ConsoleReporter.PLAIN;
+import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType.*;
+import static org.apache.maven.plugin.surefire.report.ReportEntryType.ERROR;
+import static org.apache.maven.plugin.surefire.report.ReportEntryType.FAILURE;
+import static org.apache.maven.plugin.surefire.report.ReportEntryType.SUCCESS;
 
 /**
  * Provides reporting modules on the plugin side.
@@ -68,7 +73,7 @@ public class DefaultReporterFactory
     public DefaultReporterFactory( StartupReportConfiguration reportConfiguration )
     {
         this.reportConfiguration = reportConfiguration;
-        this.statisticsReporter = reportConfiguration.instantiateStatisticsReporter();
+        statisticsReporter = reportConfiguration.instantiateStatisticsReporter();
     }
 
     public RunListener createReporter()
@@ -120,7 +125,7 @@ public class DefaultReporterFactory
 
     public void runStarting()
     {
-        final DefaultDirectConsoleReporter consoleReporter = createConsoleLogger();
+        ConsoleLogger consoleReporter = createConsoleLogger();
         consoleReporter.info( "" );
         consoleReporter.info( "-------------------------------------------------------" );
         consoleReporter.info( " T E S T S" );
@@ -129,16 +134,16 @@ public class DefaultReporterFactory
 
     private void runCompleted()
     {
-        final DefaultDirectConsoleReporter logger = createConsoleLogger();
+        final ConsoleLogger logger = createConsoleLogger();
         if ( reportConfiguration.isPrintSummary() )
         {
             logger.info( "" );
             logger.info( "Results:" );
             logger.info( "" );
         }
-        boolean printedFailures = printTestFailures( logger, TestResultType.failure );
-        printedFailures |= printTestFailures( logger, TestResultType.error );
-        printedFailures |= printTestFailures( logger, TestResultType.flake );
+        boolean printedFailures = printTestFailures( logger, failure );
+        printedFailures |= printTestFailures( logger, error );
+        printedFailures |= printTestFailures( logger, flake );
         if ( printedFailures )
         {
             logger.info( "" );
@@ -165,30 +170,30 @@ public class DefaultReporterFactory
      * Get the result of a test based on all its runs. If it has success and failures/errors, then it is a flake;
      * if it only has errors or failures, then count its result based on its first run
      *
-     * @param reportEntryList the list of test run report type for a given test
+     * @param reportEntries the list of test run report type for a given test
      * @param rerunFailingTestsCount configured rerun count for failing tests
      * @return the type of test result
      */
     // Use default visibility for testing
-    static TestResultType getTestResultType( List<ReportEntryType> reportEntryList, int rerunFailingTestsCount  )
+    static TestResultType getTestResultType( List<ReportEntryType> reportEntries, int rerunFailingTestsCount  )
     {
-        if ( reportEntryList == null || reportEntryList.isEmpty() )
+        if ( reportEntries == null || reportEntries.isEmpty() )
         {
-            return TestResultType.unknown;
+            return unknown;
         }
 
         boolean seenSuccess = false, seenFailure = false, seenError = false;
-        for ( ReportEntryType resultType : reportEntryList )
+        for ( ReportEntryType resultType : reportEntries )
         {
-            if ( resultType == ReportEntryType.SUCCESS )
+            if ( resultType == SUCCESS )
             {
                 seenSuccess = true;
             }
-            else if ( resultType == ReportEntryType.FAILURE )
+            else if ( resultType == FAILURE )
             {
                 seenFailure = true;
             }
-            else if ( resultType == ReportEntryType.ERROR )
+            else if ( resultType == ERROR )
             {
                 seenError = true;
             }
@@ -198,27 +203,27 @@ public class DefaultReporterFactory
         {
             if ( seenSuccess && rerunFailingTestsCount > 0 )
             {
-                return TestResultType.flake;
+                return flake;
             }
             else
             {
                 if ( seenError )
                 {
-                    return TestResultType.error;
+                    return error;
                 }
                 else
                 {
-                    return TestResultType.failure;
+                    return failure;
                 }
             }
         }
         else if ( seenSuccess )
         {
-            return TestResultType.success;
+            return success;
         }
         else
         {
-            return TestResultType.skipped;
+            return skipped;
         }
     }
 
@@ -264,23 +269,20 @@ public class DefaultReporterFactory
             String testClassMethodName = entry.getKey();
             completedCount++;
 
-            List<ReportEntryType> resultTypeList = new ArrayList<ReportEntryType>();
+            List<ReportEntryType> resultTypes = new ArrayList<ReportEntryType>();
             for ( TestMethodStats methodStats : testMethodStats )
             {
-                resultTypeList.add( methodStats.getResultType() );
+                resultTypes.add( methodStats.getResultType() );
             }
 
-            TestResultType resultType = getTestResultType( resultTypeList,
-                                                           reportConfiguration.getRerunFailingTestsCount() );
-
-            switch ( resultType )
+            switch ( getTestResultType( resultTypes, reportConfiguration.getRerunFailingTestsCount() ) )
             {
                 case success:
                     // If there are multiple successful runs of the same test, count all of them
                     int successCount = 0;
-                    for ( ReportEntryType type : resultTypeList )
+                    for ( ReportEntryType type : resultTypes )
                     {
-                        if ( type == ReportEntryType.SUCCESS )
+                        if ( type == SUCCESS )
                         {
                             successCount++;
                         }
@@ -316,7 +318,7 @@ public class DefaultReporterFactory
      * @return {@code true} if printed some lines
      */
     // Use default visibility for testing
-    boolean printTestFailures( DefaultDirectConsoleReporter logger, TestResultType type )
+    boolean printTestFailures( ConsoleLogger logger, TestResultType type )
     {
         final Map<String, List<TestMethodStats>> testStats;
         switch ( type )
@@ -375,12 +377,12 @@ public class DefaultReporterFactory
     enum TestResultType
     {
 
-        error( "Tests in error: " ),
-        failure( "Failed tests: " ),
-        flake( "Flaked tests: " ),
-        success( "Success: " ),
-        skipped( "Skipped: " ),
-        unknown( "Unknown: " );
+        error(   "Tests in error: " ),
+        failure( "Failed tests: "   ),
+        flake(   "Flaked tests: "   ),
+        success( "Success: "        ),
+        skipped( "Skipped: "        ),
+        unknown( "Unknown: "        );
 
         private final String logPrefix;
 


[07/14] maven-surefire git commit: refactoring

Posted by ti...@apache.org.
refactoring


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/949cb8dc
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/949cb8dc
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/949cb8dc

Branch: refs/heads/master
Commit: 949cb8dc5a09f356dd53a028e25381a24ce7db20
Parents: a63c6bb
Author: Tibor17 <ti...@lycos.com>
Authored: Fri Aug 26 22:59:51 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Fri Aug 26 22:59:51 2016 +0200

----------------------------------------------------------------------
 .../org/apache/maven/plugin/surefire/report/ConsoleReporter.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/949cb8dc/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java
index eabb447..1fcf4b0 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java
@@ -93,7 +93,7 @@ public class ConsoleReporter
      * @param report report whose test set is starting
      * @return the message
      */
-    static String getTestSetStartingMessage( ReportEntry report )
+    private static String getTestSetStartingMessage( ReportEntry report )
     {
         return TEST_SET_STARTING_PREFIX + report.getNameWithGroup() + "\n";
     }


[05/14] maven-surefire git commit: refactoring

Posted by ti...@apache.org.
refactoring


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/b6346461
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/b6346461
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/b6346461

Branch: refs/heads/master
Commit: b6346461271e259a82158c6fccae8f3967fc5676
Parents: 8da7eda
Author: Tibor17 <ti...@lycos.com>
Authored: Fri Aug 26 14:38:45 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Fri Aug 26 14:38:45 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/maven/surefire/testng/TestNGExecutor.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b6346461/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
index 3c78b60..f95c0f2 100644
--- a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
+++ b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
@@ -47,6 +47,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import static org.apache.maven.surefire.cli.CommandLineOption.LOGGING_LEVEL_DEBUG;
+import static org.apache.maven.surefire.cli.CommandLineOption.SHOW_ERRORS;
 import static org.apache.maven.surefire.util.ReflectionUtils.instantiate;
 import static org.apache.maven.surefire.util.ReflectionUtils.tryLoadClass;
 import static org.apache.maven.surefire.util.internal.ConcurrencyUtils.countDownToZero;
@@ -135,8 +137,7 @@ final class TestNGExecutor
 
     private static boolean isCliDebugOrShowErrors( List<CommandLineOption> mainCliOptions )
     {
-        return mainCliOptions.contains( CommandLineOption.LOGGING_LEVEL_DEBUG )
-            || mainCliOptions.contains( CommandLineOption.SHOW_ERRORS );
+        return mainCliOptions.contains( LOGGING_LEVEL_DEBUG ) || mainCliOptions.contains( SHOW_ERRORS );
     }
 
     private static TestMetadata findTestMetadata( Class<?> testClass )


[10/14] maven-surefire git commit: refactoring

Posted by ti...@apache.org.
refactoring


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/c155f17b
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/c155f17b
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/c155f17b

Branch: refs/heads/master
Commit: c155f17b3689b9d643e0eed95ce271ced87d2c7e
Parents: da1e149
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Aug 28 22:16:09 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Aug 28 22:16:09 2016 +0200

----------------------------------------------------------------------
 .../surefire/booterclient/ForkStarter.java      | 21 ++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c155f17b/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 125758f..2a70927 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
@@ -63,18 +63,19 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import static java.lang.StrictMath.min;
+import static java.lang.System.currentTimeMillis;
+import static java.lang.Thread.currentThread;
 import static java.util.Collections.addAll;
+import static java.util.concurrent.Executors.newScheduledThreadPool;
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.SECONDS;
 import static org.apache.maven.plugin.surefire.AbstractSurefireMojo.createCopyAndReplaceForkNumPlaceholder;
@@ -283,7 +284,7 @@ public class ForkStarter
     private RunResult runSuitesForkOnceMultiple( final SurefireProperties effectiveSystemProperties, int forkCount )
         throws SurefireBooterForkException
     {
-        ThreadPoolExecutor executorService = new ThreadPoolExecutor( forkCount, forkCount, 60, TimeUnit.SECONDS,
+        ThreadPoolExecutor executorService = new ThreadPoolExecutor( forkCount, forkCount, 60, SECONDS,
                                                                   new ArrayBlockingQueue<Runnable>( forkCount ) );
         executorService.setThreadFactory( FORKED_JVM_DAEMON_THREAD_FACTORY );
 
@@ -364,7 +365,7 @@ public class ForkStarter
     {
         ArrayList<Future<RunResult>> results = new ArrayList<Future<RunResult>>( 500 );
         ThreadPoolExecutor executorService =
-            new ThreadPoolExecutor( forkCount, forkCount, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>() );
+            new ThreadPoolExecutor( forkCount, forkCount, 60, SECONDS, new LinkedBlockingQueue<Runnable>() );
         executorService.setThreadFactory( FORKED_JVM_DAEMON_THREAD_FACTORY );
         final TestLessInputStreamBuilder builder = new TestLessInputStreamBuilder();
         ScheduledFuture<?> ping = triggerPingTimerForShutdown( builder );
@@ -443,7 +444,7 @@ public class ForkStarter
             catch ( InterruptedException e )
             {
                 executorService.shutdownNow();
-                Thread.currentThread().interrupt();
+                currentThread().interrupt();
                 throw new SurefireBooterForkException( "Interrupted", e );
             }
             catch ( ExecutionException e )
@@ -464,11 +465,11 @@ public class ForkStarter
         try
         {
             // Should stop immediately, as we got all the results if we are here
-            executorService.awaitTermination( 60 * 60, TimeUnit.SECONDS );
+            executorService.awaitTermination( 60 * 60, SECONDS );
         }
         catch ( InterruptedException e )
         {
-            Thread.currentThread().interrupt();
+            currentThread().interrupt();
             throw new SurefireBooterForkException( "Interrupted", e );
         }
     }
@@ -684,13 +685,13 @@ public class ForkStarter
     private static ScheduledExecutorService createPingScheduler()
     {
         ThreadFactory threadFactory = newDaemonThreadFactory( "ping-timer-" + PING_IN_SECONDS + "s" );
-        return Executors.newScheduledThreadPool( 1, threadFactory );
+        return newScheduledThreadPool( 1, threadFactory );
     }
 
     private static ScheduledExecutorService createTimeoutCheckScheduler()
     {
         ThreadFactory threadFactory = newDaemonThreadFactory( "timeout-check-timer" );
-        return Executors.newScheduledThreadPool( 1, threadFactory );
+        return newScheduledThreadPool( 1, threadFactory );
     }
 
     private ScheduledFuture<?> triggerPingTimerForShutdown( final TestLessInputStreamBuilder builder )
@@ -724,7 +725,7 @@ public class ForkStarter
         {
             public void run()
             {
-                long systemTime = System.currentTimeMillis();
+                long systemTime = currentTimeMillis();
                 for ( ForkClient forkClient : currentForkClients )
                 {
                     forkClient.tryToTimeout( systemTime, forkedProcessTimeoutInSeconds );


[09/14] maven-surefire git commit: improved ForkStarter

Posted by ti...@apache.org.
improved ForkStarter


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/da1e1493
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/da1e1493
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/da1e1493

Branch: refs/heads/master
Commit: da1e1493b1865636654a5048f744f6dfdd656993
Parents: 4e5bc16
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Aug 28 22:01:06 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Aug 28 22:01:06 2016 +0200

----------------------------------------------------------------------
 .../surefire/booterclient/ForkStarter.java      | 46 ++++++++------------
 1 file changed, 19 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/da1e1493/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 6d7fdb3..125758f 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
@@ -72,9 +72,9 @@ import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicReference;
 
 import static java.lang.StrictMath.min;
+import static java.util.Collections.addAll;
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.SECONDS;
 import static org.apache.maven.plugin.surefire.AbstractSurefireMojo.createCopyAndReplaceForkNumPlaceholder;
@@ -94,6 +94,7 @@ import static org.apache.maven.surefire.util.internal.ConcurrencyUtils.countDown
 import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDaemonThread;
 import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDaemonThreadFactory;
 import static org.apache.maven.surefire.util.internal.StringUtils.FORK_STREAM_CHARSET_NAME;
+import static org.apache.maven.surefire.util.internal.StringUtils.requireNonNull;
 
 /**
  * Starts the fork or runs in-process.
@@ -151,48 +152,38 @@ public class ForkStarter
     private static class CloseableCloser
         implements Runnable, Closeable
     {
-        private final Queue<AtomicReference<Closeable>> testProvidingInputStream;
+        private final Queue<Closeable> testProvidingInputStream;
 
         private final Thread inputStreamCloserHook;
 
         public CloseableCloser( Closeable... testProvidingInputStream )
         {
-            this.testProvidingInputStream = new ConcurrentLinkedQueue<AtomicReference<Closeable>>();
-            for ( Closeable closeable : testProvidingInputStream )
+            this.testProvidingInputStream = new ConcurrentLinkedQueue<Closeable>();
+            addAll( this.testProvidingInputStream, testProvidingInputStream );
+            if ( this.testProvidingInputStream.isEmpty() )
             {
-                if ( closeable != null )
-                {
-                    this.testProvidingInputStream.add( new AtomicReference<Closeable>( closeable ) );
-                }
+                inputStreamCloserHook = null;
             }
-            if ( !this.testProvidingInputStream.isEmpty() )
+            else
             {
                 inputStreamCloserHook = newDaemonThread( this, "closer-shutdown-hook" );
                 addShutDownHook( inputStreamCloserHook );
             }
-            else
-            {
-                inputStreamCloserHook = null;
-            }
         }
 
+        @SuppressWarnings( "checkstyle:innerassignment" )
         public void run()
         {
-            for ( AtomicReference<Closeable> closeableAtomicReference : testProvidingInputStream )
+            for ( Closeable closeable; ( closeable = testProvidingInputStream.poll() ) != null; )
             {
-                Closeable closeable = closeableAtomicReference.getAndSet( null );
-                if ( closeable != null )
+                try
                 {
-                    try
-                    {
-                        closeable.close();
-                    }
-                    catch ( IOException e )
-                    {
-                        // ignore
-                    }
+                    closeable.close();
+                }
+                catch ( IOException e )
+                {
+                    // ignore
                 }
-
             }
         }
 
@@ -562,8 +553,9 @@ public class ForkStarter
             cli.createArg().setFile( systPropsFile );
         }
 
-        ThreadedStreamConsumer threadedStreamConsumer = new ThreadedStreamConsumer( forkClient );
-        final CloseableCloser closer = new CloseableCloser( threadedStreamConsumer, testProvidingInputStream );
+        final ThreadedStreamConsumer threadedStreamConsumer = new ThreadedStreamConsumer( forkClient );
+        final CloseableCloser closer =
+                new CloseableCloser( threadedStreamConsumer, requireNonNull( testProvidingInputStream, "null param" ) );
 
         if ( forkConfiguration.isDebug() )
         {


[13/14] maven-surefire git commit: refactoring [reorder instance vars as in constructor]

Posted by ti...@apache.org.
refactoring [reorder instance vars as in constructor]


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/319bd0ec
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/319bd0ec
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/319bd0ec

Branch: refs/heads/master
Commit: 319bd0ecba32a87dd8aa5bfd8e09d376de2c2a0a
Parents: 468a173
Author: Tibor17 <ti...@lycos.com>
Authored: Thu Sep 1 20:28:39 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Thu Sep 1 20:28:39 2016 +0200

----------------------------------------------------------------------
 .../booterclient/output/DeserializedStacktraceWriter.java      | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/319bd0ec/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/DeserializedStacktraceWriter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/DeserializedStacktraceWriter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/DeserializedStacktraceWriter.java
index daa3f29..8832a36 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/DeserializedStacktraceWriter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/DeserializedStacktraceWriter.java
@@ -35,15 +35,15 @@ public class DeserializedStacktraceWriter
 {
     private final String message;
 
-    private final String stackTrace;
-
     private final String smartTrimmed;
 
+    private final String stackTrace;
+
     public DeserializedStacktraceWriter( String message, String smartTrimmed, String stackTrace )
     {
         this.message = message;
-        this.stackTrace = stackTrace;
         this.smartTrimmed = smartTrimmed;
+        this.stackTrace = stackTrace;
     }
 
     public String smartTrimmedStackTrace()


[03/14] maven-surefire git commit: refactoring

Posted by ti...@apache.org.
refactoring


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/dd6b6207
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/dd6b6207
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/dd6b6207

Branch: refs/heads/master
Commit: dd6b62076058c363b6e0bf1cb2634cd6c81c8256
Parents: 4b73cac
Author: Tibor17 <ti...@lycos.com>
Authored: Thu Aug 25 17:59:23 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Thu Aug 25 17:59:23 2016 +0200

----------------------------------------------------------------------
 .../apache/maven/surefire/booter/BaseProviderFactory.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/dd6b6207/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
index a1de9d4..c72e2f7 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
@@ -36,6 +36,7 @@ import org.apache.maven.surefire.util.DirectoryScanner;
 import org.apache.maven.surefire.util.RunOrderCalculator;
 import org.apache.maven.surefire.util.ScanResult;
 
+import java.io.PrintStream;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -129,10 +130,9 @@ public class BaseProviderFactory
 
     public ConsoleLogger getConsoleLogger()
     {
-        return insideFork
-                ? new ForkingRunListener( reporterConfiguration.getOriginalSystemOut(), ROOT_CHANNEL,
-                                           reporterConfiguration.isTrimStackTrace() )
-                : new DefaultDirectConsoleReporter( reporterConfiguration.getOriginalSystemOut() );
+        boolean trim = reporterConfiguration.isTrimStackTrace();
+        PrintStream out = reporterConfiguration.getOriginalSystemOut();
+        return insideFork ? new ForkingRunListener( out, ROOT_CHANNEL, trim ) : new DefaultDirectConsoleReporter( out );
     }
 
     public void setTestRequest( TestRequest testRequest )


[04/14] maven-surefire git commit: SHOW_ERRORS should be observed before thrown exception on Enum.valueOf()

Posted by ti...@apache.org.
SHOW_ERRORS should be observed before thrown exception on Enum.valueOf()


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/8da7eda3
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/8da7eda3
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/8da7eda3

Branch: refs/heads/master
Commit: 8da7eda3152a2dd56065c01cdb1fee15aff38736
Parents: dd6b620
Author: Tibor17 <ti...@lycos.com>
Authored: Fri Aug 26 14:37:22 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Fri Aug 26 14:37:22 2016 +0200

----------------------------------------------------------------------
 .../org/apache/maven/plugin/surefire/SurefireHelper.java  | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8da7eda3/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java
index 3b0bbc2..8952787 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java
@@ -127,17 +127,17 @@ public final class SurefireHelper
             Method getRequestMethod = session.getClass().getMethod( "getRequest" );
             MavenExecutionRequest request = (MavenExecutionRequest) getRequestMethod.invoke( session );
 
+            if ( request.isShowErrors() )
+            {
+                cli.add( SHOW_ERRORS );
+            }
+
             String f = getFailureBehavior( request );
             if ( f != null )
             {
                 // compatible with enums Maven 3.0
                 cli.add( CommandLineOption.valueOf( f.startsWith( "REACTOR_" ) ? f : "REACTOR_" + f ) );
             }
-
-            if ( request.isShowErrors() )
-            {
-                cli.add( SHOW_ERRORS );
-            }
         }
         catch ( Exception e )
         {


[02/14] maven-surefire git commit: refactoring

Posted by ti...@apache.org.
refactoring


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/4b73cacc
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/4b73cacc
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/4b73cacc

Branch: refs/heads/master
Commit: 4b73cacc18689d13f646a46f9ca4e70770725755
Parents: 280333d
Author: Tibor17 <ti...@lycos.com>
Authored: Thu Aug 25 00:26:18 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Thu Aug 25 00:26:18 2016 +0200

----------------------------------------------------------------------
 .../surefire/booterclient/ProviderDetector.java   | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4b73cacc/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java
index 2d31288..c676d58 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java
@@ -25,17 +25,20 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.URL;
-import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Set;
 
+import static java.lang.Character.isJavaIdentifierPart;
+import static java.lang.Character.isJavaIdentifierStart;
+import static java.util.Collections.emptySet;
+
 /**
  * @author Stephen Conolly
  * @author Kristian Rosenvold
  * @noinspection UnusedDeclaration
  */
-public class ProviderDetector
+public final class ProviderDetector
 {
 
     @Nonnull public static Set<String> getServiceNames( Class<?> clazz, ClassLoader classLoader )
@@ -45,7 +48,7 @@ public class ProviderDetector
 
         if ( classLoader == null )
         {
-            return Collections.emptySet();
+            return emptySet();
         }
         final Enumeration<URL> urlEnumeration = classLoader.getResources( resourceName );
         return getNames( urlEnumeration );
@@ -71,8 +74,7 @@ public class ProviderDetector
             final BufferedReader reader = getReader( url );
             try
             {
-                String line;
-                while ( ( line = reader.readLine() ) != null )
+                for ( String line; ( line = reader.readLine() ) != null; )
                 {
                     int ci = line.indexOf( '#' );
                     if ( ci >= 0 )
@@ -86,19 +88,19 @@ public class ProviderDetector
                         continue; // next line
                     }
 
-                    if ( ( line.indexOf( ' ' ) >= 0 ) || ( line.indexOf( '\t' ) >= 0 ) )
+                    if ( line.indexOf( ' ' ) >= 0 || line.indexOf( '\t' ) >= 0 )
                     {
                         continue nextUrl; // next url
                     }
                     char cp = line.charAt( 0 ); // should use codePointAt but this was JDK1.3
-                    if ( !Character.isJavaIdentifierStart( cp ) )
+                    if ( !isJavaIdentifierStart( cp ) )
                     {
                         continue nextUrl; // next url
                     }
                     for ( int i = 1; i < n; i++ )
                     {
                         cp = line.charAt( i );  // should use codePointAt but this was JDK1.3
-                        if ( !Character.isJavaIdentifierPart( cp ) && ( cp != '.' ) )
+                        if ( !isJavaIdentifierPart( cp ) && cp != '.' )
                         {
                             continue nextUrl; // next url
                         }