You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2015/05/06 09:15:22 UTC
[2/3] maven-surefire git commit: [SUREFIRE] Refactoring
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-api/src/test/java/org/apache/maven/surefire/util/ScanResultTest.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/test/java/org/apache/maven/surefire/util/ScanResultTest.java b/surefire-api/src/test/java/org/apache/maven/surefire/util/ScanResultTest.java
index 7c6628a..02c2d22 100644
--- a/surefire-api/src/test/java/org/apache/maven/surefire/util/ScanResultTest.java
+++ b/surefire-api/src/test/java/org/apache/maven/surefire/util/ScanResultTest.java
@@ -19,11 +19,12 @@ package org.apache.maven.surefire.util;
* under the License.
*/
+import junit.framework.TestCase;
+
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
-import java.util.Properties;
-
-import junit.framework.TestCase;
+import java.util.Map;
/**
* @author Kristian Rosenvold
@@ -36,7 +37,7 @@ public class ScanResultTest
{
List<String> files = Arrays.asList( "abc", "cde" );
DefaultScanResult scanResult = new DefaultScanResult( files );
- Properties serialized = new Properties();
+ Map<String, String> serialized = new HashMap<String, String>();
scanResult.writeTo( serialized );
DefaultScanResult read = DefaultScanResult.from( serialized );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
index 400f141..b6d9005 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
@@ -142,10 +142,7 @@ public class Classpath implements Iterable<String>
Classpath classpath = (Classpath) o;
- return !( unmodifiableElements != null
- ? !unmodifiableElements.equals( classpath.unmodifiableElements )
- : classpath.unmodifiableElements != null );
-
+ return unmodifiableElements.equals( classpath.unmodifiableElements );
}
public ClassLoader createClassLoader( ClassLoader parent, boolean childDelegation, boolean enableAssertions,
@@ -177,7 +174,7 @@ public class Classpath implements Iterable<String>
public int hashCode()
{
- return unmodifiableElements != null ? unmodifiableElements.hashCode() : 0;
+ return unmodifiableElements.hashCode();
}
public String getLogMessage( String descriptor )
@@ -213,7 +210,7 @@ public class Classpath implements Iterable<String>
}
else
{
- result.append( element );
+ result.append( (String) null );
}
}
return result.toString();
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
index 4b5b5ba..1b122ce 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
@@ -167,7 +167,7 @@ public class ForkedBooter
private static ReporterFactory createForkingReporterFactory( ProviderConfiguration providerConfiguration,
PrintStream originalSystemOut )
{
- final Boolean trimStackTrace = providerConfiguration.getReporterConfiguration().isTrimStackTrace();
+ final boolean trimStackTrace = providerConfiguration.getReporterConfiguration().isTrimStackTrace();
return SurefireReflector.createForkingReporterFactoryInCurrentClassLoader( trimStackTrace, originalSystemOut );
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-booter/src/main/java/org/apache/maven/surefire/booter/KeyValueSource.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/KeyValueSource.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/KeyValueSource.java
index 9decb23..cf3c629 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/KeyValueSource.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/KeyValueSource.java
@@ -26,5 +26,5 @@ import java.util.Map;
*/
public interface KeyValueSource
{
- void copyTo( Map target );
+ void copyTo( Map<Object, Object> target );
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java
index c5d6b5b..8fec269 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java
@@ -21,23 +21,19 @@ package org.apache.maven.surefire.booter;
import java.io.File;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Properties;
import org.apache.maven.surefire.util.internal.StringUtils;
/**
- * Makes java.util.Properties behave like it's 2013
- *
* @author Kristian Rosenvold
*/
public class PropertiesWrapper
implements KeyValueSource
{
- private final Properties properties;
+ private final Map<String, String> properties;
- public PropertiesWrapper( Properties properties )
+ public PropertiesWrapper( Map<String, String> properties )
{
if ( properties == null )
{
@@ -46,39 +42,37 @@ public class PropertiesWrapper
this.properties = properties;
}
- public Properties getProperties()
+ public Map<String, String> getProperties()
{
return properties;
}
public void setAsSystemProperties()
{
- for ( Object o : properties.keySet() )
+ for ( Map.Entry<String, String> entry : properties.entrySet() )
{
- String key = (String) o;
-
- System.setProperty( key, properties.getProperty( key ) );
+ System.setProperty( entry.getKey(), entry.getValue() );
}
}
public String getProperty( String key )
{
- return properties.getProperty( key );
+ return properties.get( key );
}
public boolean getBooleanProperty( String propertyName )
{
- return Boolean.valueOf( properties.getProperty( propertyName ) );
+ return Boolean.valueOf( properties.get( propertyName ) );
}
- public Boolean getBooleanObjectProperty( String propertyName )
+ public boolean getBooleanObjectProperty( String propertyName )
{
- return Boolean.valueOf( properties.getProperty( propertyName ) );
+ return Boolean.valueOf( properties.get( propertyName ) );
}
public int getIntProperty( String propertyName )
{
- return Integer.parseInt( properties.getProperty( propertyName ) );
+ return Integer.parseInt( properties.get( propertyName ) );
}
public File getFileProperty( String key )
@@ -94,13 +88,10 @@ public class PropertiesWrapper
public List<String> getStringList( String propertyPrefix )
{
- String value;
List<String> result = new ArrayList<String>();
-
- int i = 0;
- while ( true )
+ for ( int i = 0; ; i++ )
{
- value = getProperty( propertyPrefix + ( i++ ) );
+ String value = getProperty( propertyPrefix + i );
if ( value == null )
{
@@ -120,14 +111,17 @@ public class PropertiesWrapper
public TypeEncodedValue getTypeEncodedValue( String key )
{
String typeEncoded = getProperty( key );
- if ( typeEncoded == null )
+ if ( typeEncoded != null )
+ {
+ int typeSep = typeEncoded.indexOf( "|" );
+ String type = typeEncoded.substring( 0, typeSep );
+ String value = typeEncoded.substring( typeSep + 1 );
+ return new TypeEncodedValue( type, value );
+ }
+ else
{
return null;
}
- int typeSep = typeEncoded.indexOf( "|" );
- String type = typeEncoded.substring( 0, typeSep );
- String value = typeEncoded.substring( typeSep + 1 );
- return new TypeEncodedValue( type, value );
}
@@ -140,7 +134,7 @@ public class PropertiesWrapper
public void setClasspath( String prefix, Classpath classpath )
{
List classpathElements = classpath.getClassPath();
- for ( int i = 0; i < classpathElements.size(); ++i )
+ for ( int i = 0, size = classpathElements.size(); i < size; ++i )
{
String element = (String) classpathElements.get( i );
setProperty( prefix + i, element );
@@ -152,44 +146,35 @@ public class PropertiesWrapper
{
if ( value != null )
{
- properties.setProperty( key, value );
+ properties.put( key, value );
}
}
public void addList( List items, String propertyPrefix )
{
- if ( items == null || items.size() == 0 )
- {
- return;
- }
- int i = 0;
- for ( Object item : items )
+ if ( items != null && !items.isEmpty() )
{
- if ( item == null )
+ int i = 0;
+ for ( Object item : items )
{
- throw new NullPointerException( propertyPrefix + i + " has null value" );
+ if ( item == null )
+ {
+ throw new NullPointerException( propertyPrefix + i + " has null value" );
+ }
+
+ String[] stringArray = StringUtils.split( item.toString(), "," );
+
+ for ( String aStringArray : stringArray )
+ {
+ properties.put( propertyPrefix + i, aStringArray );
+ i++;
+ }
}
-
- String[] stringArray = StringUtils.split( item.toString(), "," );
-
- for ( String aStringArray : stringArray )
- {
- properties.setProperty( propertyPrefix + i, aStringArray );
- i++;
- }
-
}
}
- public void copyTo( Map target )
+ public void copyTo( Map<Object, Object> target )
{
- Iterator iter = properties.keySet().iterator();
- Object key;
- while ( iter.hasNext() )
- {
- key = iter.next();
- //noinspection unchecked
- target.put( key, properties.get( key ) );
- }
+ target.putAll( properties );
}
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
index 362be85..2ee0870 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
@@ -21,7 +21,7 @@ package org.apache.maven.surefire.booter;
import java.io.File;
import java.util.List;
-import java.util.Properties;
+import java.util.Map;
import org.apache.maven.surefire.report.ReporterConfiguration;
import org.apache.maven.surefire.testset.DirectoryScannerParameters;
import org.apache.maven.surefire.testset.RunOrderParameters;
@@ -54,7 +54,7 @@ public class ProviderConfiguration
private final RunOrderParameters runOrderParameters;
- private final Properties providerProperties;
+ private final Map<String, String> providerProperties;
private final boolean failIfNoTests;
@@ -66,7 +66,7 @@ public class ProviderConfiguration
public ProviderConfiguration( DirectoryScannerParameters directoryScannerParameters,
RunOrderParameters runOrderParameters, boolean failIfNoTests,
ReporterConfiguration reporterConfiguration, TestArtifactInfo testArtifact,
- TestRequest testSuiteDefinition, Properties providerProperties,
+ TestRequest testSuiteDefinition, Map<String, String> providerProperties,
TypeEncodedValue typeEncodedTestSet, boolean readTestsFromInStream )
{
this.runOrderParameters = runOrderParameters;
@@ -87,9 +87,9 @@ public class ProviderConfiguration
}
- public Boolean isFailIfNoTests()
+ public boolean isFailIfNoTests()
{
- return ( failIfNoTests ) ? Boolean.TRUE : Boolean.FALSE;
+ return failIfNoTests;
}
public File getBaseDir()
@@ -123,7 +123,7 @@ public class ProviderConfiguration
return testSuiteDefinition;
}
- public Properties getProviderProperties()
+ public Map<String, String> getProviderProperties()
{
return providerProperties;
}
@@ -138,7 +138,6 @@ public class ProviderConfiguration
return runOrderParameters;
}
-
public boolean isReadTestsFromInStream()
{
return readTestsFromInStream;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java
index 4a624ea..17db489 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java
@@ -24,7 +24,9 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Map;
import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
/**
* @author Kristian Rosenvold
@@ -42,18 +44,22 @@ public class SystemPropertyManager
public static PropertiesWrapper loadProperties( InputStream inStream )
throws IOException
{
- Properties p = new Properties();
-
try
{
+ Properties p = new Properties();
p.load( inStream );
+ Map<String, String> map = new ConcurrentHashMap<String, String>( p.size() );
+ // @todo use .stringPropertyNames() JDK6 instead of .keySet()
+ for ( Map.Entry<?, ?> entry : p.entrySet() )
+ {
+ map.put( (String) entry.getKey(), (String) entry.getValue() );
+ }
+ return new PropertiesWrapper( map );
}
finally
{
- close( inStream );
+ close( inStream ); // @todo use try-with-resources JDK7, search in all code
}
-
- return new PropertiesWrapper( p );
}
private static PropertiesWrapper loadProperties( File file )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-booter/src/test/java/org/apache/maven/surefire/booter/Foo.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/Foo.java b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/Foo.java
index 82248b5..99b8564 100644
--- a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/Foo.java
+++ b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/Foo.java
@@ -20,7 +20,7 @@ package org.apache.maven.surefire.booter;
*/
-import java.util.Properties;
+import java.util.Map;
import org.apache.maven.surefire.report.ReporterConfiguration;
import org.apache.maven.surefire.testset.DirectoryScannerParameters;
import org.apache.maven.surefire.testset.RunOrderParameters;
@@ -36,7 +36,7 @@ public class Foo
{
DirectoryScannerParameters directoryScannerParameters;
- Properties providerProperties;
+ Map<String, String> providerProperties;
ReporterConfiguration reporterConfiguration;
@@ -68,7 +68,7 @@ public class Foo
return called;
}
- public void setProviderProperties( Properties providerProperties )
+ public void setProviderProperties( Map<String, String> providerProperties )
{
this.providerProperties = providerProperties;
this.called = true;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-booter/src/test/java/org/apache/maven/surefire/booter/PropertiesWrapperTest.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/PropertiesWrapperTest.java b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/PropertiesWrapperTest.java
index a20f96e..4567b5b 100644
--- a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/PropertiesWrapperTest.java
+++ b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/PropertiesWrapperTest.java
@@ -19,9 +19,7 @@ package org.apache.maven.surefire.booter;
* under the License.
*/
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
+import java.util.*;
import junit.framework.TestCase;
@@ -34,9 +32,7 @@ public class PropertiesWrapperTest
public void testAddList()
throws Exception
{
-
- Properties props = new Properties();
- PropertiesWrapper propertiesWrapper = new PropertiesWrapper( props );
+ PropertiesWrapper propertiesWrapper = new PropertiesWrapper( new HashMap<String, String>() );
List<String> items = new ArrayList<String>();
items.add( "String1" );
items.add( "String2,String3" );
@@ -58,8 +54,7 @@ public class PropertiesWrapperTest
private static final String SECOND_ELEMENT = "foo1";
- private final Properties properties = new Properties();
-
+ private final Map<String, String> properties = new HashMap<String, String>();
private final PropertiesWrapper mapper = new PropertiesWrapper( properties );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java
index d4f48d0..d41849d 100644
--- a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java
+++ b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java
@@ -24,7 +24,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Properties;
+import java.util.HashMap;
import org.apache.maven.surefire.report.ReporterConfiguration;
import org.apache.maven.surefire.testset.DirectoryScannerParameters;
import org.apache.maven.surefire.testset.RunOrderParameters;
@@ -49,7 +49,7 @@ public class SurefireReflectorTest
DirectoryScannerParameters directoryScannerParameters =
new DirectoryScannerParameters( new File( "ABC" ), new ArrayList(), new ArrayList(), new ArrayList(),
- Boolean.FALSE, "hourly" );
+ false, "hourly" );
surefireReflector.setDirectoryScannerParameters( foo, directoryScannerParameters );
assertTrue( isCalled( foo ) );
@@ -86,7 +86,7 @@ public class SurefireReflectorTest
SurefireReflector surefireReflector = getReflector();
Object foo = getFoo();
- surefireReflector.setProviderProperties( foo, new Properties() );
+ surefireReflector.setProviderProperties( foo, new HashMap<String, String>() );
assertTrue( isCalled( foo ) );
}
@@ -103,7 +103,7 @@ public class SurefireReflectorTest
private ReporterConfiguration getReporterConfiguration()
{
- return new ReporterConfiguration( new File( "CDE" ), Boolean.TRUE );
+ return new ReporterConfiguration( new File( "CDE" ), true );
}
public void testTestClassLoaderAware()
@@ -143,7 +143,7 @@ public class SurefireReflectorTest
final Method isCalled;
try
{
- isCalled = foo.getClass().getMethod( "isCalled", new Class[0] );
+ isCalled = foo.getClass().getMethod( "isCalled" );
return (Boolean) isCalled.invoke( foo );
}
catch ( IllegalAccessException e )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
index 361aa04..4635b41 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
@@ -106,7 +106,7 @@ public class HelperAssertions
*/
public static IntegrationTestSuiteResults parseReportList( List<ReportTestSuite> reports )
{
- Assert.assertTrue( "No reports!", reports.size() > 0 );
+ Assert.assertTrue( "No reports!", !reports.isEmpty() );
int total = 0, errors = 0, failures = 0, skipped = 0, flakes = 0;
for ( ReportTestSuite report : reports )
{
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java
index 9ad7715..6cde650 100644
--- a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java
+++ b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java
@@ -38,12 +38,6 @@ public class TestProvider
invokeRuntimeExceptionIfSet( System.getProperty( "constructorCrash" ) );
}
-
- public Boolean isRunnable()
- {
- return Boolean.TRUE;
- }
-
public Iterator getSuites()
{
invokeRuntimeExceptionIfSet( System.getProperty( "getSuitesCrash" ) );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java
----------------------------------------------------------------------
diff --git a/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java b/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java
index cacc691..ba5b637 100644
--- a/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java
+++ b/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java
@@ -117,7 +117,7 @@ public class JUnit4RunListener
{
this.reporter.testError( report );
}
- failureFlag.set( Boolean.TRUE );
+ failureFlag.set( true );
}
protected StackTraceWriter createStackTraceWriter( Failure failure )
@@ -129,7 +129,7 @@ public class JUnit4RunListener
public void testAssumptionFailure( Failure failure )
{
this.reporter.testAssumptionFailure( createReportEntry( failure.getDescription() ) );
- failureFlag.set( Boolean.TRUE );
+ failureFlag.set( true );
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/FilterFactory.java
----------------------------------------------------------------------
diff --git a/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/FilterFactory.java b/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/FilterFactory.java
index 4bdd438..5dd2918 100644
--- a/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/FilterFactory.java
+++ b/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/FilterFactory.java
@@ -27,7 +27,6 @@ import org.apache.maven.surefire.testset.TestListResolver;
import org.junit.runner.manipulation.Filter;
import java.util.Map;
-import java.util.Properties;
import java.util.Set;
/**
@@ -42,10 +41,10 @@ public class FilterFactory
this.testClassLoader = testClassLoader;
}
- public Filter createGroupFilter( Properties providerProperties )
+ public Filter createGroupFilter( Map<String, String> providerProperties )
{
- String groups = providerProperties.getProperty( ProviderParameterNames.TESTNG_GROUPS_PROP );
- String excludedGroups = providerProperties.getProperty( ProviderParameterNames.TESTNG_EXCLUDEDGROUPS_PROP );
+ String groups = providerProperties.get( ProviderParameterNames.TESTNG_GROUPS_PROP );
+ String excludedGroups = providerProperties.get( ProviderParameterNames.TESTNG_EXCLUDEDGROUPS_PROP );
GroupMatcher included = null;
if ( groups != null && groups.trim().length() > 0 )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java b/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
index 536da71..351e9c1 100644
--- a/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
+++ b/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
@@ -85,7 +85,7 @@ public class JUnit4Provider
scanResult = booterParameters.getScanResult();
runOrderCalculator = booterParameters.getRunOrderCalculator();
customRunListeners = JUnit4RunListenerFactory.
- createCustomListeners( booterParameters.getProviderProperties().getProperty( "listener" ) );
+ createCustomListeners( booterParameters.getProviderProperties().get( "listener" ) );
jUnit4TestChecker = new JUnit4TestChecker( testClassLoader );
testResolver = booterParameters.getTestRequest().getTestListResolver();
rerunFailingTestsCount = booterParameters.getTestRequest().getRerunFailingTestsCount();
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-providers/surefire-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4ProviderTest.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4ProviderTest.java b/surefire-providers/surefire-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4ProviderTest.java
index a888162..8f0356c 100644
--- a/surefire-providers/surefire-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4ProviderTest.java
+++ b/surefire-providers/surefire-junit4/src/test/java/org/apache/maven/surefire/junit4/JUnit4ProviderTest.java
@@ -22,15 +22,8 @@ package org.apache.maven.surefire.junit4;
import junit.framework.TestCase;
import org.apache.maven.surefire.booter.BaseProviderFactory;
import org.apache.maven.surefire.testset.TestRequest;
-import org.apache.maven.surefire.util.TestsToRun;
-import org.junit.runner.Description;
-import org.junit.runner.notification.Failure;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
+import java.util.HashMap;
/**
* @author Kristian Rosenvold
@@ -45,8 +38,8 @@ public class JUnit4ProviderTest
private JUnit4Provider getJUnit4Provider()
{
- BaseProviderFactory providerParameters = new BaseProviderFactory( null, Boolean.TRUE );
- providerParameters.setProviderProperties( new Properties() );
+ BaseProviderFactory providerParameters = new BaseProviderFactory( null, true );
+ providerParameters.setProviderProperties( new HashMap<String, String>() );
providerParameters.setClassLoaders( getClass().getClassLoader() );
providerParameters.setTestRequest( new TestRequest( null, null, null ) );
return new JUnit4Provider( providerParameters );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java
index 04031c6..6a7a248 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java
@@ -21,7 +21,7 @@ package org.apache.maven.surefire.junitcore;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Properties;
+import java.util.Map;
import org.apache.maven.surefire.booter.ProviderParameterNames;
@@ -52,7 +52,7 @@ public final class JUnitCoreParameters
private final String parallel;
- private final Boolean perCoreThreadCount;
+ private final boolean perCoreThreadCount;
private final int threadCount;
@@ -66,24 +66,22 @@ public final class JUnitCoreParameters
private final double parallelTestsTimeoutForcedInSeconds;
- private final Boolean useUnlimitedThreads;
+ private final boolean useUnlimitedThreads;
private final boolean parallelOptimization;
- public JUnitCoreParameters( Properties properties )
+ public JUnitCoreParameters( Map<String, String> properties )
{
- parallel = properties.getProperty( PARALLEL_KEY, "none" ).toLowerCase();
- perCoreThreadCount = Boolean.valueOf( properties.getProperty( PERCORETHREADCOUNT_KEY, "true" ) );
- threadCount = Integer.valueOf( properties.getProperty( THREADCOUNT_KEY, "0" ) );
- threadCountMethods = Integer.valueOf( properties.getProperty( THREADCOUNTMETHODS_KEY, "0" ) );
- threadCountClasses = Integer.valueOf( properties.getProperty( THREADCOUNTCLASSES_KEY, "0" ) );
- threadCountSuites = Integer.valueOf( properties.getProperty( THREADCOUNTSUITES_KEY, "0" ) );
- useUnlimitedThreads = Boolean.valueOf( properties.getProperty( USEUNLIMITEDTHREADS_KEY, "false" ) );
- parallelTestsTimeoutInSeconds =
- Math.max( Double.valueOf( properties.getProperty( PARALLEL_TIMEOUT_KEY, "0" ) ), 0 );
- parallelTestsTimeoutForcedInSeconds =
- Math.max( Double.valueOf( properties.getProperty( PARALLEL_TIMEOUTFORCED_KEY, "0" ) ), 0 );
- parallelOptimization = Boolean.valueOf( properties.getProperty( PARALLEL_OPTIMIZE_KEY, "true" ) );
+ parallel = property( properties, PARALLEL_KEY, "none" ).toLowerCase();
+ perCoreThreadCount = property( properties, PERCORETHREADCOUNT_KEY, true );
+ threadCount = property( properties, THREADCOUNT_KEY, 0 );
+ threadCountMethods = property( properties, THREADCOUNTMETHODS_KEY, 0 );
+ threadCountClasses = property( properties, THREADCOUNTCLASSES_KEY, 0 );
+ threadCountSuites = property( properties, THREADCOUNTSUITES_KEY, 0 );
+ useUnlimitedThreads = property( properties, USEUNLIMITEDTHREADS_KEY, false );
+ parallelTestsTimeoutInSeconds = Math.max( property( properties, PARALLEL_TIMEOUT_KEY, 0d ), 0 );
+ parallelTestsTimeoutForcedInSeconds = Math.max( property( properties, PARALLEL_TIMEOUTFORCED_KEY, 0d ), 0 );
+ parallelOptimization = property( properties, PARALLEL_OPTIMIZE_KEY, true );
}
private static Collection<String> lowerCase( String... elements )
@@ -122,12 +120,13 @@ public final class JUnitCoreParameters
* @deprecated Instead use the expression ( {@link #isParallelMethods()} && {@link #isParallelClasses()} ).
*/
@Deprecated
+ @SuppressWarnings( { "unused", "deprecation" } )
public boolean isParallelBoth()
{
return isParallelMethods() && isParallelClasses();
}
- public Boolean isPerCoreThreadCount()
+ public boolean isPerCoreThreadCount()
{
return perCoreThreadCount;
}
@@ -152,7 +151,7 @@ public final class JUnitCoreParameters
return threadCountSuites;
}
- public Boolean isUseUnlimitedThreads()
+ public boolean isUseUnlimitedThreads()
{
return useUnlimitedThreads;
}
@@ -190,4 +189,24 @@ public final class JUnitCoreParameters
+ ", threadCountClasses=" + threadCountClasses + ", threadCountMethods=" + threadCountMethods
+ ", parallelOptimization=" + parallelOptimization;
}
+
+ private static boolean property( Map<String, String> properties, String key, boolean fallback )
+ {
+ return properties.containsKey( key ) ? Boolean.valueOf( properties.get( key ) ) : fallback;
+ }
+
+ private static String property( Map<String, String> properties, String key, String fallback )
+ {
+ return properties.containsKey( key ) ? properties.get( key ) : fallback;
+ }
+
+ private static int property( Map<String, String> properties, String key, int fallback )
+ {
+ return properties.containsKey( key ) ? Integer.valueOf( properties.get( key ) ) : fallback;
+ }
+
+ private static double property( Map<String, String> properties, String key, double fallback )
+ {
+ return properties.containsKey( key ) ? Double.valueOf( properties.get( key ) ) : fallback;
+ }
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
index 66147ad..0cebc84 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
@@ -87,15 +87,10 @@ public class JUnitCoreProvider
testResolver = providerParameters.getTestRequest().getTestListResolver();
rerunFailingTestsCount = providerParameters.getTestRequest().getRerunFailingTestsCount();
customRunListeners = JUnit4RunListenerFactory.createCustomListeners(
- providerParameters.getProviderProperties().getProperty( "listener" ) );
+ providerParameters.getProviderProperties().get( "listener" ) );
jUnit48Reflector = new JUnit48Reflector( testClassLoader );
}
- public Boolean isRunnable()
- {
- return Boolean.TRUE;
- }
-
public Iterator getSuites()
{
testsToRun = scanClassPath();
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java
index acfe429..76bb7c3 100644
--- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java
+++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java
@@ -19,7 +19,8 @@ package org.apache.maven.surefire.junitcore;
* under the License.
*/
-import java.util.Properties;
+import java.util.HashMap;
+import java.util.Map;
import org.junit.Test;
@@ -124,54 +125,54 @@ public class JUnitCoreParametersTest
assertTrue( newTestSetBoth().isParallelismSelected() );
}
- private Properties newDefaultProperties()
+ private Map<String, String> newDefaultProperties()
{
- return new Properties();
+ return new HashMap<String, String>();
}
- private Properties newPropertiesClasses()
+ private Map<String, String> newPropertiesClasses()
{
- Properties props = new Properties();
- props.setProperty( JUnitCoreParameters.PARALLEL_KEY, "classes" );
- props.setProperty( JUnitCoreParameters.PERCORETHREADCOUNT_KEY, "false" );
- props.setProperty( JUnitCoreParameters.THREADCOUNT_KEY, "2" );
- props.setProperty( JUnitCoreParameters.USEUNLIMITEDTHREADS_KEY, "false" );
+ Map<String, String> props = new HashMap<String, String>();
+ props.put(JUnitCoreParameters.PARALLEL_KEY, "classes");
+ props.put(JUnitCoreParameters.PERCORETHREADCOUNT_KEY, "false");
+ props.put(JUnitCoreParameters.THREADCOUNT_KEY, "2");
+ props.put(JUnitCoreParameters.USEUNLIMITEDTHREADS_KEY, "false");
return props;
}
- private Properties newPropertiesMethods()
+ private Map<String, String> newPropertiesMethods()
{
- Properties props = new Properties();
- props.setProperty( JUnitCoreParameters.PARALLEL_KEY, "methods" );
- props.setProperty( JUnitCoreParameters.PERCORETHREADCOUNT_KEY, "false" );
- props.setProperty( JUnitCoreParameters.THREADCOUNT_KEY, "2" );
- props.setProperty( JUnitCoreParameters.USEUNLIMITEDTHREADS_KEY, "true" );
+ Map<String, String> props = new HashMap<String, String>();
+ props.put(JUnitCoreParameters.PARALLEL_KEY, "methods");
+ props.put(JUnitCoreParameters.PERCORETHREADCOUNT_KEY, "false");
+ props.put(JUnitCoreParameters.THREADCOUNT_KEY, "2");
+ props.put(JUnitCoreParameters.USEUNLIMITEDTHREADS_KEY, "true");
return props;
}
- private Properties newPropertiesBoth()
+ private Map<String, String> newPropertiesBoth()
{
- Properties props = new Properties();
- props.setProperty( JUnitCoreParameters.PARALLEL_KEY, "both" );
- props.setProperty( JUnitCoreParameters.PERCORETHREADCOUNT_KEY, "true" );
- props.setProperty( JUnitCoreParameters.THREADCOUNT_KEY, "7" );
- props.setProperty( JUnitCoreParameters.USEUNLIMITEDTHREADS_KEY, "false" );
+ Map<String, String> props = new HashMap<String, String>();
+ props.put(JUnitCoreParameters.PARALLEL_KEY, "both");
+ props.put(JUnitCoreParameters.PERCORETHREADCOUNT_KEY, "true");
+ props.put(JUnitCoreParameters.THREADCOUNT_KEY, "7");
+ props.put(JUnitCoreParameters.USEUNLIMITEDTHREADS_KEY, "false");
return props;
}
- private Properties newPropertiesTimeouts( double timeout, double forcedTimeout )
+ private Map<String, String> newPropertiesTimeouts( double timeout, double forcedTimeout )
{
- Properties props = new Properties();
- props.setProperty( JUnitCoreParameters.PARALLEL_TIMEOUT_KEY, Double.toString( timeout ) );
- props.setProperty( JUnitCoreParameters.PARALLEL_TIMEOUTFORCED_KEY, Double.toString( forcedTimeout ) );
+ Map<String, String> props = new HashMap<String, String>();
+ props.put(JUnitCoreParameters.PARALLEL_TIMEOUT_KEY, Double.toString(timeout));
+ props.put(JUnitCoreParameters.PARALLEL_TIMEOUTFORCED_KEY, Double.toString(forcedTimeout));
return props;
}
- private Properties newPropertiesOptimization( boolean optimize )
+ private Map<String, String> newPropertiesOptimization( boolean optimize )
{
- Properties props = new Properties();
- props.setProperty( JUnitCoreParameters.PARALLEL_OPTIMIZE_KEY, Boolean.toString( optimize ) );
+ Map<String, String> props = new HashMap<String, String>();
+ props.put( JUnitCoreParameters.PARALLEL_OPTIMIZE_KEY, Boolean.toString( optimize ) );
return props;
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java
index 1ee89ef..4563e6d 100644
--- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java
+++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java
@@ -18,11 +18,7 @@ package org.apache.maven.surefire.junitcore;
*/
import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
+import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.maven.plugin.surefire.report.DefaultReporterFactory;
import org.apache.maven.surefire.booter.BaseProviderFactory;
@@ -92,7 +88,7 @@ public class Surefire746Test
ConsoleLogger consoleLogger = new DefaultConsoleReporter( System.out );
providerParameters.setReporterConfiguration( new ReporterConfiguration( new File( "" ), false ) );
- Properties junitProps = new Properties();
+ Map<String, String> junitProps = new HashMap<String, String>();
junitProps.put( ProviderParameterNames.PARALLEL_PROP, "none" );
JUnitCoreParameters jUnitCoreParameters = new JUnitCoreParameters( junitProps );
@@ -102,7 +98,7 @@ public class Surefire746Test
RunListener listener =
ConcurrentRunListener.createInstance( testSetMap, reporterFactory, false, false, consoleLogger );
- TestsToRun testsToRun = new TestsToRun( Arrays.<Class>asList( TestClassTest.class ) );
+ TestsToRun testsToRun = new TestsToRun(Collections.<Class>singletonList( TestClassTest.class ) );
org.junit.runner.notification.RunListener jUnit4RunListener = new JUnitCoreRunListener( listener, testSetMap );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/84fd7235/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/OptimizedParallelComputerTest.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/OptimizedParallelComputerTest.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/OptimizedParallelComputerTest.java
index 67d7683..cb092a6 100644
--- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/OptimizedParallelComputerTest.java
+++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/OptimizedParallelComputerTest.java
@@ -30,7 +30,8 @@ import org.junit.experimental.theories.Theory;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
-import java.util.Properties;
+import java.util.HashMap;
+import java.util.Map;
import static org.apache.maven.surefire.junitcore.JUnitCoreParameters.*;
import static org.apache.maven.surefire.junitcore.pc.ParallelComputerUtil.*;
@@ -74,9 +75,9 @@ public final class OptimizedParallelComputerTest
throws TestSetFailedException
{
overrideAvailableProcessors( cpu );
- Properties properties = new Properties();
- properties.setProperty( PARALLEL_KEY, "suites" );
- properties.setProperty( THREADCOUNT_KEY, "3" );
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put(PARALLEL_KEY, "suites");
+ properties.put(THREADCOUNT_KEY, "3");
JUnitCoreParameters params = new JUnitCoreParameters( properties );
RunnerCounter counter = new RunnerCounter( 5, 10, 20 );
Concurrency concurrency = resolveConcurrency( params, counter );
@@ -94,9 +95,9 @@ public final class OptimizedParallelComputerTest
throws TestSetFailedException
{
overrideAvailableProcessors( cpu );
- Properties properties = new Properties();
- properties.setProperty( PARALLEL_KEY, "classes" );
- properties.setProperty( THREADCOUNT_KEY, "3" );
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put(PARALLEL_KEY, "classes");
+ properties.put(THREADCOUNT_KEY, "3");
JUnitCoreParameters params = new JUnitCoreParameters( properties );
RunnerCounter counter = new RunnerCounter( 1, 5, 10 );
Concurrency concurrency = resolveConcurrency( params, counter );
@@ -114,9 +115,9 @@ public final class OptimizedParallelComputerTest
throws TestSetFailedException
{
overrideAvailableProcessors( cpu );
- Properties properties = new Properties();
- properties.setProperty( PARALLEL_KEY, "methods" );
- properties.setProperty( THREADCOUNT_KEY, "3" );
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put(PARALLEL_KEY, "methods");
+ properties.put(THREADCOUNT_KEY, "3");
JUnitCoreParameters params = new JUnitCoreParameters( properties );
RunnerCounter counter = new RunnerCounter( 1, 2, 5 );
Concurrency concurrency = resolveConcurrency( params, counter );
@@ -134,9 +135,9 @@ public final class OptimizedParallelComputerTest
throws TestSetFailedException
{
overrideAvailableProcessors( cpu );
- Properties properties = new Properties();
- properties.setProperty( PARALLEL_KEY, "both" );
- properties.setProperty( THREADCOUNT_KEY, "3" );
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put(PARALLEL_KEY, "both");
+ properties.put(THREADCOUNT_KEY, "3");
JUnitCoreParameters params = new JUnitCoreParameters( properties );
RunnerCounter counter = new RunnerCounter( 1, 2, 5 );
Concurrency concurrency = resolveConcurrency( params, counter );
@@ -154,9 +155,9 @@ public final class OptimizedParallelComputerTest
throws TestSetFailedException
{
overrideAvailableProcessors( cpu );
- Properties properties = new Properties();
- properties.setProperty( PARALLEL_KEY, "classesAndMethods" );
- properties.setProperty( THREADCOUNT_KEY, "3" );
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put(PARALLEL_KEY, "classesAndMethods");
+ properties.put(THREADCOUNT_KEY, "3");
JUnitCoreParameters params = new JUnitCoreParameters( properties );
RunnerCounter counter = new RunnerCounter( 1, 2, 5 );
Concurrency concurrency = resolveConcurrency( params, counter );
@@ -174,9 +175,9 @@ public final class OptimizedParallelComputerTest
throws TestSetFailedException
{
overrideAvailableProcessors( cpu );
- Properties properties = new Properties();
- properties.setProperty( PARALLEL_KEY, "suitesAndMethods" );
- properties.setProperty( THREADCOUNT_KEY, "3" );
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put(PARALLEL_KEY, "suitesAndMethods");
+ properties.put(THREADCOUNT_KEY, "3");
JUnitCoreParameters params = new JUnitCoreParameters( properties );
RunnerCounter counter = new RunnerCounter( 2, 3, 5 );
Concurrency concurrency = resolveConcurrency( params, counter );
@@ -194,9 +195,9 @@ public final class OptimizedParallelComputerTest
throws TestSetFailedException
{
overrideAvailableProcessors( cpu );
- Properties properties = new Properties();
- properties.setProperty( PARALLEL_KEY, "suitesAndClasses" );
- properties.setProperty( THREADCOUNT_KEY, "3" );
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put(PARALLEL_KEY, "suitesAndClasses");
+ properties.put(THREADCOUNT_KEY, "3");
JUnitCoreParameters params = new JUnitCoreParameters( properties );
RunnerCounter counter = new RunnerCounter( 2, 5, 20 );
Concurrency concurrency = resolveConcurrency( params, counter );
@@ -214,9 +215,9 @@ public final class OptimizedParallelComputerTest
throws TestSetFailedException
{
overrideAvailableProcessors( cpu );
- Properties properties = new Properties();
- properties.setProperty( PARALLEL_KEY, "all" );
- properties.setProperty( THREADCOUNT_KEY, "3" );
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put(PARALLEL_KEY, "all");
+ properties.put(THREADCOUNT_KEY, "3");
JUnitCoreParameters params = new JUnitCoreParameters( properties );
RunnerCounter counter = new RunnerCounter( 2, 5, 20 );
Concurrency concurrency = resolveConcurrency( params, counter );
@@ -235,10 +236,10 @@ public final class OptimizedParallelComputerTest
{
// 4 * cpu to 5 * cpu threads to run test classes
overrideAvailableProcessors( cpu );
- Properties properties = new Properties();
- properties.setProperty( PARALLEL_KEY, "suitesAndClasses" );
- properties.setProperty( THREADCOUNT_KEY, "6" );
- properties.setProperty( THREADCOUNTSUITES_KEY, "2" );
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put(PARALLEL_KEY, "suitesAndClasses");
+ properties.put(THREADCOUNT_KEY, "6");
+ properties.put(THREADCOUNTSUITES_KEY, "2");
JUnitCoreParameters params = new JUnitCoreParameters( properties );
RunnerCounter counter = new RunnerCounter( 3, 5, 20 );
Concurrency concurrency = resolveConcurrency( params, counter );
@@ -257,10 +258,10 @@ public final class OptimizedParallelComputerTest
{
// 4 * cpu to 5 * cpu threads to run test methods
overrideAvailableProcessors( cpu );
- Properties properties = new Properties();
- properties.setProperty( PARALLEL_KEY, "suitesAndMethods" );
- properties.setProperty( THREADCOUNT_KEY, "6" );
- properties.setProperty( THREADCOUNTSUITES_KEY, "2" );
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put(PARALLEL_KEY, "suitesAndMethods");
+ properties.put(THREADCOUNT_KEY, "6");
+ properties.put(THREADCOUNTSUITES_KEY, "2");
JUnitCoreParameters params = new JUnitCoreParameters( properties );
RunnerCounter counter = new RunnerCounter( 3, 5, 20 );
Concurrency concurrency = resolveConcurrency( params, counter );
@@ -279,10 +280,10 @@ public final class OptimizedParallelComputerTest
{
// 4 * cpu to 5 * cpu threads to run test methods
overrideAvailableProcessors( cpu );
- Properties properties = new Properties();
- properties.setProperty( PARALLEL_KEY, "classesAndMethods" );
- properties.setProperty( THREADCOUNT_KEY, "6" );
- properties.setProperty( THREADCOUNTCLASSES_KEY, "2" );
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put(PARALLEL_KEY, "classesAndMethods");
+ properties.put(THREADCOUNT_KEY, "6");
+ properties.put(THREADCOUNTCLASSES_KEY, "2");
JUnitCoreParameters params = new JUnitCoreParameters( properties );
RunnerCounter counter = new RunnerCounter( 3, 5, 20 );
Concurrency concurrency = resolveConcurrency( params, counter );
@@ -301,11 +302,11 @@ public final class OptimizedParallelComputerTest
{
// 8 * cpu to 13 * cpu threads to run test methods
overrideAvailableProcessors( cpu );
- Properties properties = new Properties();
- properties.setProperty( PARALLEL_KEY, "all" );
- properties.setProperty( THREADCOUNT_KEY, "14" );
- properties.setProperty( THREADCOUNTSUITES_KEY, "2" );
- properties.setProperty( THREADCOUNTCLASSES_KEY, "4" );
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put( PARALLEL_KEY, "all" );
+ properties.put( THREADCOUNT_KEY, "14" );
+ properties.put( THREADCOUNTSUITES_KEY, "2" );
+ properties.put( THREADCOUNTCLASSES_KEY, "4" );
JUnitCoreParameters params = new JUnitCoreParameters( properties );
RunnerCounter counter = new RunnerCounter( 3, 5, 20 );
Concurrency concurrency = resolveConcurrency( params, counter );