1 package org.apache.maven.plugin.dependency;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.util.Set;
24
25 import org.apache.maven.artifact.Artifact;
26 import org.apache.maven.project.MavenProject;
27
28 public class TestPropertiesMojo
29 extends AbstractDependencyMojoTestCase
30 {
31 protected void setUp()
32 throws Exception
33 {
34
35 super.setUp( "markers", true );
36 }
37
38
39
40
41
42
43 public void testSetProperties()
44 throws Exception
45 {
46 File testPom = new File( getBasedir(), "target/test-classes/unit/properties-test/plugin-config.xml" );
47 PropertiesMojo mojo = (PropertiesMojo) lookupMojo( "properties", testPom );
48
49 assertNotNull( mojo );
50 assertNotNull( mojo.getProject() );
51 MavenProject project = mojo.getProject();
52
53 Set<Artifact> artifacts = this.stubFactory.getScopedArtifacts();
54 Set<Artifact> directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts();
55 artifacts.addAll( directArtifacts );
56
57 project.setArtifacts( artifacts );
58 project.setDependencyArtifacts( directArtifacts );
59
60
61 mojo.execute();
62
63 for ( Artifact artifact : artifacts )
64 {
65 File artifactFile = artifact.getFile();
66 assertNotNull( artifact.getDependencyConflictId() );
67 assertTrue( artifactFile.isFile() );
68
69 }
70
71 }
72
73 }