1 package org.apache.maven.plugins.dependency.resolvers;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.IOException;
23 import java.util.HashSet;
24 import java.util.Set;
25
26 import org.apache.maven.artifact.Artifact;
27 import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
28 import org.apache.maven.plugins.dependency.utils.DependencyStatusSets;
29
30 public class ResolveDependenciesMojoTest
31 extends AbstractDependencyMojoTestCase
32 {
33 protected void setUp()
34 throws Exception
35 {
36
37 super.setUp( "dss", true );
38 }
39
40 public void testDependencyStatusLog()
41 throws IOException
42 {
43 Set<Artifact> artifacts = this.stubFactory.getMixedArtifacts();
44 doTestDependencyStatusLog( artifacts );
45 }
46
47 public void testDependencyStatusLogNullFiles()
48 throws IOException
49 {
50 this.stubFactory.setCreateFiles( false );
51 Set<Artifact> artifacts = this.stubFactory.getMixedArtifacts();
52 doTestDependencyStatusLog( artifacts );
53 }
54
55 public void testDependencyStatusEmptySet()
56 {
57 doTestDependencyStatusLog( new HashSet<Artifact>() );
58 }
59
60 public void doTestDependencyStatusLog( Set<Artifact> artifacts )
61 {
62
63
64
65 ResolveDependenciesMojo mojo = newMojo( new DependencyStatusSets() );
66 mojo.getOutput( false, true, false );
67 mojo.getOutput( true, true, false );
68
69 mojo = newMojo( new DependencyStatusSets( artifacts, null, null ) );
70 mojo.getOutput( false, true, false );
71 mojo.getOutput( true, true, false );
72
73 mojo = newMojo( new DependencyStatusSets( null, artifacts, null ) );
74 mojo.getOutput( false, true, false );
75 mojo.getOutput( true, true, false );
76
77 mojo = newMojo( new DependencyStatusSets( null, null, artifacts ) );
78 mojo.getOutput( false, true, false );
79 mojo.getOutput( true, true, false );
80
81 mojo = newMojo( new DependencyStatusSets( artifacts, artifacts, null ) );
82 mojo.getOutput( false, true, false );
83 mojo.getOutput( true, true, false );
84
85 mojo = newMojo( new DependencyStatusSets( null, artifacts, artifacts ) );
86 mojo.getOutput( false, true, false );
87 mojo.getOutput( true, true, false );
88
89 mojo = newMojo( new DependencyStatusSets( artifacts, null, artifacts ) );
90 mojo.getOutput( false, true, false );
91 mojo.getOutput( true, true, false );
92
93 mojo = newMojo( new DependencyStatusSets( artifacts, artifacts, artifacts ) );
94 mojo.getOutput( false, true, false );
95 mojo.getOutput( true, true, false );
96 mojo.getOutput( false, false, false );
97 mojo.getOutput( true, false, false );
98 }
99
100 private ResolveDependenciesMojo newMojo( final DependencyStatusSets dss )
101 {
102 ResolveDependenciesMojo mojo = new ResolveDependenciesMojo();
103 mojo.results = dss;
104 return mojo;
105 }
106 }