You are viewing a plain text version of this content. The canonical link for it is here.
Posted to surefire-commits@maven.apache.org by kr...@apache.org on 2011/02/09 21:02:58 UTC
svn commit: r1069064 - in /maven/surefire/trunk:
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/
surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/
surefire-integration-tests/src/test/resources/junit44-dep/
Author: krosenvold
Date: Wed Feb 9 20:02:57 2011
New Revision: 1069064
URL: http://svn.apache.org/viewvc?rev=1069064&view=rev
Log:
[SUREFIRE-698] 47 provider ignores junit-dep
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitDepIT.java (contents, props changed)
- copied, changed from r1069062, maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit44DepIT.java
Removed:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit44DepIT.java
Modified:
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-dep/pom.xml
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=1069064&r1=1069063&r2=1069064&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 Wed Feb 9 20:02:57 2011
@@ -109,9 +109,10 @@ public abstract class AbstractSurefireMo
try
{
+ final Artifact junitDepArtifact = getJunitDepArtifact();
wellKnownProviders = new ProviderList( new ProviderInfo[]{ new TestNgProviderInfo( getTestNgArtifact() ),
- new JUnitCoreProviderInfo( getJunitArtifact() ),
- new JUnit4ProviderInfo( getJunitArtifact(), getJunitDepArtifact() ), new JUnit3ProviderInfo() },
+ new JUnitCoreProviderInfo( getJunitArtifact(), junitDepArtifact ),
+ new JUnit4ProviderInfo( getJunitArtifact(), junitDepArtifact ), new JUnit3ProviderInfo() },
new DynamicProviderInfo( null ) );
return wellKnownProviders.resolve( getLog() );
@@ -477,8 +478,8 @@ public abstract class AbstractSurefireMo
if ( !range.containsVersion( new DefaultArtifactVersion( artifact.getVersion() ) ) )
{
throw new MojoFailureException(
- "TestNG support requires version 4.7 or above. You have declared version "
- + artifact.getVersion() );
+ "TestNG support requires version 4.7 or above. You have declared version " +
+ artifact.getVersion() );
}
}
return artifact;
@@ -642,7 +643,7 @@ public abstract class AbstractSurefireMo
checksum.add( getObjectFactory() );
checksum.add( getFailIfNoTests() );
checksum.add( getRunOrder() );
- addPluginSpecificChecksumItems(checksum);
+ addPluginSpecificChecksumItems( checksum );
return checksum.getSha1();
}
@@ -792,8 +793,8 @@ public abstract class AbstractSurefireMo
Artifact artifact = (Artifact) i.next();
getLog().debug(
- "Adding to " + getPluginName() + " booter test classpath: " + artifact.getFile().getAbsolutePath()
- + " Scope: " + artifact.getScope() );
+ "Adding to " + getPluginName() + " booter test classpath: " + artifact.getFile().getAbsolutePath() +
+ " Scope: " + artifact.getScope() );
bootClasspath.addClassPathElementUrl( artifact.getFile().getAbsolutePath() );
}
@@ -870,8 +871,8 @@ public abstract class AbstractSurefireMo
}
catch ( Exception e )
{
- String msg = "Build uses Maven 2.0.x, cannot propagate system properties"
- + " from command line to tests (cf. SUREFIRE-121)";
+ String msg = "Build uses Maven 2.0.x, cannot propagate system properties" +
+ " from command line to tests (cf. SUREFIRE-121)";
if ( getLog().isDebugEnabled() )
{
getLog().warn( msg, e );
@@ -1113,9 +1114,12 @@ public abstract class AbstractSurefireMo
{
private final Artifact junitArtifact;
- JUnitCoreProviderInfo( Artifact junitArtifact )
+ private final Artifact junitDepArtifact;
+
+ JUnitCoreProviderInfo( Artifact junitArtifact, Artifact junitDepArtifact )
{
this.junitArtifact = junitArtifact;
+ this.junitDepArtifact = junitDepArtifact;
}
public String getProviderName()
@@ -1123,9 +1127,15 @@ public abstract class AbstractSurefireMo
return "org.apache.maven.surefire.junitcore.JUnitCoreProvider";
}
+ private boolean is47CompatibleJunitDep()
+ {
+ return junitDepArtifact != null && isJunit47Compatible( junitDepArtifact );
+ }
+
public boolean isApplicable()
{
- return isAnyJunit4( junitArtifact ) && isAnyConcurrencySelected() && isJunit47Compatible( junitArtifact );
+ final boolean isJunitArtifact47 = isAnyJunit4( junitArtifact ) && isJunit47Compatible( junitArtifact );
+ return isAnyConcurrencySelected() && ( isJunitArtifact47 || is47CompatibleJunitDep() );
}
public void addProviderProperties()
Copied: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitDepIT.java (from r1069062, maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit44DepIT.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitDepIT.java?p2=maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitDepIT.java&p1=maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit44DepIT.java&r1=1069062&r2=1069064&rev=1069064&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit44DepIT.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitDepIT.java Wed Feb 9 20:02:57 2011
@@ -24,10 +24,10 @@ package org.apache.maven.surefire.its;
*
* @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
*/
-public class JUnit44DepIT
+public class JUnitDepIT
extends SurefireVerifierTestClass
{
- public JUnit44DepIT()
+ public JUnitDepIT()
{
super( "/junit44-dep" );
}
@@ -35,17 +35,34 @@ public class JUnit44DepIT
public void testJUnit44Dep()
throws Exception
{
+ debugLogging();
+ addGoal( "-Djunit-dep.version=4.4" );
executeTest();
+
verifyErrorFreeLog();
assertTestSuiteResults( 1, 0, 0, 0 );
+ verifyTextInLog( "surefire-junit4" ); // Ahem. Will match on the 4.7 provider too
}
public void testJUnit44DepWithSneaky381()
throws Exception
{
+ debugLogging();
activateProfile("provided381");
+ addGoal( "-Djunit-dep.version=4.4" );
+ executeTest();
+ verifyErrorFreeLog();
+ assertTestSuiteResults( 1, 0, 0, 0 );
+ }
+
+ public void testJUnit47Dep()
+ throws Exception
+ {
+ debugLogging();
+ addGoal( "-Djunit-dep.version=4.7" );
executeTest();
verifyErrorFreeLog();
assertTestSuiteResults( 1, 0, 0, 0 );
+ verifyTextInLog( "surefire-junit47" );
}
Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitDepIT.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-dep/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-dep/pom.xml?rev=1069064&r1=1069063&r2=1069064&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-dep/pom.xml (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-dep/pom.xml Wed Feb 9 20:02:57 2011
@@ -32,7 +32,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
- <version>4.4</version>
+ <version>${junit-dep.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -64,6 +64,9 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
+ <configuration>
+ <parallel>classes</parallel>
+ </configuration>
</plugin>
</plugins>
</build>