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