diff options
author | Brett Porter <brett@apache.org> | 2008-04-08 07:28:46 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2008-04-08 07:28:46 +0000 |
commit | 919466bbd25449259800c25a41f19a2e5a27bb70 (patch) | |
tree | 20d793f19f72c3134bcb8892f4bb3ecac4da83d2 /archiva-modules/archiva-base | |
parent | 80a96f560c65a8fe3b8584842f54f6fd9dc6d8c1 (diff) | |
download | archiva-919466bbd25449259800c25a41f19a2e5a27bb70.tar.gz archiva-919466bbd25449259800c25a41f19a2e5a27bb70.zip |
additional tests and add classifier
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@645780 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base')
5 files changed, 196 insertions, 2 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java index 6102c333d..6d3bc514d 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java @@ -89,7 +89,7 @@ public class DependencyTreeGeneratorConsumer /** @plexus.requirement */ private MavenProjectBuilder projectBuilder; - + /** @plexus.requirement */ private ArtifactRepositoryFactory artifactRepositoryFactory; @@ -300,6 +300,10 @@ public class DependencyTreeGeneratorConsumer { dependency.addElement( "scope" ).setText( artifact.getScope() ); } + if ( artifact.getClassifier() != null ) + { + dependency.addElement( "classifier" ).setText( artifact.getClassifier() ); + } xmlNode = dependency.addElement( "dependencies" ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/test/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/test/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumerTest.java index 9b8bc8a1e..0c28f19e7 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/test/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/test/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumerTest.java @@ -27,6 +27,8 @@ import org.apache.commons.io.IOUtils; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.consumers.ConsumerException; import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; +import org.apache.maven.profiles.DefaultProfileManager; +import org.codehaus.plexus.spring.PlexusContainerAdapter; import org.codehaus.plexus.spring.PlexusInSpringTestCase; public class DependencyTreeGeneratorConsumerTest @@ -44,7 +46,7 @@ public class DependencyTreeGeneratorConsumerTest throws Exception { super.setUp(); - + consumer = (DependencyTreeGeneratorConsumer) lookup( KnownRepositoryContentConsumer.class, "dependency-tree-generator" ); @@ -76,4 +78,45 @@ public class DependencyTreeGeneratorConsumerTest consumer.completeScan(); } + + public void testInvalidCoordinate() + throws IOException, ConsumerException + { + consumer.beginScan( repository ); + + String path = "openejb/jaxb-xjc/2.0EA3/jaxb-xjc-2.0EA3.pom"; + try + { + consumer.processFile( path ); + + fail( "Should not have successfully processed the file" ); + } + catch ( ConsumerException e ) + { + File generatedFile = new File( generatedRepositoryLocation, path + ".xml" ); + assertFalse( generatedFile.exists() ); + } + + consumer.completeScan(); + } + + public void testProfiles() + throws IOException, ConsumerException + { + PlexusContainerAdapter container = new PlexusContainerAdapter(); + container.setApplicationContext( getApplicationContext() ); + + DefaultProfileManager m = new DefaultProfileManager( container ); + + consumer.beginScan( repository ); + + String path = "org/apache/maven/surefire/surefire-testng/2.0/surefire-testng-2.0.pom"; + consumer.processFile( path ); + + File generatedFile = new File( generatedRepositoryLocation, path + ".xml" ); + assertEquals( IOUtils.toString( getClass().getResourceAsStream( "/test-data/surefire-testng-2.0-tree.xml" ) ), + FileUtils.readFileToString( generatedFile ) ); + + consumer.completeScan(); + } } diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/test/resources/test-data/surefire-testng-2.0-tree.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/test/resources/test-data/surefire-testng-2.0-tree.xml new file mode 100644 index 000000000..287c45954 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/test/resources/test-data/surefire-testng-2.0-tree.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tree> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-testng</artifactId> + <type>jar</type> + <version>2.0</version> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-api</artifactId> + <type>jar</type> + <version>2.0</version> + <scope>compile</scope> + <dependencies> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-utils</artifactId> + <type>jar</type> + <version>1.1</version> + <scope>compile</scope> + </dependency> + </dependencies> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <type>jar</type> + <version>4.7</version> + <scope>compile</scope> + <classifier>jdk15</classifier> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <type>jar</type> + <version>3.8.1</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>qdox</groupId> + <artifactId>qdox</artifactId> + <type>jar</type> + <version>1.5</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>bsh</groupId> + <artifactId>bsh</artifactId> + <type>jar</type> + <version>2.0b1</version> + <scope>runtime</scope> + </dependency> + </dependencies> + </dependency> + </dependencies> + </dependency> +</tree> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/test/resources/test-repo/openejb/jaxb-xjc/2.0EA3/jaxb-xjc-2.0EA3.pom b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/test/resources/test-repo/openejb/jaxb-xjc/2.0EA3/jaxb-xjc-2.0EA3.pom new file mode 100644 index 000000000..d56af580b --- /dev/null +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/test/resources/test-repo/openejb/jaxb-xjc/2.0EA3/jaxb-xjc-2.0EA3.pom @@ -0,0 +1,6 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>openejb</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.0EA3</version> +</project> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/test/resources/test-repo/org/apache/maven/surefire/surefire-testng/2.0/surefire-testng-2.0.pom b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/test/resources/test-repo/org/apache/maven/surefire/surefire-testng/2.0/surefire-testng-2.0.pom new file mode 100644 index 000000000..d8de3ad32 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/test/resources/test-repo/org/apache/maven/surefire/surefire-testng/2.0/surefire-testng-2.0.pom @@ -0,0 +1,82 @@ +<?xml version="1.0"?><project> + <parent> + <artifactId>surefire-providers</artifactId> + <groupId>org.apache.maven.surefire</groupId> + <version>2.0</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>surefire-testng</artifactId> + <name>SureFire TestNG Runner</name> + <version>2.0</version> + <build> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.4</source> + <target>1.4</target> + </configuration> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <fork>false</fork> + </configuration> + </plugin> + </plugins> + </build> + <profiles> + <profile> + <id>jdk14</id> + <activation> + <jdk>1.4</jdk> + </activation> + <dependencies> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>4.7</version> + <classifier>jdk14</classifier> + </dependency> + </dependencies> + </profile> + <profile> + <id>jdk15</id> + <activation> + <jdk>!1.4</jdk> + </activation> + <dependencies> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>4.7</version> + <classifier>jdk15</classifier> + </dependency> + </dependencies> + </profile> + <profile> + <id>jdk1.3</id> + <build> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <fork>false</fork> + <compilerVersion>1.4</compilerVersion> + </configuration> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <forkMode>once</forkMode> + <jvm>${JAVA_1_3_HOME}/bin/java</jvm> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles> + <distributionManagement> + <status>deployed</status> + </distributionManagement> +</project>
\ No newline at end of file |