1 package org.apache.maven.plugin.war.stub;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.artifact.Artifact;
23 import org.apache.maven.model.Dependency;
24 import org.apache.maven.plugin.testing.stubs.ArtifactStub;
25
26 import java.util.ArrayList;
27 import java.util.Iterator;
28 import java.util.List;
29 import java.util.Set;
30 import java.util.TreeSet;
31
32 public class MavenProjectArtifactsStub
33 extends MavenProjectBasicStub
34 {
35 TreeSet artifacts;
36
37 public MavenProjectArtifactsStub()
38 throws Exception
39 {
40 artifacts = new TreeSet();
41 }
42
43 public void addArtifact( ArtifactStub stub )
44 {
45 artifacts.add( stub );
46 }
47
48 public Set getArtifacts()
49 {
50 return artifacts;
51 }
52
53 public List getDependencies()
54 {
55 if ( getArtifacts() == null )
56 {
57 return new ArrayList();
58 }
59 final List dependencies = new ArrayList();
60 final Iterator it = getArtifacts().iterator();
61 while ( it.hasNext() )
62 {
63 Artifact a = (Artifact) it.next();
64 Dependency dependency = new Dependency();
65 dependency.setArtifactId( a.getArtifactId() );
66 dependency.setGroupId( a.getGroupId() );
67 dependency.setVersion( a.getVersion() );
68 dependency.setScope( a.getScope() );
69 dependency.setType( a.getType() );
70 dependency.setClassifier( a.getClassifier() );
71 dependencies.add( dependency );
72
73 }
74 return dependencies;
75
76 }
77
78 public List getRuntimeClasspathElements()
79 {
80 List artifacts = new ArrayList();
81
82 artifacts.add(
83 "src/test/resources/unit/manifest/manifest-with-classpath/sample-artifacts/maven-artifact1-1.0-SNAPSHOT.jar" );
84 artifacts.add(
85 "src/test/resources/unit/manifest/manifest-with-classpath/sample-artifacts/maven-artifact2-1.0-SNAPSHOT.jar" );
86
87 return artifacts;
88 }
89 }