added dependency with classifier test

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1402786 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Herve Boutemy 2012-10-27 12:20:37 +00:00
parent 4758085459
commit 57c8d8570f
3 changed files with 27 additions and 2 deletions

View File

@ -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 )

View File

@ -38,5 +38,11 @@
<groupId>ut.simple</groupId>
<artifactId>dependency</artifactId>
</dependency>
<dependency>
<groupId>ut.simple</groupId>
<artifactId>dependency</artifactId>
<version>1.0</version>
<classifier>sources</classifier>
</dependency>
</dependencies>
</project>