Committing integration test for mng-3380...will clean up long paths next, but need to get this committed first.

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@675011 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2008-07-08 22:45:26 +00:00
parent d8e6ed1532
commit 31341f6c89
17 changed files with 423 additions and 0 deletions

View File

@ -0,0 +1,262 @@
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;
import java.io.File;
/**
* expected project.getArtifacts() results:
*
* direct-dependency-groupId:direct-dependency-artifactId:jar:1:compile
* transitive-dependency-new-groupId:transitive-dependency-artifactId:jar:2:compile
* other-groupId:other-artifactId-a:jar:1:compile
* other-groupId:other-artifactId-b:jar:1:compile
*
* org.apache.maven.project.MavenProject#.getArtifacts() is called with goal:
* org.apache.maven.its:mng3380.plugin:mng-3380-test
*
*/
public class MavenITmng3380ManagedRelocatedTransdepsTest
extends AbstractMavenIntegrationTestCase {
public MavenITmng3380ManagedRelocatedTransdepsTest()
throws InvalidVersionSpecificationException {
super("(2.0.9,)");
}
public void testitMNG3380() throws Exception {
// compute test directory
File testDir = ResourceExtractor.simpleExtractResources(getClass(),
"/mng-3380-managedRelocatedTransdeps");
Verifier verifier = new Verifier(testDir.getAbsolutePath());
deleteArtifacts( verifier );
installDependencies( testDir );
String path = testDir.getAbsolutePath() //
+ "/projects/root-groupId/root-artifactId/1";
verifier = new Verifier(path);
verifier.executeGoal("package");
// verify no errors so far
verifier.verifyErrorFreeLog();
verifier.resetStreams();
}
private void installDependencies( File testDir )
throws Exception
{
// install projects
String path = testDir.getAbsolutePath() //
+ "/projects/other-groupId/other-artifactId-c/1";
Verifier verifier = new Verifier(path);
verifier.executeGoal("install");
path = testDir.getAbsolutePath() //
+ "/projects/other-groupId/other-artifactId-b/1";
verifier = new Verifier(path);
verifier.executeGoal("install");
path = testDir.getAbsolutePath() //
+ "/projects/other-groupId/other-artifactId-a/1";
verifier = new Verifier(path);
verifier.executeGoal("install");
path = testDir.getAbsolutePath() //
+ "/projects/transitive-dependency-old-groupId/transitive-dependency-artifactId/1";
verifier = new Verifier(path);
verifier.executeGoal("install");
path = testDir.getAbsolutePath() //
+ "/projects/transitive-dependency-new-groupId/transitive-dependency-artifactId/1";
verifier = new Verifier(path);
verifier.executeGoal("install");
path = testDir.getAbsolutePath() //
+ "/projects/transitive-dependency-new-groupId/transitive-dependency-artifactId/2";
verifier = new Verifier(path);
verifier.executeGoal("install");
path = testDir.getAbsolutePath() //
+ "/projects/direct-dependency-groupId/direct-dependency-artifactId/1";
verifier = new Verifier(path);
verifier.executeGoal("install");
}
private void deleteArtifacts( Verifier verifier )
throws Exception
{
// delete projects
verifier.deleteArtifact( //
"other-groupId", //
"other-artifactId-c", //
"1", //
"jar");
verifier.deleteArtifact( //
"other-groupId", //
"other-artifactId-c", //
"1", //
"pom");
verifier.assertArtifactNotPresent( //
"other-groupId", //
"other-artifactId-c", //
"1", //
"jar");
verifier.assertArtifactNotPresent( //
"other-groupId", //
"other-artifactId-c", //
"1", //
"pom");
verifier.deleteArtifact( //
"other-groupId", //
"other-artifactId-b", //
"1", //
"jar");
verifier.deleteArtifact( //
"other-groupId", //
"other-artifactId-b", //
"1", //
"pom");
verifier.assertArtifactNotPresent( //
"other-groupId", //
"other-artifactId-b", //
"1", //
"jar");
verifier.assertArtifactNotPresent( //
"other-groupId", //
"other-artifactId-b", //
"1", //
"pom");
verifier.deleteArtifact( //
"other-groupId", //
"other-artifactId-a", //
"1", //
"jar");
verifier.deleteArtifact( //
"other-groupId", //
"other-artifactId-a", //
"1", //
"pom");
verifier.assertArtifactNotPresent( //
"other-groupId", //
"other-artifactId-a", //
"1", //
"jar");
verifier.assertArtifactNotPresent( //
"other-groupId", //
"other-artifactId-a", //
"1", //
"pom");
verifier.deleteArtifact( //
"transitive-dependency-old-groupId", //
"transitive-dependency-artifactId", //
"1", //
"jar");
verifier.deleteArtifact( //
"transitive-dependency-old-groupId", //
"transitive-dependency-artifactId", //
"1", //
"pom");
verifier.assertArtifactNotPresent( //
"transitive-dependency-old-groupId", //
"transitive-dependency-artifactId", //
"1", //
"jar");
verifier.assertArtifactNotPresent( //
"transitive-dependency-old-groupId", //
"transitive-dependency-artifactId", //
"1", //
"pom");
verifier.deleteArtifact( //
"transitive-dependency-new-groupId", //
"transitive-dependency-artifactId", //
"1", //
"jar");
verifier.deleteArtifact( //
"transitive-dependency-new-groupId", //
"transitive-dependency-artifactId", //
"1", //
"pom");
verifier.assertArtifactNotPresent( //
"transitive-dependency-new-groupId", //
"transitive-dependency-artifactId", //
"1", //
"jar");
verifier.assertArtifactNotPresent( //
"transitive-dependency-new-groupId", //
"transitive-dependency-artifactId", //
"1", //
"pom");
verifier.deleteArtifact( //
"transitive-dependency-new-groupId", //
"transitive-dependency-artifactId", //
"2", //
"jar");
verifier.deleteArtifact( //
"transitive-dependency-new-groupId", //
"transitive-dependency-artifactId", //
"2", //
"pom");
verifier.assertArtifactNotPresent( //
"transitive-dependency-new-groupId", //
"transitive-dependency-artifactId", //
"2", //
"jar");
verifier.assertArtifactNotPresent( //
"transitive-dependency-new-groupId", //
"transitive-dependency-artifactId", //
"2", //
"pom");
verifier.deleteArtifact( //
"direct-dependency-groupId", //
"direct-dependency-artifactId", //
"1", //
"jar");
verifier.deleteArtifact( //
"direct-dependency-groupId", //
"direct-dependency-artifactId", //
"1", //
"pom");
verifier.assertArtifactNotPresent( //
"direct-dependency-groupId", //
"direct-dependency-artifactId", //
"1", //
"jar");
verifier.assertArtifactNotPresent( //
"direct-dependency-groupId", //
"direct-dependency-artifactId", //
"1", //
"pom");
verifier.deleteArtifact( //
"root-groupId", //
"root-artifactId", //
"1", //
"jar");
verifier.deleteArtifact( //
"root-groupId", //
"root-artifactId", //
"1", //
"pom");
verifier.assertArtifactNotPresent( //
"root-groupId", //
"root-artifactId", //
"1", //
"jar");
verifier.assertArtifactNotPresent( //
"root-groupId", //
"root-artifactId", //
"1", //
"pom");
}
}

View File

@ -0,0 +1,13 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>direct-dependency-groupId</groupId>
<artifactId>direct-dependency-artifactId</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>transitive-dependency-old-groupId</groupId>
<artifactId>transitive-dependency-artifactId</artifactId>
<version>1</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,6 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>other-groupId</groupId>
<artifactId>other-artifactId-a</artifactId>
<version>1</version>
</project>

View File

@ -0,0 +1,6 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>other-groupId</groupId>
<artifactId>other-artifactId-b</artifactId>
<version>1</version>
</project>

View File

@ -0,0 +1,6 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>other-groupId</groupId>
<artifactId>other-artifactId-c</artifactId>
<version>1</version>
</project>

View File

@ -0,0 +1,28 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>root-groupId</groupId>
<artifactId>root-artifactId</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>direct-dependency-groupId</groupId>
<artifactId>direct-dependency-artifactId</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>transitive-dependency-new-groupId</groupId>
<artifactId>transitive-dependency-artifactId</artifactId>
<version>2</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>

View File

@ -0,0 +1,7 @@
package tests;
import tests.TransitiveComponent2;
import tests.OtherComponentA;
import tests.OtherComponentB;
public class RootComponent{}

View File

@ -0,0 +1,18 @@
package tests;
import junit.framework.TestCase;
public class DependencyManagementTest
extends TestCase
{
public void testWrongTransitiveArtifactIsAvoided()
{
assertNull( Thread.currentThread().getContextClassLoader().getResource( "tests/TransitiveComponent1.class" ) );
}
public void testOtherCArtifactIsAvoided()
{
assertNull( Thread.currentThread().getContextClassLoader().getResource( "tests/OtherComponentC.class" ) );
}
}

View File

@ -0,0 +1,18 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>transitive-dependency-new-groupId</groupId>
<artifactId>transitive-dependency-artifactId</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>other-groupId</groupId>
<artifactId>other-artifactId-a</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>other-groupId</groupId>
<artifactId>other-artifactId-c</artifactId>
<version>1</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,7 @@
package tests;
import tests.OtherComponentA;
import tests.OtherComponentC;
public class TransitiveComponent1
{}

View File

@ -0,0 +1,18 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>transitive-dependency-new-groupId</groupId>
<artifactId>transitive-dependency-artifactId</artifactId>
<version>2</version>
<dependencies>
<dependency>
<groupId>other-groupId</groupId>
<artifactId>other-artifactId-a</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>other-groupId</groupId>
<artifactId>other-artifactId-b</artifactId>
<version>1</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,7 @@
package tests;
import tests.OtherComponentA;
import tests.OtherComponentB;
public class TransitiveComponent2
{}

View File

@ -0,0 +1,11 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>transitive-dependency-old-groupId</groupId>
<artifactId>transitive-dependency-artifactId</artifactId>
<version>1</version>
<distributionManagement>
<relocation>
<groupId>transitive-dependency-new-groupId</groupId>
</relocation>
</distributionManagement>
</project>