From bf2a316d91c238f75f10a0b2c50c3716314c38ea Mon Sep 17 00:00:00 2001 From: John Dennis Casey Date: Wed, 26 Jul 2006 21:56:35 +0000 Subject: [PATCH] [MNG-1562] Added unit test confirming the necessity of groupId:artifactId:type for non-jar dependency references. Will update site documentation as well. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@425863 13f79535-47bb-0310-9956-ffa450edef68 --- .../DefaultModelDefaultsInjectorTest.java | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/maven-project/src/test/java/org/apache/maven/project/injection/DefaultModelDefaultsInjectorTest.java b/maven-project/src/test/java/org/apache/maven/project/injection/DefaultModelDefaultsInjectorTest.java index 9a694669c3..7babd771c6 100644 --- a/maven-project/src/test/java/org/apache/maven/project/injection/DefaultModelDefaultsInjectorTest.java +++ b/maven-project/src/test/java/org/apache/maven/project/injection/DefaultModelDefaultsInjectorTest.java @@ -16,6 +16,8 @@ package org.apache.maven.project.injection; * limitations under the License. */ +import java.util.List; + import junit.framework.TestCase; import org.apache.maven.model.Dependency; @@ -23,8 +25,6 @@ import org.apache.maven.model.DependencyManagement; import org.apache.maven.model.Exclusion; import org.apache.maven.model.Model; -import java.util.List; - /** * @author jdcasey */ @@ -36,6 +36,45 @@ public class DefaultModelDefaultsInjectorTest new DefaultModelDefaultsInjector(); } + public void testShouldMergeManagedDependencyOfTypeEJBToDependencyList() + { + Model model = new Model(); + + Dependency managedDep = new Dependency(); + + managedDep.setGroupId( "group" ); + managedDep.setArtifactId( "artifact" ); + managedDep.setVersion( "1.0" ); + managedDep.setType( "ejb" ); + + DependencyManagement depMgmt = new DependencyManagement(); + + depMgmt.addDependency( managedDep ); + + model.setDependencyManagement( depMgmt ); + + Dependency dep = new Dependency(); + + dep.setGroupId( "group" ); + dep.setArtifactId( "artifact" ); + + // looks like groupId:artifactId:type is the minimum for identification, where + // type is defaulted to "jar". + dep.setType( "ejb" ); + + model.addDependency( dep ); + + new DefaultModelDefaultsInjector().injectDefaults( model ); + + List resultingDeps = model.getDependencies(); + + assertEquals( 1, resultingDeps.size() ); + + Dependency result = (Dependency) resultingDeps.get( 0 ); + + assertEquals( "1.0", result.getVersion() ); + } + public void testShouldSucceedInMergingDependencyWithDependency() { Model model = new Model();