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/19 20:58:01 UTC

[3/3] maven-surefire git commit: [SUREFIRE-1244] NumberFormatException in parallel test run with runOrder = failedFirst

[SUREFIRE-1244] NumberFormatException in parallel test run with runOrder = failedFirst


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

Branch: refs/heads/master
Commit: 175d1d44b629d362e40b650fe8c0a30cb3623774
Parents: 7f14afc
Author: Tibor17 <ti...@lycos.com>
Authored: Mon Sep 19 22:57:35 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Mon Sep 19 22:57:35 2016 +0200

----------------------------------------------------------------------
 .../plugin/surefire/StartupReportConfiguration.java   | 14 ++++++++++----
 .../surefire/report/DefaultReporterFactory.java       |  2 +-
 .../plugin/surefire/runorder/StatisticsReporter.java  |  4 ++--
 3 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/175d1d44/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 30156f9..8b1b710 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
@@ -45,7 +45,7 @@ import static org.apache.maven.plugin.surefire.report.ConsoleReporter.PLAIN;
  *
  * @author Kristian Rosenvold
  */
-public class StartupReportConfiguration
+public final class StartupReportConfiguration
 {
     public static final String BRIEF_REPORT_FORMAT = BRIEF;
 
@@ -77,13 +77,15 @@ public class StartupReportConfiguration
 
     private final int rerunFailingTestsCount;
 
-    private String xsdSchemaLocation;
+    private final String xsdSchemaLocation;
 
     private final Properties testVmSystemProperties = new Properties();
 
     private final Map<String, Map<String, List<WrappedReportEntry>>> testClassMethodRunHistory
         = new ConcurrentHashMap<String, Map<String, List<WrappedReportEntry>>>();
 
+    private StatisticsReporter statisticsReporter;
+
     @SuppressWarnings( "checkstyle:parameternumber" )
     public StartupReportConfiguration( boolean useFile, boolean printSummary, String reportFormat,
                                        boolean redirectTestOutputToFile, boolean disableXmlReport,
@@ -195,9 +197,13 @@ public class StartupReportConfiguration
             : new DirectConsoleOutput( originalSystemOut, originalSystemErr );
     }
 
-    public StatisticsReporter instantiateStatisticsReporter()
+    public synchronized StatisticsReporter getStatisticsReporter()
     {
-        return requiresRunHistory ? new StatisticsReporter( getStatisticsFile() ) : null;
+        if ( statisticsReporter == null )
+        {
+            statisticsReporter = requiresRunHistory ? new StatisticsReporter( getStatisticsFile() ) : null;
+        }
+        return statisticsReporter;
     }
 
     public File getStatisticsFile()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/175d1d44/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 b182f71..a2bc7ec 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
@@ -82,7 +82,7 @@ public class DefaultReporterFactory
     {
         this.reportConfiguration = reportConfiguration;
         this.consoleLogger = consoleLogger;
-        statisticsReporter = reportConfiguration.instantiateStatisticsReporter();
+        statisticsReporter = reportConfiguration.getStatisticsReporter();
         listeners = new ConcurrentLinkedQueue<TestSetRunListener>();
     }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/175d1d44/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 ca33d67..9dd3380 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
@@ -28,7 +28,7 @@ import static org.apache.maven.plugin.surefire.runorder.RunEntryStatisticsMap.fr
 /**
  * @author Kristian Rosenvold
  */
-public class StatisticsReporter
+public final class StatisticsReporter
 {
     private final RunEntryStatisticsMap existing;
 
@@ -43,7 +43,7 @@ public class StatisticsReporter
         newResults = new RunEntryStatisticsMap();
     }
 
-    public void testSetCompleted()
+    public synchronized void testSetCompleted()
     {
         try
         {