You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by st...@apache.org on 2017/01/23 10:58:08 UTC

[7/8] maven-surefire git commit: Revert "[SUREFIRE-1317] - Refactoring"

Revert "[SUREFIRE-1317] - Refactoring"

This reverts commit b50ea3acf0701e4a66ad8f55930cb41dd2bfc999.


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

Branch: refs/heads/master
Commit: e36fe19ebd1e4db3ced9e853b4a60489a54e569c
Parents: c12adb8
Author: Stephen Connolly <st...@gmail.com>
Authored: Mon Jan 23 10:56:20 2017 +0000
Committer: Stephen Connolly <st...@gmail.com>
Committed: Mon Jan 23 10:56:20 2017 +0000

----------------------------------------------------------------------
 maven-surefire-common/pom.xml                   |  1 -
 .../plugin/surefire/AbstractSurefireMojo.java   |  1 -
 .../surefire/StartupReportConfiguration.java    |  7 +--
 .../surefire/booterclient/ForkStarter.java      |  4 +-
 .../output/DeserializedStacktraceWriter.java    |  2 +-
 .../booterclient/output/ForkClient.java         | 13 +-----
 .../output/LostCommandsDumpSingleton.java       |  7 ---
 .../output/ThreadedStreamConsumer.java          | 49 ++++++++++++--------
 .../surefire/report/DefaultReporterFactory.java | 13 +++---
 .../report/NullStatelessXmlReporter.java        |  2 +-
 .../surefire/report/StatelessXmlReporter.java   | 10 ++--
 .../surefire/report/TestSetRunListener.java     |  2 +-
 .../surefire/runorder/StatisticsReporter.java   |  4 +-
 .../report/DefaultReporterFactoryTest.java      | 18 +++----
 .../report/StatelessXmlReporterTest.java        |  6 +--
 .../maven/plugins/surefire/report/Utils.java    |  1 -
 .../surefire/booter/MasterProcessCommand.java   |  8 ++--
 .../surefire/report/CategorizedReportEntry.java | 17 ++++---
 .../maven/surefire/report/SafeThrowable.java    |  5 --
 .../surefire/util/internal/StringUtils.java     | 28 ++++++++++-
 20 files changed, 105 insertions(+), 93 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/maven-surefire-common/pom.xml
----------------------------------------------------------------------
diff --git a/maven-surefire-common/pom.xml b/maven-surefire-common/pom.xml
index ae71f0d..54825b7 100644
--- a/maven-surefire-common/pom.xml
+++ b/maven-surefire-common/pom.xml
@@ -141,7 +141,6 @@
         </executions>
       </plugin>
       <plugin>
-        <!-- Remove in 3.0 -->
         <artifactId>maven-dependency-plugin</artifactId>
         <executions>
           <execution>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index 99eca2c..4f7744f 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -234,7 +234,6 @@ public abstract class AbstractSurefireMojo
      * unless overridden.
      */
     @Parameter
-    // TODO use regex for fully qualified class names in 3.0 and change the filtering abilities
     private List<String> excludes;
 
     /**

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
index bf6e5ef..482ce00 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
@@ -171,16 +171,11 @@ public final class StartupReportConfiguration
         return rerunFailingTestsCount;
     }
 
-    public boolean hasRerunFailingTestsCount()
-    {
-        return getRerunFailingTestsCount() > 0;
-    }
-
     public StatelessXmlReporter instantiateStatelessXmlReporter()
     {
         return isDisableXmlReport()
             ? null
-            : new StatelessXmlReporter( reportsDirectory, reportNameSuffix, trimStackTrace, hasRerunFailingTestsCount(),
+            : new StatelessXmlReporter( reportsDirectory, reportNameSuffix, trimStackTrace, rerunFailingTestsCount,
                                         testClassMethodRunHistory, xsdSchemaLocation );
     }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/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 b864076..05c4cc2 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
@@ -189,9 +189,9 @@ public class ForkStarter
                 {
                     closeable.close();
                 }
-                catch ( Throwable e )
+                catch ( IOException e )
                 {
-                    e.printStackTrace();
+                    // ignore
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/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 952feb8..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
@@ -64,6 +64,6 @@ public class DeserializedStacktraceWriter
 
     public SafeThrowable getThrowable()
     {
-        return new SafeThrowable( message );
+        return new SafeThrowable( new Throwable( message ) );
     }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/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 e37e82f..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
@@ -25,6 +25,7 @@ import org.apache.maven.plugin.surefire.report.DefaultReporterFactory;
 import org.apache.maven.shared.utils.cli.StreamConsumer;
 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;
 
@@ -67,7 +68,6 @@ 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;
 
-// todo move to the same package with ForkStarter
 /**
  * Knows how to reconstruct *all* the state transmitted over stdout by the forked process.
  *
@@ -284,25 +284,16 @@ public class ForkClient
         }
         catch ( NumberFormatException e )
         {
-            // native stream sent a text e.g. GC verbose
             // SUREFIRE-859
             LostCommandsDumpSingleton.getSingleton().dumpException( e, s, defaultReporterFactory );
         }
         catch ( NoSuchElementException e )
         {
-            // native stream sent a text e.g. GC verbose
             // SUREFIRE-859
             LostCommandsDumpSingleton.getSingleton().dumpException( e, s, defaultReporterFactory );
         }
-        catch ( IndexOutOfBoundsException e )
+        catch ( ReporterException e )
         {
-            // native stream sent a text e.g. GC verbose
-            // SUREFIRE-859
-            LostCommandsDumpSingleton.getSingleton().dumpException( e, s, defaultReporterFactory );
-        }
-        catch ( RuntimeException e )
-        {
-            // e.g. ReporterException
             LostCommandsDumpSingleton.getSingleton().dumpException( e, s, defaultReporterFactory );
             throw e;
         }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/LostCommandsDumpSingleton.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/LostCommandsDumpSingleton.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/LostCommandsDumpSingleton.java
index a8f11e4..fa38c05 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/LostCommandsDumpSingleton.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/LostCommandsDumpSingleton.java
@@ -21,15 +21,8 @@ package org.apache.maven.plugin.surefire.booterclient.output;
 
 import org.apache.maven.plugin.surefire.report.DefaultReporterFactory;
 import org.apache.maven.surefire.util.internal.DumpFileUtils;
-
 import java.io.File;
 
-/**
- * Dumps lost commands and caused exceptions in {@link ForkClient}.
- *
- * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
- * @since 2.19.2
- */
 final class LostCommandsDumpSingleton
 {
     private static final LostCommandsDumpSingleton SINGLETON = new LostCommandsDumpSingleton();

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ThreadedStreamConsumer.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ThreadedStreamConsumer.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ThreadedStreamConsumer.java
index c095199..ebf3edb 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ThreadedStreamConsumer.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ThreadedStreamConsumer.java
@@ -20,15 +20,12 @@ package org.apache.maven.plugin.surefire.booterclient.output;
  */
 
 import org.apache.maven.shared.utils.cli.StreamConsumer;
+import org.apache.maven.surefire.util.internal.DaemonThreadFactory;
 
-import java.io.Closeable;
-import java.io.IOException;
 import java.util.concurrent.BlockingQueue;
+import java.io.Closeable;
 import java.util.concurrent.LinkedBlockingQueue;
 
-import static java.util.concurrent.TimeUnit.SECONDS;
-import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDaemonThread;
-
 /**
  * Knows how to reconstruct *all* the state transmitted over stdout by the forked process.
  *
@@ -39,21 +36,27 @@ public final class ThreadedStreamConsumer
 {
     private static final String POISON = "Pioson";
 
+    private static final int ITEM_LIMIT_BEFORE_SLEEP = 10000;
+
     private final BlockingQueue<String> items = new LinkedBlockingQueue<String>();
 
     private final Thread thread;
 
     private final Pumper pumper;
 
-    final class Pumper
+    static class Pumper
         implements Runnable
     {
+        private final BlockingQueue<String> queue;
+
         private final StreamConsumer target;
 
         private volatile Throwable throwable;
 
-        Pumper( StreamConsumer target )
+
+        Pumper( BlockingQueue<String> queue, StreamConsumer target )
         {
+            this.queue = queue;
             this.target = target;
         }
 
@@ -74,7 +77,7 @@ public final class ThreadedStreamConsumer
             {
                 try
                 {
-                    item = items.take();
+                    item = queue.take();
                     target.consumeLine( item );
                 }
                 catch ( InterruptedException e )
@@ -96,8 +99,8 @@ public final class ThreadedStreamConsumer
 
     public ThreadedStreamConsumer( StreamConsumer target )
     {
-        pumper = new Pumper( target );
-        thread = newDaemonThread( pumper, ThreadedStreamConsumer.class.getSimpleName() );
+        pumper = new Pumper( items, target );
+        thread = DaemonThreadFactory.newDaemonThread( pumper, "ThreadedStreamConsumer" );
         thread.start();
     }
 
@@ -105,29 +108,35 @@ public final class ThreadedStreamConsumer
     public void consumeLine( String s )
     {
         items.add( s );
+        if ( items.size() > ITEM_LIMIT_BEFORE_SLEEP )
+        {
+            try
+            {
+                Thread.sleep( 100 );
+            }
+            catch ( InterruptedException ignore )
+            {
+            }
+        }
     }
 
-    public void close() throws IOException
+
+    public void close()
     {
         try
         {
             items.add( POISON );
-            if ( thread.isAlive() )
-            {
-                thread.join( SECONDS.toMillis( 10L ) );
-                thread.interrupt();
-            }
+            thread.join();
         }
         catch ( InterruptedException e )
         {
-            throw new IOException( e );
+            throw new RuntimeException( e );
         }
 
         //noinspection ThrowableResultOfMethodCallIgnored
-        Throwable e = pumper.getThrowable();
-        if ( e != null )
+        if ( pumper.getThrowable() != null )
         {
-            throw new IOException( e );
+            throw new RuntimeException( pumper.getThrowable() );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/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 1c2c68c..b4a6f30 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
@@ -37,7 +37,6 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.TreeMap;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
@@ -219,11 +218,11 @@ public class DefaultReporterFactory
      * if it only has errors or failures, then count its result based on its first run
      *
      * @param reportEntries the list of test run report type for a given test
-     * @param hasRerunFailingTestsCount <tt>true</tt> if rerun count for failing tests is greater than zero
+     * @param rerunFailingTestsCount configured rerun count for failing tests
      * @return the type of test result
      */
     // Use default visibility for testing
-    static TestResultType getTestResultType( List<ReportEntryType> reportEntries, boolean hasRerunFailingTestsCount  )
+    static TestResultType getTestResultType( List<ReportEntryType> reportEntries, int rerunFailingTestsCount  )
     {
         if ( reportEntries == null || reportEntries.isEmpty() )
         {
@@ -249,7 +248,7 @@ public class DefaultReporterFactory
 
         if ( seenFailure || seenError )
         {
-            if ( seenSuccess & hasRerunFailingTestsCount )
+            if ( seenSuccess && rerunFailingTestsCount > 0 )
             {
                 return flake;
             }
@@ -311,7 +310,7 @@ public class DefaultReporterFactory
         // Update globalStatistics by iterating through mergedTestHistoryResult
         int completedCount = 0, skipped = 0;
 
-        for ( Entry<String, List<TestMethodStats>> entry : mergedTestHistoryResult.entrySet() )
+        for ( Map.Entry<String, List<TestMethodStats>> entry : mergedTestHistoryResult.entrySet() )
         {
             List<TestMethodStats> testMethodStats = entry.getValue();
             String testClassMethodName = entry.getKey();
@@ -323,7 +322,7 @@ public class DefaultReporterFactory
                 resultTypes.add( methodStats.getResultType() );
             }
 
-            switch ( getTestResultType( resultTypes, reportConfiguration.hasRerunFailingTestsCount() ) )
+            switch ( getTestResultType( resultTypes, reportConfiguration.getRerunFailingTestsCount() ) )
             {
                 case success:
                     // If there are multiple successful runs of the same test, count all of them
@@ -394,7 +393,7 @@ public class DefaultReporterFactory
             printed = true;
         }
 
-        for ( Entry<String, List<TestMethodStats>> entry : testStats.entrySet() )
+        for ( Map.Entry<String, List<TestMethodStats>> entry : testStats.entrySet() )
         {
             printed = true;
             List<TestMethodStats> testMethodStats = entry.getValue();

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java
index e72adc7..5895c8a 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java
@@ -33,7 +33,7 @@ class NullStatelessXmlReporter
 
     private NullStatelessXmlReporter()
     {
-        super( null, null, false, false, null, null );
+        super( null, null, false, 0, null, null );
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
index 271d3f0..8ebeb96 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
@@ -92,7 +92,7 @@ public class StatelessXmlReporter
 
     private final boolean trimStackTrace;
 
-    private final boolean hasRerunFailingTestsCount;
+    private final int rerunFailingTestsCount;
 
     private final String xsdSchemaLocation;
 
@@ -101,14 +101,14 @@ public class StatelessXmlReporter
     private final Map<String, Map<String, List<WrappedReportEntry>>> testClassMethodRunHistoryMap;
 
     public StatelessXmlReporter( File reportsDirectory, String reportNameSuffix, boolean trimStackTrace,
-                                 boolean hasRerunFailingTestsCount,
+                                 int rerunFailingTestsCount,
                                  Map<String, Map<String, List<WrappedReportEntry>>> testClassMethodRunHistoryMap,
                                  String xsdSchemaLocation )
     {
         this.reportsDirectory = reportsDirectory;
         this.reportNameSuffix = reportNameSuffix;
         this.trimStackTrace = trimStackTrace;
-        this.hasRerunFailingTestsCount = hasRerunFailingTestsCount;
+        this.rerunFailingTestsCount = rerunFailingTestsCount;
         this.testClassMethodRunHistoryMap = testClassMethodRunHistoryMap;
         this.xsdSchemaLocation = xsdSchemaLocation;
     }
@@ -147,7 +147,7 @@ public class StatelessXmlReporter
 
                 if ( !methodEntryList.isEmpty() )
                 {
-                    if ( hasRerunFailingTestsCount )
+                    if ( rerunFailingTestsCount > 0 )
                     {
                         TestResultType resultType = getTestResultType( methodEntryList );
                         switch ( resultType )
@@ -268,7 +268,7 @@ public class StatelessXmlReporter
             testResultTypeList.add( singleRunEntry.getReportEntryType() );
         }
 
-        return DefaultReporterFactory.getTestResultType( testResultTypeList, hasRerunFailingTestsCount );
+        return DefaultReporterFactory.getTestResultType( testResultTypeList, rerunFailingTestsCount );
     }
 
     private Map<String, List<WrappedReportEntry>> getAddMethodRunHistoryMap( String testClassName )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
index c5a17d3..f0f996d 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
@@ -269,7 +269,7 @@ public class TestSetRunListener
         }
     }
 
-    List<TestMethodStats> getTestMethodStats()
+    public List<TestMethodStats> getTestMethodStats()
     {
         return testMethodStats;
     }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/runorder/StatisticsReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/runorder/StatisticsReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/runorder/StatisticsReporter.java
index 3f78939..5776cc9 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/runorder/StatisticsReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/runorder/StatisticsReporter.java
@@ -42,11 +42,11 @@ public class StatisticsReporter
         this( dataFile, fromFile( dataFile ), new RunEntryStatisticsMap() );
     }
 
-    protected StatisticsReporter( File dataFile, RunEntryStatisticsMap existing, RunEntryStatisticsMap newResults )
+    protected StatisticsReporter( File dataFile, RunEntryStatisticsMap existing, RunEntryStatisticsMap newRestuls )
     {
         this.dataFile = dataFile;
         this.existing = existing;
-        this.newResults = newResults;
+        this.newResults = newRestuls;
     }
 
     public synchronized void testSetCompleted()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
index c4c2556..fbe875d 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
@@ -185,41 +185,41 @@ public class DefaultReporterFactoryTest
     public void testGetTestResultType()
     {
         List<ReportEntryType> emptyList = new ArrayList<ReportEntryType>();
-        assertEquals( unknown, getTestResultType( emptyList, true ) );
+        assertEquals( unknown, getTestResultType( emptyList, 1 ) );
 
         List<ReportEntryType> successList = new ArrayList<ReportEntryType>();
         successList.add( ReportEntryType.SUCCESS );
         successList.add( ReportEntryType.SUCCESS );
-        assertEquals( success, getTestResultType( successList, true ) );
+        assertEquals( success, getTestResultType( successList, 1 ) );
 
         List<ReportEntryType> failureErrorList = new ArrayList<ReportEntryType>();
         failureErrorList.add( ReportEntryType.FAILURE );
         failureErrorList.add( ReportEntryType.ERROR );
-        assertEquals( error, getTestResultType( failureErrorList, true ) );
+        assertEquals( error, getTestResultType( failureErrorList, 1 ) );
 
         List<ReportEntryType> errorFailureList = new ArrayList<ReportEntryType>();
         errorFailureList.add( ReportEntryType.ERROR );
         errorFailureList.add( ReportEntryType.FAILURE );
-        assertEquals( error, getTestResultType( errorFailureList, true ) );
+        assertEquals( error, getTestResultType( errorFailureList, 1 ) );
 
         List<ReportEntryType> flakeList = new ArrayList<ReportEntryType>();
         flakeList.add( ReportEntryType.SUCCESS );
         flakeList.add( ReportEntryType.FAILURE );
-        assertEquals( flake, getTestResultType( flakeList, true ) );
+        assertEquals( flake, getTestResultType( flakeList, 1 ) );
 
-        assertEquals( failure, getTestResultType( flakeList, false ) );
+        assertEquals( failure, getTestResultType( flakeList, 0 ) );
 
         flakeList = new ArrayList<ReportEntryType>();
         flakeList.add( ReportEntryType.ERROR );
         flakeList.add( ReportEntryType.SUCCESS );
         flakeList.add( ReportEntryType.FAILURE );
-        assertEquals( flake, getTestResultType( flakeList, true ) );
+        assertEquals( flake, getTestResultType( flakeList, 1 ) );
 
-        assertEquals( error, getTestResultType( flakeList, false ) );
+        assertEquals( error, getTestResultType( flakeList, 0 ) );
 
         List<ReportEntryType> skippedList = new ArrayList<ReportEntryType>();
         skippedList.add( ReportEntryType.SKIPPED );
-        assertEquals( skipped, getTestResultType( skippedList, true ) );
+        assertEquals( skipped, getTestResultType( skippedList, 1 ) );
     }
 
     static class DummyStackTraceWriter

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
index 553ee40..5b649e3 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
@@ -83,7 +83,7 @@ public class StatelessXmlReporterTest
     public void testFileNameWithoutSuffix()
     {
         StatelessXmlReporter reporter =
-            new StatelessXmlReporter( reportDir, null, false, false,
+            new StatelessXmlReporter( reportDir, null, false, 0,
                                       new ConcurrentHashMap<String, Map<String, List<WrappedReportEntry>>>(), XSD );
         reporter.cleanTestHistoryMap();
 
@@ -136,7 +136,7 @@ public class StatelessXmlReporterTest
                                     ReportEntryType.ERROR, 13, stdOut, stdErr );
 
         stats.testSucceeded( t2 );
-        StatelessXmlReporter reporter = new StatelessXmlReporter( reportDir, null, false, false,
+        StatelessXmlReporter reporter = new StatelessXmlReporter( reportDir, null, false, 0,
                         new ConcurrentHashMap<String, Map<String, List<WrappedReportEntry>>>(), XSD );
         reporter.testSetCompleted( testSetReportEntry, stats );
 
@@ -216,7 +216,7 @@ public class StatelessXmlReporterTest
         rerunStats.testSucceeded( testThreeSecondRun );
 
         StatelessXmlReporter reporter =
-            new StatelessXmlReporter( reportDir, null, false, true,
+            new StatelessXmlReporter( reportDir, null, false, 1,
                                       new HashMap<String, Map<String, List<WrappedReportEntry>>>(), XSD );
 
         reporter.testSetCompleted( testSetReportEntry, stats );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Utils.java
----------------------------------------------------------------------
diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Utils.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Utils.java
index d2cb04e..8fd91bf 100644
--- a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Utils.java
+++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Utils.java
@@ -23,7 +23,6 @@ public final class Utils
 {
     private Utils()
     {
-        throw new IllegalStateException( "no instantiable constructor" );
     }
 
     public static String toSystemNewLine( String s )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessCommand.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessCommand.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessCommand.java
index 0bd7b89..a75aa83 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessCommand.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessCommand.java
@@ -19,6 +19,8 @@ package org.apache.maven.surefire.booter;
  * under the License.
  */
 
+import org.apache.maven.surefire.util.internal.StringUtils;
+
 import java.io.DataInputStream;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
@@ -46,7 +48,7 @@ public enum MasterProcessCommand
     /** To tell a forked process that the master process is still alive. Repeated after 10 seconds. */
     NOOP( 4, Void.class );
 
-    private static final Charset ASCII = Charset.forName( "US-ASCII" );
+    private static final Charset ASCII = Charset.forName( "ASCII" );
 
     private final int id;
 
@@ -150,7 +152,7 @@ public enum MasterProcessCommand
                 case RUN_CLASS:
                     return new String( data, FORK_STREAM_CHARSET_NAME );
                 case SHUTDOWN:
-                    return new String( data, ASCII );
+                    return StringUtils.decode( data, ASCII );
                 default:
                     return null;
             }
@@ -168,7 +170,7 @@ public enum MasterProcessCommand
             case RUN_CLASS:
                 return encodeStringForForkCommunication( data );
             case SHUTDOWN:
-                return data.getBytes( ASCII );
+                return StringUtils.encode( data, ASCII );
             default:
                 return new byte[0];
         }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java
index 0cccd6e..77cfaf3 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java
@@ -67,7 +67,17 @@ public class CategorizedReportEntry
     @Override
     public String getNameWithGroup()
     {
-        return isNameWithGroup() ? getName() + GROUP_PREFIX + getGroup() + GROUP_SUFIX : getName();
+        StringBuilder result = new StringBuilder();
+        result.append( getName() );
+
+        if ( getGroup() != null && !getName().equals( getGroup() ) )
+        {
+            result.append( GROUP_PREFIX );
+            result.append( getGroup() );
+            result.append( GROUP_SUFIX );
+        }
+
+        return result.toString();
     }
 
     public boolean equals( Object o )
@@ -97,9 +107,4 @@ public class CategorizedReportEntry
         result = 31 * result + ( group != null ? group.hashCode() : 0 );
         return result;
     }
-
-    private boolean isNameWithGroup()
-    {
-        return getGroup() != null && !getGroup().equals( getName() );
-    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/surefire-api/src/main/java/org/apache/maven/surefire/report/SafeThrowable.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/SafeThrowable.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/SafeThrowable.java
index b3b86f2..60c7897 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/report/SafeThrowable.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/SafeThrowable.java
@@ -31,11 +31,6 @@ public class SafeThrowable
         this.target = target;
     }
 
-    public SafeThrowable( String message )
-    {
-        this( new Throwable( message ) );
-    }
-
     public String getLocalizedMessage()
     {
         try

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e36fe19e/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 352b5fd..830cace 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
@@ -57,7 +57,7 @@ import java.util.StringTokenizer;
  */
 public final class StringUtils
 {
-    public static final String NL = System.getProperty( "line.separator", "\n" );
+    public static final String NL = System.getProperty( "line.separator" );
 
     private static final byte[] HEX_CHARS = {
                     '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
@@ -345,6 +345,32 @@ public final class StringUtils
         return ByteBuffer.wrap( out, 0, outPos );
     }
 
+    public static String decode( byte[] toDecode, Charset charset )
+    {
+        try
+        {
+            // @todo use new JDK 1.6 constructor String(byte bytes[], Charset charset)
+            return new String( toDecode, charset.name() );
+        }
+        catch ( UnsupportedEncodingException e )
+        {
+            throw new RuntimeException( "The JVM must support Charset " + charset, e );
+        }
+    }
+
+    public static byte[] encode( String toEncode, Charset charset )
+    {
+        try
+        {
+            // @todo use new JDK 1.6 method getBytes(Charset charset)
+            return toEncode.getBytes( charset.name() );
+        }
+        catch ( UnsupportedEncodingException e )
+        {
+            throw new RuntimeException( "The JVM must support Charset " + charset, e );
+        }
+    }
+
     public static byte[] encodeStringForForkCommunication( String string )
     {
         try