[SUREFIRE-1654] Remove deprecated forkMode parameter
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 257e64b..3070901 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
@@ -168,10 +168,6 @@ public abstract class AbstractSurefireMojo
extends AbstractMojo
implements SurefireExecutionParameters
{
- private static final String FORK_ONCE = "once";
- private static final String FORK_ALWAYS = "always";
- private static final String FORK_NEVER = "never";
- private static final String FORK_PERTHREAD = "perthread";
private static final Map<String, String> JAVA_9_MATCHER_OLD_NOTATION = singletonMap( "version", "[1.9,)" );
private static final Map<String, String> JAVA_9_MATCHER = singletonMap( "version", "[9,)" );
private static final Platform PLATFORM = new Platform();
@@ -363,23 +359,6 @@ public abstract class AbstractSurefireMojo
private boolean failIfNoTests;
/**
- * <strong>DEPRECATED</strong> since version 2.14. Use {@code forkCount} and {@code reuseForks} instead.
- * <br>
- * <br>
- * Option to specify the forking mode. Can be {@code never}, {@code once}, {@code always}, {@code perthread}.<br>
- * The {@code none} and {@code pertest} are also accepted for backwards compatibility.<br>
- * The {@code always} forks for each test-class.<br>
- * The {@code perthread} creates the number of parallel forks specified by {@code threadCount}, where each forked
- * JVM is executing one test-class. See also the parameter {@code reuseForks} for the lifetime of JVM.
- *
- * @since 2.1
- * @deprecated
- */
- @Deprecated
- @Parameter( property = "forkMode", defaultValue = "once" )
- private String forkMode;
-
- /**
* Relative path to <i>temporary-surefire-boot</i> directory containing internal Surefire temporary files.
* <br>
* The <i>temporary-surefire-boot</i> directory is <i>project.build.directory</i> on most platforms or
@@ -440,7 +419,7 @@ public abstract class AbstractSurefireMojo
/**
* When false it makes tests run using the standard classloader delegation instead of the default Maven isolated
- * classloader. Only used when forking ({@code forkMode} is not {@code none}).<br>
+ * classloader. Only used when forking ({@code forkCount} is greater than zero).<br>
* Setting it to false helps with some problems caused by conflicts between xml parsers in the classpath and the
* Java 5 provider parser.
*
@@ -1123,10 +1102,8 @@ boolean verifyParameters()
else
{
ensureEnableProcessChecker();
- convertDeprecatedForkMode();
ensureWorkingDirectoryExists();
ensureParallelRunningCompatibility();
- ensureThreadCountWithPerThread();
warnIfUselessUseSystemClassLoaderParameter();
warnIfDefunctGroupsCombinations();
warnIfRerunClashes();
@@ -1796,28 +1773,11 @@ private boolean isAnyJunit4( Artifact artifact )
return isWithinVersionSpec( artifact, "[4.0,)" );
}
- private static boolean isForkModeNever( String forkMode )
- {
- return FORK_NEVER.equals( forkMode );
- }
-
protected boolean isForking()
{
return 0 < getEffectiveForkCount();
}
- String getEffectiveForkMode()
- {
- String forkMode1 = getForkMode();
-
- if ( toolchain != null && isForkModeNever( forkMode1 ) )
- {
- return FORK_ONCE;
- }
-
- return getEffectiveForkMode( forkMode1 );
- }
-
private List<RunOrder> getRunOrders()
{
String runOrderString = getRunOrder();
@@ -2144,7 +2104,7 @@ private Artifact getShadefireArtifact()
return getPluginArtifactMap().get( "org.apache.maven.surefire:surefire-shadefire" );
}
- private StartupReportConfiguration getStartupReportConfiguration( String configChecksum, boolean isForkMode )
+ private StartupReportConfiguration getStartupReportConfiguration( String configChecksum, boolean isForking )
{
SurefireStatelessReporter xmlReporter =
statelessTestsetReporter == null
@@ -2165,7 +2125,7 @@ private StartupReportConfiguration getStartupReportConfiguration( String configC
getReportsDirectory(), isTrimStackTrace(), getReportNameSuffix(),
getStatisticsFile( configChecksum ), requiresRunHistory(),
getRerunFailingTestsCount(), getReportSchemaLocation(), getEncoding(),
- isForkMode, xmlReporter, outReporter, testsetReporter );
+ isForking, xmlReporter, outReporter, testsetReporter );
}
private boolean isSpecificTestSpecified()
@@ -2557,31 +2517,6 @@ private void ensureEnableProcessChecker() throws MojoFailureException
}
}
- private void convertDeprecatedForkMode()
- {
- String effectiveForkMode = getEffectiveForkMode();
- // FORK_ONCE (default) is represented by the default values of forkCount and reuseForks
- if ( FORK_PERTHREAD.equals( effectiveForkMode ) )
- {
- forkCount = String.valueOf( threadCount );
- }
- else if ( FORK_NEVER.equals( effectiveForkMode ) )
- {
- forkCount = "0";
- }
- else if ( FORK_ALWAYS.equals( effectiveForkMode ) )
- {
- forkCount = "1";
- reuseForks = false;
- }
-
- if ( !FORK_ONCE.equals( getForkMode() ) )
- {
- getConsoleLogger().warning( "The parameter forkMode is deprecated since version 2.14. "
- + "Use forkCount and reuseForks instead." );
- }
- }
-
@SuppressWarnings( "checkstyle:emptyblock" )
protected int getEffectiveForkCount()
{
@@ -2764,7 +2699,6 @@ private String getConfigChecksum()
checksum.add( getReportNameSuffix() );
checksum.add( isUseFile() );
checksum.add( isRedirectTestOutputToFile() );
- checksum.add( getForkMode() );
checksum.add( getForkCount() );
checksum.add( isReuseForks() );
checksum.add( getJvm() );
@@ -2973,15 +2907,6 @@ private void ensureParallelRunningCompatibility()
}
}
- private void ensureThreadCountWithPerThread()
- throws MojoFailureException
- {
- if ( FORK_PERTHREAD.equals( getEffectiveForkMode() ) && getThreadCount() < 1 )
- {
- throw new MojoFailureException( "Fork mode perthread requires a thread count" );
- }
- }
-
private void warnIfUselessUseSystemClassLoaderParameter()
{
if ( isUseSystemClassLoader() && isNotForking() )
@@ -3678,17 +3603,6 @@ public void setFailIfNoTests( boolean failIfNoTests )
this.failIfNoTests = failIfNoTests;
}
- public String getForkMode()
- {
- return forkMode;
- }
-
- @SuppressWarnings( "UnusedDeclaration" )
- public void setForkMode( String forkMode )
- {
- this.forkMode = forkMode;
- }
-
public String getJvm()
{
return jvm;
@@ -4099,27 +4013,6 @@ public void setResolutionErrorHandler( ResolutionErrorHandler resolutionErrorHan
this.resolutionErrorHandler = resolutionErrorHandler;
}
- private static String getEffectiveForkMode( String forkMode )
- {
- if ( "pertest".equalsIgnoreCase( forkMode ) )
- {
- return FORK_ALWAYS;
- }
- else if ( "none".equalsIgnoreCase( forkMode ) )
- {
- return FORK_NEVER;
- }
- else if ( forkMode.equals( FORK_NEVER ) || forkMode.equals( FORK_ONCE )
- || forkMode.equals( FORK_ALWAYS ) || forkMode.equals( FORK_PERTHREAD ) )
- {
- return forkMode;
- }
- else
- {
- throw new IllegalArgumentException( "Fork mode " + forkMode + " is not a legal value" );
- }
- }
-
private static final class ClasspathCache
{
private final Map<String, Classpath> classpaths = new HashMap<>( 4 );
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 989a524..59497ad 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
@@ -90,7 +90,7 @@ private Object createStartupReportConfiguration( @Nonnull StartupReportConfigura
reporterConfiguration.isTrimStackTrace(), reporterConfiguration.getReportNameSuffix(),
reporterConfiguration.getStatisticsFile(), reporterConfiguration.isRequiresRunHistory(),
reporterConfiguration.getRerunFailingTestsCount(), reporterConfiguration.getXsdSchemaLocation(),
- reporterConfiguration.getEncoding().name(), reporterConfiguration.isForkMode(),
+ reporterConfiguration.getEncoding().name(), reporterConfiguration.isForking(),
reporterConfiguration.getXmlReporter().clone( surefireClassLoader ),
reporterConfiguration.getConsoleOutputReporter().clone( surefireClassLoader ),
reporterConfiguration.getTestsetReporter().clone( surefireClassLoader )
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 a15f802..f6b4c27 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
@@ -84,7 +84,7 @@ public final class StartupReportConfiguration
private final Charset encoding;
- private final boolean isForkMode;
+ private final boolean isForking;
private final SurefireStatelessReporter xmlReporter;
@@ -99,7 +99,7 @@ public StartupReportConfiguration( boolean useFile, boolean printSummary, String
boolean redirectTestOutputToFile,
@Nonnull File reportsDirectory, boolean trimStackTrace, String reportNameSuffix,
File statisticsFile, boolean requiresRunHistory, int rerunFailingTestsCount,
- String xsdSchemaLocation, String encoding, boolean isForkMode,
+ String xsdSchemaLocation, String encoding, boolean isForking,
SurefireStatelessReporter xmlReporter, SurefireConsoleOutputReporter consoleOutputReporter,
SurefireStatelessTestsetInfoReporter testsetReporter )
{
@@ -118,7 +118,7 @@ public StartupReportConfiguration( boolean useFile, boolean printSummary, String
this.xsdSchemaLocation = xsdSchemaLocation;
String charset = trimToNull( encoding );
this.encoding = charset == null ? UTF_8 : Charset.forName( charset );
- this.isForkMode = isForkMode;
+ this.isForking = isForking;
this.xmlReporter = xmlReporter;
this.consoleOutputReporter = consoleOutputReporter;
this.testsetReporter = testsetReporter;
@@ -162,14 +162,14 @@ public int getRerunFailingTestsCount()
public StatelessReportEventListener<WrappedReportEntry, TestSetStats> instantiateStatelessXmlReporter(
Integer forkNumber )
{
- assert ( forkNumber == null ) == !isForkMode;
+ assert ( forkNumber == null ) == !isForking;
// If forking TestNG the suites have same name 'TestSuite' and tend to override report statistics in stateful
// reporter, see Surefire1535TestNGParallelSuitesIT. The testClassMethodRunHistory should be isolated.
// In the in-plugin execution of parallel JUnit4.7 with rerun the map must be shared because reports and
// listeners are in ThreadLocal, see Surefire1122ParallelAndFlakyTestsIT.
Map<String, Deque<WrappedReportEntry>> testClassMethodRunHistory
- = isForkMode
+ = isForking
? new ConcurrentHashMap<String, Deque<WrappedReportEntry>>()
: this.testClassMethodRunHistory;
@@ -243,9 +243,9 @@ public Charset getEncoding()
return encoding;
}
- public boolean isForkMode()
+ public boolean isForking()
{
- return isForkMode;
+ return isForking;
}
private File resolveReportsDirectory( Integer forkNumber )
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/CommonReflectorTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/CommonReflectorTest.java
index 2253dac..645a3ab 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/CommonReflectorTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/CommonReflectorTest.java
@@ -103,7 +103,7 @@ public void createReportingReporterFactory()
assertThat( reportConfiguration.getRerunFailingTestsCount() ).isEqualTo( 1 );
assertThat( reportConfiguration.getXsdSchemaLocation() ).isNull();
assertThat( reportConfiguration.getEncoding() ).isEqualTo( UTF_8 );
- assertThat( reportConfiguration.isForkMode() ).isFalse();
+ assertThat( reportConfiguration.isForking() ).isFalse();
assertThat( reportConfiguration.getXmlReporter().toString() )
.isEqualTo( xmlReporter.toString() );
assertThat( reportConfiguration.getTestsetReporter().toString() )
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java
index 4ca4b32..25e417c 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java
@@ -32,7 +32,6 @@
import org.apache.maven.surefire.api.suite.RunResult;
import org.apache.maven.surefire.api.util.DefaultScanResult;
import org.apache.maven.surefire.api.util.SureFireFileManager;
-import org.apache.maven.toolchain.Toolchain;
import org.codehaus.plexus.logging.Logger;
import org.junit.Test;
@@ -101,16 +100,6 @@ public void testGetStartupReportConfiguration2() throws Exception
}
@Test
- public void testForkMode()
- {
- AbstractSurefireMojo surefirePlugin = new Mojo( null, null );
- setInternalState( surefirePlugin, "toolchain", new MyToolChain() );
- setInternalState( surefirePlugin, "forkMode", "never" );
- assertThat( surefirePlugin.getEffectiveForkMode() )
- .isEqualTo( "once" );
- }
-
- @Test
@SuppressWarnings( "checkstyle:magicnumber" )
public void testForkCountComputation()
{
@@ -151,21 +140,6 @@ private static void assertConversionFails( AbstractSurefireMojo surefirePlugin,
fail( "Expected NumberFormatException when converting " + value );
}
- private static class MyToolChain implements Toolchain
- {
- @Override
- public String getType()
- {
- return null;
- }
-
- @Override
- public String findTool( String s )
- {
- return null;
- }
- }
-
@Test
public void scanDependenciesShouldReturnNull()
throws MojoFailureException
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 ded28a3..b2f015b 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
@@ -349,7 +349,7 @@ public void testCreateReporterWithZeroStatistics()
assertEquals( 0, reportConfig.getRerunFailingTestsCount() );
assertNull( reportConfig.getXsdSchemaLocation() );
assertEquals( UTF_8, reportConfig.getEncoding() );
- assertFalse( reportConfig.isForkMode() );
+ assertFalse( reportConfig.isForking() );
assertNotNull( reportConfig.getXmlReporter() );
assertNotNull( reportConfig.getConsoleOutputReporter() );
assertNotNull( reportConfig.getTestsetReporter() );
diff --git a/maven-surefire-plugin/src/site/apt/examples/class-loading.apt.vm b/maven-surefire-plugin/src/site/apt/examples/class-loading.apt.vm
index 269a920..4ff36f9 100644
--- a/maven-surefire-plugin/src/site/apt/examples/class-loading.apt.vm
+++ b/maven-surefire-plugin/src/site/apt/examples/class-loading.apt.vm
@@ -167,7 +167,7 @@
* Run Maven with <<<--debug>>> (or equivalently, <<<-X>>>) to get more detailed output
- * Check your <<<forkCount>>>. If <<<forkCount=0>>> (or <<<forkMode=never>>>, the deprecated version of that), it's impossible to use the system class loader or a plain old Java classpath; we have to use an isolated class loader.
+ * Check your <<<forkCount>>>. If <<<forkCount=0>>>, it's impossible to use the system class loader or a plain old Java classpath; we have to use an isolated class loader.
* If you're using the defaults, <<<useSystemClassLoader=true>>> and <<<useManifestOnlyJar=false>>>. In that case, look at the generated manifest-only Surefire booter JAR. Open it up (it's just a zip) and read its manifest.
diff --git a/maven-surefire-plugin/src/site/apt/examples/fork-options-and-parallel-execution.apt.vm b/maven-surefire-plugin/src/site/apt/examples/fork-options-and-parallel-execution.apt.vm
index fe9d2f6..1aed2f3 100644
--- a/maven-surefire-plugin/src/site/apt/examples/fork-options-and-parallel-execution.apt.vm
+++ b/maven-surefire-plugin/src/site/apt/examples/fork-options-and-parallel-execution.apt.vm
@@ -404,32 +404,6 @@
properties, e.g. <<<baseDir>>>, which may lead to changing system properties
and unexpected runtime behaviour.
-* Migrating the Deprecated forkMode Parameter to forkCount and reuseForks
-
- ${thisPlugin.toLowerCase()} versions prior 2.14 used the parameter <<<forkMode>>>
- to configure forking. Although that parameter is still supported for backward
- compatibility, users are strongly encouraged to migrate their configuration
- and use <<<forkCount>>> and <<<reuseForks>>> instead.
-
-
- The migration is quite simple, given the following mapping:
-
-*--------------------------+-------------------------------------------+
- <<Old Setting>> | <<New Setting>> |
-*--------------------------+-------------------------------------------+
- <<<forkMode=once>>> | <<<forkCount=1>>> (default), |
- (default) | <<<reuseForks=true>>> (default) |
-*--------------------------+-------------------------------------------+
- <<<forkMode=always>>> | <<<forkCount=1>>> (default), |
- | <<<reuseForks=false>>> |
-*--------------------------+-------------------------------------------+
- <<<forkMode=never>>> | <<<forkCount=0>>> |
-*--------------------------+-------------------------------------------+
- <<<forkMode=perthread>>>, | <<<forkCount=N>>>, |
- <<<threadCount=N>>> | (<<<reuseForks=false>>>, if you did not |
- | had that one set) |
-*--------------------------+-------------------------------------------+
-
* Known issues and limitations
* <<<$\{surefire.forkNumber\}>>> propagation is not supported on Maven 2.x
diff --git a/surefire-its/pom.xml b/surefire-its/pom.xml
index 4e227e7..b66e01d 100644
--- a/surefire-its/pom.xml
+++ b/surefire-its/pom.xml
@@ -182,7 +182,6 @@
<runOrder>alphabetical</runOrder>
<threadCount>1</threadCount>
<perCoreThreadCount>false</perCoreThreadCount>
- <forkMode>once</forkMode>
<argLine>-server -Xmx64m -XX:+UseG1GC -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Djava.awt.headless=true -Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
<includes>
<include>org/apache/**/*IT*.java</include>
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestFailIfNoTestsForkModeIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestFailIfNoTestsForkCountIT.java
similarity index 84%
rename from surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestFailIfNoTestsForkModeIT.java
rename to surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestFailIfNoTestsForkCountIT.java
index 6e2a67a..f9b2464 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestFailIfNoTestsForkModeIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestFailIfNoTestsForkCountIT.java
@@ -24,46 +24,46 @@
import org.junit.Test;
/**
- * Test failIfNoTests with various forkModes.
+ * Test failIfNoTests with various forking strategies.
*
* @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
* @author <a href="mailto:krosenvold@apache.org">Kristian Rosenvold</a>
*/
-public class CheckTestFailIfNoTestsForkModeIT
+public class CheckTestFailIfNoTestsForkCountIT
extends SurefireJUnit4IntegrationTestCase
{
@Test
- public void failIfNoTestsForkModeAlways()
+ public void failIfNoTestsForkAlways()
{
unpack().forkAlways().failIfNoTests( true ).maven().withFailure().executeTest();
}
@Test
- public void failIfNoTestsForkModeNever()
+ public void failIfNoTestsForkNever()
{
unpack().forkNever().failIfNoTests( true ).maven().withFailure().executeTest();
}
@Test
- public void failIfNoTestsForkModeOnce()
+ public void failIfNoTestsForkOnce()
{
unpack().forkOnce().failIfNoTests( true ).maven().withFailure().executeTest();
}
@Test
- public void dontFailIfNoTestsForkModeAlways()
+ public void dontFailIfNoTestsForkAlways()
{
doTest( unpack().forkAlways().failIfNoTests( false ) );
}
@Test
- public void dontFailIfNoTestsForkModeNever()
+ public void dontFailIfNoTestsForkNever()
{
doTest( unpack().forkNever().failIfNoTests( false ) );
}
@Test
- public void dontFailIfNoTestsForkModeOnce()
+ public void dontFailIfNoTestsForkOnce()
{
doTest( unpack().forkOnce().failIfNoTests( false ) );
}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java
index 5d6cc81..2870a79 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java
@@ -40,7 +40,7 @@ public void suiteXml()
}
@Test
- public void suiteXmlForkModeAlways()
+ public void suiteXmlForkAlways()
{
unpack().forkAlways()
.executeTest()
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/CrashDetectionIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/CrashDetectionIT.java
index b5489d1..e044def 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/CrashDetectionIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/CrashDetectionIT.java
@@ -38,9 +38,8 @@ public void crashInFork()
public void crashInReusableFork()
{
unpack( "crash-detection" )
- .forkPerThread()
- .reuseForks( true )
- .threadCount( 1 )
+ .forkPerThread( getThreadCount() )
+ .threadCount( getThreadCount() )
.maven()
.withFailure()
.executeTest();
@@ -50,12 +49,16 @@ public void crashInReusableFork()
public void hardCrashInReusableFork()
{
unpack( "crash-detection" )
- .forkPerThread()
- .reuseForks( true )
- .threadCount( 1 )
+ .forkPerThread( getThreadCount() )
+ .threadCount( getThreadCount() )
.addGoal( "-DkillHard=true" )
.maven()
.withFailure()
.executeTest();
}
+
+ protected int getThreadCount()
+ {
+ return 1;
+ }
}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/ForkModeIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/ForkCountIT.java
similarity index 74%
rename from surefire-its/src/test/java/org/apache/maven/surefire/its/ForkModeIT.java
rename to surefire-its/src/test/java/org/apache/maven/surefire/its/ForkCountIT.java
index 22dc5fd..ea0fab8 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/ForkModeIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/ForkCountIT.java
@@ -35,11 +35,11 @@
import org.junit.Test;
/**
- * Test forkMode
+ * Test forkCount and reuseForks
*
* @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
*/
-public class ForkModeIT
+public class ForkCountIT
extends SurefireJUnit4IntegrationTestCase
{
@@ -49,29 +49,11 @@ public class ForkModeIT
public static void installDumpPidPlugin()
throws Exception
{
- unpack( ForkModeIT.class, "test-helper-dump-pid-plugin", "plugin" ).executeInstall();
+ unpack( ForkCountIT.class, "test-helper-dump-pid-plugin", "plugin" ).executeInstall();
}
@Test
- public void testForkModeAlways()
- {
- String[] pids = doTest( unpack( getProject() ).setForkJvm().forkAlways() );
- assertDifferentPids( pids );
- assertEndWith( pids, "_1_1", 3 );
- assertFalse( "pid 1 is not the same as the main process' pid", pids[0].equals( getMainPID() ) );
- }
-
- @Test
- public void testForkModePerTest()
- {
- String[] pids = doTest( unpack( getProject() ).setForkJvm().forkPerTest() );
- assertDifferentPids( pids );
- assertEndWith( pids, "_1_1", 3 );
- assertFalse( "pid 1 is not the same as the main process' pid", pids[0].equals( getMainPID() ) );
- }
-
- @Test
- public void testForkModeNever()
+ public void testForkNever()
{
String[] pids = doTest( unpack( getProject() ).forkNever() );
assertSamePids( pids );
@@ -80,49 +62,31 @@ public void testForkModeNever()
}
@Test
- public void testForkModeNone()
+ public void testForkOncePerThreadSingleThread()
{
- String[] pids = doTest( unpack( getProject() ).forkMode( "none" ) );
- assertSamePids( pids );
- assertEndWith( pids, "_1_1", 3 );
- assertEquals( "my pid is equal to pid 1 of the test", getMainPID(), pids[0] );
- }
-
- @Test
- public void testForkModeOncePerThreadSingleThread()
- {
+ int threadCount = 1;
String[] pids = doTest( unpack( getProject() )
.setForkJvm()
- .forkPerThread()
- .reuseForks( true )
- .threadCount( 1 ) );
+ .forkPerThread( threadCount )
+ .threadCount( threadCount ) );
assertSamePids( pids );
assertEndWith( pids, "_1_1", 3 );
assertFalse( "pid 1 is not the same as the main process' pid", pids[0].equals( getMainPID() ) );
}
@Test
- public void testForkModeOncePerThreadTwoThreads()
+ public void testForkOncePerThreadTwoThreads()
{
+ int threadCount = 2;
String[] pids = doTest( unpack( getProject() )
- .forkPerThread()
- .reuseForks( true )
- .threadCount( 2 )
+ .forkPerThread( threadCount )
+ .threadCount( threadCount )
.addGoal( "-DsleepLength=7200" ) );
assertDifferentPids( pids, 2 );
assertFalse( "pid 1 is not the same as the main process' pid", pids[0].equals( getMainPID() ) );
}
@Test
- public void testForkCountZero()
- {
- String[] pids = doTest( unpack( getProject() ).forkCount( 0 ) );
- assertSamePids( pids );
- assertEndWith( pids, "_1_1", 3 );
- assertEquals( "my pid is equal to pid 1 of the test", getMainPID(), pids[0] );
- }
-
- @Test
public void testForkCountOneNoReuse()
{
String[] pids = doTest( unpack( getProject() ).setForkJvm().forkCount( 1 ).reuseForks( false ) );
@@ -179,7 +143,7 @@ private void assertDifferentPids( String[] pids, int numOfDifferentPids )
}
@Test
- public void testForkModeOnce()
+ public void testForkOnce()
{
String[] pids = doTest( unpack( getProject() ).forkOnce() );
assertSamePids( pids );
@@ -217,11 +181,11 @@ private void assertDifferentPids( String[] pids )
}
}
- private String[] doTest( SurefireLauncher forkMode )
+ private String[] doTest( SurefireLauncher forkLauncher )
{
- forkMode.sysProp( "testProperty", "testValue_${surefire.threadNumber}_${surefire.forkNumber}" );
- forkMode.addGoal( "org.apache.maven.plugins.surefire:maven-dump-pid-plugin:dump-pid" );
- outputValidator = forkMode.executeTest();
+ forkLauncher.sysProp( "testProperty", "testValue_${surefire.threadNumber}_${surefire.forkNumber}" );
+ forkLauncher.addGoal( "org.apache.maven.plugins.surefire:maven-dump-pid-plugin:dump-pid" );
+ outputValidator = forkLauncher.executeTest();
outputValidator.verifyErrorFreeLog().assertTestSuiteResults( 3, 0, 0, 0 );
String[] pids = new String[3];
for ( int i = 1; i <= pids.length; i++ )
@@ -235,7 +199,7 @@ private void assertDifferentPids( String[] pids )
protected String getProject()
{
- return "fork-mode";
+ return "fork-count";
}
}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/ForkModeMultiModuleIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/ForkCountMultiModuleIT.java
similarity index 92%
rename from surefire-its/src/test/java/org/apache/maven/surefire/its/ForkModeMultiModuleIT.java
rename to surefire-its/src/test/java/org/apache/maven/surefire/its/ForkCountMultiModuleIT.java
index b0ed712..fd3c4f8 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/ForkModeMultiModuleIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/ForkCountMultiModuleIT.java
@@ -36,11 +36,11 @@
import static org.junit.Assert.assertTrue;
/**
- * Test forkMode in a multi module project with parallel maven builds
+ * Test forking in a multi-module project with parallel maven builds
*
* @author Andreas Gudian
*/
-public class ForkModeMultiModuleIT extends SurefireJUnit4IntegrationTestCase
+public class ForkCountMultiModuleIT extends SurefireJUnit4IntegrationTestCase
{
@Test
public void testForkCountOneNoReuse()
@@ -130,11 +130,11 @@ private void assertAllDifferentPids( List<String> pids )
assertDifferentPids( pids, pids.size() );
}
- private List<String> doTest( SurefireLauncher forkMode )
+ private List<String> doTest( SurefireLauncher forkLauncher )
{
- forkMode.addGoal( "-T2" );
- forkMode.sysProp( "testProperty", "testValue_${surefire.threadNumber}_${surefire.forkNumber}" );
- final OutputValidator outputValidator = forkMode.setForkJvm().executeTest();
+ forkLauncher.addGoal( "-T2" );
+ forkLauncher.sysProp( "testProperty", "testValue_${surefire.threadNumber}_${surefire.forkNumber}" );
+ final OutputValidator outputValidator = forkLauncher.setForkJvm().executeTest();
List<String> pids = new ArrayList<>( 6 );
pids.addAll( validateModule( outputValidator, "module-a" ) );
pids.addAll( validateModule( outputValidator, "module-b" ) );
@@ -159,7 +159,7 @@ private List<String> validateModule( OutputValidator outputValidator, String mod
protected String getProject()
{
- return "fork-mode-multimodule";
+ return "fork-count-multimodule";
}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/ForkModeTestNGIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/ForkCountTestNGIT.java
similarity index 88%
rename from surefire-its/src/test/java/org/apache/maven/surefire/its/ForkModeTestNGIT.java
rename to surefire-its/src/test/java/org/apache/maven/surefire/its/ForkCountTestNGIT.java
index 5ba0577..a25413c 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/ForkModeTestNGIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/ForkCountTestNGIT.java
@@ -20,16 +20,16 @@
*/
/**
- * Test forkMode
+ * Test forkCount and reuseForks
*
* @author <a href="mailto:velo.br@gmail.com">Marvin Froeder</a>
*/
-public class ForkModeTestNGIT
- extends ForkModeIT
+public class ForkCountTestNGIT
+ extends ForkCountIT
{
@Override
protected String getProject()
{
- return "fork-mode-testng";
+ return "fork-count-testng";
}
}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/ResultCountingIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/ResultCountingIT.java
index 034e114..6c0bb6d 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/ResultCountingIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/ResultCountingIT.java
@@ -40,28 +40,29 @@ public class ResultCountingIT
public void testCountingWithJunit481ForkNever()
throws Exception
{
- assertForkMode( "never" );
+ assertForkCount( 0, true );
}
@Test
public void testCountingWithJunit481ForkOnce()
throws Exception
{
- assertForkMode( "once" );
+ assertForkCount( 1, true );
}
@Test
public void testCountingWithJunit481ForkAlways()
throws Exception
{
- assertForkMode( "always" );
+ assertForkCount( 1, false );
}
- private void assertForkMode( String forkMode )
+ private void assertForkCount( int forkCount, boolean reuseForks )
throws IOException, VerificationException
{
- OutputValidator outputValidator = unpack( "result-counting" ).failNever().forkMode( forkMode ).executeTest();
+ OutputValidator outputValidator = unpack( "result-counting" ).failNever().forkCount( forkCount )
+ .reuseForks( reuseForks ).executeTest();
outputValidator.assertTestSuiteResults( 36, 23, 4, 2 );
outputValidator.verifyTextInLog( "Tests run: 36, Failures: 4, Errors: 23, Skipped: 2" );
}
-}
\ No newline at end of file
+}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderIT.java
index a3f167b..906eaff 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderIT.java
@@ -164,7 +164,8 @@ public void testNonExistingRunOrderJUnit4()
{
unpack()
.activateProfile( "junit4" )
- .forkMode( getForkMode() )
+ .forkCount( 1 )
+ .reuseForks( reuseForks() )
.runOrder( "nonExistingRunOrder" )
.maven()
.withFailure()
@@ -177,7 +178,8 @@ public void testNonExistingRunOrderJUnit5()
{
unpack()
.activateProfile( "junit5" )
- .forkMode( getForkMode() )
+ .forkCount( 1 )
+ .reuseForks( reuseForks() )
.runOrder( "nonExistingRunOrder" )
.maven()
.withFailure()
@@ -189,7 +191,8 @@ private OutputValidator executeWithRunOrder( String runOrder, String profile )
{
return unpack()
.activateProfile( profile )
- .forkMode( getForkMode() )
+ .forkCount( 1 )
+ .reuseForks( reuseForks() )
.runOrder( runOrder )
.executeTest()
.verifyErrorFree( 3 );
@@ -199,7 +202,8 @@ private OutputValidator executeWithRandomOrder( String profile )
{
return unpack()
.activateProfile( profile )
- .forkMode( getForkMode() )
+ .forkCount( 1 )
+ .reuseForks( reuseForks() )
.runOrder( "random" )
.executeTest()
.verifyErrorFree( 3 );
@@ -209,16 +213,17 @@ private OutputValidator executeWithRandomOrder( String profile, long seed )
{
return unpack()
.activateProfile( profile )
- .forkMode( getForkMode() )
+ .forkCount( 1 )
+ .reuseForks( reuseForks() )
.runOrder( "random" )
.runOrderRandomSeed( String.valueOf( seed ) )
.executeTest()
.verifyErrorFree( 3 );
}
- protected String getForkMode()
+ protected boolean reuseForks()
{
- return "once";
+ return true;
}
private SurefireLauncher unpack()
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderParallelForksIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderParallelForksIT.java
index 5694ae3..fa0292a 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderParallelForksIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderParallelForksIT.java
@@ -27,8 +27,8 @@ public class RunOrderParallelForksIT
{
@Override
- protected String getForkMode()
+ protected boolean reuseForks()
{
- return "perthread";
+ return false;
}
}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/XmlReporterRunTimeIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/XmlReporterRunTimeIT.java
index 539d6cf..07e4843 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/XmlReporterRunTimeIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/XmlReporterRunTimeIT.java
@@ -40,7 +40,7 @@ public class XmlReporterRunTimeIT
extends SurefireJUnit4IntegrationTestCase
{
@Test
- public void testForkModeAlways()
+ public void testForkAlways()
throws Exception
{
// just generate .surefire-<hash> in order to apply runOrder
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
index 09ee6ae..87de8f9 100755
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
@@ -183,27 +183,22 @@ public SurefireLauncher redirectToFile( boolean redirect )
public SurefireLauncher forkOnce()
{
- return forkMode( "once" );
+ return forkCount( 1 ).reuseForks( true );
}
public SurefireLauncher forkNever()
{
- return forkMode( "never" );
+ return forkCount( 0 );
}
public SurefireLauncher forkAlways()
{
- return forkMode( "always" );
+ return forkCount( 1 ).reuseForks( false );
}
- public SurefireLauncher forkPerTest()
+ public SurefireLauncher forkPerThread( int threadCount )
{
- return forkMode( "pertest" );
- }
-
- public SurefireLauncher forkPerThread()
- {
- return forkMode( "perthread" );
+ return forkCount( threadCount ).reuseForks( true );
}
public SurefireLauncher threadCount( int threadCount )
@@ -224,12 +219,6 @@ public SurefireLauncher reuseForks( boolean reuseForks )
return this;
}
- public SurefireLauncher forkMode( String forkMode )
- {
- mavenLauncher.sysProp( "forkMode", forkMode );
- return this;
- }
-
public SurefireLauncher runOrder( String runOrder )
{
mavenLauncher.sysProp( "surefire.runOrder", runOrder );
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java
index d24801c..c28254b 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java
@@ -46,7 +46,7 @@ public void twoSuitesInParallel()
throws VerificationException
{
OutputValidator validator = unpack()
- .forkMode( "never" )
+ .forkNever()
.executeTest()
.verifyErrorFree( 2 );
@@ -61,7 +61,7 @@ public void twoSuitesInParallelForked()
throws VerificationException
{
OutputValidator validator = unpack()
- .forkMode( "once" )
+ .forkOnce()
.executeTest()
.verifyErrorFree( 2 );
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1295AttributeJvmCrashesToTestsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1295AttributeJvmCrashesToTestsIT.java
index 5561d86..c18edda 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1295AttributeJvmCrashesToTestsIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1295AttributeJvmCrashesToTestsIT.java
@@ -53,6 +53,8 @@
public class Surefire1295AttributeJvmCrashesToTestsIT
extends SurefireJUnit4IntegrationTestCase
{
+ private static final int ONE_FORK_REUSE_THREAD_COUNT = 1;
+
/**
*
*/
@@ -108,9 +110,8 @@ public void test()
.reuseForks( false );
break;
case ONE_FORK_REUSE:
- launcher.forkPerThread()
- .reuseForks( true )
- .threadCount( 1 );
+ launcher.forkPerThread( ONE_FORK_REUSE_THREAD_COUNT )
+ .threadCount( ONE_FORK_REUSE_THREAD_COUNT );
break;
default:
fail();
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1364SystemPropertiesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1364SystemPropertiesIT.java
index d13b0f2..2a21b9f 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1364SystemPropertiesIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1364SystemPropertiesIT.java
@@ -39,7 +39,7 @@ public void junit3Forked()
SurefireLauncher launcher = unpack( "surefire-1364" );
OutputValidator validator = launcher.setForkJvm()
.activateProfile( "junit3" )
- .forkMode( "once" )
+ .forkOnce()
.executeTest()
.verifyErrorFree( 2 );
@@ -56,7 +56,7 @@ public void junit3InProcess()
SurefireLauncher launcher = unpack( "surefire-1364" );
OutputValidator validator = launcher.setForkJvm()
.activateProfile( "junit3" )
- .forkMode( "never" )
+ .forkNever()
.executeTest()
.verifyErrorFree( 2 );
@@ -72,7 +72,7 @@ public void junit4Forked()
{
SurefireLauncher launcher = unpack( "surefire-1364" );
OutputValidator validator = launcher.setForkJvm()
- .forkMode( "once" )
+ .forkOnce()
.executeTest()
.verifyErrorFree( 2 );
@@ -88,7 +88,7 @@ public void junit4InProcess()
{
SurefireLauncher launcher = unpack( "surefire-1364" );
OutputValidator validator = launcher.setForkJvm()
- .forkMode( "never" )
+ .forkNever()
.executeTest()
.verifyErrorFree( 2 );
@@ -105,7 +105,7 @@ public void junit47Forked()
SurefireLauncher launcher = unpack( "surefire-1364" );
OutputValidator validator = launcher.setForkJvm()
.activateProfile( "junit47" )
- .forkMode( "once" )
+ .forkOnce()
.executeTest()
.verifyErrorFree( 2 );
@@ -122,7 +122,7 @@ public void junit47InProcess()
SurefireLauncher launcher = unpack( "surefire-1364" );
OutputValidator validator = launcher.setForkJvm()
.activateProfile( "junit47" )
- .forkMode( "never" )
+ .forkNever()
.executeTest()
.verifyErrorFree( 2 );
@@ -139,7 +139,7 @@ public void junit47ForkedParallel()
SurefireLauncher launcher = unpack( "surefire-1364" );
OutputValidator validator = launcher.setForkJvm()
.activateProfile( "junit47" )
- .forkMode( "once" )
+ .forkOnce()
.parallelClasses()
.threadCount( 2 )
.disablePerCoreThreadCount()
@@ -159,7 +159,7 @@ public void junit47InProcessParallel()
SurefireLauncher launcher = unpack( "surefire-1364" );
OutputValidator validator = launcher.setForkJvm()
.activateProfile( "junit47" )
- .forkMode( "never" )
+ .forkNever()
.parallelClasses()
.threadCount( 2 )
.disablePerCoreThreadCount()
@@ -179,7 +179,7 @@ public void testNg()
SurefireLauncher launcher = unpack( "surefire-1364" );
OutputValidator validator = launcher.setForkJvm()
.activateProfile( "testng" )
- .forkMode( "once" )
+ .forkOnce()
.executeTest()
.verifyErrorFree( 3 );
@@ -193,7 +193,7 @@ public void testNgInProcess()
SurefireLauncher launcher = unpack( "surefire-1364" );
OutputValidator validator = launcher.setForkJvm()
.activateProfile( "testng" )
- .forkMode( "never" )
+ .forkNever()
.executeTest()
.verifyErrorFree( 3 );
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1367AssumptionLogsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1367AssumptionLogsIT.java
index cb57b21..231010f 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1367AssumptionLogsIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1367AssumptionLogsIT.java
@@ -38,8 +38,8 @@ public class Surefire1367AssumptionLogsIT extends SurefireJUnit4IntegrationTestC
@Test
public void shouldSeeLogsParallelForked()
{
- OutputValidator outputValidator = unpack().setForkJvm().forkMode(
- "once" ).parallelClassesAndMethods().disablePerCoreThreadCount().threadCountClasses(
+ OutputValidator outputValidator =
+ unpack().setForkJvm().forkOnce().parallelClassesAndMethods().disablePerCoreThreadCount().threadCountClasses(
2 ).threadCountMethods( 2 ).executeTest().assertTestSuiteResults( 2, 0, 0, 2 );
verifyReportA( outputValidator );
@@ -49,9 +49,10 @@ public void shouldSeeLogsParallelForked()
@Test
public void shouldSeeLogsParallelInPlugin()
{
- OutputValidator outputValidator = unpack().setForkJvm().forkMode(
- "never" ).parallelClassesAndMethods().disablePerCoreThreadCount().threadCountClasses(
- 2 ).threadCountMethods( 2 ).executeTest().assertTestSuiteResults( 2, 0, 0, 2 );
+ OutputValidator outputValidator =
+ unpack().setForkJvm().forkNever().parallelClassesAndMethods().disablePerCoreThreadCount()
+ .threadCountClasses(
+ 2 ).threadCountMethods( 2 ).executeTest().assertTestSuiteResults( 2, 0, 0, 2 );
verifyReportA( outputValidator );
verifyReportB( outputValidator );
@@ -60,8 +61,8 @@ public void shouldSeeLogsParallelInPlugin()
@Test
public void shouldSeeLogsForked()
{
- OutputValidator outputValidator = unpack().setForkJvm().forkMode( "once" ).executeTest().assertTestSuiteResults(
- 2, 0, 0, 2 );
+ OutputValidator outputValidator = unpack().setForkJvm().forkOnce().executeTest().assertTestSuiteResults(
+ 2, 0, 0, 2 );
verifyReportA( outputValidator );
verifyReportB( outputValidator );
@@ -70,8 +71,8 @@ public void shouldSeeLogsForked()
@Test
public void shouldSeeLogsInPlugin()
{
- OutputValidator outputValidator = unpack().setForkJvm().forkMode(
- "never" ).executeTest().assertTestSuiteResults( 2, 0, 0, 2 );
+ OutputValidator outputValidator =
+ unpack().setForkJvm().forkNever().executeTest().assertTestSuiteResults( 2, 0, 0, 2 );
verifyReportA( outputValidator );
verifyReportB( outputValidator );
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire801ForkModeNoneClassLoaderIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire801ForkNeverClassLoaderIT.java
similarity index 86%
rename from surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire801ForkModeNoneClassLoaderIT.java
rename to surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire801ForkNeverClassLoaderIT.java
index 910cfc5..2e3a8fb 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire801ForkModeNoneClassLoaderIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire801ForkNeverClassLoaderIT.java
@@ -27,12 +27,12 @@
*
* @author Kristian Rosenvold
*/
-public class Surefire801ForkModeNoneClassLoaderIT
+public class Surefire801ForkNeverClassLoaderIT
extends SurefireJUnit4IntegrationTestCase
{
@Test
- public void testSHouldBeOkWithForkNever()
+ public void testShouldBeOkWithForkNever()
{
- unpack( "fork-mode-resource-loading" ).forkNever().executeTest();
+ unpack( "fork-count-resource-loading" ).forkNever().executeTest();
}
}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire839TestWithoutCategoriesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire839TestWithoutCategoriesIT.java
index ca46340..e5925cb 100755
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire839TestWithoutCategoriesIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire839TestWithoutCategoriesIT.java
@@ -38,11 +38,11 @@ public void classWithoutCategory()
@Test
public void classWithoutCategoryForked()
{
+ int threadCount = 2;
unpack( "junit48-categories" )
.setJUnitVersion( "4.11" )
- .forkPerThread()
- .reuseForks( true )
- .threadCount( 2 )
+ .forkPerThread( threadCount )
+ .threadCount( threadCount )
.executeTest()
.verifyErrorFree( 3 );
}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire855AllowFailsafeUseArtifactFileIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire855AllowFailsafeUseArtifactFileIT.java
index 1263ab3..130a500 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire855AllowFailsafeUseArtifactFileIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire855AllowFailsafeUseArtifactFileIT.java
@@ -39,15 +39,16 @@ public void warShouldUseClasses()
@Test
public void jarShouldUseFile()
{
- unpack( "surefire-855-failsafe-use-jar" )
- .maven().sysProp( "forkMode", "once" ).executeVerify().assertIntegrationTestSuiteResults( 3, 0, 0, 1 );
+ unpack( "surefire-855-failsafe-use-jar" ).maven().sysProp( "forkCount", 1 )
+ .sysProp( "reuseForks", true ).executeVerify()
+ .assertIntegrationTestSuiteResults( 3, 0, 0, 1 );
}
@Test
public void jarNotForkingShouldUseFile()
{
unpack( "surefire-855-failsafe-use-jar" )
- .maven().sysProp( "forkMode", "never" ).executeVerify().assertIntegrationTestSuiteResults( 3, 0, 0, 1 );
+ .maven().sysProp( "forkCount", 0 ).executeVerify().assertIntegrationTestSuiteResults( 3, 0, 0, 1 );
}
@Test
@@ -55,4 +56,4 @@ public void osgiBundleShouldUseFile()
{
unpack( "surefire-855-failsafe-use-bundle" ).maven().executeVerify().verifyErrorFree( 2 );
}
-}
\ No newline at end of file
+}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire907PerThreadWithoutThreadCountIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire907PerThreadWithoutThreadCountIT.java
deleted file mode 100755
index eb7a711..0000000
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire907PerThreadWithoutThreadCountIT.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.apache.maven.surefire.its.jiras;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.surefire.its.fixture.OutputValidator;
-import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
-
-import org.junit.Test;
-
-/**
- *
- */
-public class Surefire907PerThreadWithoutThreadCountIT
- extends SurefireJUnit4IntegrationTestCase
-{
- @Test
- public void categoryAB()
- {
- OutputValidator validator = unpack( "fork-mode" )
- .forkPerThread()
- .reuseForks( false )
- .maven()
- .withFailure()
- .executeTest();
-
- validator.verifyTextInLog( "Fork mode perthread requires a thread count" );
- }
-
-}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire946KillMainProcessInReusableForkIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire946KillMainProcessInReusableForkIT.java
index cdd3236..77a1b05 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire946KillMainProcessInReusableForkIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire946KillMainProcessInReusableForkIT.java
@@ -100,7 +100,7 @@ public void test() throws Exception
.sysProp( "testSleepTime", String.valueOf( TEST_SLEEP_TIME ) )
.addGoal( "org.apache.maven.plugins.surefire:maven-selfdestruct-plugin:selfdestruct" )
.setForkJvm()
- .forkPerThread().threadCount( 1 ).reuseForks( true ).maven().withFailure().executeTest();
+ .forkPerThread( 1 ).maven().withFailure().executeTest();
XPathFactory xpathFactory = XPathFactory.newInstance();
diff --git a/surefire-its/src/test/resources/argLine-parameter/pom.xml b/surefire-its/src/test/resources/argLine-parameter/pom.xml
index 2a6d678..5522fa2 100644
--- a/surefire-its/src/test/resources/argLine-parameter/pom.xml
+++ b/surefire-its/src/test/resources/argLine-parameter/pom.xml
@@ -51,7 +51,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
<argLine>
<!--
These lines must be tab-indented, see SUREFIRE-2063;
diff --git a/surefire-its/src/test/resources/argLine-properties/pom.xml b/surefire-its/src/test/resources/argLine-properties/pom.xml
index 2a6d6c2..ef10cfe 100644
--- a/surefire-its/src/test/resources/argLine-properties/pom.xml
+++ b/surefire-its/src/test/resources/argLine-properties/pom.xml
@@ -75,7 +75,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
<argLine>-Dp1=@{from.prop} -Dp2=@{override.prop} -Dp3=@{undefined.prop} -Dp4=@{generated.prop}</argLine>
</configuration>
</plugin>
diff --git a/surefire-its/src/test/resources/consoleOutput/pom.xml b/surefire-its/src/test/resources/consoleOutput/pom.xml
index 2b52941..05b4d65 100644
--- a/surefire-its/src/test/resources/consoleOutput/pom.xml
+++ b/surefire-its/src/test/resources/consoleOutput/pom.xml
@@ -31,7 +31,8 @@
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<testFailureIgnore>true</testFailureIgnore>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<includes>
<include>**/Test*.java</include>
</includes>
diff --git a/surefire-its/src/test/resources/consoleOutputEncoding/pom.xml b/surefire-its/src/test/resources/consoleOutputEncoding/pom.xml
index 5dec5d8..7654190 100644
--- a/surefire-its/src/test/resources/consoleOutputEncoding/pom.xml
+++ b/surefire-its/src/test/resources/consoleOutputEncoding/pom.xml
@@ -49,7 +49,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<printSummary>${printSummary}</printSummary>
<reportFormat>${reportFormat}</reportFormat>
<includes>
@@ -63,7 +64,8 @@
<properties>
<junit.version>4.8.1</junit.version>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
<printSummary>true</printSummary>
<reportFormat>brief</reportFormat>
</properties>
diff --git a/surefire-its/src/test/resources/consoleoutput-noisy/pom.xml b/surefire-its/src/test/resources/consoleoutput-noisy/pom.xml
index 6fd7013..a002f45 100644
--- a/surefire-its/src/test/resources/consoleoutput-noisy/pom.xml
+++ b/surefire-its/src/test/resources/consoleoutput-noisy/pom.xml
@@ -30,7 +30,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<printSummary>${printSummary}</printSummary>
<useFile>${useFile}</useFile>
<parallel>${parallel}</parallel>
@@ -52,7 +53,8 @@
<useFile>true</useFile>
<junit.version>4.8.1</junit.version>
<redirect.to.file>true</redirect.to.file>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
<printSummary>true</printSummary>
<parallel></parallel>
<reportFormat>brief</reportFormat>
diff --git a/surefire-its/src/test/resources/crash-detection/pom.xml b/surefire-its/src/test/resources/crash-detection/pom.xml
index 81e9c6a..b84ffeb 100644
--- a/surefire-its/src/test/resources/crash-detection/pom.xml
+++ b/surefire-its/src/test/resources/crash-detection/pom.xml
@@ -49,7 +49,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/crash-during-test/pom.xml b/surefire-its/src/test/resources/crash-during-test/pom.xml
index 66f3fce..b3c6828 100644
--- a/surefire-its/src/test/resources/crash-during-test/pom.xml
+++ b/surefire-its/src/test/resources/crash-during-test/pom.xml
@@ -55,7 +55,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>
diff --git a/surefire-its/src/test/resources/environment-variables/pom.xml b/surefire-its/src/test/resources/environment-variables/pom.xml
index 902e97e..049f2d7 100644
--- a/surefire-its/src/test/resources/environment-variables/pom.xml
+++ b/surefire-its/src/test/resources/environment-variables/pom.xml
@@ -29,7 +29,8 @@
<name>Test for checking environment variables into forks</name>
<properties>
- <forkMode>always</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>false</reuseForks>
<useSystemClassLoader>false</useSystemClassLoader>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
@@ -49,7 +50,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<useSystemClassLoader>${useSystemClassLoader}</useSystemClassLoader>
<environmentVariables>
<DUMMY_ENV_VAR>foo</DUMMY_ENV_VAR>
diff --git a/surefire-its/src/test/resources/fail-fast-junit/pom.xml b/surefire-its/src/test/resources/fail-fast-junit/pom.xml
index 6dca1d5..2dbe1e2 100644
--- a/surefire-its/src/test/resources/fail-fast-junit/pom.xml
+++ b/surefire-its/src/test/resources/fail-fast-junit/pom.xml
@@ -53,7 +53,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<runOrder>alphabetical</runOrder>
- <forkMode>once</forkMode><!--override to default value in order to enable forkCount-->
<argLine>-Xms64m -Xmx128m</argLine>
</configuration>
</plugin>
diff --git a/surefire-its/src/test/resources/fail-fast-testng/pom.xml b/surefire-its/src/test/resources/fail-fast-testng/pom.xml
index c891407..064c6f8 100644
--- a/surefire-its/src/test/resources/fail-fast-testng/pom.xml
+++ b/surefire-its/src/test/resources/fail-fast-testng/pom.xml
@@ -50,8 +50,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<runOrder>alphabetical</runOrder>
- <forkMode>once</forkMode><!--override to default value in order to enable forkCount-->
- <argLine>-Xms64m -Xmx128m</argLine>
+ <argLine>-Xms64m -Xmx128m</argLine>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/failingBuilds/pom.xml b/surefire-its/src/test/resources/failingBuilds/pom.xml
index 8e988ad..22d4326 100644
--- a/surefire-its/src/test/resources/failingBuilds/pom.xml
+++ b/surefire-its/src/test/resources/failingBuilds/pom.xml
@@ -33,7 +33,7 @@
</build>
<properties>
<junit.version>4.8.1</junit.version>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
diff --git a/surefire-its/src/test/resources/failure-result-counting/pom.xml b/surefire-its/src/test/resources/failure-result-counting/pom.xml
index 7d79f29..a629e5d 100644
--- a/surefire-its/src/test/resources/failure-result-counting/pom.xml
+++ b/surefire-its/src/test/resources/failure-result-counting/pom.xml
@@ -21,7 +21,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<includes>
<include>**/*.java</include>
</includes>
@@ -31,7 +32,8 @@
</build>
<properties>
<junit.version>4.10</junit.version>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
diff --git a/surefire-its/src/test/resources/failureOutput/pom.xml b/surefire-its/src/test/resources/failureOutput/pom.xml
index 85c10ee..fd871e4 100644
--- a/surefire-its/src/test/resources/failureOutput/pom.xml
+++ b/surefire-its/src/test/resources/failureOutput/pom.xml
@@ -22,7 +22,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<printSummary>${printSummary}</printSummary>
<useFile>${userFile}</useFile>
<reportFormat>${reportFormat}</reportFormat>
@@ -39,7 +40,8 @@
<properties>
<junit.version>4.8.1</junit.version>
<redirect.to.file>true</redirect.to.file>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
<printSummary>true</printSummary>
<useFile>true</useFile>
<reportFormat>brief</reportFormat>
diff --git a/surefire-its/src/test/resources/fork-consoleOutput/pom.xml b/surefire-its/src/test/resources/fork-consoleOutput/pom.xml
index 407d86b..ba911d3 100644
--- a/surefire-its/src/test/resources/fork-consoleOutput/pom.xml
+++ b/surefire-its/src/test/resources/fork-consoleOutput/pom.xml
@@ -22,7 +22,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<printSummary>${printSummary}</printSummary>
<useFile>true</useFile>
<reportFormat>${reportFormat}</reportFormat>
@@ -37,7 +38,8 @@
<properties>
<junit.version>4.8.1</junit.version>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
<printSummary>true</printSummary>
<reportFormat>brief</reportFormat>
<maven.compiler.source>1.7</maven.compiler.source>
diff --git a/surefire-its/src/test/resources/fork-consoleOutputWithErrors/pom.xml b/surefire-its/src/test/resources/fork-consoleOutputWithErrors/pom.xml
index 9aa5e1b..c508625 100644
--- a/surefire-its/src/test/resources/fork-consoleOutputWithErrors/pom.xml
+++ b/surefire-its/src/test/resources/fork-consoleOutputWithErrors/pom.xml
@@ -22,7 +22,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<printSummary>${printSummary}</printSummary>
<useFile>${userFile}</useFile>
<reportFormat>${reportFormat}</reportFormat>
@@ -39,7 +40,8 @@
<properties>
<junit.version>4.8.1</junit.version>
<redirect.to.file>true</redirect.to.file>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
<printSummary>true</printSummary>
<useFile>true</useFile>
<reportFormat>brief</reportFormat>
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/pom.xml b/surefire-its/src/test/resources/fork-count-multimodule/module-a/pom.xml
similarity index 88%
copy from surefire-its/src/test/resources/fork-mode-multimodule/module-b/pom.xml
copy to surefire-its/src/test/resources/fork-count-multimodule/module-a/pom.xml
index 61fd8a0..61d6772 100644
--- a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/pom.xml
+++ b/surefire-its/src/test/resources/fork-count-multimodule/module-a/pom.xml
@@ -25,12 +25,12 @@
<parent>
<groupId>org.apache.maven.plugins.surefire</groupId>
- <artifactId>fork-mode-multimodule</artifactId>
+ <artifactId>fork-count-multimodule</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.maven.plugins.surefire</groupId>
- <artifactId>fork-mode-multimodule.module-b</artifactId>
- <name>Test for forkMode Module B</name>
+ <artifactId>fork-count-multimodule.module-a</artifactId>
+ <name>Test for forkCount Module A</name>
</project>
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-count-multimodule/module-a/src/test/java/forkCount/Test1.java
similarity index 98%
rename from surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test1.java
rename to surefire-its/src/test/resources/fork-count-multimodule/module-a/src/test/java/forkCount/Test1.java
index ed3dd57..fefe2ea 100644
--- a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test1.java
+++ b/surefire-its/src/test/resources/fork-count-multimodule/module-a/src/test/java/forkCount/Test1.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test2.java b/surefire-its/src/test/resources/fork-count-multimodule/module-a/src/test/java/forkCount/Test2.java
similarity index 97%
rename from surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test2.java
rename to surefire-its/src/test/resources/fork-count-multimodule/module-a/src/test/java/forkCount/Test2.java
index e9d0652..abf068c 100644
--- a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test2.java
+++ b/surefire-its/src/test/resources/fork-count-multimodule/module-a/src/test/java/forkCount/Test2.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test3.java b/surefire-its/src/test/resources/fork-count-multimodule/module-a/src/test/java/forkCount/Test3.java
similarity index 97%
rename from surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test3.java
rename to surefire-its/src/test/resources/fork-count-multimodule/module-a/src/test/java/forkCount/Test3.java
index c8eef74..1c024fa 100644
--- a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test3.java
+++ b/surefire-its/src/test/resources/fork-count-multimodule/module-a/src/test/java/forkCount/Test3.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/pom.xml b/surefire-its/src/test/resources/fork-count-multimodule/module-b/pom.xml
similarity index 88%
rename from surefire-its/src/test/resources/fork-mode-multimodule/module-b/pom.xml
rename to surefire-its/src/test/resources/fork-count-multimodule/module-b/pom.xml
index 61fd8a0..cba844e 100644
--- a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/pom.xml
+++ b/surefire-its/src/test/resources/fork-count-multimodule/module-b/pom.xml
@@ -25,12 +25,12 @@
<parent>
<groupId>org.apache.maven.plugins.surefire</groupId>
- <artifactId>fork-mode-multimodule</artifactId>
+ <artifactId>fork-count-multimodule</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.maven.plugins.surefire</groupId>
- <artifactId>fork-mode-multimodule.module-b</artifactId>
- <name>Test for forkMode Module B</name>
+ <artifactId>fork-count-multimodule.module-b</artifactId>
+ <name>Test for forkCount Module B</name>
</project>
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-count-multimodule/module-b/src/test/java/forkCount/Test1.java
similarity index 98%
copy from surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test1.java
copy to surefire-its/src/test/resources/fork-count-multimodule/module-b/src/test/java/forkCount/Test1.java
index ed3dd57..fefe2ea 100644
--- a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test1.java
+++ b/surefire-its/src/test/resources/fork-count-multimodule/module-b/src/test/java/forkCount/Test1.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test2.java b/surefire-its/src/test/resources/fork-count-multimodule/module-b/src/test/java/forkCount/Test2.java
similarity index 97%
copy from surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test2.java
copy to surefire-its/src/test/resources/fork-count-multimodule/module-b/src/test/java/forkCount/Test2.java
index e9d0652..abf068c 100644
--- a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test2.java
+++ b/surefire-its/src/test/resources/fork-count-multimodule/module-b/src/test/java/forkCount/Test2.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test3.java b/surefire-its/src/test/resources/fork-count-multimodule/module-b/src/test/java/forkCount/Test3.java
similarity index 97%
copy from surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test3.java
copy to surefire-its/src/test/resources/fork-count-multimodule/module-b/src/test/java/forkCount/Test3.java
index c8eef74..1c024fa 100644
--- a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test3.java
+++ b/surefire-its/src/test/resources/fork-count-multimodule/module-b/src/test/java/forkCount/Test3.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/pom.xml b/surefire-its/src/test/resources/fork-count-multimodule/pom.xml
similarity index 91%
rename from surefire-its/src/test/resources/fork-mode-multimodule/pom.xml
rename to surefire-its/src/test/resources/fork-count-multimodule/pom.xml
index e0786b1..c9e78e9 100644
--- a/surefire-its/src/test/resources/fork-mode-multimodule/pom.xml
+++ b/surefire-its/src/test/resources/fork-count-multimodule/pom.xml
@@ -24,9 +24,9 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.plugins.surefire</groupId>
- <artifactId>fork-mode-multimodule</artifactId>
+ <artifactId>fork-count-multimodule</artifactId>
<version>1.0-SNAPSHOT</version>
- <name>Test for forkMode Multimodule</name>
+ <name>Test for forkCount Multimodule</name>
<packaging>pom</packaging>
@@ -46,7 +46,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<threadCount>${threadCount}</threadCount>
<runOrder>alphabetical</runOrder>
</configuration>
diff --git a/surefire-its/src/test/resources/junit-fork-mode-always/pom.xml b/surefire-its/src/test/resources/fork-count-resource-loading/pom.xml
similarity index 88%
rename from surefire-its/src/test/resources/junit-fork-mode-always/pom.xml
rename to surefire-its/src/test/resources/fork-count-resource-loading/pom.xml
index 9b86c75..dad2889 100644
--- a/surefire-its/src/test/resources/junit-fork-mode-always/pom.xml
+++ b/surefire-its/src/test/resources/fork-count-resource-loading/pom.xml
@@ -24,9 +24,9 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.plugins.surefire</groupId>
- <artifactId>testng-fork-mode</artifactId>
+ <artifactId>fork-count-resource-loading</artifactId>
<version>1.0-SNAPSHOT</version>
- <name>Test for forkMode</name>
+ <name>Test for forkCount</name>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
@@ -39,7 +39,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
</configuration>
</plugin>
</plugins>
@@ -49,7 +50,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.8.2</version>
+ <version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/surefire-its/src/test/resources/fork-mode-resource-loading/src/test/java/forkMode/ResourceLoadTest.java b/surefire-its/src/test/resources/fork-count-resource-loading/src/test/java/forkCount/ResourceLoadTest.java
similarity index 98%
rename from surefire-its/src/test/resources/fork-mode-resource-loading/src/test/java/forkMode/ResourceLoadTest.java
rename to surefire-its/src/test/resources/fork-count-resource-loading/src/test/java/forkCount/ResourceLoadTest.java
index e2c3d51..9083cde 100644
--- a/surefire-its/src/test/resources/fork-mode-resource-loading/src/test/java/forkMode/ResourceLoadTest.java
+++ b/surefire-its/src/test/resources/fork-count-resource-loading/src/test/java/forkCount/ResourceLoadTest.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-mode-resource-loading/src/test/resources/myFile.txt b/surefire-its/src/test/resources/fork-count-resource-loading/src/test/resources/myFile.txt
similarity index 100%
rename from surefire-its/src/test/resources/fork-mode-resource-loading/src/test/resources/myFile.txt
rename to surefire-its/src/test/resources/fork-count-resource-loading/src/test/resources/myFile.txt
diff --git a/surefire-its/src/test/resources/fork-mode-testng/pom.xml b/surefire-its/src/test/resources/fork-count-testng/pom.xml
similarity index 92%
rename from surefire-its/src/test/resources/fork-mode-testng/pom.xml
rename to surefire-its/src/test/resources/fork-count-testng/pom.xml
index 8e25749..a314954 100644
--- a/surefire-its/src/test/resources/fork-mode-testng/pom.xml
+++ b/surefire-its/src/test/resources/fork-count-testng/pom.xml
@@ -8,9 +8,9 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.plugins.surefire</groupId>
- <artifactId>fork-mode-testng</artifactId>
+ <artifactId>fork-count-testng</artifactId>
<version>1.0-SNAPSHOT</version>
- <name>Test for forkMode</name>
+ <name>Test for forkCount</name>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
@@ -23,7 +23,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<threadCount>${threadCount}</threadCount>
</configuration>
</plugin>
diff --git a/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-count-testng/src/test/java/forkCount/Test1.java
similarity index 98%
rename from surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test1.java
rename to surefire-its/src/test/resources/fork-count-testng/src/test/java/forkCount/Test1.java
index 9c13d2c..c4c9829 100644
--- a/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test1.java
+++ b/surefire-its/src/test/resources/fork-count-testng/src/test/java/forkCount/Test1.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test2.java b/surefire-its/src/test/resources/fork-count-testng/src/test/java/forkCount/Test2.java
similarity index 97%
rename from surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test2.java
rename to surefire-its/src/test/resources/fork-count-testng/src/test/java/forkCount/Test2.java
index d7e8be9..2c4aed4 100644
--- a/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test2.java
+++ b/surefire-its/src/test/resources/fork-count-testng/src/test/java/forkCount/Test2.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test3.java b/surefire-its/src/test/resources/fork-count-testng/src/test/java/forkCount/Test3.java
similarity index 97%
rename from surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test3.java
rename to surefire-its/src/test/resources/fork-count-testng/src/test/java/forkCount/Test3.java
index e52f2b7..7066225 100644
--- a/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test3.java
+++ b/surefire-its/src/test/resources/fork-count-testng/src/test/java/forkCount/Test3.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-mode/pom.xml b/surefire-its/src/test/resources/fork-count/pom.xml
similarity index 91%
rename from surefire-its/src/test/resources/fork-mode/pom.xml
rename to surefire-its/src/test/resources/fork-count/pom.xml
index 28bfb4d..a4ebd32 100644
--- a/surefire-its/src/test/resources/fork-mode/pom.xml
+++ b/surefire-its/src/test/resources/fork-count/pom.xml
@@ -24,9 +24,9 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.plugins.surefire</groupId>
- <artifactId>fork-mode</artifactId>
+ <artifactId>fork-count</artifactId>
<version>1.0-SNAPSHOT</version>
- <name>Test for forkMode</name>
+ <name>Test for forkCount</name>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
@@ -39,7 +39,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<threadCount>${threadCount}</threadCount>
<runOrder>alphabetical</runOrder>
</configuration>
diff --git a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-count/src/test/java/forkCount/Test1.java
similarity index 98%
rename from surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java
rename to surefire-its/src/test/resources/fork-count/src/test/java/forkCount/Test1.java
index cd02aca..87f4cd0 100644
--- a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java
+++ b/surefire-its/src/test/resources/fork-count/src/test/java/forkCount/Test1.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test2.java b/surefire-its/src/test/resources/fork-count/src/test/java/forkCount/Test2.java
similarity index 97%
rename from surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test2.java
rename to surefire-its/src/test/resources/fork-count/src/test/java/forkCount/Test2.java
index 2d4b1dc..ce621a7 100644
--- a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test2.java
+++ b/surefire-its/src/test/resources/fork-count/src/test/java/forkCount/Test2.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test3.java b/surefire-its/src/test/resources/fork-count/src/test/java/forkCount/Test3.java
similarity index 97%
rename from surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test3.java
rename to surefire-its/src/test/resources/fork-count/src/test/java/forkCount/Test3.java
index a0f4f2c..c3c9d80 100644
--- a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test3.java
+++ b/surefire-its/src/test/resources/fork-count/src/test/java/forkCount/Test3.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-fail/pom.xml b/surefire-its/src/test/resources/fork-fail/pom.xml
index 9db6d72..b426d99 100644
--- a/surefire-its/src/test/resources/fork-fail/pom.xml
+++ b/surefire-its/src/test/resources/fork-fail/pom.xml
@@ -40,7 +40,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
<argLine>${argLine}</argLine>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
diff --git a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-fail/src/test/java/forkCount/Test1.java
similarity index 98%
rename from surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test1.java
rename to surefire-its/src/test/resources/fork-fail/src/test/java/forkCount/Test1.java
index 1f41d4e..0aee23b 100644
--- a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test1.java
+++ b/surefire-its/src/test/resources/fork-fail/src/test/java/forkCount/Test1.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test2.java b/surefire-its/src/test/resources/fork-fail/src/test/java/forkCount/Test2.java
similarity index 97%
rename from surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test2.java
rename to surefire-its/src/test/resources/fork-fail/src/test/java/forkCount/Test2.java
index 33d3cf1..e702ddf 100644
--- a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test2.java
+++ b/surefire-its/src/test/resources/fork-fail/src/test/java/forkCount/Test2.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test3.java b/surefire-its/src/test/resources/fork-fail/src/test/java/forkCount/Test3.java
similarity index 97%
copy from surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test3.java
copy to surefire-its/src/test/resources/fork-fail/src/test/java/forkCount/Test3.java
index c8eef74..1c024fa 100644
--- a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test3.java
+++ b/surefire-its/src/test/resources/fork-fail/src/test/java/forkCount/Test3.java
@@ -1,4 +1,4 @@
-package forkMode;
+package forkCount;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/pom.xml b/surefire-its/src/test/resources/fork-mode-multimodule/module-a/pom.xml
deleted file mode 100644
index 9de3941..0000000
--- a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/pom.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-~ Licensed to the Apache Software Foundation (ASF) under one
-~ or more contributor license agreements. See the NOTICE file
-~ distributed with this work for additional information
-~ regarding copyright ownership. The ASF licenses this file
-~ to you under the Apache License, Version 2.0 (the
-~ "License"); you may not use this file except in compliance
-~ with the License. You may obtain a copy of the License at
-~
-~ http://www.apache.org/licenses/LICENSE-2.0
-~
-~ Unless required by applicable law or agreed to in writing,
-~ software distributed under the License is distributed on an
-~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-~ KIND, either express or implied. See the License for the
-~ specific language governing permissions and limitations
-~ under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.maven.plugins.surefire</groupId>
- <artifactId>fork-mode-multimodule</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.maven.plugins.surefire</groupId>
- <artifactId>fork-mode-multimodule.module-a</artifactId>
- <name>Test for forkMode Module A</name>
-
-</project>
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test3.java b/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test3.java
deleted file mode 100644
index c8eef74..0000000
--- a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test3.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package forkMode;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-public class Test3
- extends TestCase
-{
-
- public void test3() throws IOException {
- Test1.dumpPidFile(this);
- }
-
-}
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test1.java
deleted file mode 100644
index ed3dd57..0000000
--- a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test1.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package forkMode;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.util.Random;
-
-import junit.framework.TestCase;
-
-public class Test1
- extends TestCase
-{
-
- private static final Random RANDOM = new Random();
-
- public void test1()
- throws IOException, InterruptedException
- {
- int sleepLength = Integer.valueOf( System.getProperty( "sleepLength", "1500" ));
- Thread.sleep(sleepLength);
- dumpPidFile( this );
- }
-
- public static void dumpPidFile( TestCase test )
- throws IOException
- {
- String fileName = test.getName() + "-pid";
- File target = new File( "target" ).getCanonicalFile(); // getCanonicalFile required for embedded mode
- if ( !( target.exists() && target.isDirectory() ) )
- {
- target = new File( "." );
- }
- File pidFile = new File( target, fileName );
- try ( FileWriter fw = new FileWriter( pidFile ) )
- {
- // DGF little known trick... this is guaranteed to be unique to the PID
- // In fact, it usually contains the pid and the local host name!
- String pid = ManagementFactory.getRuntimeMXBean().getName();
- fw.write( pid );
- fw.write( " " );
- fw.write( System.getProperty( "testProperty", String.valueOf( RANDOM.nextLong() ) ) );
- System.out.println( "Done Writing pid file" + pidFile.getAbsolutePath() );
- }
- }
-}
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test2.java b/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test2.java
deleted file mode 100644
index e9d0652..0000000
--- a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test2.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package forkMode;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-public class Test2
- extends TestCase
-{
-
- public void test2() throws IOException, InterruptedException {
- int sleepLength = Integer.valueOf( System.getProperty( "sleepLength", "1500" ));
- Thread.sleep(sleepLength);
- Test1.dumpPidFile(this);
- }
-
-}
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test3.java b/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test3.java
deleted file mode 100644
index c8eef74..0000000
--- a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test3.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package forkMode;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-public class Test3
- extends TestCase
-{
-
- public void test3() throws IOException {
- Test1.dumpPidFile(this);
- }
-
-}
diff --git a/surefire-its/src/test/resources/fork-mode-resource-loading/pom.xml b/surefire-its/src/test/resources/fork-mode-resource-loading/pom.xml
deleted file mode 100644
index e40033c..0000000
--- a/surefire-its/src/test/resources/fork-mode-resource-loading/pom.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.maven.plugins.surefire</groupId>
- <artifactId>fork-mode-resource-loading</artifactId>
- <version>1.0-SNAPSHOT</version>
- <name>Test for forkMode</name>
-
- <properties>
- <maven.compiler.source>1.7</maven.compiler.source>
- <maven.compiler.target>1.7</maven.compiler.target>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>${surefire.version}</version>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/surefire-its/src/test/resources/fork-timeout/pom.xml b/surefire-its/src/test/resources/fork-timeout/pom.xml
index 25365a2..09b7a58 100644
--- a/surefire-its/src/test/resources/fork-timeout/pom.xml
+++ b/surefire-its/src/test/resources/fork-timeout/pom.xml
@@ -10,7 +10,8 @@
<properties>
<junit.version>4.8.1</junit.version>
<junit.parallel>classes</junit.parallel>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
<timeOut>1</timeOut>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
@@ -29,7 +30,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<parallel>${junit.parallel}</parallel>
<threadCount>3</threadCount>
<perCoreThreadCount>false</perCoreThreadCount>
diff --git a/surefire-its/src/test/resources/java9-full-api/pom.xml b/surefire-its/src/test/resources/java9-full-api/pom.xml
index d1dfe79..562f94f 100644
--- a/surefire-its/src/test/resources/java9-full-api/pom.xml
+++ b/surefire-its/src/test/resources/java9-full-api/pom.xml
@@ -47,7 +47,7 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
</configuration>
</plugin>
<plugin>
@@ -61,7 +61,7 @@
</execution>
</executions>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/junit-fork-mode-always/src/test/java/junit4/forkMode/Test1.java b/surefire-its/src/test/resources/junit-fork-mode-always/src/test/java/junit4/forkMode/Test1.java
deleted file mode 100644
index d56d697..0000000
--- a/surefire-its/src/test/resources/junit-fork-mode-always/src/test/java/junit4/forkMode/Test1.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package junit4.forkMode;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-
-import org.junit.Test;
-
-public class Test1
-{
-
- @Test
- public void test1()
- throws IOException
- {
- dumpPidFile( "test1" );
- }
-
- public static void dumpPidFile( String name )
- throws IOException
- {
- String fileName = name + "-pid";
- File target = new File( "target" );
- if ( !( target.exists() && target.isDirectory() ) )
- {
- target = new File( "." );
- }
- File pidFile = new File( target, fileName );
- try ( FileWriter fw = new FileWriter( pidFile ) )
- {
- // DGF little known trick... this is guaranteed to be unique to the PID
- // In fact, it usually contains the pid and the local host name!
- String pid = ManagementFactory.getRuntimeMXBean().getName();
- fw.write( pid );
- System.out.println( "pid = " + pid );
- }
- }
-}
diff --git a/surefire-its/src/test/resources/junit-fork-mode-always/src/test/java/junit4/forkMode/Test2.java b/surefire-its/src/test/resources/junit-fork-mode-always/src/test/java/junit4/forkMode/Test2.java
deleted file mode 100644
index f57f1b8..0000000
--- a/surefire-its/src/test/resources/junit-fork-mode-always/src/test/java/junit4/forkMode/Test2.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package junit4.forkMode;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-
-import org.junit.Test;
-
-public class Test2
-{
-
- @Test
- public void test2()
- throws IOException
- {
- Test1.dumpPidFile( "test2" );
- }
-
-}
diff --git a/surefire-its/src/test/resources/junit-fork-mode-always/src/test/java/junit4/forkMode/Test3.java b/surefire-its/src/test/resources/junit-fork-mode-always/src/test/java/junit4/forkMode/Test3.java
deleted file mode 100644
index af7f6fd..0000000
--- a/surefire-its/src/test/resources/junit-fork-mode-always/src/test/java/junit4/forkMode/Test3.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package junit4.forkMode;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-
-import org.junit.Test;
-
-public class Test3
-{
-
- @Test
- public void test3()
- throws IOException
- {
- Test1.dumpPidFile( "test3" );
- }
-
-}
diff --git a/surefire-its/src/test/resources/junit4-forkAlways-staticInit/pom.xml b/surefire-its/src/test/resources/junit4-forkAlways-staticInit/pom.xml
index 4bfc081..d5177ed 100644
--- a/surefire-its/src/test/resources/junit4-forkAlways-staticInit/pom.xml
+++ b/surefire-its/src/test/resources/junit4-forkAlways-staticInit/pom.xml
@@ -30,7 +30,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>always</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/junit47-redirect-output/pom.xml b/surefire-its/src/test/resources/junit47-redirect-output/pom.xml
index 38ec727..94cca5d 100644
--- a/surefire-its/src/test/resources/junit47-redirect-output/pom.xml
+++ b/surefire-its/src/test/resources/junit47-redirect-output/pom.xml
@@ -29,7 +29,8 @@
</dependency>
</dependencies>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<printSummary>${printSummary}</printSummary>
<useFile>true</useFile>
<redirectTestOutputToFile>${redirect.to.file}</redirectTestOutputToFile>
@@ -48,7 +49,8 @@
<properties>
<junit.version>4.8.1</junit.version>
<redirect.to.file>true</redirect.to.file>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
<printSummary>true</printSummary>
<parallel>none</parallel>
<maven.compiler.source>1.7</maven.compiler.source>
diff --git a/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/pom.xml b/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/pom.xml
index 5c5f836..a26a8f5 100644
--- a/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/pom.xml
+++ b/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/pom.xml
@@ -43,7 +43,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
</configuration>
<dependencies>
<dependency>
diff --git a/surefire-its/src/test/resources/junit47-static-inner-class-tests/pom.xml b/surefire-its/src/test/resources/junit47-static-inner-class-tests/pom.xml
index 81f26c2..bb92b20 100644
--- a/surefire-its/src/test/resources/junit47-static-inner-class-tests/pom.xml
+++ b/surefire-its/src/test/resources/junit47-static-inner-class-tests/pom.xml
@@ -25,7 +25,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>never</forkMode>
+ <forkCount>0</forkCount>
</configuration>
<dependencies>
<dependency>
diff --git a/surefire-its/src/test/resources/junit48-method-pattern/pom.xml b/surefire-its/src/test/resources/junit48-method-pattern/pom.xml
index 40227c3..c53e9aa 100644
--- a/surefire-its/src/test/resources/junit48-method-pattern/pom.xml
+++ b/surefire-its/src/test/resources/junit48-method-pattern/pom.xml
@@ -55,7 +55,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<test>BasicTest#testSuccess*</test>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/junit48-multiple-methods/pom.xml b/surefire-its/src/test/resources/junit48-multiple-methods/pom.xml
index 09ef51e..f132843 100644
--- a/surefire-its/src/test/resources/junit48-multiple-methods/pom.xml
+++ b/surefire-its/src/test/resources/junit48-multiple-methods/pom.xml
@@ -55,7 +55,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<test>junit4/BasicTest#testSuccessOne+testFailOne,junit4/TestThree#testSuccessTwo</test>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/junit48-single-method/pom.xml b/surefire-its/src/test/resources/junit48-single-method/pom.xml
index 96061ce..a56bf39 100644
--- a/surefire-its/src/test/resources/junit48-single-method/pom.xml
+++ b/surefire-its/src/test/resources/junit48-single-method/pom.xml
@@ -55,7 +55,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<test>BasicTest#testSuccessOne</test>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/long-windows-path/pom.xml b/surefire-its/src/test/resources/long-windows-path/pom.xml
index c65948c..edee4ee 100644
--- a/surefire-its/src/test/resources/long-windows-path/pom.xml
+++ b/surefire-its/src/test/resources/long-windows-path/pom.xml
@@ -48,7 +48,7 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/pom.xml b/surefire-its/src/test/resources/pom.xml
index 6a3d7e8..606722a 100644
--- a/surefire-its/src/test/resources/pom.xml
+++ b/surefire-its/src/test/resources/pom.xml
@@ -20,7 +20,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>never</forkMode>
<enableProcessChecker>all</enableProcessChecker>
</configuration>
</plugin>
@@ -28,7 +27,6 @@
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>never</forkMode>
<enableProcessChecker>all</enableProcessChecker>
</configuration>
</plugin>
diff --git a/surefire-its/src/test/resources/reporters/pom.xml b/surefire-its/src/test/resources/reporters/pom.xml
index 2152525..7dfd1b5 100644
--- a/surefire-its/src/test/resources/reporters/pom.xml
+++ b/surefire-its/src/test/resources/reporters/pom.xml
@@ -25,7 +25,8 @@
<version>${surefire.version}</version>
<configuration>
<disableXmlReport>false</disableXmlReport>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<printSummary>${printSummary}</printSummary>
<useFile>true</useFile>
<redirectTestOutputToFile>${redirect.to.file}</redirectTestOutputToFile>
@@ -41,7 +42,8 @@
<properties>
<junit.version>4.8.1</junit.version>
<redirect.to.file>true</redirect.to.file>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
<printSummary>true</printSummary>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
diff --git a/surefire-its/src/test/resources/result-counting/pom.xml b/surefire-its/src/test/resources/result-counting/pom.xml
index fcb7372..3e7844c 100644
--- a/surefire-its/src/test/resources/result-counting/pom.xml
+++ b/surefire-its/src/test/resources/result-counting/pom.xml
@@ -21,7 +21,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<includes>
<include>**/Test*.java</include>
<include>**/MySuiteTest1.java</include>
@@ -34,7 +35,8 @@
</build>
<properties>
<junit.version>4.8.1</junit.version>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
diff --git a/surefire-its/src/test/resources/runOrder/pom.xml b/surefire-its/src/test/resources/runOrder/pom.xml
index 8f00c3b..5bfad14 100644
--- a/surefire-its/src/test/resources/runOrder/pom.xml
+++ b/surefire-its/src/test/resources/runOrder/pom.xml
@@ -40,7 +40,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
</configuration>
<dependencies>
</dependencies>
diff --git a/surefire-its/src/test/resources/small-result-counting/pom.xml b/surefire-its/src/test/resources/small-result-counting/pom.xml
index e06061c..44c6389 100644
--- a/surefire-its/src/test/resources/small-result-counting/pom.xml
+++ b/surefire-its/src/test/resources/small-result-counting/pom.xml
@@ -21,7 +21,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<includes>
<include>**/Test*.java</include>
</includes>
@@ -31,7 +32,8 @@
</build>
<properties>
<junit.version>4.8.1</junit.version>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
diff --git a/surefire-its/src/test/resources/surefire-1041-exception-in-junit-runner/pom.xml b/surefire-its/src/test/resources/surefire-1041-exception-in-junit-runner/pom.xml
index efd19e8..7630c4e 100644
--- a/surefire-its/src/test/resources/surefire-1041-exception-in-junit-runner/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1041-exception-in-junit-runner/pom.xml
@@ -35,7 +35,6 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>once</forkMode>
<forkCount>1</forkCount>
</configuration>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-1053-system-properties/pom.xml b/surefire-its/src/test/resources/surefire-1053-system-properties/pom.xml
index 1774dc4..3df1d01 100644
--- a/surefire-its/src/test/resources/surefire-1053-system-properties/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1053-system-properties/pom.xml
@@ -54,7 +54,7 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
<systemPropertyVariables>
<myArg>myVal1</myArg>
</systemPropertyVariables>
diff --git a/surefire-its/src/test/resources/surefire-1055-parallelTestCount/pom.xml b/surefire-its/src/test/resources/surefire-1055-parallelTestCount/pom.xml
index 51ef7bc..6e4bfdf 100644
--- a/surefire-its/src/test/resources/surefire-1055-parallelTestCount/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1055-parallelTestCount/pom.xml
@@ -54,7 +54,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
<parallel>classesAndMethods</parallel>
<perCoreThreadCount>false</perCoreThreadCount>
<useUnlimitedThreads>true</useUnlimitedThreads>
diff --git a/surefire-its/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/pom.xml b/surefire-its/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/pom.xml
index d8c5a01..1d34cbc 100644
--- a/surefire-its/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1136-cwd-propagation-in-forked-mode/pom.xml
@@ -54,8 +54,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <!-- To override fork mode from parrent pom.xml -->
- <forkMode>once</forkMode>
<forkCount>1</forkCount>
<!-- To ensure proper variables expansion for both standard maven and surefire specific variables -->
<workingDirectory>${project.name}_${surefire.forkNumber}</workingDirectory>
@@ -66,4 +64,4 @@
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git a/surefire-its/src/test/resources/surefire-1158-remove-info-lines/pom.xml b/surefire-its/src/test/resources/surefire-1158-remove-info-lines/pom.xml
index 37e65bf..954a31c 100644
--- a/surefire-its/src/test/resources/surefire-1158-remove-info-lines/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1158-remove-info-lines/pom.xml
@@ -53,7 +53,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>always</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>false</reuseForks>
</configuration>
<dependencies>
<dependency>
diff --git a/surefire-its/src/test/resources/surefire-1202-rerun-and-failfast/pom.xml b/surefire-its/src/test/resources/surefire-1202-rerun-and-failfast/pom.xml
index 4fb9d72..d82d0a1 100644
--- a/surefire-its/src/test/resources/surefire-1202-rerun-and-failfast/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1202-rerun-and-failfast/pom.xml
@@ -62,7 +62,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>once</forkMode>
<forkCount>1</forkCount>
<skipAfterFailureCount>2</skipAfterFailureCount>
<rerunFailingTestsCount>3</rerunFailingTestsCount>
@@ -115,4 +114,4 @@
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>
diff --git a/surefire-its/src/test/resources/surefire-1211/pom.xml b/surefire-its/src/test/resources/surefire-1211/pom.xml
index 98db2a7..3572a95 100644
--- a/surefire-its/src/test/resources/surefire-1211/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1211/pom.xml
@@ -56,7 +56,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
<properties>
<property>
<name>junit</name>
diff --git a/surefire-its/src/test/resources/surefire-1264/pom.xml b/surefire-its/src/test/resources/surefire-1264/pom.xml
index 320401d..aad5867 100644
--- a/surefire-its/src/test/resources/surefire-1264/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1264/pom.xml
@@ -24,7 +24,7 @@
<threadCount>2</threadCount>
<parallel>all</parallel>
<runOrder>balanced</runOrder>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
<systemPropertyVariables>
<canFail>${canFail}</canFail>
</systemPropertyVariables>
diff --git a/surefire-its/src/test/resources/surefire-1364/pom.xml b/surefire-its/src/test/resources/surefire-1364/pom.xml
index 952ca06..3e149b0 100644
--- a/surefire-its/src/test/resources/surefire-1364/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1364/pom.xml
@@ -34,7 +34,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <forkedMode>once</forkedMode>
+ <forkCount>1</forkCount>
</properties>
<dependencies>
@@ -64,7 +64,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>${forkedMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
<systemPropertyVariables>
<forkedProp>forkedValue${surefire.forkNumber}</forkedProp>
</systemPropertyVariables>
diff --git a/surefire-its/src/test/resources/surefire-1367/pom.xml b/surefire-its/src/test/resources/surefire-1367/pom.xml
index b1d3ac3..6987a02 100644
--- a/surefire-its/src/test/resources/surefire-1367/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1367/pom.xml
@@ -50,7 +50,8 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
</plugin>
diff --git a/surefire-its/src/test/resources/surefire-146-forkPerTestNoSetup/pom.xml b/surefire-its/src/test/resources/surefire-146-forkPerTestNoSetup/pom.xml
index 671a654..309fc7c 100644
--- a/surefire-its/src/test/resources/surefire-146-forkPerTestNoSetup/pom.xml
+++ b/surefire-its/src/test/resources/surefire-146-forkPerTestNoSetup/pom.xml
@@ -49,7 +49,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>pertest</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/surefire-162-charsetProvider/pom.xml b/surefire-its/src/test/resources/surefire-162-charsetProvider/pom.xml
index 3eb6175..66b1156 100644
--- a/surefire-its/src/test/resources/surefire-162-charsetProvider/pom.xml
+++ b/surefire-its/src/test/resources/surefire-162-charsetProvider/pom.xml
@@ -15,7 +15,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
<useSystemClassLoader>true</useSystemClassLoader>
</configuration>
</plugin>
diff --git a/surefire-its/src/test/resources/surefire-1993-jpms-providing-modules/application/pom.xml b/surefire-its/src/test/resources/surefire-1993-jpms-providing-modules/application/pom.xml
index fedb873..9ad69fd 100644
--- a/surefire-its/src/test/resources/surefire-1993-jpms-providing-modules/application/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1993-jpms-providing-modules/application/pom.xml
@@ -72,7 +72,6 @@
</executions>
<configuration>
<forkCount>1</forkCount>
- <forkMode>once</forkMode>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/surefire-510-testClassPath/pom.xml b/surefire-its/src/test/resources/surefire-510-testClassPath/pom.xml
index 5cb7b92..d501b0a 100644
--- a/surefire-its/src/test/resources/surefire-510-testClassPath/pom.xml
+++ b/surefire-its/src/test/resources/surefire-510-testClassPath/pom.xml
@@ -39,7 +39,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/surefire-613-testCount-in-parallel/pom.xml b/surefire-its/src/test/resources/surefire-613-testCount-in-parallel/pom.xml
index 8175d3f..5fffa76 100644
--- a/surefire-its/src/test/resources/surefire-613-testCount-in-parallel/pom.xml
+++ b/surefire-its/src/test/resources/surefire-613-testCount-in-parallel/pom.xml
@@ -25,7 +25,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
<parallel>methods</parallel>
<threadCount>10</threadCount>
<includes>
diff --git a/surefire-its/src/test/resources/surefire-621-testCounting-junit3-in-parallel/pom.xml b/surefire-its/src/test/resources/surefire-621-testCounting-junit3-in-parallel/pom.xml
index 412035d..68b99be 100644
--- a/surefire-its/src/test/resources/surefire-621-testCounting-junit3-in-parallel/pom.xml
+++ b/surefire-its/src/test/resources/surefire-621-testCounting-junit3-in-parallel/pom.xml
@@ -54,7 +54,7 @@
<include>**/MySuiteTest2.java</include>
<include>**/MySuiteTest3.java</include>
</includes>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
</configuration>
</execution>
</executions>
@@ -90,7 +90,7 @@
<include>**/MySuiteTest2.java</include>
<include>**/MySuiteTest3.java</include>
</includes>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
</configuration>
</execution>
</executions>
@@ -124,7 +124,7 @@
<include>**/MySuiteTest2.java</include>
<include>**/MySuiteTest3.java</include>
</includes>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
</configuration>
</execution>
</executions>
@@ -166,7 +166,7 @@
<includes>
<include>JUnit4AdapterSuiteTest</include>
</includes>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
</configuration>
</execution>
</executions>
@@ -198,7 +198,7 @@
<includes>
<include>JUnit4AdapterSuiteTest</include>
</includes>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
</configuration>
</execution>
</executions>
diff --git a/surefire-its/src/test/resources/surefire-628-consoleoutputbeforeandafterclass/pom.xml b/surefire-its/src/test/resources/surefire-628-consoleoutputbeforeandafterclass/pom.xml
index 9c975a8..0bec5d9 100644
--- a/surefire-its/src/test/resources/surefire-628-consoleoutputbeforeandafterclass/pom.xml
+++ b/surefire-its/src/test/resources/surefire-628-consoleoutputbeforeandafterclass/pom.xml
@@ -27,7 +27,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
<threadCount>5</threadCount>
<includes>
<include>**/Test*.java</include>
diff --git a/surefire-its/src/test/resources/surefire-674-buildFailingWhenErrors/pom.xml b/surefire-its/src/test/resources/surefire-674-buildFailingWhenErrors/pom.xml
index 398a225..006e9f9 100644
--- a/surefire-its/src/test/resources/surefire-674-buildFailingWhenErrors/pom.xml
+++ b/surefire-its/src/test/resources/surefire-674-buildFailingWhenErrors/pom.xml
@@ -21,7 +21,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
<includes>
<include>**/Test*.java</include>
<include>**/MySuiteTest1.java</include>
@@ -34,7 +35,8 @@
</build>
<properties>
<junit.version>4.8.1</junit.version>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
diff --git a/surefire-its/src/test/resources/surefire-685-commaseparatedIncludes/pom.xml b/surefire-its/src/test/resources/surefire-685-commaseparatedIncludes/pom.xml
index eb40366..d3e8dc7 100644
--- a/surefire-its/src/test/resources/surefire-685-commaseparatedIncludes/pom.xml
+++ b/surefire-its/src/test/resources/surefire-685-commaseparatedIncludes/pom.xml
@@ -49,7 +49,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
<includes>
<include>**/TestA.java,**/TestB.java</include>
</includes>
diff --git a/surefire-its/src/test/resources/surefire-812-log4j-classloader/pom.xml b/surefire-its/src/test/resources/surefire-812-log4j-classloader/pom.xml
index 61be350..20749f3 100644
--- a/surefire-its/src/test/resources/surefire-812-log4j-classloader/pom.xml
+++ b/surefire-its/src/test/resources/surefire-812-log4j-classloader/pom.xml
@@ -19,7 +19,8 @@
<version>${surefire.version}</version>
<configuration>
<useManifestOnlyJar>false</useManifestOnlyJar>
- <forkMode>always</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>false</reuseForks>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<systemPropertyVariables>
<java.awt.headless>true</java.awt.headless>
diff --git a/surefire-its/src/test/resources/surefire-817-system-exit/pom.xml b/surefire-its/src/test/resources/surefire-817-system-exit/pom.xml
index 8f48176..1f963b9 100644
--- a/surefire-its/src/test/resources/surefire-817-system-exit/pom.xml
+++ b/surefire-its/src/test/resources/surefire-817-system-exit/pom.xml
@@ -54,7 +54,8 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>always</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>false</reuseForks>
</configuration>
<dependencies>
<dependency>
diff --git a/surefire-its/src/test/resources/surefire-855-failsafe-use-bundle/pom.xml b/surefire-its/src/test/resources/surefire-855-failsafe-use-bundle/pom.xml
index 62e2eba..5494bf5 100644
--- a/surefire-its/src/test/resources/surefire-855-failsafe-use-bundle/pom.xml
+++ b/surefire-its/src/test/resources/surefire-855-failsafe-use-bundle/pom.xml
@@ -129,7 +129,8 @@
</execution>
</executions>
<configuration>
- <forkMode>always</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/surefire-855-failsafe-use-jar/pom.xml b/surefire-its/src/test/resources/surefire-855-failsafe-use-jar/pom.xml
index 6a72717..01412f1 100644
--- a/surefire-its/src/test/resources/surefire-855-failsafe-use-jar/pom.xml
+++ b/surefire-its/src/test/resources/surefire-855-failsafe-use-jar/pom.xml
@@ -117,7 +117,8 @@
</execution>
</executions>
<configuration>
- <forkMode>${forkMode}</forkMode>
+ <forkCount>${forkCount}</forkCount>
+ <reuseForks>${reuseForks}</reuseForks>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/surefire-855-failsafe-use-jar/src/test/java/jiras/surefire855/jar/FooIT.java b/surefire-its/src/test/resources/surefire-855-failsafe-use-jar/src/test/java/jiras/surefire855/jar/FooIT.java
index 56e2b7e..3daa41f 100644
--- a/surefire-its/src/test/resources/surefire-855-failsafe-use-jar/src/test/java/jiras/surefire855/jar/FooIT.java
+++ b/surefire-its/src/test/resources/surefire-855-failsafe-use-jar/src/test/java/jiras/surefire855/jar/FooIT.java
@@ -130,7 +130,7 @@ private static Properties loadTestProperties( Class clazz )
public void shouldBeJarWithForking()
throws IOException
{
- assumeThat( System.getProperty( "forkMode" ), is( not( "never" ) ) );
+ assumeThat( System.getProperty( "forkCount" ), is( not( "0" ) ) );
String classPath = manifestClassPath( getClass() );
System.out.println( "CLASS PATH:" );
@@ -159,7 +159,7 @@ public void shouldBeJarWithForking()
public void jarShouldExistWhenNotForking()
throws Exception
{
- assumeThat( System.getProperty( "forkMode" ), is( "never" ) );
+ assumeThat( System.getProperty( "forkCount" ), is( "0" ) );
assertThat( surefireDir() ).isNull();
assertThat( new File( "target/" + ARTIFACT_FILE_NAME ).getCanonicalFile() ).isFile();
diff --git a/surefire-its/src/test/resources/surefire-855-failsafe-use-war/pom.xml b/surefire-its/src/test/resources/surefire-855-failsafe-use-war/pom.xml
index 06a91f0..07c0127 100644
--- a/surefire-its/src/test/resources/surefire-855-failsafe-use-war/pom.xml
+++ b/surefire-its/src/test/resources/surefire-855-failsafe-use-war/pom.xml
@@ -126,7 +126,8 @@
</execution>
</executions>
<configuration>
- <forkMode>always</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/surefire-972-bizarre-noclassdef/boom/pom.xml b/surefire-its/src/test/resources/surefire-972-bizarre-noclassdef/boom/pom.xml
index fa075ab..d4cc4ed 100644
--- a/surefire-its/src/test/resources/surefire-972-bizarre-noclassdef/boom/pom.xml
+++ b/surefire-its/src/test/resources/surefire-972-bizarre-noclassdef/boom/pom.xml
@@ -34,7 +34,8 @@
<goal>verify</goal>
</goals>
<configuration>
- <forkMode>always</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>false</reuseForks>
</configuration>
</execution>
</executions>
diff --git a/surefire-its/src/test/resources/test-helper-dump-pid-plugin/pom.xml b/surefire-its/src/test/resources/test-helper-dump-pid-plugin/pom.xml
index 4cc41d4..69e4d91 100644
--- a/surefire-its/src/test/resources/test-helper-dump-pid-plugin/pom.xml
+++ b/surefire-its/src/test/resources/test-helper-dump-pid-plugin/pom.xml
@@ -55,7 +55,7 @@
</executions>
</plugin>
<plugin>
- <!-- No test sources here. See the ForkModeIT and surefire-its/src/main/resources/fork-mode. -->
+ <!-- No test sources here. See the ForkCountIT and surefire-its/src/main/resources/fork-count. -->
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
diff --git a/surefire-its/src/test/resources/testng-execute-error/pom.xml b/surefire-its/src/test/resources/testng-execute-error/pom.xml
index 7e06dbe..ef44849 100644
--- a/surefire-its/src/test/resources/testng-execute-error/pom.xml
+++ b/surefire-its/src/test/resources/testng-execute-error/pom.xml
@@ -69,7 +69,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <forkMode>once</forkMode>
+ <forkCount>1</forkCount>
<useFile>true</useFile>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
diff --git a/surefire-its/src/test/resources/testng-listeners/pom.xml b/surefire-its/src/test/resources/testng-listeners/pom.xml
index e2482a2..904c391 100644
--- a/surefire-its/src/test/resources/testng-listeners/pom.xml
+++ b/surefire-its/src/test/resources/testng-listeners/pom.xml
@@ -21,23 +21,35 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.maven.surefire</groupId>
- <artifactId>it-parent</artifactId>
- <version>1.0</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>testng-listeners</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <modelVersion>4.0.0</modelVersion>
- <dependencies>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>6.8.8</version>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
+ <parent>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>it-parent</artifactId>
+ <version>1.0</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>testng-listeners</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>6.8.8</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ <configuration>
+ <forkCount>0</forkCount>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
index f3b121b..445407f 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
@@ -36,9 +36,10 @@
import static org.apache.maven.surefire.api.util.internal.ObjectUtils.systemProps;
/**
- * A class to be used when there is no JUnit parallelism (methods or/and class). This allow to workaround JUnit
+ * A class to be used when there is no JUnit parallelism (methods or/and class). This allows to workaround JUnit
* limitation a la Junit4 provider. Specifically, we can redirect properly the output even if we don't have class
- * demarcation in JUnit. It works when if there is a JVM instance per test run, i.e. with forkMode=always or perthread.
+ * demarcation in JUnit. It works when if there is a JVM instance per test run, i.e. with reuseForks=false and
+ * forkCount greater than one.
*/
@Deprecated // remove this class after StatelessXmlReporter is capable of parallel test sets processing
class NonConcurrentRunListener