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 2013/04/11 20:50:24 UTC
[1/3] git commit: Java5 conversion
Updated Branches:
refs/heads/master 61b116733 -> 35fc2ceec
Java5 conversion
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/1aea676b
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/1aea676b
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/1aea676b
Branch: refs/heads/master
Commit: 1aea676be8423f345e255134f3e426aab74a0299
Parents: 61b1167
Author: Kristian Rosenvold <kr...@apache.org>
Authored: Tue Mar 26 14:43:39 2013 +0100
Committer: Kristian Rosenvold <kr...@apache.org>
Committed: Thu Apr 11 20:47:34 2013 +0200
----------------------------------------------------------------------
maven-failsafe-plugin/pom.xml | 1 -
.../surefire/booterclient/BooterSerializer.java | 3 +-
surefire-api/pom.xml | 7 -
.../surefire/runorder/RunEntryStatistics.java | 4 +-
.../surefire/runorder/RunEntryStatisticsMap.java | 101 +++++++--------
.../runorder/ThreadedExecutionScheduler.java | 9 +-
.../maven/surefire/booter/BaseProviderFactory.java | 8 +-
.../surefire/booter/ForkingReporterFactory.java | 2 +-
.../maven/surefire/booter/ForkingRunListener.java | 17 +--
.../maven/surefire/booter/SurefireReflector.java | 3 +-
.../ConsoleOutputReceiverForCurrentThread.java | 4 +-
.../report/LegacyPojoStackTraceWriter.java | 4 +-
.../org/apache/maven/surefire/suite/RunResult.java | 7 +-
.../maven/surefire/testset/RunOrderParameters.java | 10 --
.../apache/maven/surefire/testset/TestRequest.java | 12 +-
.../surefire/util/DefaultDirectoryScanner.java | 37 ++----
.../surefire/util/DefaultRunOrderCalculator.java | 16 +-
.../maven/surefire/util/DefaultScanResult.java | 14 +-
.../apache/maven/surefire/util/LazyTestsToRun.java | 14 +-
.../maven/surefire/util/ReflectionUtils.java | 4 +-
.../org/apache/maven/surefire/util/RunOrder.java | 12 +-
.../org/apache/maven/surefire/util/TestsToRun.java | 23 ++--
.../org/apache/maven/surefire/util/UrlUtils.java | 5 +-
.../apache/maven/surefire/report/MockReporter.java | 6 +-
surefire-booter/pom.xml | 7 -
.../apache/maven/surefire/booter/Classpath.java | 34 +++---
.../maven/surefire/booter/IsolatedClassLoader.java | 2 +-
.../maven/surefire/booter/PropertiesWrapper.java | 21 ++--
.../surefire/booter/ProviderConfiguration.java | 4 -
.../maven/surefire/booter/TypeEncodedValue.java | 1 +
.../maven/surefire/booter/ClasspathTest.java | 4 +-
.../java/org/apache/maven/surefire/booter/Foo.java | 4 +-
.../surefire/booter/PropertiesWrapperTest.java | 2 +-
.../surefire/booter/SurefireReflectorTest.java | 18 ++--
.../maven/surefire/junit4/JUnit4Provider.java | 4 +-
.../maven/surefire/junitcore/Surefire746Test.java | 2 +-
surefire-providers/surefire-testng/pom.xml | 9 --
.../maven/surefire/testng/TestNGXmlTestSuite.java | 2 +-
38 files changed, 185 insertions(+), 252 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/maven-failsafe-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/pom.xml b/maven-failsafe-plugin/pom.xml
index bdd4c4b..0dadfdf 100644
--- a/maven-failsafe-plugin/pom.xml
+++ b/maven-failsafe-plugin/pom.xml
@@ -207,7 +207,6 @@
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<fork>false</fork>
- <compilerVersion>1.4</compilerVersion>
</configuration>
</plugin>
</plugins>
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
index a80a8ae..7530aea 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
@@ -81,8 +81,7 @@ class BooterSerializer
properties.setProperty( BooterConstants.TESTARTIFACT_CLASSIFIER, testNg.getClassifier() );
}
- properties.setProperty( BooterConstants.FORKTESTSET_PREFER_TESTS_FROM_IN_STREAM,
- Boolean.valueOf( readTestsFromInStream ) );
+ properties.setProperty( BooterConstants.FORKTESTSET_PREFER_TESTS_FROM_IN_STREAM, readTestsFromInStream );
properties.setProperty( BooterConstants.FORKTESTSET, getTypeEncoded( testSet ) );
TestRequest testSuiteDefinition = booterConfiguration.getTestSuiteDefinition();
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-api/pom.xml b/surefire-api/pom.xml
index 80b7c75..3c67e9a 100644
--- a/surefire-api/pom.xml
+++ b/surefire-api/pom.xml
@@ -51,13 +51,6 @@
</dependencies>
</plugin>
<plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.3</source>
- <target>1.3</target>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatistics.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatistics.java b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatistics.java
index c2465f5..73d2adf 100644
--- a/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatistics.java
+++ b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatistics.java
@@ -42,7 +42,7 @@ public class RunEntryStatistics
public static RunEntryStatistics fromReportEntry( ReportEntry previous )
{
final Integer elapsed = previous.getElapsed();
- return new RunEntryStatistics( elapsed != null ? elapsed.intValue() : 0, 0, previous.getName() );
+ return new RunEntryStatistics( elapsed != null ? elapsed : 0, 0, previous.getName() );
}
public static RunEntryStatistics fromValues( int runTime, int successfulBuilds, Class clazz, String testName )
@@ -87,7 +87,7 @@ public class RunEntryStatistics
public String getAsString()
{
- StringBuffer stringBuffer = new StringBuffer();
+ StringBuilder stringBuffer = new StringBuilder();
stringBuffer.append( successfulBuilds );
stringBuffer.append( "," );
stringBuffer.append( runTime );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatisticsMap.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatisticsMap.java b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatisticsMap.java
index cd4e8eb..d9432ed 100644
--- a/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatisticsMap.java
+++ b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatisticsMap.java
@@ -20,6 +20,8 @@ package org.apache.maven.plugin.surefire.runorder;
*/
+import org.apache.maven.surefire.report.ReportEntry;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
@@ -32,28 +34,26 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.maven.surefire.report.ReportEntry;
/**
* @author Kristian Rosenvold
*/
public class RunEntryStatisticsMap
{
- private final Map runEntryStatistics;
+ private final Map<String, RunEntryStatistics> runEntryStatistics;
- public RunEntryStatisticsMap( Map runEntryStatistics )
+ public RunEntryStatisticsMap( Map<String, RunEntryStatistics> runEntryStatistics )
{
this.runEntryStatistics = Collections.synchronizedMap( runEntryStatistics );
}
public RunEntryStatisticsMap()
{
- this( new HashMap() );
+ this( new HashMap<String, RunEntryStatistics>() );
}
public static RunEntryStatisticsMap fromFile( File file )
@@ -81,7 +81,7 @@ public class RunEntryStatisticsMap
static RunEntryStatisticsMap fromReader( Reader fileReader )
throws IOException
{
- Map result = new HashMap();
+ Map<String, RunEntryStatistics> result = new HashMap<String, RunEntryStatistics>();
BufferedReader bufferedReader = new BufferedReader( fileReader );
String line = bufferedReader.readLine();
while ( line != null )
@@ -101,12 +101,12 @@ public class RunEntryStatisticsMap
{
FileOutputStream fos = new FileOutputStream( file );
PrintWriter printWriter = new PrintWriter( fos );
- List items = new ArrayList( runEntryStatistics.values() );
+ List<RunEntryStatistics> items = new ArrayList<RunEntryStatistics>( runEntryStatistics.values() );
Collections.sort( items, new RunCountComparator() );
RunEntryStatistics item;
- for ( Iterator iter = items.iterator(); iter.hasNext(); )
+ for ( RunEntryStatistics item1 : items )
{
- item = (RunEntryStatistics) iter.next();
+ item = item1;
printWriter.println( item.getAsString() );
}
printWriter.close();
@@ -115,7 +115,7 @@ public class RunEntryStatisticsMap
public RunEntryStatistics findOrCreate( ReportEntry reportEntry )
{
- final RunEntryStatistics item = (RunEntryStatistics) runEntryStatistics.get( reportEntry.getName() );
+ final RunEntryStatistics item = runEntryStatistics.get( reportEntry.getName() );
return item != null ? item : RunEntryStatistics.fromReportEntry( reportEntry );
}
@@ -123,14 +123,14 @@ public class RunEntryStatisticsMap
{
final RunEntryStatistics newItem = findOrCreate( reportEntry );
final Integer elapsed = reportEntry.getElapsed();
- return newItem.nextGeneration( elapsed != null ? elapsed.intValue() : 0 );
+ return newItem.nextGeneration( elapsed != null ? elapsed : 0 );
}
public RunEntryStatistics createNextGenerationFailure( ReportEntry reportEntry )
{
final RunEntryStatistics newItem = findOrCreate( reportEntry );
final Integer elapsed = reportEntry.getElapsed();
- return newItem.nextGenerationFailure( elapsed != null ? elapsed.intValue() : 0 );
+ return newItem.nextGenerationFailure( elapsed != null ? elapsed : 0 );
}
public void add( RunEntryStatistics item )
@@ -139,16 +139,14 @@ public class RunEntryStatisticsMap
}
class RunCountComparator
- implements Comparator
+ implements Comparator<RunEntryStatistics>
{
- public int compare( Object o, Object o1 )
+ public int compare( RunEntryStatistics o, RunEntryStatistics o1 )
{
- RunEntryStatistics re = (RunEntryStatistics) o;
- RunEntryStatistics re1 = (RunEntryStatistics) o1;
- int runtime = re.getSuccessfulBuilds() - re1.getSuccessfulBuilds();
+ int runtime = o.getSuccessfulBuilds() - o1.getSuccessfulBuilds();
if ( runtime == 0 )
{
- return re.getRunTime() - re1.getRunTime();
+ return o.getRunTime() - o1.getRunTime();
}
return runtime;
}
@@ -156,32 +154,32 @@ public class RunEntryStatisticsMap
public List getPrioritizedTestsClassRunTime( List testsToRun, int threadCount )
{
- final List prioritizedTests = getPrioritizedTests( testsToRun, new TestRuntimeComparator() );
+ final List<PrioritizedTest> prioritizedTests = getPrioritizedTests( testsToRun, new TestRuntimeComparator() );
ThreadedExecutionScheduler threadedExecutionScheduler = new ThreadedExecutionScheduler( threadCount );
- for ( Iterator prioritizedTest = prioritizedTests.iterator(); prioritizedTest.hasNext(); )
+ for ( Object prioritizedTest1 : prioritizedTests )
{
- threadedExecutionScheduler.addTest( (PrioritizedTest) prioritizedTest.next() );
+ threadedExecutionScheduler.addTest( (PrioritizedTest) prioritizedTest1 );
}
return threadedExecutionScheduler.getResult();
}
- public List getPrioritizedTestsByFailureFirst( List testsToRun )
+ public List<Class> getPrioritizedTestsByFailureFirst( List testsToRun )
{
final List prioritizedTests = getPrioritizedTests( testsToRun, new LeastFailureComparator() );
return transformToClasses( prioritizedTests );
}
- private List getPrioritizedTests( List testsToRun, Comparator priorityComparator )
+ private List<PrioritizedTest> getPrioritizedTests( List testsToRun, Comparator<Priority> priorityComparator )
{
Map classPriorities = getPriorities( priorityComparator );
- List tests = new ArrayList();
- for ( Iterator iter = testsToRun.iterator(); iter.hasNext(); )
+ List<PrioritizedTest> tests = new ArrayList<PrioritizedTest>();
+ for ( Object aTestsToRun : testsToRun )
{
- Class clazz = (Class) iter.next();
+ Class clazz = (Class) aTestsToRun;
Priority pri = (Priority) classPriorities.get( clazz.getName() );
if ( pri == null )
{
@@ -195,41 +193,40 @@ public class RunEntryStatisticsMap
}
- private List transformToClasses( List tests )
+ private List<Class> transformToClasses( List tests )
{
- List result = new ArrayList();
- for ( int i = 0; i < tests.size(); i++ )
+ List<Class> result = new ArrayList<Class>();
+ for ( Object test : tests )
{
- result.add( ( (PrioritizedTest) tests.get( i ) ).getClazz() );
+ result.add( ( (PrioritizedTest) test ).getClazz() );
}
return result;
}
- public Map getPriorities( Comparator priorityComparator )
+ public Map getPriorities( Comparator<Priority> priorityComparator )
{
- Map priorities = new HashMap();
- for ( Iterator iter = runEntryStatistics.keySet().iterator(); iter.hasNext(); )
+ Map<String, Priority> priorities = new HashMap<String, Priority>();
+ for ( Object o : runEntryStatistics.keySet() )
{
- String testNames = (String) iter.next();
+ String testNames = (String) o;
String clazzName = extractClassName( testNames );
- Priority priority = (Priority) priorities.get( clazzName );
+ Priority priority = priorities.get( clazzName );
if ( priority == null )
{
priority = new Priority( clazzName );
priorities.put( clazzName, priority );
}
- RunEntryStatistics itemStat = (RunEntryStatistics) runEntryStatistics.get( testNames );
+ RunEntryStatistics itemStat = runEntryStatistics.get( testNames );
priority.addItem( itemStat );
}
- List items = new ArrayList( priorities.values() );
+ List<Priority> items = new ArrayList<Priority>( priorities.values() );
Collections.sort( items, priorityComparator );
- Map result = new HashMap();
+ Map<String, Priority> result = new HashMap<String, Priority>();
int i = 0;
- for ( Iterator iter = items.iterator(); iter.hasNext(); )
+ for ( Priority pri : items )
{
- Priority pri = (Priority) iter.next();
pri.setPriority( i++ );
result.put( pri.getClassName(), pri );
}
@@ -237,35 +234,29 @@ public class RunEntryStatisticsMap
}
class PrioritizedTestComparator
- implements Comparator
+ implements Comparator<PrioritizedTest>
{
- public int compare( Object o, Object o1 )
+ public int compare( PrioritizedTest o, PrioritizedTest o1 )
{
- PrioritizedTest re = (PrioritizedTest) o;
- PrioritizedTest re1 = (PrioritizedTest) o1;
- return re.getPriority() - re1.getPriority();
+ return o.getPriority() - o1.getPriority();
}
}
class TestRuntimeComparator
- implements Comparator
+ implements Comparator<Priority>
{
- public int compare( Object o, Object o1 )
+ public int compare( Priority o, Priority o1 )
{
- Priority re = (Priority) o;
- Priority re1 = (Priority) o1;
- return re1.getTotalRuntime() - re.getTotalRuntime();
+ return o1.getTotalRuntime() - o.getTotalRuntime();
}
}
class LeastFailureComparator
- implements Comparator
+ implements Comparator<Priority>
{
- public int compare( Object o, Object o1 )
+ public int compare( Priority o, Priority o1 )
{
- Priority re = (Priority) o;
- Priority re1 = (Priority) o1;
- return re.getMinSuccessRate() - re1.getMinSuccessRate();
+ return o.getMinSuccessRate() - o1.getMinSuccessRate();
}
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/ThreadedExecutionScheduler.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/ThreadedExecutionScheduler.java b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/ThreadedExecutionScheduler.java
index ea3f8a6..5cd34a0 100644
--- a/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/ThreadedExecutionScheduler.java
+++ b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/ThreadedExecutionScheduler.java
@@ -40,7 +40,7 @@ public class ThreadedExecutionScheduler
lists = new List[numThreads];
for ( int i = 0; i < numThreads; i++ )
{
- lists[i] = new ArrayList();
+ lists[i] = new ArrayList<Class>();
}
}
@@ -48,14 +48,15 @@ public class ThreadedExecutionScheduler
{
final int leastBusySlot = findLeastBusySlot();
runTime[leastBusySlot] += prioritizedTest.getTotalRuntime();
+ //noinspection unchecked
lists[leastBusySlot].add( prioritizedTest.getClazz() );
}
public List getResult()
{
- List result = new ArrayList();
+ List<Class> result = new ArrayList<Class>();
int index = 0;
- boolean added = false;
+ boolean added;
do
{
added = false;
@@ -63,7 +64,7 @@ public class ThreadedExecutionScheduler
{
if ( lists[i].size() > index )
{
- result.add( lists[i].get( index ) );
+ result.add( (Class) lists[i].get( index ) );
added = true;
}
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
index 626ff52..5f8f040 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java
@@ -58,7 +58,7 @@ public class BaseProviderFactory
private TestArtifactInfo testArtifactInfo;
- private static final Integer ROOT_CHANNEl = new Integer( 0 );
+ private static final Integer ROOT_CHANNEl = 0;
private final ReporterFactory reporterFactory;
@@ -69,7 +69,7 @@ public class BaseProviderFactory
public BaseProviderFactory( ReporterFactory reporterFactory, Boolean insideFork )
{
this.reporterFactory = reporterFactory;
- this.insideFork = insideFork.booleanValue();
+ this.insideFork = insideFork;
}
public DirectoryScanner getDirectoryScanner()
@@ -128,8 +128,8 @@ public class BaseProviderFactory
{
if ( insideFork )
{
- return new ForkingRunListener( reporterConfiguration.getOriginalSystemOut(), ROOT_CHANNEl.intValue(),
- reporterConfiguration.isTrimStackTrace().booleanValue() );
+ return new ForkingRunListener( reporterConfiguration.getOriginalSystemOut(), ROOT_CHANNEl,
+ reporterConfiguration.isTrimStackTrace() );
}
return new DefaultDirectConsoleReporter( reporterConfiguration.getOriginalSystemOut() );
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java
index de4bbdd..ad8c87b 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingReporterFactory.java
@@ -50,7 +50,7 @@ public class ForkingReporterFactory
public synchronized RunListener createReporter()
{
- return new ForkingRunListener( originalSystemOut, testSetChannelId++, isTrimstackTrace.booleanValue() );
+ return new ForkingRunListener( originalSystemOut, testSetChannelId++, isTrimstackTrace );
}
public RunResult close()
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
index d20fcf2..9a8beec 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
@@ -95,7 +95,7 @@ public class ForkingRunListener
public ForkingRunListener( PrintStream target, int testSetChannelId, boolean trimStackTraces )
{
this.target = target;
- this.testSetChannelId = new Integer( testSetChannelId );
+ this.testSetChannelId = testSetChannelId;
this.trimStackTraces = trimStackTraces;
stdOutHeader = createHeader( BOOTERCODE_STDOUT, testSetChannelId );
stdErrHeader = createHeader( BOOTERCODE_STDERR, testSetChannelId );
@@ -232,10 +232,10 @@ public class ForkingRunListener
private String toPropertyString( String key, String value )
{
StringBuffer stringBuffer = new StringBuffer();
- append( stringBuffer, BOOTERCODE_SYSPROPS );
- comma( stringBuffer );
- append( stringBuffer, Integer.toHexString( testSetChannelId.intValue() ) );
- comma( stringBuffer );
+
+ append( stringBuffer, BOOTERCODE_SYSPROPS );comma( stringBuffer );
+ append( stringBuffer, Integer.toHexString( testSetChannelId ) );comma( stringBuffer );
+
StringUtils.escapeJavaStyleString( stringBuffer, key );
append( stringBuffer, "," );
StringUtils.escapeJavaStyleString( stringBuffer, value );
@@ -246,10 +246,9 @@ public class ForkingRunListener
private String toString( byte operationCode, ReportEntry reportEntry, Integer testSetChannelId )
{
StringBuffer stringBuffer = new StringBuffer();
- append( stringBuffer, operationCode );
- comma( stringBuffer );
- append( stringBuffer, Integer.toHexString( testSetChannelId.intValue() ) );
- comma( stringBuffer );
+ append( stringBuffer, operationCode ); comma( stringBuffer );
+ append( stringBuffer, Integer.toHexString( testSetChannelId ) );comma( stringBuffer );
+
nullableEncoding( stringBuffer, reportEntry.getSourceName() );
comma( stringBuffer );
nullableEncoding( stringBuffer, reportEntry.getName() );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
index aec4e92..0c3055b 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
@@ -115,8 +115,7 @@ public class SurefireReflector
final Integer getErrors = (Integer) ReflectionUtils.invokeGetter( result, "getErrors" );
final Integer getSkipped = (Integer) ReflectionUtils.invokeGetter( result, "getSkipped" );
final Integer getFailures = (Integer) ReflectionUtils.invokeGetter( result, "getFailures" );
- return new RunResult( getCompletedCount1.intValue(), getErrors.intValue(), getFailures.intValue(),
- getSkipped.intValue() );
+ return new RunResult( getCompletedCount1, getErrors, getFailures, getSkipped );
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputReceiverForCurrentThread.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputReceiverForCurrentThread.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputReceiverForCurrentThread.java
index c13bd4b..fb0152c 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputReceiverForCurrentThread.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputReceiverForCurrentThread.java
@@ -24,7 +24,7 @@ package org.apache.maven.surefire.report;
*/
public final class ConsoleOutputReceiverForCurrentThread
{
- private static final ThreadLocal current = new InheritableThreadLocal();
+ private static final ThreadLocal<ConsoleOutputReceiver> current = new InheritableThreadLocal<ConsoleOutputReceiver>();
private ConsoleOutputReceiverForCurrentThread()
{
@@ -32,7 +32,7 @@ public final class ConsoleOutputReceiverForCurrentThread
public static ConsoleOutputReceiver get()
{
- return (ConsoleOutputReceiver) current.get();
+ return current.get();
}
public static void set( ConsoleOutputReceiver consoleOutputReceiver )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/report/LegacyPojoStackTraceWriter.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/LegacyPojoStackTraceWriter.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/LegacyPojoStackTraceWriter.java
index c6d23cf..3f6a352 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/report/LegacyPojoStackTraceWriter.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/LegacyPojoStackTraceWriter.java
@@ -59,7 +59,7 @@ public class LegacyPojoStackTraceWriter
public String smartTrimmedStackTrace()
{
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
result.append( testClass );
result.append( "#" );
result.append( testMethod );
@@ -128,7 +128,7 @@ public class LegacyPojoStackTraceWriter
}
}
- StringBuffer trace = new StringBuffer();
+ StringBuilder trace = new StringBuilder();
for ( int i = 0; i <= lastLine; i++ )
{
trace.append( lines[i] );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/suite/RunResult.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/suite/RunResult.java b/surefire-api/src/main/java/org/apache/maven/surefire/suite/RunResult.java
index 8749cfa..595717b 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/suite/RunResult.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/suite/RunResult.java
@@ -131,11 +131,11 @@ public class RunResult
{
if ( completedCount == 0 )
{
- return Integer.valueOf( NO_TESTS );
+ return NO_TESTS;
}
if ( !isErrorFree() )
{
- return Integer.valueOf( FAILURE );
+ return FAILURE;
}
return null;
}
@@ -202,7 +202,7 @@ public class RunResult
Integer failsafeCode = getFailsafeCode();
if ( failsafeCode != null )
{
- dom.setAttribute( "result", Integer.toString( failsafeCode.intValue() ) );
+ dom.setAttribute( "result", Integer.toString( failsafeCode ) );
}
dom.setAttribute( "timeout", Boolean.toString( this.timeout ) );
dom.addChild( create( "completed", this.completedCount ) );
@@ -261,6 +261,7 @@ public class RunResult
}
}
+ @SuppressWarnings( "RedundantIfStatement" )
public boolean equals( Object o )
{
if ( this == o )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java b/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java
index f36c640..57f3f33 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java
@@ -43,11 +43,6 @@ public class RunOrderParameters
this.runStatisticsFile = runStatisticsFile != null ? new File( runStatisticsFile ) : null;
}
- public static RunOrderParameters DEFAULT()
- {
- return new RunOrderParameters( RunOrder.DEFAULT, null );
- }
-
public static RunOrderParameters ALPHABETICAL()
{
return new RunOrderParameters( new RunOrder[]{ RunOrder.ALPHABETICAL }, null );
@@ -63,9 +58,4 @@ public class RunOrderParameters
return runStatisticsFile;
}
- public String getRunStatisticsFileName()
- {
- return runStatisticsFile != null ? runStatisticsFile.getAbsolutePath() : null;
- }
-
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestRequest.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestRequest.java b/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestRequest.java
index 4ce6ca6..190b71b 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestRequest.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestRequest.java
@@ -30,7 +30,7 @@ import java.util.List;
*/
public class TestRequest
{
- private final List suiteXmlFiles;
+ private final List<File> suiteXmlFiles;
private final File testSourceDirectory;
@@ -62,7 +62,7 @@ public class TestRequest
*
* @return A list of java.io.File objects.
*/
- public List getSuiteXmlFiles()
+ public List<File> getSuiteXmlFiles()
{
return suiteXmlFiles;
}
@@ -98,15 +98,15 @@ public class TestRequest
return requestedTestMethod;
}
- private static List createFiles( List suiteXmlFiles )
+ private static List<File> createFiles( List suiteXmlFiles )
{
if ( suiteXmlFiles != null )
{
- List files = new ArrayList();
+ List<File> files = new ArrayList<File>();
Object element;
- for ( int i = 0; i < suiteXmlFiles.size(); i++ )
+ for ( Object suiteXmlFile : suiteXmlFiles )
{
- element = suiteXmlFiles.get( i );
+ element = suiteXmlFile;
files.add( element instanceof String ? new File( (String) element ) : (File) element );
}
return files;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultDirectoryScanner.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultDirectoryScanner.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultDirectoryScanner.java
index e5f8174..559da21 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultDirectoryScanner.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultDirectoryScanner.java
@@ -19,11 +19,12 @@ package org.apache.maven.surefire.util;
* under the License.
*/
+import org.apache.maven.surefire.SpecificTestClassFilter;
+
import java.io.File;
import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Collections;
import java.util.List;
-import org.apache.maven.surefire.SpecificTestClassFilter;
/**
* Scans directories looking for tests.
@@ -51,7 +52,7 @@ public class DefaultDirectoryScanner
private final List specificTests;
- private final List classesSkippedByValidation = new ArrayList();
+ private final List<Class> classesSkippedByValidation = new ArrayList<Class>();
public DefaultDirectoryScanner( File basedir, List includes, List excludes, List specificTests )
{
@@ -64,15 +65,13 @@ public class DefaultDirectoryScanner
public TestsToRun locateTestClasses( ClassLoader classLoader, ScannerFilter scannerFilter )
{
String[] testClassNames = collectTests();
- List result = new ArrayList();
+ List<Class> result = new ArrayList<Class>();
String[] specific = specificTests == null ? new String[0] : processIncludesExcludes( specificTests );
SpecificTestClassFilter specificTestFilter = new SpecificTestClassFilter( specific );
- for ( int i = 0; i < testClassNames.length; i++ )
+ for ( String className : testClassNames )
{
- String className = testClassNames[i];
-
Class testClass = loadClass( classLoader, className );
if ( !specificTestFilter.accept( testClass ) )
@@ -143,29 +142,22 @@ public class DefaultDirectoryScanner
private static String[] processIncludesExcludes( List list )
{
- List newList = new ArrayList();
- Iterator iter = list.iterator();
- while ( iter.hasNext() )
+ List<String> newList = new ArrayList<String>();
+ for ( Object aList : list )
{
- String include = (String) iter.next();
+ String include = (String) aList;
String[] includes = include.split( "," );
- for ( int i = 0; i < includes.length; ++i )
- {
- newList.add( includes[i] );
- }
+ Collections.addAll( newList, includes );
}
String[] incs = new String[newList.size()];
for ( int i = 0; i < incs.length; i++ )
{
- String inc = (String) newList.get( i );
+ String inc = newList.get( i );
if ( inc.endsWith( JAVA_SOURCE_FILE_EXTENSION ) )
{
- inc = new StringBuffer(
- inc.length() - JAVA_SOURCE_FILE_EXTENSION.length() + JAVA_CLASS_FILE_EXTENSION.length() ).append(
- inc.substring( 0, inc.lastIndexOf( JAVA_SOURCE_FILE_EXTENSION ) ) ).append(
- JAVA_CLASS_FILE_EXTENSION ).toString();
+ inc = inc.substring( 0, inc.lastIndexOf( JAVA_SOURCE_FILE_EXTENSION ) ) + JAVA_CLASS_FILE_EXTENSION;
}
incs[i] = inc;
@@ -173,9 +165,4 @@ public class DefaultDirectoryScanner
return incs;
}
- public List getClassesSkippedByValidation()
- {
- return classesSkippedByValidation;
- }
-
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultRunOrderCalculator.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultRunOrderCalculator.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultRunOrderCalculator.java
index 47d2421..780c09d 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultRunOrderCalculator.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultRunOrderCalculator.java
@@ -19,14 +19,14 @@ package org.apache.maven.surefire.util;
* under the License.
*/
+import org.apache.maven.plugin.surefire.runorder.RunEntryStatisticsMap;
+import org.apache.maven.surefire.testset.RunOrderParameters;
+
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
-import java.util.Iterator;
import java.util.List;
-import org.apache.maven.plugin.surefire.runorder.RunEntryStatisticsMap;
-import org.apache.maven.surefire.testset.RunOrderParameters;
/**
* Applies the final runorder of the tests
@@ -55,18 +55,18 @@ public class DefaultRunOrderCalculator
public TestsToRun orderTestClasses( TestsToRun scannedClasses )
{
- List result = new ArrayList( 500 );
+ List<Class> result = new ArrayList<Class>( 500 );
- for ( Iterator it = scannedClasses.iterator(); it.hasNext(); )
+ for ( Class scannedClass : scannedClasses )
{
- result.add( it.next() );
+ result.add( scannedClass );
}
orderTestClasses( result, runOrder.length != 0 ? runOrder[0] : null );
return new TestsToRun( result );
}
- private void orderTestClasses( List testClasses, RunOrder runOrder )
+ private void orderTestClasses( List<Class> testClasses, RunOrder runOrder )
{
if ( RunOrder.RANDOM.equals( runOrder ) )
{
@@ -76,7 +76,7 @@ public class DefaultRunOrderCalculator
{
RunEntryStatisticsMap runEntryStatisticsMap =
RunEntryStatisticsMap.fromFile( runOrderParameters.getRunStatisticsFile() );
- final List prioritized = runEntryStatisticsMap.getPrioritizedTestsByFailureFirst( testClasses );
+ final List<Class> prioritized = runEntryStatisticsMap.getPrioritizedTestsByFailureFirst( testClasses );
testClasses.clear();
testClasses.addAll( prioritized );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultScanResult.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultScanResult.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultScanResult.java
index f8cb61d..67fc0e6 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultScanResult.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultScanResult.java
@@ -30,11 +30,11 @@ import java.util.Properties;
public class DefaultScanResult
implements ScanResult
{
- private final List files;
+ private final List<String> files;
private static final String scanResultNo = "tc.";
- public DefaultScanResult( List files )
+ public DefaultScanResult( List<String> files )
{
this.files = files;
}
@@ -46,7 +46,7 @@ public class DefaultScanResult
public String getClassName( int index )
{
- return (String) files.get( index );
+ return files.get( index );
}
public void writeTo( Properties properties )
@@ -54,13 +54,13 @@ public class DefaultScanResult
int size = files.size();
for ( int i = 0; i < size; i++ )
{
- properties.setProperty( scanResultNo + i, (String) files.get( i ) );
+ properties.setProperty( scanResultNo + i, files.get( i ) );
}
}
public static DefaultScanResult from( Properties properties )
{
- List result = new ArrayList();
+ List<String> result = new ArrayList<String>();
int i = 0;
while ( true )
{
@@ -85,7 +85,7 @@ public class DefaultScanResult
public TestsToRun applyFilter( ScannerFilter scannerFilter, ClassLoader testClassLoader )
{
- List result = new ArrayList();
+ List<Class> result = new ArrayList<Class>();
int size = size();
for ( int i = 0; i < size; i++ )
@@ -105,7 +105,7 @@ public class DefaultScanResult
public List getClassesSkippedByValidation( ScannerFilter scannerFilter, ClassLoader testClassLoader )
{
- List result = new ArrayList();
+ List<Class> result = new ArrayList<Class>();
int size = size();
for ( int i = 0; i < size; i++ )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/util/LazyTestsToRun.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/LazyTestsToRun.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/LazyTestsToRun.java
index 5974b6a..71cd1bd 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/LazyTestsToRun.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/LazyTestsToRun.java
@@ -42,7 +42,7 @@ import org.apache.maven.surefire.booter.ForkingRunListener;
public class LazyTestsToRun
extends TestsToRun
{
- private List workQueue = new ArrayList();
+ private final List<Class> workQueue = new ArrayList<Class>();
private BufferedReader inputReader;
@@ -61,7 +61,7 @@ public class LazyTestsToRun
*/
public LazyTestsToRun( InputStream testSource, ClassLoader testClassLoader, PrintStream originalOutStream )
{
- super( Collections.emptyList() );
+ super( Collections.<Class>emptyList() );
this.testClassLoader = testClassLoader;
this.originalOutStream = originalOutStream;
@@ -79,13 +79,13 @@ public class LazyTestsToRun
protected void requestNextTest()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append( (char) ForkingRunListener.BOOTERCODE_NEXT_TEST ).append( ",0,want more!\n" );
originalOutStream.print( sb.toString() );
}
private class BlockingIterator
- implements Iterator
+ implements Iterator<Class>
{
private int lastPos = -1;
@@ -135,7 +135,7 @@ public class LazyTestsToRun
return workQueue.size() == nextPos && !streamClosed;
}
- public Object next()
+ public Class next()
{
synchronized ( workQueue )
{
@@ -153,7 +153,7 @@ public class LazyTestsToRun
/* (non-Javadoc)
* @see org.apache.maven.surefire.util.TestsToRun#iterator()
*/
- public Iterator iterator()
+ public Iterator<Class> iterator()
{
return new BlockingIterator();
}
@@ -163,7 +163,7 @@ public class LazyTestsToRun
*/
public String toString()
{
- StringBuffer sb = new StringBuffer( "LazyTestsToRun " );
+ StringBuilder sb = new StringBuilder( "LazyTestsToRun " );
synchronized ( workQueue )
{
sb.append( "(more items expected: " ).append( !streamClosed ).append( "): " );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/util/ReflectionUtils.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/ReflectionUtils.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/ReflectionUtils.java
index bc7364a..a3c9e15 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/ReflectionUtils.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/ReflectionUtils.java
@@ -127,7 +127,7 @@ public class ReflectionUtils
{
Class aClass = loadClass( classLoader, className );
Constructor constructor = ReflectionUtils.getConstructor( aClass, new Class[]{ param1Class } );
- return constructor.newInstance( new Object[]{ param1 } );
+ return constructor.newInstance( param1 );
}
catch ( InvocationTargetException e )
{
@@ -151,7 +151,7 @@ public class ReflectionUtils
{
Class aClass = loadClass( classLoader, className );
Constructor constructor = ReflectionUtils.getConstructor( aClass, new Class[]{ param1Class, param2Class } );
- return constructor.newInstance( new Object[]{ param1, param2 } );
+ return constructor.newInstance( param1, param2 );
}
catch ( InvocationTargetException e )
{
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/util/RunOrder.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/RunOrder.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/RunOrder.java
index 63fef06..e262e53 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/RunOrder.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/RunOrder.java
@@ -54,7 +54,7 @@ public class RunOrder
*/
public static RunOrder[] valueOfMulti( String values )
{
- List result = new ArrayList();
+ List<RunOrder> result = new ArrayList<RunOrder>();
if ( values != null )
{
StringTokenizer stringTokenizer = new StringTokenizer( values, "," );
@@ -63,7 +63,7 @@ public class RunOrder
result.add( valueOf( stringTokenizer.nextToken() ) );
}
}
- return (RunOrder[]) result.toArray( new RunOrder[result.size()] );
+ return result.toArray( new RunOrder[result.size()] );
}
public static RunOrder valueOf( String name )
@@ -75,11 +75,11 @@ public class RunOrder
else
{
RunOrder[] runOrders = values();
- for ( int i = 0; i < runOrders.length; i++ )
+ for ( RunOrder runOrder : runOrders )
{
- if ( runOrders[i].matches( name ) )
+ if ( runOrder.matches( name ) )
{
- return runOrders[i];
+ return runOrder;
}
}
@@ -114,7 +114,7 @@ public class RunOrder
public static String asString( RunOrder[] runOrder )
{
- StringBuffer stringBuffer = new StringBuffer();
+ StringBuilder stringBuffer = new StringBuilder();
for ( int i = 0; i < runOrder.length; i++ )
{
stringBuffer.append( runOrder[i].name );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/util/TestsToRun.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/TestsToRun.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/TestsToRun.java
index 760907c..607c332 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/TestsToRun.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/TestsToRun.java
@@ -34,23 +34,22 @@ import org.apache.maven.surefire.testset.TestSetFailedException;
*
* @author Kristian Rosenvold (junit core adaption)
*/
-public class TestsToRun
+public class TestsToRun implements Iterable<Class>
{
- private final List locatedClasses;
+ private final List<Class> locatedClasses;
/**
* Constructor
*
* @param locatedClasses A list of java.lang.Class objects representing tests to run
*/
- public TestsToRun( List locatedClasses )
+ public TestsToRun( List<Class> locatedClasses )
{
this.locatedClasses = Collections.unmodifiableList( locatedClasses );
- Set testSets = new HashSet();
+ Set<Class> testSets = new HashSet<Class>();
- for ( Iterator iterator = locatedClasses.iterator(); iterator.hasNext(); )
+ for ( Class testClass : locatedClasses )
{
- Class testClass = (Class) iterator.next();
if ( testSets.contains( testClass ) )
{
throw new RuntimeException( "Duplicate test set '" + testClass.getName() + "'" );
@@ -62,7 +61,7 @@ public class TestsToRun
public static TestsToRun fromClass( Class clazz )
throws TestSetFailedException
{
- return new TestsToRun( Arrays.asList( new Class[]{ clazz } ) );
+ return new TestsToRun( Arrays.<Class>asList( clazz ) );
}
/**
@@ -70,14 +69,14 @@ public class TestsToRun
*
* @return an unmodifiable iterator
*/
- public Iterator iterator()
+ public Iterator<Class> iterator()
{
return locatedClasses.iterator();
}
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append( "TestsToRun: [" );
Iterator it = iterator();
while ( it.hasNext() )
@@ -131,12 +130,12 @@ public class TestsToRun
{
throw new IllegalStateException( "Cannot eagerly read" );
}
- List result = new ArrayList();
- Iterator it = iterator();
+ List<Class> result = new ArrayList<Class>();
+ Iterator<Class> it = iterator();
while ( it.hasNext() )
{
result.add( it.next() );
}
- return (Class[]) result.toArray( new Class[result.size()] );
+ return result.toArray( new Class[result.size()] );
}
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/main/java/org/apache/maven/surefire/util/UrlUtils.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/UrlUtils.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/UrlUtils.java
index 475d2c4..f6f2b89 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/UrlUtils.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/UrlUtils.java
@@ -70,10 +70,9 @@ public class UrlUtils
try
{
byte[] bytes = url.toString().getBytes( ENCODING );
- StringBuffer buf = new StringBuffer( bytes.length );
- for ( int i = 0; i < bytes.length; i++ )
+ StringBuilder buf = new StringBuilder( bytes.length );
+ for ( byte b : bytes )
{
- byte b = bytes[i];
if ( b > 0 && UNRESERVED.get( b ) )
{
buf.append( (char) b );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-api/src/test/java/org/apache/maven/surefire/report/MockReporter.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/test/java/org/apache/maven/surefire/report/MockReporter.java b/surefire-api/src/test/java/org/apache/maven/surefire/report/MockReporter.java
index 22617ed..ad26f85 100644
--- a/surefire-api/src/test/java/org/apache/maven/surefire/report/MockReporter.java
+++ b/surefire-api/src/test/java/org/apache/maven/surefire/report/MockReporter.java
@@ -29,9 +29,9 @@ import java.util.concurrent.atomic.AtomicInteger;
public class MockReporter
implements RunListener, ConsoleLogger
{
- private final List events = new ArrayList();
+ private final List<String> events = new ArrayList<String>();
- private final List data = new ArrayList();
+ private final List<Object> data = new ArrayList<Object>();
public static final String SET_STARTING = "SET_STARTED";
@@ -117,7 +117,7 @@ public class MockReporter
public String getFirstEvent()
{
- return (String) events.get( 0 );
+ return events.get( 0 );
}
public ReportEntry getFirstData()
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-booter/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-booter/pom.xml b/surefire-booter/pom.xml
index 41141a0..3d14301 100644
--- a/surefire-booter/pom.xml
+++ b/surefire-booter/pom.xml
@@ -51,13 +51,6 @@
</dependencies>
</plugin>
<plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.3</source>
- <target>1.3</target>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/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 818b2e5..76287d1 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
@@ -19,16 +19,15 @@ package org.apache.maven.surefire.booter;
* under the License.
*/
+import org.apache.maven.surefire.util.UrlUtils;
+
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
-import org.apache.maven.surefire.util.UrlUtils;
-
/**
* An ordered list of classpath elements with set behaviour
*
@@ -46,19 +45,19 @@ public class Classpath
return joinedClasspath;
}
- private final List elements;
+ private final List<String> elements;
public Classpath()
{
- this.elements = new ArrayList();
+ this.elements = new ArrayList<String>();
}
public Classpath( Classpath other )
{
- this.elements = new ArrayList( other.elements );
+ this.elements = new ArrayList<String>( other.elements );
}
- public Classpath( List elements )
+ public Classpath( List<String> elements )
{
this();
addElements( elements );
@@ -76,11 +75,11 @@ public class Classpath
}
}
- private void addElements( List additionalElements )
+ private void addElements( List<String> additionalElements )
{
- for ( Iterator it = additionalElements.iterator(); it.hasNext(); )
+ for ( Object additionalElement : additionalElements )
{
- String element = (String) it.next();
+ String element = (String) additionalElement;
addClassPathElementUrl( element );
}
}
@@ -101,10 +100,9 @@ public class Classpath
public List getAsUrlList()
throws MalformedURLException
{
- List urls = new ArrayList();
- for ( Iterator i = elements.iterator(); i.hasNext(); )
+ List<URL> urls = new ArrayList<URL>();
+ for ( String url : elements )
{
- String url = (String) i.next();
File f = new File( url );
urls.add( UrlUtils.getURL( f ) );
}
@@ -113,10 +111,10 @@ public class Classpath
public void writeToSystemProperty( String propertyName )
{
- StringBuffer sb = new StringBuffer();
- for ( Iterator i = elements.iterator(); i.hasNext(); )
+ StringBuilder sb = new StringBuilder();
+ for ( String element : elements )
{
- sb.append( (String) i.next() ).append( File.pathSeparatorChar );
+ sb.append( element ).append( File.pathSeparatorChar );
}
System.setProperty( propertyName, sb.toString() );
}
@@ -146,9 +144,9 @@ public class Classpath
{
List urls = getAsUrlList();
IsolatedClassLoader classLoader = new IsolatedClassLoader( parent, childDelegation, roleName );
- for ( Iterator iter = urls.iterator(); iter.hasNext(); )
+ for ( Object url1 : urls )
{
- URL url = (URL) iter.next();
+ URL url = (URL) url1;
classLoader.addURL( url );
}
if ( parent != null )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/IsolatedClassLoader.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/IsolatedClassLoader.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/IsolatedClassLoader.java
index ee46e4b..393dd05 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/IsolatedClassLoader.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/IsolatedClassLoader.java
@@ -32,7 +32,7 @@ public class IsolatedClassLoader
{
private final ClassLoader parent = ClassLoader.getSystemClassLoader();
- private final Set urls = new HashSet();
+ private final Set<URL> urls = new HashSet<URL>();
private final String roleName;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/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 8c0dd75..28fb1d3 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
@@ -51,9 +51,9 @@ public class PropertiesWrapper
public void setAsSystemProperties()
{
- for ( Iterator i = properties.keySet().iterator(); i.hasNext(); )
+ for ( Object o : properties.keySet() )
{
- String key = (String) i.next();
+ String key = (String) o;
System.setProperty( key, properties.getProperty( key ) );
}
@@ -66,8 +66,7 @@ public class PropertiesWrapper
public boolean getBooleanProperty( String propertyName )
{
- final Boolean aBoolean = Boolean.valueOf( properties.getProperty( propertyName ) );
- return aBoolean.booleanValue();
+ return Boolean.valueOf( properties.getProperty( propertyName ) );
}
public Boolean getBooleanObjectProperty( String propertyName )
@@ -86,10 +85,10 @@ public class PropertiesWrapper
return (File) typeEncodedValue.getDecodedValue();
}
- public List getStringList( String propertyPrefix )
+ public List<String> getStringList( String propertyPrefix )
{
String value;
- List result = new ArrayList();
+ List<String> result = new ArrayList<String>();
// Whoa, C !!
for ( int i = 0; ( value = getProperty( propertyPrefix + i ) ) != null; i++ )
{
@@ -136,7 +135,7 @@ public class PropertiesWrapper
Classpath getClasspath( String prefix )
{
- List elements = getStringList( prefix );
+ List<String> elements = getStringList( prefix );
return new Classpath( elements );
}
@@ -166,9 +165,8 @@ public class PropertiesWrapper
return;
}
int i = 0;
- for ( Iterator iterator = items.iterator(); iterator.hasNext(); )
+ for ( Object item : items )
{
- Object item = iterator.next();
if ( item == null )
{
throw new NullPointerException( propertyPrefix + i + " has null value" );
@@ -176,9 +174,9 @@ public class PropertiesWrapper
String[] stringArray = StringUtils.split( item.toString(), "," );
- for ( int j = 0; j < stringArray.length; j++ )
+ for ( String aStringArray : stringArray )
{
- properties.setProperty( propertyPrefix + i, stringArray[j] );
+ properties.setProperty( propertyPrefix + i, aStringArray );
i++;
}
@@ -192,6 +190,7 @@ public class PropertiesWrapper
while ( iter.hasNext() )
{
key = iter.next();
+ //noinspection unchecked
target.put( key, properties.get( key ) );
}
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/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 cd29916..67747f5 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
@@ -44,10 +44,6 @@ public class ProviderConfiguration
*/
public static final int TESTS_SUCCEEDED_EXIT_CODE = 0;
- public static final int TESTS_FAILED_EXIT_CODE = 255;
-
- public static final int NO_TESTS_EXIT_CODE = 254;
-
private final DirectoryScannerParameters dirScannerParams;
private final ReporterConfiguration reporterConfiguration;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/TypeEncodedValue.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/TypeEncodedValue.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/TypeEncodedValue.java
index 9251422..a71d40b 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/TypeEncodedValue.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/TypeEncodedValue.java
@@ -96,6 +96,7 @@ public class TypeEncodedValue
}
}
+ @SuppressWarnings( "SimplifiableIfStatement" )
public boolean equals( Object o )
{
if ( this == o )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ClasspathTest.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ClasspathTest.java b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ClasspathTest.java
index e142164..700a3a5 100644
--- a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ClasspathTest.java
+++ b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ClasspathTest.java
@@ -117,9 +117,9 @@ public class ClasspathTest
private void assertClasspathConsistsOfElements( Classpath classpath, String[] elements )
{
List classpathElements = classpath.getClassPath();
- for ( int i = 0; i < elements.length; ++i )
+ for ( String element : elements )
{
- assertTrue( "The element '" + elements[i] + " is missing.", classpathElements.contains( elements[i] ) );
+ assertTrue( "The element '" + element + " is missing.", classpathElements.contains( element ) );
}
assertEquals( "Wrong number of classpath elements.", elements.length, classpathElements.size() );
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/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 9d3bf49..a84d69a 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
@@ -36,8 +36,6 @@ public class Foo
{
DirectoryScannerParameters directoryScannerParameters;
- TestRequest testSuiteDefinition;
-
Properties providerProperties;
ReporterConfiguration reporterConfiguration;
@@ -67,7 +65,7 @@ public class Foo
*/
public Boolean isCalled()
{
- return Boolean.valueOf( called );
+ return called;
}
public void setProviderProperties( Properties providerProperties )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/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 47d413f..560b00b 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
@@ -37,7 +37,7 @@ public class PropertiesWrapperTest
Properties props = new Properties();
PropertiesWrapper propertiesWrapper = new PropertiesWrapper( props );
- List items = new ArrayList();
+ List<String> items = new ArrayList<String>();
items.add( "String1" );
items.add( "String2,String3" );
items.add( "String4" );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/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 28e367f..cd98210 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
@@ -52,7 +52,7 @@ public class SurefireReflectorTest
new DirectoryScannerParameters( new File( "ABC" ), new ArrayList(), new ArrayList(), new ArrayList(),
Boolean.FALSE, "hourly" );
surefireReflector.setDirectoryScannerParameters( foo, directoryScannerParameters );
- assertTrue( isCalled( foo ).booleanValue() );
+ assertTrue( isCalled( foo ) );
}
@@ -64,7 +64,7 @@ public class SurefireReflectorTest
RunOrderParameters runOrderParameters = new RunOrderParameters( RunOrder.DEFAULT, new File( "." ) );
surefireReflector.setRunOrderParameters( foo, runOrderParameters );
- assertTrue( isCalled( foo ).booleanValue() );
+ assertTrue( isCalled( foo ) );
}
@@ -75,10 +75,10 @@ public class SurefireReflectorTest
Object foo = getFoo();
TestRequest testSuiteDefinition =
- new TestRequest( Arrays.asList( new File[]{ new File( "file1" ), new File( "file2" ) } ),
+ new TestRequest( Arrays.asList( new File( "file1" ), new File( "file2" ) ),
new File( "TestSOurce" ), "aUserRequestedTest", "aMethodRequested" );
surefireReflector.setTestSuiteDefinition( foo, testSuiteDefinition );
- assertTrue( isCalled( foo ).booleanValue() );
+ assertTrue( isCalled( foo ) );
}
public void testProviderProperties()
@@ -88,7 +88,7 @@ public class SurefireReflectorTest
Object foo = getFoo();
surefireReflector.setProviderProperties( foo, new Properties() );
- assertTrue( isCalled( foo ).booleanValue() );
+ assertTrue( isCalled( foo ) );
}
public void testReporterConfiguration()
@@ -99,7 +99,7 @@ public class SurefireReflectorTest
ReporterConfiguration reporterConfiguration = getReporterConfiguration();
surefireReflector.setReporterConfigurationAware( foo, reporterConfiguration );
- assertTrue( isCalled( foo ).booleanValue() );
+ assertTrue( isCalled( foo ) );
}
private ReporterConfiguration getReporterConfiguration()
@@ -114,7 +114,7 @@ public class SurefireReflectorTest
Object foo = getFoo();
surefireReflector.setTestClassLoader( foo, getClass().getClassLoader(), getClass().getClassLoader() );
- assertTrue( isCalled( foo ).booleanValue() );
+ assertTrue( isCalled( foo ) );
}
public void testArtifactInfoAware()
@@ -125,7 +125,7 @@ public class SurefireReflectorTest
TestArtifactInfo testArtifactInfo = new TestArtifactInfo( "12.3", "test" );
surefireReflector.setTestArtifactInfo( foo, testArtifactInfo );
- assertTrue( isCalled( foo ).booleanValue() );
+ assertTrue( isCalled( foo ) );
}
private SurefireReflector getReflector()
@@ -145,7 +145,7 @@ public class SurefireReflectorTest
try
{
isCalled = foo.getClass().getMethod( "isCalled", new Class[0] );
- return (Boolean) isCalled.invoke( foo, new Object[0] );
+ return (Boolean) isCalled.invoke( foo );
}
catch ( IllegalAccessException e )
{
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/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 be5c2c5..a03c7d2 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
@@ -119,9 +119,9 @@ public class JUnit4Provider
runNotifer.fireTestRunStarted( null );
- for ( @SuppressWarnings( "unchecked" ) Iterator<Class<?>> iter = testsToRun.iterator(); iter.hasNext(); )
+ for ( Class aTestsToRun : testsToRun )
{
- executeTestSet( iter.next(), reporter, runNotifer );
+ executeTestSet( aTestsToRun, reporter, runNotifer );
}
runNotifer.fireTestRunFinished( result );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/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 4ab068d..190a280 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
@@ -97,7 +97,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( Arrays.<Class>asList( TestClassTest.class ) );
org.junit.runner.notification.RunListener jUnit4RunListener = new JUnitCoreRunListener( listener, testSetMap );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-providers/surefire-testng/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-testng/pom.xml b/surefire-providers/surefire-testng/pom.xml
index 0bb4566..7578437 100644
--- a/surefire-providers/surefire-testng/pom.xml
+++ b/surefire-providers/surefire-testng/pom.xml
@@ -60,15 +60,6 @@
<plugins>
<plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <fork>false</fork>
- <compilerVersion>1.4</compilerVersion>
- <source>1.4</source>
- <target>1.4</target>
- </configuration>
- </plugin>
- <plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- DGF There are no tests in this project currently, and this
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1aea676b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
index 527b21a..48b6011 100644
--- a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
+++ b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java
@@ -63,7 +63,7 @@ public class TestNGXmlTestSuite
* Creates a testng testset to be configured by the specified
* xml file(s). The XML files are suite definitions files according to TestNG DTD.
*/
- public TestNGXmlTestSuite( List suiteFiles, String testSourceDirectory, String artifactVersion,
+ public TestNGXmlTestSuite( List<File> suiteFiles, String testSourceDirectory, String artifactVersion,
Properties confOptions, File reportsDirectory )
{
this.suiteFiles = suiteFiles;
[2/3] git commit: o Fix some poms - Use surefire-version that is
under test in working-directory and aggregate-report - Remove double
commons-io declaration in s-i-tests\pom.xml
Posted by kr...@apache.org.
o Fix some poms
- Use surefire-version that is under test in working-directory and aggregate-report
- Remove double commons-io declaration in s-i-tests\pom.xml
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/300d38b3
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/300d38b3
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/300d38b3
Branch: refs/heads/master
Commit: 300d38b3d98c9eb18d1219e8d58049106972b6b9
Parents: 1aea676
Author: Andreas Gudian <ag...@apache.org>
Authored: Thu Apr 4 21:10:36 2013 +0200
Committer: Kristian Rosenvold <kr...@apache.org>
Committed: Thu Apr 11 20:48:18 2013 +0200
----------------------------------------------------------------------
.../src/test/resources/aggregate-report/pom.xml | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/300d38b3/surefire-integration-tests/src/test/resources/aggregate-report/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/aggregate-report/pom.xml b/surefire-integration-tests/src/test/resources/aggregate-report/pom.xml
index 340452a..631ca7c 100644
--- a/surefire-integration-tests/src/test/resources/aggregate-report/pom.xml
+++ b/surefire-integration-tests/src/test/resources/aggregate-report/pom.xml
@@ -45,6 +45,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
[3/3] git commit: [SUREFIRE-968] Add test name to Test-Finished
console message
Posted by kr...@apache.org.
[SUREFIRE-968] Add test name to Test-Finished console message
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/35fc2cee
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/35fc2cee
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/35fc2cee
Branch: refs/heads/master
Commit: 35fc2ceec539049788575a64a110f996e30e6b29
Parents: 300d38b
Author: Andreas Gudian <ag...@apache.org>
Authored: Thu Apr 4 21:12:21 2013 +0200
Committer: Kristian Rosenvold <kr...@apache.org>
Committed: Thu Apr 11 20:48:18 2013 +0200
----------------------------------------------------------------------
.../plugin/surefire/report/ConsoleReporter.java | 13 +---------
.../maven/plugin/surefire/report/TestSetStats.java | 3 ++
.../plugin/surefire/report/WrappedReportEntry.java | 5 +++
.../surefire/report/CategorizedReportEntry.java | 20 +++++++++++++++
.../apache/maven/surefire/report/ReportEntry.java | 7 +++++
.../maven/surefire/report/SimpleReportEntry.java | 5 +++-
6 files changed, 40 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/35fc2cee/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java
index 1fa55c9..14e8c67 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java
@@ -41,10 +41,6 @@ public class ConsoleReporter
private static final String TEST_SET_STARTING_PREFIX = "Running ";
- private static final String TEST_SET_STARTING_GROUP_PREFIX = " (of ";
-
- private static final String TEST_SET_STARTING_GROUP_SUFIX = ")";
-
private static final int BUFFER_SIZE = 4096;
private final PrintWriter writer;
@@ -116,14 +112,7 @@ public class ConsoleReporter
{
StringBuilder message = new StringBuilder();
message.append( TEST_SET_STARTING_PREFIX );
- message.append( report.getName() );
-
- if ( report.getGroup() != null && !report.getName().equals( report.getGroup() ) )
- {
- message.append( TEST_SET_STARTING_GROUP_PREFIX );
- message.append( report.getGroup() );
- message.append( TEST_SET_STARTING_GROUP_SUFIX );
- }
+ message.append( report.getNameWithGroup() );
message.append( "\n" );
return message.toString();
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/35fc2cee/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java
index fd5fb27..ef253bf 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java
@@ -188,6 +188,9 @@ public class TestSetStats
{
buf.append( " <<< FAILURE!" );
}
+
+ buf.append( " - in " );
+ buf.append( reportEntry.getNameWithGroup() );
buf.append( "\n" );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/35fc2cee/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
index fa941f7..028898f 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
@@ -171,4 +171,9 @@ public class WrappedReportEntry
{
return ReportEntryType.success == getReportEntryType();
}
+
+ public String getNameWithGroup()
+ {
+ return original.getNameWithGroup();
+ }
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/35fc2cee/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java
index a91174e..77cfaf3 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java
@@ -26,6 +26,10 @@ public class CategorizedReportEntry
extends SimpleReportEntry
implements ReportEntry
{
+ private static final String GROUP_PREFIX = " (of ";
+
+ private static final String GROUP_SUFIX = ")";
+
private final String group;
public CategorizedReportEntry( String source, String name, String group )
@@ -60,6 +64,22 @@ public class CategorizedReportEntry
return group;
}
+ @Override
+ public String getNameWithGroup()
+ {
+ StringBuilder result = new StringBuilder();
+ result.append( getName() );
+
+ if ( getGroup() != null && !getName().equals( getGroup() ) )
+ {
+ result.append( GROUP_PREFIX );
+ result.append( getGroup() );
+ result.append( GROUP_SUFIX );
+ }
+
+ return result.toString();
+ }
+
public boolean equals( Object o )
{
if ( this == o )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/35fc2cee/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java
index 8e87066..65bcb56 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java
@@ -64,4 +64,11 @@ public interface ReportEntry
* @return A string that explains an anomaly
*/
public String getMessage();
+
+ /**
+ * A name of the test case together with the group or category (if any exists).
+ *
+ * @return A string with the test case name and group/category, or just the name.
+ */
+ public String getNameWithGroup();
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/35fc2cee/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java
index ed081fd..ca33a5f 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java
@@ -187,5 +187,8 @@ public class SimpleReportEntry
return result;
}
-
+ public String getNameWithGroup()
+ {
+ return getName();
+ }
}