1 package org.apache.maven.plugin.resources.stub;
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.Properties;
24
25 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
26 import org.codehaus.plexus.PlexusTestCase;
27 import org.codehaus.plexus.util.FileUtils;
28
29 public class MavenProjectBasicStub
30 extends MavenProjectStub
31 {
32 protected String identifier;
33
34 protected String testRootDir;
35
36 protected Properties properties;
37
38 protected String description;
39
40 public MavenProjectBasicStub( String id )
41 throws Exception
42 {
43 properties = new Properties();
44 identifier = id;
45 testRootDir = PlexusTestCase.getBasedir() + "/target/test-classes/unit/test-dir/" + identifier;
46
47 if ( !FileUtils.fileExists( testRootDir ) )
48 {
49 FileUtils.mkdir( testRootDir );
50 }
51 }
52
53 public String getName()
54 {
55 return "Test Project " + identifier;
56 }
57
58 public void setDescription( String desc )
59 {
60 description = desc;
61 }
62
63 public String getDescription()
64 {
65 if ( description == null )
66 {
67 return "this is a test project";
68 }
69 else
70 {
71 return description;
72 }
73 }
74
75 public File getBasedir()
76 {
77
78
79 return new File( testRootDir );
80 }
81
82 public String getGroupId()
83 {
84 return "org.apache.maven.plugin.test";
85 }
86
87 public String getArtifactId()
88 {
89 return "maven-resource-plugin-test#" + identifier;
90 }
91
92 public String getPackaging()
93 {
94 return "org.apache.maven.plugin.test";
95 }
96
97 public String getVersion()
98 {
99 return identifier;
100 }
101
102 public void addProperty( String key, String value )
103 {
104 properties.put( key, value );
105 }
106
107 public Properties getProperties()
108 {
109 return properties;
110 }
111 }