[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
This commit is contained in:
John Dennis Casey 2006-07-26 21:56:35 +00:00
parent 4028c67c5a
commit bf2a316d91
1 changed files with 41 additions and 2 deletions

View File

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