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