You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kr...@apache.org on 2011/12/24 10:48:41 UTC
svn commit: r1222949 - in /maven/surefire/trunk:
maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/
maven-surefire-common/src/main/java/org/apache/maven/plugin/sur...
Author: krosenvold
Date: Sat Dec 24 09:48:40 2011
New Revision: 1222949
URL: http://svn.apache.org/viewvc?rev=1222949&view=rev
Log:
o Added generics
Modified:
maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ChecksumCalculator.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterFactory.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/booter/StartupReportConfiguration.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/FileReporter.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/MulticastingReporter.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/TestSetRunListener.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/util/Relocator.java
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
Modified: maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java (original)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java Sat Dec 24 09:48:40 2011
@@ -29,6 +29,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+
+import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -139,7 +141,7 @@ public class IntegrationTestMojo
* @parameter
* @since 2.6
*/
- private List classpathDependencyExcludes;
+ private List<String> classpathDependencyExcludes;
/**
* A dependency scope to exclude from the test classpath. The scope should be one of the scopes defined by
@@ -164,7 +166,7 @@ public class IntegrationTestMojo
* @parameter
* @since 2.4
*/
- private List additionalClasspathElements;
+ private List<String> additionalClasspathElements;
/**
* Base directory where all reports are written to.
@@ -214,7 +216,7 @@ public class IntegrationTestMojo
*
* @parameter
*/
- private List includes;
+ private List<String> includes;
/**
* A list of <exclude> elements specifying the tests (by pattern) that should be excluded in testing. When not
@@ -230,7 +232,7 @@ public class IntegrationTestMojo
*
* @parameter
*/
- private List excludes;
+ private List<String> excludes;
/**
* ArtifactRepository of the localRepository. To obtain the directory of localRepository in unit tests use
@@ -256,7 +258,7 @@ public class IntegrationTestMojo
* @parameter
* @since 2.5
*/
- private Map systemPropertyVariables;
+ private Map<String,String> systemPropertyVariables;
/**
* List of System properties, loaded from a file, to pass to the JUnit tests.
@@ -282,7 +284,7 @@ public class IntegrationTestMojo
* @required
* @readonly
*/
- private Map pluginArtifactMap;
+ private Map<String,Artifact> pluginArtifactMap;
/**
* Map of project artifacts.
@@ -291,7 +293,7 @@ public class IntegrationTestMojo
* @required
* @readonly
*/
- private Map projectArtifactMap;
+ private Map<String,Artifact> projectArtifactMap;
/**
* The summary file to write integration test results to.
@@ -402,7 +404,7 @@ public class IntegrationTestMojo
* @parameter
* @since 2.1.3
*/
- private Map environmentVariables = new HashMap();
+ private Map<String,String> environmentVariables = new HashMap<String,String>();
/**
* Command line working directory.
@@ -901,22 +903,22 @@ public class IntegrationTestMojo
return null;
}
- public List getIncludes()
+ public List<String> getIncludes()
{
return includes;
}
- public void setIncludes( List includes )
+ public void setIncludes( List<String> includes )
{
this.includes = includes;
}
- public List getExcludes()
+ public List<String> getExcludes()
{
return excludes;
}
- public void setExcludes( List excludes )
+ public void setExcludes( List<String> excludes )
{
this.excludes = excludes;
}
@@ -1111,12 +1113,12 @@ public class IntegrationTestMojo
this.forkedProcessTimeoutInSeconds = forkedProcessTimeoutInSeconds;
}
- public Map getEnvironmentVariables()
+ public Map<String,String> getEnvironmentVariables()
{
return environmentVariables;
}
- public void setEnvironmentVariables( Map environmentVariables )
+ public void setEnvironmentVariables( Map<String,String> environmentVariables )
{
this.environmentVariables = environmentVariables;
}
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java Sat Dec 24 09:48:40 2011
@@ -146,7 +146,7 @@ public abstract class AbstractSurefireMo
getRemoteRepositories(), getMetadataSource(), getPluginName() );
}
- protected List createProviders()
+ protected List<ProviderInfo> createProviders()
throws MojoFailureException
{
try
@@ -169,11 +169,10 @@ public abstract class AbstractSurefireMo
private Summary executeAllProviders()
throws MojoExecutionException, MojoFailureException
{
- List providers = createProviders();
+ List<ProviderInfo> providers = createProviders();
Summary summary = new Summary();
- for ( Iterator iter = providers.iterator(); iter.hasNext(); )
+ for ( ProviderInfo provider : providers )
{
- ProviderInfo provider = (ProviderInfo) iter.next();
executeProvider( provider, summary );
}
return summary;
@@ -357,7 +356,7 @@ public abstract class AbstractSurefireMo
throws MojoExecutionException, MojoFailureException
{
ReporterConfiguration reporterConfiguration =
- new ReporterConfiguration( getReportsDirectory(), Boolean.valueOf( isTrimStackTrace() ) );
+ new ReporterConfiguration( getReportsDirectory(), isTrimStackTrace() );
Artifact testNgArtifact;
try
@@ -380,7 +379,7 @@ public abstract class AbstractSurefireMo
if ( isValidSuiteXmlFileConfig() && getTest() == null )
{
- failIfNoTests = getFailIfNoTests() != null && getFailIfNoTests().booleanValue();
+ failIfNoTests = getFailIfNoTests() != null && getFailIfNoTests();
if ( !isTestNg )
{
throw new MojoExecutionException( "suiteXmlFiles is configured, but there is no TestNG dependency" );
@@ -393,12 +392,12 @@ public abstract class AbstractSurefireMo
setFailIfNoTests( Boolean.TRUE );
}
- failIfNoTests = getFailIfNoTests() != null && getFailIfNoTests().booleanValue();
+ failIfNoTests = getFailIfNoTests() != null && getFailIfNoTests();
List includes = getIncludeList();
List excludes = getExcludeList();
directoryScannerParameters = new DirectoryScannerParameters( getTestClassesDirectory(), includes, excludes,
- Boolean.valueOf( failIfNoTests ),
+ failIfNoTests,
getRunOrder() );
}
@@ -479,9 +478,9 @@ public abstract class AbstractSurefireMo
void logClasspath( Classpath classpath, String descriptor )
{
getLog().debug( descriptor + " classpath:" );
- for ( Iterator i = classpath.getClassPath().iterator(); i.hasNext(); )
+ @SuppressWarnings( "unchecked" ) final List<String> classPath = classpath.getClassPath();
+ for ( String classpathElement : classPath )
{
- String classpathElement = (String) i.next();
if ( classpathElement == null )
{
getLog().warn( "The test classpath contains a null element." );
@@ -504,16 +503,16 @@ public abstract class AbstractSurefireMo
return getSuiteXmlFiles() != null && getSuiteXmlFiles().length > 0;
}
- private List getExcludeList()
+ private List<String> getExcludeList()
{
- List excludes;
+ List<String> excludes;
if ( isSpecificTestSpecified() )
{
// Check to see if we are running a single test. The raw parameter will
// come through if it has not been set.
// FooTest -> **/FooTest.java
- excludes = new ArrayList();
+ excludes = new ArrayList<String>();
}
else
{
@@ -524,15 +523,15 @@ public abstract class AbstractSurefireMo
// Have to wrap in an ArrayList as surefire expects an ArrayList instead of a List for some reason
if ( excludes == null || excludes.size() == 0 )
{
- excludes = new ArrayList( Arrays.asList( new String[]{ "**/*$*" } ) );
+ excludes = new ArrayList<String>( Arrays.asList( new String[]{ "**/*$*" } ) );
}
}
return excludes;
}
- private List getIncludeList()
+ private List<String> getIncludeList()
{
- List includes;
+ List<String> includes;
if ( isSpecificTestSpecified() )
{
// Check to see if we are running a single test. The raw parameter will
@@ -540,13 +539,12 @@ public abstract class AbstractSurefireMo
// FooTest -> **/FooTest.java
- includes = new ArrayList();
+ includes = new ArrayList<String>();
String[] testRegexes = StringUtils.split( getTest(), "," );
- for ( int i = 0; i < testRegexes.length; i++ )
+ for ( String testRegex : testRegexes )
{
- String testRegex = testRegexes[i];
if ( testRegex.endsWith( ".java" ) )
{
testRegex = testRegex.substring( 0, testRegex.length() - 5 );
@@ -564,7 +562,7 @@ public abstract class AbstractSurefireMo
// Have to wrap in an ArrayList as surefire expects an ArrayList instead of a List for some reason
if ( includes == null || includes.size() == 0 )
{
- includes = new ArrayList( Arrays.asList( getDefaultIncludes() ) );
+ includes = new ArrayList<String>( Arrays.asList( getDefaultIncludes() ) );
}
}
return includes;
@@ -745,11 +743,10 @@ public abstract class AbstractSurefireMo
private void verifyLegalSystemProperties()
{
final Properties properties = getInternalSystemProperties();
- Iterator iter = properties.keySet().iterator();
- while ( iter.hasNext() )
+ for ( Object o : properties.keySet() )
{
- String key = (String) iter.next();
+ String key = (String) o;
if ( "java.library.path".equals( key ) )
{
@@ -834,7 +831,7 @@ public abstract class AbstractSurefireMo
{
// A tribute to Linus Torvalds
String configChecksum = getConfigChecksum();
- Map pluginContext = getPluginContext();
+ @SuppressWarnings( "unchecked" ) Map<String,String> pluginContext = getPluginContext();
if ( pluginContext.containsKey( configChecksum ) )
{
getLog().info( "Skipping execution of surefire because it has already been run for this configuration" );
@@ -868,13 +865,13 @@ public abstract class AbstractSurefireMo
throws InvalidVersionSpecificationException, MojoFailureException, ArtifactResolutionException,
ArtifactNotFoundException
{
- List classpath = new ArrayList( 2 + getProject().getArtifacts().size() );
+ List<String> classpath = new ArrayList<String>( 2 + getProject().getArtifacts().size() );
classpath.add( getTestClassesDirectory().getAbsolutePath() );
classpath.add( getClassesDirectory().getAbsolutePath() );
- Set classpathArtifacts = getProject().getArtifacts();
+ Set<Artifact> classpathArtifacts = getProject().getArtifacts();
if ( getClasspathDependencyScopeExclude() != null && !getClasspathDependencyScopeExclude().equals( "" ) )
{
@@ -888,9 +885,8 @@ public abstract class AbstractSurefireMo
classpathArtifacts = this.filterArtifacts( classpathArtifacts, dependencyFilter );
}
- for ( Iterator iter = classpathArtifacts.iterator(); iter.hasNext(); )
+ for ( Artifact artifact : classpathArtifacts )
{
- Artifact artifact = (Artifact) iter.next();
if ( artifact.getArtifactHandler().isAddedToClasspath() )
{
File file = artifact.getFile();
@@ -948,13 +944,12 @@ public abstract class AbstractSurefireMo
* @param filter The filter to apply
* @return The filtered result
*/
- private Set filterArtifacts( Set artifacts, ArtifactFilter filter )
+ private Set<Artifact> filterArtifacts( Set<Artifact> artifacts, ArtifactFilter filter )
{
- Set filteredArtifacts = new LinkedHashSet();
+ Set<Artifact> filteredArtifacts = new LinkedHashSet<Artifact>();
- for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
+ for ( Artifact artifact : artifacts )
{
- Artifact artifact = (Artifact) iter.next();
if ( !filter.include( artifact ) )
{
filteredArtifacts.add( artifact );
@@ -966,9 +961,9 @@ public abstract class AbstractSurefireMo
private void showMap( Map map, String setting )
{
- for ( Iterator i = map.keySet().iterator(); i.hasNext(); )
+ for ( Object o : map.keySet() )
{
- String key = (String) i.next();
+ String key = (String) o;
String value = (String) map.get( key );
getLog().debug( "Setting " + setting + " [" + key + "]=[" + value + "]" );
}
@@ -1006,10 +1001,10 @@ public abstract class AbstractSurefireMo
{
ArtifactResolutionResult result = resolveArtifact( null, surefireArtifact );
- List items = new ArrayList();
- for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); )
+ List<String> items = new ArrayList<String>();
+ for ( Object o : result.getArtifacts() )
{
- Artifact artifact = (Artifact) i.next();
+ Artifact artifact = (Artifact) o;
getLog().debug(
"Adding to " + getPluginName() + " booter test classpath: " + artifact.getFile().getAbsolutePath() +
@@ -1059,9 +1054,9 @@ public abstract class AbstractSurefireMo
if ( this.getSystemPropertyVariables() != null )
{
- for ( Iterator i = getSystemPropertyVariables().keySet().iterator(); i.hasNext(); )
+ for ( Object o : getSystemPropertyVariables().keySet() )
{
- String key = (String) i.next();
+ String key = (String) o;
String value = (String) getSystemPropertyVariables().get( key );
//java Properties does not accept null value
if ( value != null )
@@ -1087,11 +1082,10 @@ public abstract class AbstractSurefireMo
if ( setInSystem )
{
// Add all system properties configured by the user
- Iterator iter = getInternalSystemProperties().keySet().iterator();
- while ( iter.hasNext() )
+ for ( Object o : getInternalSystemProperties().keySet() )
{
- String key = (String) iter.next();
+ String key = (String) o;
String value = getInternalSystemProperties().getProperty( key );
@@ -1104,9 +1098,9 @@ public abstract class AbstractSurefireMo
{
if ( properties != null )
{
- for ( Iterator i = properties.keySet().iterator(); i.hasNext(); )
+ for ( Object o : properties.keySet() )
{
- String key = (String) i.next();
+ String key = (String) o;
String value = properties.getProperty( key );
getInternalSystemProperties().setProperty( key, value );
}
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java Sat Dec 24 09:48:40 2011
@@ -68,13 +68,11 @@ public class CommonReflector
String.class, boolean.class } );
//noinspection BooleanConstructorCall
final Object[] params =
- { new Boolean( reporterConfiguration.isUseFile() ), new Boolean( reporterConfiguration.isPrintSummary() ),
- reporterConfiguration.getReportFormat(),
- new Boolean( reporterConfiguration.isRedirectTestOutputToFile() ),
- new Boolean( reporterConfiguration.isDisableXmlReport() ), reporterConfiguration.getReportsDirectory(),
- new Boolean( reporterConfiguration.isTrimStackTrace() ), reporterConfiguration.getReportNameSuffix(),
- reporterConfiguration.getConfigurationHash(),
- Boolean.valueOf( reporterConfiguration.isRequiresRunHistory() ) };
+ { reporterConfiguration.isUseFile(), reporterConfiguration.isPrintSummary(),
+ reporterConfiguration.getReportFormat(), reporterConfiguration.isRedirectTestOutputToFile(),
+ reporterConfiguration.isDisableXmlReport(), reporterConfiguration.getReportsDirectory(),
+ reporterConfiguration.isTrimStackTrace(), reporterConfiguration.getReportNameSuffix(),
+ reporterConfiguration.getConfigurationHash(), reporterConfiguration.isRequiresRunHistory() };
return ReflectionUtils.newInstance( constructor, params );
}
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java Sat Dec 24 09:48:40 2011
@@ -26,7 +26,6 @@ import org.apache.maven.surefire.util.Ne
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -46,18 +45,15 @@ public class ProviderList
}
- public List resolve( Log log )
+ public List<ProviderInfo> resolve( Log log )
{
- List providersToRun = new ArrayList();
+ List<ProviderInfo> providersToRun = new ArrayList<ProviderInfo>();
- Set manuallyConfiguredProviders = getManuallyConfiguredProviders();
+ Set<String> manuallyConfiguredProviders = getManuallyConfiguredProviders();
if ( manuallyConfiguredProviders.size() > 0 )
{
- Iterator iter = manuallyConfiguredProviders.iterator();
- String name;
- while ( iter.hasNext() )
+ for ( String name : manuallyConfiguredProviders )
{
- name = (String) iter.next();
ProviderInfo wellKnown = findByName( name );
ProviderInfo providerToAdd = wellKnown != null ? wellKnown : dynamicProvider.instantiate( name );
log.info( "Using configured provider " + providerToAdd.getProviderName() );
@@ -69,21 +65,21 @@ public class ProviderList
return autoDetectOneProvider();
}
- private List autoDetectOneProvider()
+ private List<ProviderInfo> autoDetectOneProvider()
{
- List providersToRun = new ArrayList();
- for ( int i = 0; i < wellKnownProviders.length; i++ )
+ List<ProviderInfo> providersToRun = new ArrayList<ProviderInfo>();
+ for ( ProviderInfo wellKnownProvider : wellKnownProviders )
{
- if ( wellKnownProviders[i].isApplicable() )
+ if ( wellKnownProvider.isApplicable() )
{
- providersToRun.add( wellKnownProviders[i] );
+ providersToRun.add( wellKnownProvider );
return providersToRun;
}
}
return providersToRun;
}
- private Set getManuallyConfiguredProviders()
+ private Set<String> getManuallyConfiguredProviders()
{
try
{
@@ -101,9 +97,8 @@ public class ProviderList
private ProviderInfo findByName( String providerClassName )
{
- for ( int i = 0; i < wellKnownProviders.length; i++ )
+ for ( ProviderInfo wellKnownProvider : wellKnownProviders )
{
- ProviderInfo wellKnownProvider = wellKnownProviders[i];
if ( wellKnownProvider.getProviderName().equals( providerClassName ) )
{
return wellKnownProvider;
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java Sat Dec 24 09:48:40 2011
@@ -19,11 +19,6 @@ package org.apache.maven.plugin.surefire
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
@@ -41,6 +36,11 @@ import org.apache.maven.artifact.version
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.surefire.booter.Classpath;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
/**
* Does dependency resolution and artifact handling for the surefire plugin.
*
@@ -131,11 +131,11 @@ public class SurefireDependencyResolver
VersionRange.createFromVersion( version ),
"jar", null, Artifact.SCOPE_TEST );
ArtifactResolutionResult result = resolveArtifact( filteredArtifact, providerArtifact );
- List files = new ArrayList();
+ List<String> files = new ArrayList<String>();
- for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); )
+ for ( Object o : result.getArtifacts() )
{
- Artifact artifact = (Artifact) i.next();
+ Artifact artifact = (Artifact) o;
log.debug(
"Adding to " + pluginName + " test classpath: " + artifact.getFile().getAbsolutePath() + " Scope: "
@@ -149,13 +149,13 @@ public class SurefireDependencyResolver
public Classpath addProviderToClasspath( Map pluginArtifactMap, Artifact surefireArtifact )
throws ArtifactResolutionException, ArtifactNotFoundException
{
- List files = new ArrayList();
+ List<String> files = new ArrayList<String>();
if ( surefireArtifact != null )
{
final ArtifactResolutionResult artifactResolutionResult = resolveArtifact( null, surefireArtifact );
- for ( Iterator iterator = pluginArtifactMap.values().iterator(); iterator.hasNext(); )
+ for ( Object o : pluginArtifactMap.values() )
{
- Artifact artifact = (Artifact) iterator.next();
+ Artifact artifact = (Artifact) o;
if ( !artifactResolutionResult.getArtifacts().contains( artifact ) )
{
files.add( artifact.getFile().getAbsolutePath() );
@@ -165,9 +165,9 @@ public class SurefireDependencyResolver
else
{
// Bit of a brute force strategy if not found. Should probably be improved
- for ( Iterator iterator = pluginArtifactMap.values().iterator(); iterator.hasNext(); )
+ for ( Object o : pluginArtifactMap.values() )
{
- Artifact artifact = (Artifact) iterator.next();
+ Artifact artifact = (Artifact) o;
files.add( artifact.getFile().getPath() );
}
}
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java Sat Dec 24 09:48:40 2011
@@ -94,13 +94,13 @@ public interface SurefireExecutionParame
void setTest( String test );
- List getIncludes();
+ List<String> getIncludes();
- void setIncludes( List includes );
+ void setIncludes( List<String> includes );
- List getExcludes();
+ List<String> getExcludes();
- void setExcludes( List excludes );
+ void setExcludes( List<String> excludes );
ArtifactRepository getLocalRepository();
@@ -170,9 +170,9 @@ public interface SurefireExecutionParame
void setForkedProcessTimeoutInSeconds( int forkedProcessTimeoutInSeconds );
- Map getEnvironmentVariables();
+ Map<String,String> getEnvironmentVariables();
- void setEnvironmentVariables( Map environmentVariables );
+ void setEnvironmentVariables( Map<String,String> environmentVariables );
File getWorkingDirectory();
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java Sat Dec 24 09:48:40 2011
@@ -46,13 +46,10 @@ public final class SurefireHelper
String msg;
-// System.out.println( "");
-// System.out.println( result.getTestSetSummary() );
-
if ( result.getCompletedCount() == 0 )
{
if ( ( reportParameters.getFailIfNoTests() == null )
- || !reportParameters.getFailIfNoTests().booleanValue() )
+ || !reportParameters.getFailIfNoTests() )
{
return;
}
@@ -101,7 +98,7 @@ public final class SurefireHelper
if ( result == ProviderConfiguration.NO_TESTS_EXIT_CODE )
{
if ( ( reportParameters.getFailIfNoTests() == null )
- || !reportParameters.getFailIfNoTests().booleanValue() )
+ || !reportParameters.getFailIfNoTests() )
{
return;
}
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ChecksumCalculator.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ChecksumCalculator.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ChecksumCalculator.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ChecksumCalculator.java Sat Dec 24 09:48:40 2011
@@ -28,7 +28,6 @@ import java.io.UnsupportedEncodingExcept
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -40,7 +39,7 @@ public class ChecksumCalculator
{
private static final String HEX = "0123456789ABCDEF";
- private final List checksumItems = new ArrayList();
+ private final List<Object> checksumItems = new ArrayList<Object>();
private void appendObject( Object item )
{
@@ -54,7 +53,7 @@ public class ChecksumCalculator
public void add( int value )
{
- checksumItems.add( new Integer( value ) );
+ checksumItems.add( value );
}
public void add( Map map )
@@ -84,11 +83,10 @@ public class ChecksumCalculator
{
if ( items != null )
{
- int size = items.size();
Object item;
- for ( int i = 0; i < size; i++ )
+ for ( Object item1 : items )
{
- item = items.get( i );
+ item = item1;
appendObject( item );
}
}
@@ -146,9 +144,9 @@ public class ChecksumCalculator
{
StringBuilder result = new StringBuilder();
Object item;
- for ( Iterator iter = checksumItems.iterator(); iter.hasNext(); )
+ for ( Object checksumItem : checksumItems )
{
- item = iter.next();
+ item = checksumItem;
result.append( item != null ? item.toString() : "null" );
}
return result.toString();
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java Sat Dec 24 09:48:40 2011
@@ -24,6 +24,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Set;
@@ -36,14 +37,14 @@ import java.util.Set;
public class ProviderDetector
{
- public static Set getServiceNames( Class clazz, ClassLoader classLoader )
+ public static Set<String> getServiceNames( Class clazz, ClassLoader classLoader )
throws IOException
{
final String resourceName = "META-INF/services/" + clazz.getName();
if ( classLoader == null )
{
- return new HashSet( );
+ return Collections.emptySet();
}
final Enumeration urlEnumeration = classLoader.getResources( resourceName );
return getNames( urlEnumeration );
@@ -58,10 +59,10 @@ public class ProviderDetector
* @throws IOException When reading the streams fails
* @return The set of service provider names
*/
- private static Set getNames( final Enumeration urlEnumeration )
+ private static Set<String> getNames( final Enumeration urlEnumeration )
throws IOException
{
- final Set names = new HashSet();
+ final Set<String> names = new HashSet<String>();
nextUrl:
while ( urlEnumeration.hasMoreElements() )
{
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterFactory.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterFactory.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterFactory.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterFactory.java Sat Dec 24 09:48:40 2011
@@ -19,10 +19,6 @@ package org.apache.maven.plugin.surefire
* under the License.
*/
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
import org.apache.maven.surefire.booter.StartupReportConfiguration;
import org.apache.maven.surefire.report.ConsoleLogger;
@@ -36,6 +32,10 @@ import org.apache.maven.surefire.report.
import org.apache.maven.surefire.report.TestSetRunListener;
import org.apache.maven.surefire.suite.RunResult;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Provides RunListener implementations to the providers.
* <p/>
@@ -70,7 +70,7 @@ public class FileReporterFactory
{
//noinspection BooleanConstructorCall
return new ReporterConfiguration( reportConfiguration.getReportsDirectory(),
- new Boolean( reportConfiguration.isTrimStackTrace() ) );
+ reportConfiguration.isTrimStackTrace() );
}
public RunListener createReporter()
@@ -83,10 +83,10 @@ public class FileReporterFactory
statisticsReporter, globalStats );
}
- private List instantiateReports()
+ private List<Reporter> instantiateReports()
{
final PrintStream sout = reporterConfiguration.getOriginalSystemOut();
- List result = new ArrayList();
+ List<Reporter> result = new ArrayList<Reporter>();
addIfNotNull( result, reportConfiguration.instantiateConsoleReporter() );
addIfNotNull( result, reportConfiguration.instantiateFileReporter() );
addIfNotNull( result, reportConfiguration.instantiateXmlReporter() );
@@ -95,7 +95,7 @@ public class FileReporterFactory
return result;
}
- private void addIfNotNull( List result, Reporter reporter )
+ private void addIfNotNull( List<Reporter> result, Reporter reporter )
{
if ( reporter != null )
{
@@ -132,18 +132,18 @@ public class FileReporterFactory
if ( globalStats.hadFailures() )
{
multicastingReporter.writeMessage( "Failed tests: " );
- for ( Iterator iterator = this.globalStats.getFailureSources().iterator(); iterator.hasNext(); )
+ for ( Object o : this.globalStats.getFailureSources() )
{
- logger.info( " " + iterator.next() );
+ logger.info( " " + o );
}
logger.info( "" );
}
if ( globalStats.hadErrors() )
{
logger.info( "Tests in error: " );
- for ( Iterator iterator = this.globalStats.getErrorSources().iterator(); iterator.hasNext(); )
+ for ( Object o : this.globalStats.getErrorSources() )
{
- logger.info( " " + iterator.next() );
+ logger.info( " " + o );
}
logger.info( "" );
}
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/booter/StartupReportConfiguration.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/booter/StartupReportConfiguration.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/booter/StartupReportConfiguration.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/booter/StartupReportConfiguration.java Sat Dec 24 09:48:40 2011
@@ -19,11 +19,6 @@ package org.apache.maven.surefire.booter
* under the License.
*/
-import java.io.File;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
import org.apache.maven.surefire.report.AbstractConsoleReporter;
import org.apache.maven.surefire.report.AbstractFileReporter;
@@ -37,6 +32,10 @@ import org.apache.maven.surefire.report.
import org.apache.maven.surefire.report.Reporter;
import org.apache.maven.surefire.report.XMLReporter;
+import java.io.File;
+import java.io.PrintStream;
+import java.util.Properties;
+
/**
* All the parameters used to construct reporters
* <p/>
@@ -137,15 +136,6 @@ public class StartupReportConfiguration
return reportsDirectory;
}
- public String getXmlReporterName()
- {
- if ( !isDisableXmlReport() )
- {
- return XMLReporter.class.getName();
- }
- return null;
- }
-
public XMLReporter instantiateXmlReporter()
{
if ( !isDisableXmlReport() )
@@ -155,22 +145,6 @@ public class StartupReportConfiguration
return null;
}
- public String getFileReporter()
- {
- if ( isUseFile() )
- {
- if ( BRIEF_REPORT_FORMAT.equals( getReportFormat() ) )
- {
- return BriefFileReporter.class.getName();
- }
- else if ( PLAIN_REPORT_FORMAT.equals( getReportFormat() ) )
- {
- return FileReporter.class.getName();
- }
- }
- return null;
- }
-
public AbstractFileReporter instantiateFileReporter()
{
if ( isUseFile() )
@@ -188,28 +162,6 @@ public class StartupReportConfiguration
}
- /**
- * Returns the reporter that will write to the console
- *
- * @return a console reporter of null if no console reporting
- */
- public String getConsoleReporter()
- {
- if ( isUseFile() )
- {
- return isPrintSummary() ? ConsoleReporter.class.getName() : null;
- }
- else if ( isRedirectTestOutputToFile() || BRIEF_REPORT_FORMAT.equals( getReportFormat() ) )
- {
- return BriefConsoleReporter.class.getName();
- }
- else if ( PLAIN_REPORT_FORMAT.equals( getReportFormat() ) )
- {
- return DetailedConsoleReporter.class.getName();
- }
- return null;
- }
-
public AbstractConsoleReporter instantiateConsoleReporter()
{
if ( isUseFile() )
@@ -227,18 +179,6 @@ public class StartupReportConfiguration
return null;
}
- public String getConsoleOutputFileReporterName()
- {
- if ( isRedirectTestOutputToFile() )
- {
- return ConsoleOutputFileReporter.class.getName();
- }
- else
- {
- return ConsoleOutputDirectReporter.class.getName();
- }
- }
-
public Reporter instantiateConsoleOutputFileReporter( PrintStream originalSystemOut )
{
if ( isRedirectTestOutputToFile() )
@@ -267,30 +207,6 @@ public class StartupReportConfiguration
}
- /**
- * A list of classnames representing runnable reports for this test-run.
- *
- * @return A list of strings, each string is a classname of a class
- * implementing the org.apache.maven.surefire.report.Reporter interface
- */
- public List getReports()
- {
- ArrayList reports = new ArrayList();
- addIfNotNull( reports, getConsoleReporter() );
- addIfNotNull( reports, getFileReporter() );
- addIfNotNull( reports, getXmlReporterName() );
- addIfNotNull( reports, getConsoleOutputFileReporterName() );
- return reports;
- }
-
- private void addIfNotNull( ArrayList reports, String reporter )
- {
- if ( reporter != null )
- {
- reports.add( reporter );
- }
- }
-
public Properties getTestVmSystemProperties()
{
return testVmSystemProperties;
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java Sat Dec 24 09:48:40 2011
@@ -21,7 +21,6 @@ package org.apache.maven.surefire.report
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
/**
@@ -44,7 +43,7 @@ public abstract class AbstractTextReport
private final String format;
- private List testResults;
+ private List<String> testResults;
protected AbstractTextReporter( boolean trimStackTrace, String format )
@@ -114,7 +113,7 @@ public abstract class AbstractTextReport
{
super.testSetStarting( report );
- testResults = new ArrayList();
+ testResults = new ArrayList<String>();
}
public void testSetCompleted( ReportEntry report )
@@ -126,16 +125,16 @@ public abstract class AbstractTextReport
if ( format.equals( BRIEF ) || format.equals( PLAIN ) )
{
- for ( Iterator i = testResults.iterator(); i.hasNext(); )
+ for ( String testResult : testResults )
{
- writeMessage( (String) i.next() );
+ writeMessage( testResult );
}
}
}
protected String getTestSetSummary( ReportEntry report )
{
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append( TEST_SET_COMPLETED_PREFIX );
buf.append( completedCount );
@@ -147,7 +146,7 @@ public abstract class AbstractTextReport
buf.append( skipped );
buf.append( ", Time elapsed: " );
int elapsed = report.getElapsed() != null
- ? report.getElapsed().intValue()
+ ? report.getElapsed()
: (int) ( System.currentTimeMillis() - testSetStartTime );
buf.append( elapsedTimeAsString( elapsed ) );
buf.append( " sec" );
@@ -164,7 +163,7 @@ public abstract class AbstractTextReport
protected String getElapsedTimeSummary( ReportEntry report )
{
- StringBuffer reportContent = new StringBuffer();
+ StringBuilder reportContent = new StringBuilder();
long runTime = getActualRunTime( report );
reportContent.append( report.getName() );
@@ -177,7 +176,7 @@ public abstract class AbstractTextReport
protected String getOutput( ReportEntry report, String msg )
{
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append( getElapsedTimeSummary( report ) );
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/FileReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/FileReporter.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/FileReporter.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/FileReporter.java Sat Dec 24 09:48:40 2011
@@ -31,11 +31,6 @@ public class FileReporter
extends AbstractFileReporter
{
- public FileReporter( boolean trimStackTrace, File reportsDirectory )
- {
- super( trimStackTrace, PLAIN, reportsDirectory );
- }
-
public FileReporter( boolean trimStackTrace, File reportsDirectory, String reportNamePrefix )
{
super( trimStackTrace, PLAIN, reportsDirectory, reportNamePrefix);
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/MulticastingReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/MulticastingReporter.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/MulticastingReporter.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/MulticastingReporter.java Sat Dec 24 09:48:40 2011
@@ -35,10 +35,10 @@ public class MulticastingReporter
private volatile long lastStartAt;
- public MulticastingReporter( List target )
+ public MulticastingReporter( List<Reporter> target )
{
size = target.size();
- this.target = (Reporter[]) target.toArray( new Reporter[target.size()] );
+ this.target = target.toArray( new Reporter[target.size()] );
}
public void testSetStarting( ReportEntry report )
@@ -110,8 +110,8 @@ public class MulticastingReporter
return other;
}
return new CategorizedReportEntry( other.getSourceName(), other.getName(), other.getGroup(),
- other.getStackTraceWriter(), Integer.valueOf(
- (int) (System.currentTimeMillis() - this.lastStartAt) ));
+ other.getStackTraceWriter(),
+ (int) ( System.currentTimeMillis() - this.lastStartAt ) );
}
public void writeMessage( String message )
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/TestSetRunListener.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/TestSetRunListener.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/TestSetRunListener.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/TestSetRunListener.java Sat Dec 24 09:48:40 2011
@@ -19,12 +19,12 @@ package org.apache.maven.surefire.report
* under the License.
*/
+import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
+import org.apache.maven.surefire.util.internal.ByteBuffer;
+
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
-import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
-import org.apache.maven.surefire.util.internal.ByteBuffer;
/**
* Reports data for a single test set.
@@ -40,9 +40,9 @@ public class TestSetRunListener
private final MulticastingReporter multicastingReporter;
- private final List testStdOut = Collections.synchronizedList( new ArrayList() );
+ private final List<ByteBuffer> testStdOut = Collections.synchronizedList( new ArrayList<ByteBuffer>() );
- private final List testStdErr = Collections.synchronizedList( new ArrayList() );
+ private final List<ByteBuffer> testStdErr = Collections.synchronizedList( new ArrayList<ByteBuffer>() );
public TestSetRunListener( AbstractConsoleReporter consoleReporter, AbstractFileReporter fileReporter,
@@ -50,28 +50,28 @@ public class TestSetRunListener
RunStatistics globalStats )
{
- ArrayList reportes = new ArrayList();
+ List<Reporter> reporters = new ArrayList<Reporter>();
if ( consoleReporter != null )
{
- reportes.add( consoleReporter );
+ reporters.add( consoleReporter );
}
if ( fileReporter != null )
{
- reportes.add( fileReporter );
+ reporters.add( fileReporter );
}
if ( xmlReporter != null )
{
- reportes.add( xmlReporter );
+ reporters.add( xmlReporter );
}
if ( reporter != null )
{
- reportes.add( reporter );
+ reporters.add( reporter );
}
if ( statisticsReporter != null )
{
- reportes.add( statisticsReporter );
+ reporters.add( statisticsReporter );
}
- multicastingReporter = new MulticastingReporter( reportes );
+ multicastingReporter = new MulticastingReporter( reporters );
this.testSetStatistics = new TestSetStatistics();
this.globalStatistics = globalStats;
}
@@ -198,12 +198,11 @@ public class TestSetRunListener
multicastingReporter.reset();
}
- public String getAsString( List byteBufferList )
+ public String getAsString( List<ByteBuffer> byteBufferList )
{
- StringBuffer stringBuffer = new StringBuffer();
- for ( Iterator iter = byteBufferList.iterator(); iter.hasNext(); )
+ StringBuilder stringBuffer = new StringBuilder();
+ for ( ByteBuffer byteBuffer : byteBufferList )
{
- ByteBuffer byteBuffer = (ByteBuffer) iter.next();
stringBuffer.append( byteBuffer.toString() );
}
return stringBuffer.toString();
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/util/Relocator.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/util/Relocator.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/util/Relocator.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/surefire/util/Relocator.java Sat Dec 24 09:48:40 2011
@@ -52,7 +52,7 @@ public class Relocator
{
return className;
}
- if (className.indexOf( relocation) >= 0){
+ if ( className.contains( relocation ) ){
return className;
}
String rest = className.substring( "org.apache.maven.surefire.".length() );
Modified: maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java?rev=1222949&r1=1222948&r2=1222949&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java Sat Dec 24 09:48:40 2011
@@ -24,6 +24,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+
+import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -149,7 +151,7 @@ public class SurefirePlugin
* @parameter
* @since 2.4
*/
- private List additionalClasspathElements;
+ private List<String> additionalClasspathElements;
/**
* Base directory where all reports are written to.
@@ -233,7 +235,7 @@ public class SurefirePlugin
* @parameter
* @since 2.5
*/
- private Map systemPropertyVariables;
+ private Map<String,String> systemPropertyVariables;
/**
* List of System properties, loaded from a file, to pass to the JUnit tests.
@@ -259,7 +261,7 @@ public class SurefirePlugin
* @required
* @readonly
*/
- private Map pluginArtifactMap;
+ private Map<String,Artifact> pluginArtifactMap;
/**
* Map of project artifacts.
@@ -268,7 +270,7 @@ public class SurefirePlugin
* @required
* @readonly
*/
- private Map projectArtifactMap;
+ private Map<String,Artifact> projectArtifactMap;
/**
* Option to print summary of test suites or just print the test cases that have errors.
@@ -371,7 +373,7 @@ public class SurefirePlugin
* @parameter
* @since 2.1.3
*/
- private Map environmentVariables = new HashMap();
+ private Map<String,String> environmentVariables = new HashMap<String,String>();
/**
* Command line working directory.
@@ -1047,12 +1049,12 @@ public class SurefirePlugin
this.forkedProcessTimeoutInSeconds = forkedProcessTimeoutInSeconds;
}
- public Map getEnvironmentVariables()
+ public Map<String,String> getEnvironmentVariables()
{
return environmentVariables;
}
- public void setEnvironmentVariables( Map environmentVariables )
+ public void setEnvironmentVariables( Map<String,String> environmentVariables )
{
this.environmentVariables = environmentVariables;
}
@@ -1309,7 +1311,7 @@ public class SurefirePlugin
public boolean isMavenParallel()
{
- return parallelMavenExecution != null && parallelMavenExecution.booleanValue();
+ return parallelMavenExecution != null && parallelMavenExecution;
}
public String getRunOrder()