KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > maven > artifact > factory > DefaultArtifactFactoryTest


1 package org.apache.maven.artifact.factory;
2
3 import org.apache.maven.artifact.Artifact;
4 import org.apache.maven.artifact.versioning.VersionRange;
5 import org.codehaus.plexus.PlexusTestCase;
6
7 public class DefaultArtifactFactoryTest
8     extends PlexusTestCase
9 {
10     
11     public void testPropagationOfSystemScopeRegardlessOfInheritedScope() throws Exception JavaDoc
12     {
13         ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
14         
15         Artifact artifact = factory.createDependencyArtifact( "test-grp", "test-artifact", VersionRange.createFromVersion("1.0"), "type", null, "system", "provided" );
16         Artifact artifact2 = factory.createDependencyArtifact( "test-grp", "test-artifact-2", VersionRange.createFromVersion("1.0"), "type", null, "system", "test" );
17         Artifact artifact3 = factory.createDependencyArtifact( "test-grp", "test-artifact-3", VersionRange.createFromVersion("1.0"), "type", null, "system", "runtime" );
18         Artifact artifact4 = factory.createDependencyArtifact( "test-grp", "test-artifact-4", VersionRange.createFromVersion("1.0"), "type", null, "system", "compile" );
19         
20         // this one should never happen in practice...
21
Artifact artifact5 = factory.createDependencyArtifact( "test-grp", "test-artifact-5", VersionRange.createFromVersion("1.0"), "type", null, "system", "system" );
22         
23         assertEquals( "system", artifact.getScope() );
24         assertEquals( "system", artifact2.getScope() );
25         assertEquals( "system", artifact3.getScope() );
26         assertEquals( "system", artifact4.getScope() );
27         assertEquals( "system", artifact5.getScope() );
28     }
29
30 }
31
Popular Tags