You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2007/06/29 07:55:50 UTC
svn commit: r551804 - in
/maven/core-integration-testing/trunk/maven-integration-test-helper: ./
src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/maven/
src/main/java/org/apache/maven/integrationtests/
Author: jvanzyl
Date: Thu Jun 28 22:55:49 2007
New Revision: 551804
URL: http://svn.apache.org/viewvc?view=rev&rev=551804
Log:
o separation of the base integration test. this can now be used in the IT suite we run and used in the archetype.
Added:
maven/core-integration-testing/trunk/maven-integration-test-helper/
maven/core-integration-testing/trunk/maven-integration-test-helper/pom.xml (with props)
maven/core-integration-testing/trunk/maven-integration-test-helper/src/
maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/
maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/
maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/
maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/
maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/maven/
maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/maven/integrationtests/
maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/maven/integrationtests/AbstractMavenIntegrationTestCase.java (with props)
Added: maven/core-integration-testing/trunk/maven-integration-test-helper/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/maven-integration-test-helper/pom.xml?view=auto&rev=551804
==============================================================================
--- maven/core-integration-testing/trunk/maven-integration-test-helper/pom.xml (added)
+++ maven/core-integration-testing/trunk/maven-integration-test-helper/pom.xml Thu Jun 28 22:55:49 2007
@@ -0,0 +1,25 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its</groupId>
+ <artifactId>maven-integration-test-helper</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Maven Integration Tests</name>
+ <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.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ </dependency>
+ </dependencies>
+</project>
Propchange: maven/core-integration-testing/trunk/maven-integration-test-helper/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/maven-integration-test-helper/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/maven/integrationtests/AbstractMavenIntegrationTestCase.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/maven/integrationtests/AbstractMavenIntegrationTestCase.java?view=auto&rev=551804
==============================================================================
--- maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/maven/integrationtests/AbstractMavenIntegrationTestCase.java (added)
+++ maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/maven/integrationtests/AbstractMavenIntegrationTestCase.java Thu Jun 28 22:55:49 2007
@@ -0,0 +1,109 @@
+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;
+import java.io.IOException;
+import java.io.PrintStream;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Jason van Zyl
+ * @author Kenney Westerhof
+ */
+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();
+ }
+
+ try
+ {
+ super.runTest();
+ out.println( " Ok" );
+ }
+ catch ( Throwable t )
+ {
+ out.println( " Failure" );
+ throw t;
+ }
+ }
+
+ private String getITName()
+ {
+ String simpleName = getClass().getName();
+ int idx = simpleName.lastIndexOf( '.' );
+ simpleName = idx >= 0 ? simpleName.substring( idx + 1 ) : simpleName;
+ simpleName = simpleName.startsWith( "MavenIT" ) ? simpleName.substring( "MavenIT".length() ) : simpleName;
+ simpleName = simpleName.endsWith( "Test" ) ? simpleName.substring( 0, simpleName.length() - 4 ) : simpleName;
+ return simpleName;
+ }
+
+ protected File setupLocalRepo()
+ throws IOException
+ {
+ String tempDirPath = System.getProperty( "maven.test.tmpdir", System.getProperty( "java.io.tmpdir" ) );
+ File localRepo = new File( tempDirPath, "local-repository/" + getITName() );
+ if ( localRepo.isDirectory() )
+ {
+ FileUtils.deleteDirectory( localRepo );
+ }
+
+ System.setProperty( "maven.repo.local", localRepo.getAbsolutePath() );
+
+ return localRepo;
+ }
+}
Propchange: maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/maven/integrationtests/AbstractMavenIntegrationTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/maven/integrationtests/AbstractMavenIntegrationTestCase.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"