1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.checkstyle.stubs;
20
21 import java.io.File;
22 import java.util.ArrayList;
23 import java.util.Collections;
24 import java.util.List;
25
26 import org.apache.maven.artifact.DependencyResolutionRequiredException;
27 import org.apache.maven.model.Build;
28 import org.apache.maven.model.Organization;
29 import org.apache.maven.model.ReportPlugin;
30 import org.codehaus.plexus.PlexusTestCase;
31
32
33
34
35
36 public class ModuleMavenProjectStub extends CheckstyleProjectStub {
37
38
39 public List<String> getCompileClasspathElements() throws DependencyResolutionRequiredException {
40 return getCompileSourceRoots();
41 }
42
43
44 public List<String> getTestClasspathElements() throws DependencyResolutionRequiredException {
45 List<String> list = new ArrayList<>(getCompileClasspathElements());
46 list.add(PlexusTestCase.getBasedir() + "/target/test-classes");
47 return list;
48 }
49
50
51 public List<String> getCompileSourceRoots() {
52 return Collections.singletonList(PlexusTestCase.getBasedir() + "/target/classes");
53 }
54
55
56 public List<String> getTestCompileSourceRoots() {
57 List<String> list = new ArrayList<>(getCompileSourceRoots());
58 list.add(PlexusTestCase.getBasedir() + "/target/test-classes");
59 return list;
60 }
61
62
63 public File getBasedir() {
64 return new File(PlexusTestCase.getBasedir());
65 }
66
67
68 public List<ReportPlugin> getReportPlugins() {
69 ReportPlugin jxrPlugin = new ReportPlugin();
70
71 jxrPlugin.setArtifactId("maven-jxr-plugin");
72
73 return Collections.singletonList(jxrPlugin);
74 }
75
76
77 public Organization getOrganization() {
78 Organization organization = new Organization();
79
80 organization.setName("maven-plugin-tests");
81
82 return organization;
83 }
84
85
86 public String getInceptionYear() {
87 return "2006";
88 }
89
90
91 public Build getBuild() {
92 Build build = new Build();
93
94 build.setDirectory(PlexusTestCase.getBasedir() + "/target/test-harness/checkstyle/multi");
95 build.setSourceDirectory(PlexusTestCase.getBasedir() + "/src/test/test-sources");
96 build.setTestSourceDirectory(PlexusTestCase.getBasedir() + "/src/test/java");
97
98 return build;
99 }
100
101
102 public File getFile() {
103 File file = new File(getBasedir(), "pom.xml");
104
105 return file;
106 }
107 }