1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.resources.stub;
20
21 import java.io.File;
22 import java.util.Properties;
23
24 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
25 import org.codehaus.plexus.PlexusTestCase;
26 import org.codehaus.plexus.util.FileUtils;
27
28 public class MavenProjectBasicStub extends MavenProjectStub {
29 protected String identifier;
30
31 protected String testRootDir;
32
33 protected Properties properties;
34
35 protected String description;
36
37 public MavenProjectBasicStub(String id) {
38 properties = new Properties();
39 identifier = id;
40 testRootDir = PlexusTestCase.getBasedir() + "/target/unit/test-dir/" + identifier;
41
42 if (!FileUtils.fileExists(testRootDir)) {
43 FileUtils.mkdir(testRootDir);
44 }
45 }
46
47 public String getName() {
48 return "Test Project " + identifier;
49 }
50
51 public void setDescription(String desc) {
52 description = desc;
53 }
54
55 public String getDescription() {
56 if (description == null) {
57 return "this is a test project";
58 } else {
59 return description;
60 }
61 }
62
63 public File getBasedir() {
64
65
66 return new File(testRootDir);
67 }
68
69 public String getGroupId() {
70 return "org.apache.maven.plugin.test";
71 }
72
73 public String getArtifactId() {
74 return "maven-resource-plugin-test#" + identifier;
75 }
76
77 public String getPackaging() {
78 return "org.apache.maven.plugin.test";
79 }
80
81 public String getVersion() {
82 return identifier;
83 }
84
85 public void addProperty(String key, String value) {
86 properties.put(key, value);
87 }
88
89 public Properties getProperties() {
90 return properties;
91 }
92 }