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 2021/05/12 16:41:16 UTC
[maven-surefire] branch SUREFIRE-1910 updated: removed unnecessary
field failIfNoTests in fork VM
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch SUREFIRE-1910
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
The following commit(s) were added to refs/heads/SUREFIRE-1910 by this push:
new 8220390 removed unnecessary field failIfNoTests in fork VM
8220390 is described below
commit 82203901218c51e2e5f16b0607f45034eca7351c
Author: tibordigana <ti...@gmail.com>
AuthorDate: Wed May 12 18:41:09 2021 +0200
removed unnecessary field failIfNoTests in fork VM
---
.../maven/plugin/surefire/AbstractSurefireMojo.java | 14 ++------------
.../surefire/booterclient/BooterSerializer.java | 3 ---
.../BooterDeserializerProviderConfigurationTest.java | 5 ++---
.../BooterDeserializerStartupConfigurationTest.java | 4 ++--
.../api/testset/DirectoryScannerParameters.java | 19 +++----------------
.../maven/surefire/booter/BooterDeserializer.java | 6 ++----
.../maven/surefire/booter/ProviderConfiguration.java | 10 +---------
.../maven/surefire/booter/SurefireReflector.java | 3 +--
.../maven/surefire/booter/SurefireReflectorTest.java | 4 ++--
9 files changed, 15 insertions(+), 53 deletions(-)
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 365f86f..51fcb73 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
@@ -1887,16 +1887,6 @@ public abstract class AbstractSurefireMojo
}
else
{
- if ( isSpecificTestSpecified() )
- {
- actualFailIfNoTests = getEffectiveFailIfNoTests() != NO_FAILURE;
- setFailIfNoTests( actualFailIfNoTests );
- }
- else
- {
- actualFailIfNoTests = getFailIfNoTests();
- }
-
// @todo remove these three params and use DirectoryScannerParameters to pass into DirectoryScanner only
// @todo or remove it in next major version :: 3.0
// @todo remove deprecated methods in ProviderParameters => included|excluded|specificTests not needed here
@@ -1908,12 +1898,12 @@ public abstract class AbstractSurefireMojo
directoryScannerParameters =
new DirectoryScannerParameters( getTestClassesDirectory(), actualIncludes, actualExcludes,
- specificTests, actualFailIfNoTests, getRunOrder() );
+ specificTests, getRunOrder() );
}
Map<String, String> providerProperties = toStringProperties( getProperties() );
- return new ProviderConfiguration( directoryScannerParameters, runOrderParameters, actualFailIfNoTests,
+ return new ProviderConfiguration( directoryScannerParameters, runOrderParameters,
reporterConfiguration,
testNg, // Not really used in provider. Limited to de/serializer.
testSuiteDefinition, providerProperties, null,
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
index 1335a82..1385bd4 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
@@ -47,7 +47,6 @@ import static org.apache.maven.surefire.booter.AbstractPathConfiguration.ENABLE_
import static org.apache.maven.surefire.booter.AbstractPathConfiguration.SUREFIRE_CLASSPATH;
import static org.apache.maven.surefire.booter.BooterConstants.EXCLUDES_PROPERTY_PREFIX;
import static org.apache.maven.surefire.booter.BooterConstants.FAIL_FAST_COUNT;
-import static org.apache.maven.surefire.booter.BooterConstants.FAILIFNOTESTS;
import static org.apache.maven.surefire.booter.BooterConstants.FORKTESTSET;
import static org.apache.maven.surefire.booter.BooterConstants.FORKTESTSET_PREFER_TESTS_FROM_IN_STREAM;
import static org.apache.maven.surefire.booter.BooterConstants.FORK_NUMBER;
@@ -151,7 +150,6 @@ class BooterSerializer
DirectoryScannerParameters directoryScannerParameters = providerConfiguration.getDirScannerParams();
if ( directoryScannerParameters != null )
{
- properties.setProperty( FAILIFNOTESTS, toString( directoryScannerParameters.isFailIfNoTests() ) );
properties.addList( directoryScannerParameters.getIncludes(), INCLUDES_PROPERTY_PREFIX );
properties.addList( directoryScannerParameters.getExcludes(), EXCLUDES_PROPERTY_PREFIX );
properties.addList( directoryScannerParameters.getSpecificTests(), SPECIFIC_TEST_PROPERTY_PREFIX );
@@ -175,7 +173,6 @@ class BooterSerializer
ClassLoaderConfiguration classLoaderConfig = startupConfiguration.getClassLoaderConfiguration();
properties.setProperty( USESYSTEMCLASSLOADER, toString( classLoaderConfig.isUseSystemClassLoader() ) );
properties.setProperty( USEMANIFESTONLYJAR, toString( classLoaderConfig.isUseManifestOnlyJar() ) );
- properties.setProperty( FAILIFNOTESTS, toString( providerConfiguration.isFailIfNoTests() ) );
properties.setProperty( PROVIDER_CONFIGURATION, startupConfiguration.getProviderClassName() );
properties.setProperty( FAIL_FAST_COUNT, toString( providerConfiguration.getSkipAfterFailureCount() ) );
properties.setProperty( SHUTDOWN, providerConfiguration.getShutdown().name() );
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java
index 7a08390..55f63f3 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java
@@ -200,7 +200,6 @@ public class BooterDeserializerProviderConfigurationTest
throws IOException
{
ProviderConfiguration reloaded = getReloadedProviderConfiguration();
- assertTrue( reloaded.isFailIfNoTests() );
assertEquals( cli, reloaded.getMainCliOptions() );
}
@@ -238,7 +237,7 @@ public class BooterDeserializerProviderConfigurationTest
excludes.add( "xx1" );
excludes.add( "xx2" );
- return new DirectoryScannerParameters( aDir, includes, excludes, Collections.<String>emptyList(), true,
+ return new DirectoryScannerParameters( aDir, includes, excludes, Collections.<String>emptyList(),
RunOrder.asString( RunOrder.DEFAULT ) );
}
@@ -277,7 +276,7 @@ public class BooterDeserializerProviderConfigurationTest
new TestListResolver( USER_REQUESTED_TEST + "#aUserRequestedTestMethod" ),
RERUN_FAILING_TEST_COUNT );
RunOrderParameters runOrderParameters = new RunOrderParameters( RunOrder.DEFAULT, null );
- return new ProviderConfiguration( directoryScannerParameters, runOrderParameters, true, reporterConfiguration,
+ return new ProviderConfiguration( directoryScannerParameters, runOrderParameters, reporterConfiguration,
new TestArtifactInfo( "5.0", "ABC" ), testSuiteDefinition, new HashMap<String, String>(), TEST_TYPED,
readTestsFromInStream, cli, 0, Shutdown.DEFAULT, 0 );
}
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java
index 669e73c..9baf914 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java
@@ -191,14 +191,14 @@ public class BooterDeserializerStartupConfigurationTest
File cwd = new File( "." );
DirectoryScannerParameters directoryScannerParameters =
new DirectoryScannerParameters( cwd, new ArrayList<String>(), new ArrayList<String>(),
- new ArrayList<String>(), true, "hourly" );
+ new ArrayList<String>(), "hourly" );
ReporterConfiguration reporterConfiguration = new ReporterConfiguration( cwd, true );
TestRequest testSuiteDefinition =
new TestRequest( Arrays.asList( getSuiteXmlFileStrings() ), getTestSourceDirectory(),
new TestListResolver( "aUserRequestedTest#aUserRequestedTestMethod" ) );
RunOrderParameters runOrderParameters = new RunOrderParameters( RunOrder.DEFAULT, null );
- return new ProviderConfiguration( directoryScannerParameters, runOrderParameters, true, reporterConfiguration,
+ return new ProviderConfiguration( directoryScannerParameters, runOrderParameters, reporterConfiguration,
new TestArtifactInfo( "5.0", "ABC" ), testSuiteDefinition, new HashMap<String, String>(),
BooterDeserializerProviderConfigurationTest.TEST_TYPED, true, cli, 0, Shutdown.DEFAULT, 0 );
}
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/api/testset/DirectoryScannerParameters.java b/surefire-api/src/main/java/org/apache/maven/surefire/api/testset/DirectoryScannerParameters.java
index c407edb..4c1eae2 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/api/testset/DirectoryScannerParameters.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/api/testset/DirectoryScannerParameters.java
@@ -39,26 +39,23 @@ public class DirectoryScannerParameters
@Deprecated
private final List<String> specificTests;
- private final boolean failIfNoTests;
-
private final RunOrder[] runOrder;
private DirectoryScannerParameters( File testClassesDirectory, List<String> includes, List<String> excludes,
- List<String> specificTests, boolean failIfNoTests, RunOrder[] runOrder )
+ List<String> specificTests, RunOrder[] runOrder )
{
this.testClassesDirectory = testClassesDirectory;
this.includes = includes;
this.excludes = excludes;
this.specificTests = specificTests;
- this.failIfNoTests = failIfNoTests;
this.runOrder = runOrder;
}
public DirectoryScannerParameters( File testClassesDirectory, @Deprecated List<String> includes,
@Deprecated List<String> excludes, @Deprecated List<String> specificTests,
- boolean failIfNoTests, String runOrder )
+ String runOrder )
{
- this( testClassesDirectory, includes, excludes, specificTests, failIfNoTests,
+ this( testClassesDirectory, includes, excludes, specificTests,
runOrder == null ? RunOrder.DEFAULT : RunOrder.valueOfMulti( runOrder ) );
}
@@ -100,16 +97,6 @@ public class DirectoryScannerParameters
return excludes;
}
- /**
- * Indicates if lack of runable tests should fail the entire build
- *
- * @return true if no tests should fail the build
- */
- public boolean isFailIfNoTests()
- {
- return failIfNoTests;
- }
-
public RunOrder[] getRunOrder()
{
return runOrder;
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 ca5328e..2b365ad 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
@@ -113,8 +113,7 @@ public class BooterDeserializer
final int rerunFailingTestsCount = properties.getIntProperty( RERUN_FAILING_TESTS_COUNT );
DirectoryScannerParameters dirScannerParams =
- new DirectoryScannerParameters( testClassesDirectory, includes, excludes, specificTests,
- properties.getBooleanProperty( FAILIFNOTESTS ), runOrder );
+ new DirectoryScannerParameters( testClassesDirectory, includes, excludes, specificTests, runOrder );
RunOrderParameters runOrderParameters
= new RunOrderParameters( runOrder, runStatisticsFile == null ? null : new File( runStatisticsFile ),
@@ -138,8 +137,7 @@ public class BooterDeserializer
Integer systemExitTimeout =
systemExitTimeoutAsString == null ? null : Integer.valueOf( systemExitTimeoutAsString );
- return new ProviderConfiguration( dirScannerParams, runOrderParameters,
- properties.getBooleanProperty( FAILIFNOTESTS ), reporterConfiguration, testNg,
+ return new ProviderConfiguration( dirScannerParams, runOrderParameters, reporterConfiguration, testNg,
testSuiteDefinition, properties.getProperties(), typeEncodedTestForFork,
preferTestsFromInStream, fromStrings( cli ), failFastCount, shutdown,
systemExitTimeout );
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
index 54b6187..fd0effc 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
@@ -54,8 +54,6 @@ public class ProviderConfiguration
private final Map<String, String> providerProperties;
- private final boolean failIfNoTests;
-
private final TypeEncodedValue forkTestSet;
private final boolean readTestsFromInStream;
@@ -70,7 +68,7 @@ public class ProviderConfiguration
@SuppressWarnings( "checkstyle:parameternumber" )
public ProviderConfiguration( DirectoryScannerParameters directoryScannerParameters,
- RunOrderParameters runOrderParameters, boolean failIfNoTests,
+ RunOrderParameters runOrderParameters,
ReporterConfiguration reporterConfiguration, TestArtifactInfo testArtifact,
TestRequest testSuiteDefinition, Map<String, String> providerProperties,
TypeEncodedValue typeEncodedTestSet, boolean readTestsFromInStream,
@@ -83,7 +81,6 @@ public class ProviderConfiguration
this.testArtifact = testArtifact;
this.testSuiteDefinition = testSuiteDefinition;
this.dirScannerParams = directoryScannerParameters;
- this.failIfNoTests = failIfNoTests;
this.forkTestSet = typeEncodedTestSet;
this.readTestsFromInStream = readTestsFromInStream;
this.mainCliOptions = mainCliOptions;
@@ -97,11 +94,6 @@ public class ProviderConfiguration
return reporterConfiguration;
}
- public boolean isFailIfNoTests()
- {
- return failIfNoTests;
- }
-
public File getBaseDir()
{
return dirScannerParams.getTestClassesDirectory();
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
index d4f459a..2df77b0 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
@@ -160,14 +160,13 @@ public final class SurefireReflector
return null;
}
//Can't use the constructor with the RunOrder parameter. Using it causes some integration tests to fail.
- Class<?>[] arguments = { File.class, List.class, List.class, List.class, boolean.class, String.class };
+ Class<?>[] arguments = { File.class, List.class, List.class, List.class, String.class };
Constructor<?> constructor = getConstructor( this.directoryScannerParameters, arguments );
return newInstance( constructor,
directoryScannerParameters.getTestClassesDirectory(),
directoryScannerParameters.getIncludes(),
directoryScannerParameters.getExcludes(),
directoryScannerParameters.getSpecificTests(),
- directoryScannerParameters.isFailIfNoTests(),
RunOrder.asString( directoryScannerParameters.getRunOrder() ) );
}
diff --git a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java
index 88fd583..b4290a7 100644
--- a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java
+++ b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java
@@ -81,7 +81,7 @@ public class SurefireReflectorTest
DirectoryScannerParameters directoryScannerParameters =
new DirectoryScannerParameters( new File( "ABC" ), new ArrayList<String>(), new ArrayList<String>(),
- new ArrayList<String>(), false, "hourly" );
+ new ArrayList<String>(), "hourly" );
surefireReflector.setDirectoryScannerParameters( foo, directoryScannerParameters );
assertTrue( isCalled( foo ) );
assertNotNull( ( (Foo) foo ).getDirectoryScannerParameters() );
@@ -104,7 +104,7 @@ public class SurefireReflectorTest
DirectoryScannerParameters directoryScannerParameters =
new DirectoryScannerParameters( new File( "ABC" ), new ArrayList<String>(), new ArrayList<String>(),
- new ArrayList<String>(), false, "hourly" );
+ new ArrayList<String>(), "hourly" );
surefireReflector.setIfDirScannerAware( foo, directoryScannerParameters );
assertTrue( isCalled( foo ) );
}