mirror of https://github.com/apache/maven.git
* Added getMavenVersion call to the Verifier
* Added a flag to run maven internally instead of forked (using reflection), nice for in IDE's. * Added possibility to skip tests for certain maven versions, specified by a versionrange * made it26 and it31 only run for 2.0.x * added dependency to maven-artifact 2.0.5 on core-integration-tests for the VerionRange and DefaultArtifactVersion. git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@512437 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a88016e8ab
commit
d6a7c262da
|
@ -34,10 +34,16 @@
|
|||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<!-- needed for VersionRange and Version -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-verifier</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package org.apache.maven.integrationtests;
|
||||
|
||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
||||
import org.apache.maven.artifact.versioning.VersionRange;
|
||||
import org.apache.maven.it.util.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -15,19 +18,58 @@ import junit.framework.TestCase;
|
|||
public abstract class AbstractMavenIntegrationTestCase
|
||||
extends TestCase
|
||||
{
|
||||
/**
|
||||
* Save System.out for progress reports etc.
|
||||
*/
|
||||
private static PrintStream out = System.out;
|
||||
|
||||
private boolean skip;
|
||||
|
||||
private DefaultArtifactVersion version;
|
||||
|
||||
private VersionRange versionRange;
|
||||
|
||||
protected AbstractMavenIntegrationTestCase()
|
||||
{
|
||||
}
|
||||
|
||||
protected AbstractMavenIntegrationTestCase( String versionRangeStr )
|
||||
throws InvalidVersionSpecificationException
|
||||
{
|
||||
this.versionRange = VersionRange.createFromVersionSpec( versionRangeStr );
|
||||
|
||||
String v = System.getProperty( "maven.version" );
|
||||
if ( v != null )
|
||||
{
|
||||
this.version = new DefaultArtifactVersion( v );
|
||||
if ( !versionRange.containsVersion( this.version ) )
|
||||
{
|
||||
skip = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out.print( "WARNING: " + getITName() + ": version range '" + versionRange
|
||||
+ "' supplied but no maven version - not skipping test." );
|
||||
}
|
||||
}
|
||||
|
||||
protected void runTest()
|
||||
throws Throwable
|
||||
{
|
||||
out.print( getITName() + "(" + getName() + ").." );
|
||||
|
||||
if ( skip )
|
||||
{
|
||||
out.println( " Skipping (version " + version + " not in range " + versionRange + ")" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( "true".equals( System.getProperty( "useEmptyLocalRepository", "false" ) ) )
|
||||
{
|
||||
setupLocalRepo();
|
||||
}
|
||||
|
||||
// save System.out since running the test will replace it
|
||||
PrintStream out = System.out;
|
||||
|
||||
out.print( getITName() + "(" + getName() + ").." );
|
||||
|
||||
try
|
||||
{
|
||||
super.runTest();
|
||||
|
|
|
@ -1,13 +1,26 @@
|
|||
package org.apache.maven.integrationtests;
|
||||
|
||||
import org.apache.maven.it.VerificationException;
|
||||
import org.apache.maven.it.Verifier;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
public class IntegrationTestSuite
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
public static Test suite()
|
||||
private static PrintStream out = System.out;
|
||||
|
||||
public static Test suite() throws VerificationException
|
||||
{
|
||||
String mavenVersion = new Verifier( "" ).getMavenVersion();
|
||||
|
||||
out.println( "Running integration tests for Maven " + mavenVersion );
|
||||
|
||||
System.setProperty( "maven.version", mavenVersion );
|
||||
|
||||
TestSuite suite = new TestSuite();
|
||||
suite.addTestSuite( MavenIT0000Test.class );
|
||||
suite.addTestSuite( MavenIT0001Test.class );
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.apache.maven.integrationtests;
|
||||
|
||||
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
||||
import org.apache.maven.it.Verifier;
|
||||
import org.apache.maven.it.util.ResourceExtractor;
|
||||
|
||||
|
@ -9,6 +10,11 @@ import java.util.Properties;
|
|||
public class MavenIT0026Test
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
public MavenIT0026Test()
|
||||
throws InvalidVersionSpecificationException
|
||||
{
|
||||
super( "[,2.1-SNAPSHOT)" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test merging of global- and user-level settings.xml files.
|
||||
|
@ -29,4 +35,3 @@ public class MavenIT0026Test
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.apache.maven.integrationtests;
|
||||
|
||||
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
||||
import org.apache.maven.it.Verifier;
|
||||
import org.apache.maven.it.util.ResourceExtractor;
|
||||
|
||||
|
@ -9,11 +10,15 @@ import java.util.Properties;
|
|||
public class MavenIT0031Test
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
public MavenIT0031Test()
|
||||
throws InvalidVersionSpecificationException
|
||||
{
|
||||
super( "[,2.1-SNAPSHOT)" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test usage of plugins.xml mapping file on the repository to resolve
|
||||
* plugin artifactId from it's prefix using the pluginGroups in
|
||||
* the provided settings.xml.
|
||||
* Test usage of plugins.xml mapping file on the repository to resolve plugin artifactId from it's prefix using the
|
||||
* pluginGroups in the provided settings.xml.
|
||||
*/
|
||||
public void testit0031()
|
||||
throws Exception
|
||||
|
@ -30,9 +35,8 @@ public class MavenIT0031Test
|
|||
verifier.setVerifierProperties( verifierProperties );
|
||||
verifier.executeGoal( "modello:java" );
|
||||
verifier.assertFilePresent( "target/generated-sources/modello/org/apache/maven/it/it0031/Root.java" );
|
||||
// don't verify error free log
|
||||
// don't verify error free log
|
||||
verifier.resetStreams();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue