From 57c8d8570f792a90b22c5fe6acacbaef47e2b388 Mon Sep 17 00:00:00 2001 From: Herve Boutemy Date: Sat, 27 Oct 2012 12:20:37 +0000 Subject: [PATCH] added dependency with classifier test git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1402786 13f79535-47bb-0310-9956-ffa450edef68 --- .../internal/RepositorySystemTest.java | 23 +++++++++++++++++-- .../ut/simple/artifact/1.0/artifact-1.0.pom | 6 +++++ .../dependency/1.0/dependency-1.0-sources.jar | 0 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 maven-aether-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0-sources.jar diff --git a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RepositorySystemTest.java b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RepositorySystemTest.java index c2a679ed71..dc2f187489 100644 --- a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RepositorySystemTest.java +++ b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RepositorySystemTest.java @@ -65,12 +65,12 @@ public class RepositorySystemTest Artifact artifact = new DefaultArtifact( artifactCoords ); CollectRequest collectRequest = new CollectRequest(); - collectRequest.setRoot( new Dependency( artifact, "" ) ); + collectRequest.setRoot( new Dependency( artifact, null ) ); collectRequest.addRepository( newTestRepository() ); CollectResult collectResult = system.collectDependencies( session, collectRequest ); - assertEquals( 1, collectResult.getRoot().getChildren().size() ); + assertEquals( 2, collectResult.getRoot().getChildren().size() ); Dependency dep = collectResult.getRoot().getChildren().get( 0 ).getDependency(); assertEquals( "compile", dep.getScope() ); assertFalse( dep.isOptional() ); @@ -89,6 +89,25 @@ public class RepositorySystemTest assertEquals( "true", depArtifact.getProperty( "constitutesBuildPath", null ) ); assertEquals( "false", depArtifact.getProperty( "includesDependencies", null ) ); assertEquals( 4, depArtifact.getProperties().size() ); + + dep = collectResult.getRoot().getChildren().get( 1 ).getDependency(); + assertEquals( "compile", dep.getScope() ); + assertFalse( dep.isOptional() ); + assertEquals( 0, dep.getExclusions().size() ); + depArtifact = dep.getArtifact(); + assertEquals( "ut.simple", depArtifact.getGroupId() ); + assertEquals( "dependency", depArtifact.getArtifactId() ); + assertEquals( "1.0", depArtifact.getVersion() ); + assertEquals( "1.0", depArtifact.getBaseVersion() ); + assertNull( depArtifact.getFile() ); + assertFalse( depArtifact.isSnapshot() ); + assertEquals( "sources", depArtifact.getClassifier() ); + assertEquals( "jar", depArtifact.getExtension() ); + assertEquals( "java", depArtifact.getProperty( "language", null ) ); + assertEquals( "jar", depArtifact.getProperty( "type", null ) ); // shouldn't it be java-sources given the classifier? + assertEquals( "true", depArtifact.getProperty( "constitutesBuildPath", null ) ); // shouldn't it be false given the classifier? + assertEquals( "false", depArtifact.getProperty( "includesDependencies", null ) ); + assertEquals( 4, depArtifact.getProperties().size() ); } public static RepositorySystemSession newMavenRepositorySystemSession( RepositorySystem system ) diff --git a/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.pom b/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.pom index 72cba879d9..f8b72af51c 100644 --- a/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.pom +++ b/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.pom @@ -38,5 +38,11 @@ ut.simple dependency + + ut.simple + dependency + 1.0 + sources + \ No newline at end of file diff --git a/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0-sources.jar b/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0-sources.jar new file mode 100644 index 0000000000..e69de29bb2