maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tibordig...@apache.org
Subject [04/25] maven-surefire git commit: [SUREFIRE-1284] Statistics file should not be determined as (directory of surefire-reports).getParentFile().getParentFile(). It is a problem if report directory is customized. Statistics file should be located in projec
Date Thu, 13 Oct 2016 19:31:05 GMT
[SUREFIRE-1284] Statistics file should not be determined as (directory of surefire-reports).getParentFile().getParentFile().
It is a problem if report directory is customized. Statistics file should be located in project
dir.


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

Branch: refs/heads/junit5
Commit: 53c79809e20b30a6ff08dea2075602b7e790c2e2
Parents: ada12d4
Author: Tibor17 <tibor17@lycos.com>
Authored: Sat Sep 24 14:04:44 2016 +0200
Committer: Tibor17 <tibor17@lycos.com>
Committed: Sat Sep 24 14:04:44 2016 +0200

----------------------------------------------------------------------
 .../plugin/surefire/AbstractSurefireMojo.java    | 12 +++++-------
 .../maven/plugin/surefire/CommonReflector.java   |  4 ++--
 .../surefire/StartupReportConfiguration.java     | 19 ++++++++-----------
 .../plugin/surefire/SurefireProperties.java      |  2 +-
 .../report/DefaultReporterFactoryTest.java       |  6 +++---
 .../maven/surefire/booter/SurefireReflector.java |  6 ++----
 .../surefire/testset/RunOrderParameters.java     |  4 ++--
 .../surefire/booter/BooterDeserializer.java      |  3 ++-
 8 files changed, 25 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/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 bd9e0bd..1dd80b2 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
@@ -1029,7 +1029,7 @@ public abstract class AbstractSurefireMojo
         ClassLoaderConfiguration classLoaderConfiguration = getClassLoaderConfiguration();
         provider.addProviderProperties();
         RunOrderParameters runOrderParameters =
-            new RunOrderParameters( getRunOrder(), getStatisticsFileName( getConfigChecksum()
) );
+            new RunOrderParameters( getRunOrder(), getStatisticsFile( getConfigChecksum()
) );
 
         if ( isNotForking() )
         {
@@ -1562,10 +1562,9 @@ public abstract class AbstractSurefireMojo
         return h;
     }
 
-    public String getStatisticsFileName( String configurationHash )
+    public File getStatisticsFile( String configurationHash )
     {
-        return getReportsDirectory().getParentFile().getParentFile() + File.separator + ".surefire-"
-            + configurationHash;
+        return new File( getBasedir(), ".surefire-" + configurationHash );
     }
 
     StartupConfiguration createStartupConfiguration( ProviderInfo provider,
@@ -1631,8 +1630,8 @@ public abstract class AbstractSurefireMojo
         return new StartupReportConfiguration( isUseFile(), isPrintSummary(), getReportFormat(),
                                                isRedirectTestOutputToFile(), isDisableXmlReport(),
                                                getReportsDirectory(), isTrimStackTrace(),
getReportNameSuffix(),
-                                               configChecksum, requiresRunHistory(), getRerunFailingTestsCount(),
-                                               getReportSchemaLocation() );
+                                               getStatisticsFile( configChecksum ), requiresRunHistory(),
+                                               getRerunFailingTestsCount(), getReportSchemaLocation()
);
     }
 
     private boolean isSpecificTestSpecified()
@@ -2091,7 +2090,6 @@ public abstract class AbstractSurefireMojo
         checksum.add( getRerunFailingTestsCount() );
         addPluginSpecificChecksumItems( checksum );
         return checksum.getSha1();
-
     }
 
     protected void addPluginSpecificChecksumItems( ChecksumCalculator checksum )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
index 4ae589f..1918930 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
@@ -71,14 +71,14 @@ public class CommonReflector
     {
         Constructor<?> constructor = getConstructor( startupReportConfiguration, boolean.class,
boolean.class,
                                                            String.class, boolean.class, boolean.class,
File.class,
-                                                           boolean.class, String.class, String.class,
boolean.class,
+                                                           boolean.class, String.class, File.class,
boolean.class,
                                                            int.class, String.class );
         //noinspection BooleanConstructorCall
         Object[] params = { reporterConfiguration.isUseFile(), reporterConfiguration.isPrintSummary(),
             reporterConfiguration.getReportFormat(), reporterConfiguration.isRedirectTestOutputToFile(),
             reporterConfiguration.isDisableXmlReport(), reporterConfiguration.getReportsDirectory(),
             reporterConfiguration.isTrimStackTrace(), reporterConfiguration.getReportNameSuffix(),
-            reporterConfiguration.getConfigurationHash(), reporterConfiguration.isRequiresRunHistory(),
+            reporterConfiguration.getStatisticsFile(), reporterConfiguration.isRequiresRunHistory(),
             reporterConfiguration.getRerunFailingTestsCount(), reporterConfiguration.getXsdSchemaLocation()
};
         return newInstance( constructor, params );
     }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/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 8b1b710..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
@@ -63,7 +63,7 @@ public final class StartupReportConfiguration
 
     private final String reportNameSuffix;
 
-    private final String configurationHash;
+    private final File statisticsFile;
 
     private final boolean requiresRunHistory;
 
@@ -90,7 +90,7 @@ public final class StartupReportConfiguration
     public StartupReportConfiguration( boolean useFile, boolean printSummary, String reportFormat,
                                        boolean redirectTestOutputToFile, boolean disableXmlReport,
                                        @Nonnull File reportsDirectory, boolean trimStackTrace,
String reportNameSuffix,
-                                       String configurationHash, boolean requiresRunHistory,
+                                       File statisticsFile, boolean requiresRunHistory,
                                        int rerunFailingTestsCount, String xsdSchemaLocation
)
     {
         this.useFile = useFile;
@@ -101,7 +101,7 @@ public final class StartupReportConfiguration
         this.reportsDirectory = reportsDirectory;
         this.trimStackTrace = trimStackTrace;
         this.reportNameSuffix = reportNameSuffix;
-        this.configurationHash = configurationHash;
+        this.statisticsFile = statisticsFile;
         this.requiresRunHistory = requiresRunHistory;
         this.originalSystemOut = System.out;
         this.originalSystemErr = System.err;
@@ -115,7 +115,8 @@ public final class StartupReportConfiguration
     public static StartupReportConfiguration defaultValue()
     {
         File target = new File( "./target" );
-        return new StartupReportConfiguration( true, true, "PLAIN", false, false, target,
false, null, "TESTHASH",
+        File statisticsFile = new File( target, "TESTHASH" );
+        return new StartupReportConfiguration( true, true, "PLAIN", false, false, target,
false, null, statisticsFile,
                                                false, 0, null );
     }
 
@@ -125,7 +126,8 @@ public final class StartupReportConfiguration
     public static StartupReportConfiguration defaultNoXml()
     {
         File target = new File( "./target" );
-        return new StartupReportConfiguration( true, true, "PLAIN", false, true, target,
false, null, "TESTHASHxXML",
+        File statisticsFile = new File( target, "TESTHASHxXML" );
+        return new StartupReportConfiguration( true, true, "PLAIN", false, true, target,
false, null, statisticsFile,
                                                false, 0, null );
     }
 
@@ -208,7 +210,7 @@ public final class StartupReportConfiguration
 
     public File getStatisticsFile()
     {
-        return new File( reportsDirectory.getParentFile().getParentFile(), ".surefire-" +
this.configurationHash );
+        return statisticsFile;
     }
 
     public Properties getTestVmSystemProperties()
@@ -221,11 +223,6 @@ public final class StartupReportConfiguration
         return trimStackTrace;
     }
 
-    public String getConfigurationHash()
-    {
-        return configurationHash;
-    }
-
     public boolean isRequiresRunHistory()
     {
         return requiresRunHistory;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
index b1537d6..3663f39 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
@@ -47,7 +47,7 @@ public class SurefireProperties
     implements KeyValueSource
 {
     private static final Collection<String> KEYS_THAT_CANNOT_BE_USED_AS_SYSTEM_PROPERTIES
=
-            asList( "java.library.path", "file.encoding", "jdk.map.althashing.threshold"
);
+            asList( "java.library.path", "file.encoding", "jdk.map.althashing.threshold",
"line.separator" );
 
     private final LinkedHashSet<Object> items = new LinkedHashSet<Object>();
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/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 0a0a9c8..e51c993 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
@@ -27,7 +27,6 @@ import junit.framework.TestCase;
 
 import org.apache.maven.plugin.surefire.StartupReportConfiguration;
 import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
-import org.apache.maven.plugin.surefire.log.api.NullConsoleLogger;
 import org.apache.maven.surefire.report.RunStatistics;
 import org.apache.maven.surefire.report.SafeThrowable;
 import org.apache.maven.surefire.report.StackTraceWriter;
@@ -62,9 +61,10 @@ public class DefaultReporterFactoryTest
 
     public void testMergeTestHistoryResult()
     {
+        File reportsDirectory = new File("target");
         StartupReportConfiguration reportConfig =
-                new StartupReportConfiguration( true, true, "PLAIN", false, false, new File("target"),
false, null,
-                                                      "TESTHASH", false, 1, null );
+                new StartupReportConfiguration( true, true, "PLAIN", false, false, reportsDirectory,
false, null,
+                                                      new File( reportsDirectory, "TESTHASH"
), false, 1, null );
 
         DummyTestReporter reporter = new DummyTestReporter();
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
index 958a23a..528589c 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
@@ -235,11 +235,10 @@ public class SurefireReflector
             return null;
         }
         //Can't use the constructor with the RunOrder parameter. Using it causes some integration
tests to fail.
-        Class<?>[] arguments = { String.class, String.class };
+        Class<?>[] arguments = { String.class, File.class };
         Constructor constructor = getConstructor( this.runOrderParameters, arguments );
         File runStatisticsFile = runOrderParameters.getRunStatisticsFile();
-        return newInstance( constructor, RunOrder.asString( runOrderParameters.getRunOrder()
),
-                            runStatisticsFile == null ? null : runStatisticsFile.getAbsolutePath()
);
+        return newInstance( constructor, RunOrder.asString( runOrderParameters.getRunOrder()
), runStatisticsFile );
     }
 
     Object createTestArtifactInfo( TestArtifactInfo testArtifactInfo )
@@ -253,7 +252,6 @@ public class SurefireReflector
         return newInstance( constructor, testArtifactInfo.getVersion(), testArtifactInfo.getClassifier()
);
     }
 
-
     Object createReporterConfiguration( ReporterConfiguration reporterConfig )
     {
         Constructor constructor = getConstructor( reporterConfiguration, File.class, boolean.class
);

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java
b/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java
index 9c096f1..6a2cceb 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java
@@ -37,10 +37,10 @@ public class RunOrderParameters
         this.runStatisticsFile = runStatisticsFile;
     }
 
-    public RunOrderParameters( String runOrder, String runStatisticsFile )
+    public RunOrderParameters( String runOrder, File runStatisticsFile )
     {
         this.runOrder = runOrder == null ? RunOrder.DEFAULT : RunOrder.valueOfMulti( runOrder
);
-        this.runStatisticsFile = runStatisticsFile != null ? new File( runStatisticsFile
) : null;
+        this.runStatisticsFile = runStatisticsFile;
     }
 
     public static RunOrderParameters alphabetical()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/53c79809/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
index 208a4be..bb64115 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
@@ -86,7 +86,8 @@ public class BooterDeserializer
             new DirectoryScannerParameters( testClassesDirectory, includes, excludes, specificTests,
                                             properties.getBooleanProperty( FAILIFNOTESTS
), runOrder );
 
-        RunOrderParameters runOrderParameters = new RunOrderParameters( runOrder, runStatisticsFile
);
+        RunOrderParameters runOrderParameters
+                = new RunOrderParameters( runOrder, runStatisticsFile == null ? null : new
File( runStatisticsFile ) );
 
         TestArtifactInfo testNg = new TestArtifactInfo( testNgVersion, testArtifactClassifier
);
         TestRequest testSuiteDefinition =


Mime
View raw message