1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.war.stub;
20
21 import java.io.File;
22 import java.util.HashSet;
23 import java.util.Properties;
24 import java.util.Set;
25
26 import org.apache.maven.artifact.Artifact;
27 import org.apache.maven.model.Build;
28 import org.apache.maven.model.Organization;
29 import org.apache.maven.project.MavenProject;
30
31
32
33
34 public class MavenProjectBasicStub extends MavenProject {
35 protected String testRootDir;
36
37 protected Properties properties;
38
39 public MavenProjectBasicStub() throws Exception {
40 super(new ModelStub());
41 properties = new Properties();
42 }
43
44 public Set<Artifact> getArtifacts() {
45 return new HashSet<>();
46 }
47
48 public String getName() {
49 return "Test Project ";
50 }
51
52 public File getBasedir() {
53
54
55
56 return null;
57 }
58
59 public String getGroupId() {
60 return "org.apache.maven.plugin.test";
61 }
62
63 public String getArtifactId() {
64 return "maven-war-plugin-test";
65 }
66
67 public String getPackaging() {
68 return "jar";
69 }
70
71 public String getVersion() {
72 return "0.0-Test";
73 }
74
75 public void addProperty(String key, String value) {
76 properties.put(key, value);
77 }
78
79 public Properties getProperties() {
80 return properties;
81 }
82
83 public String getDescription() {
84 return "Test Description";
85 }
86
87 public Organization getOrganization() {
88 return new Organization() {
89 public String getName() {
90 return "Test Name";
91 }
92 };
93 }
94
95 @Override
96 public Build getBuild() {
97 Build build = super.getBuild();
98
99 build.setDirectory(System.getProperty("project.build.directory"));
100 build.setOutputDirectory(System.getProperty("project.build.outputDirectory"));
101
102 return build;
103 }
104
105 @Override
106 public MavenProject clone() {
107 return this;
108 }
109 }