View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugins.checkstyle.stubs;
20  
21  import java.io.File;
22  import java.util.Collections;
23  import java.util.List;
24  
25  import org.apache.maven.artifact.DependencyResolutionRequiredException;
26  import org.apache.maven.model.Build;
27  import org.apache.maven.model.Organization;
28  import org.apache.maven.model.ReportPlugin;
29  import org.apache.maven.project.MavenProject;
30  import org.codehaus.plexus.PlexusTestCase;
31  
32  /**
33   *
34   */
35  public class MultiMavenProjectStub extends CheckstyleProjectStub {
36  
37      public MultiMavenProjectStub() {
38          setExecutionRoot(true);
39      }
40  
41      @Override
42      public MavenProject getExecutionProject() {
43          return this;
44      }
45  
46      /** {@inheritDoc} */
47      public List<String> getCompileClasspathElements() throws DependencyResolutionRequiredException {
48          return Collections.emptyList();
49      }
50  
51      /** {@inheritDoc} */
52      public List<String> getTestClasspathElements() throws DependencyResolutionRequiredException {
53          return Collections.emptyList();
54      }
55  
56      /** {@inheritDoc} */
57      public List<String> getCompileSourceRoots() {
58          return Collections.emptyList();
59      }
60  
61      /** {@inheritDoc} */
62      public List<String> getTestCompileSourceRoots() {
63          return Collections.emptyList();
64      }
65  
66      /** {@inheritDoc} */
67      public File getBasedir() {
68          return new File(PlexusTestCase.getBasedir());
69      }
70  
71      /** {@inheritDoc} */
72      public List<ReportPlugin> getReportPlugins() {
73          ReportPlugin jxrPlugin = new ReportPlugin();
74  
75          jxrPlugin.setArtifactId("maven-jxr-plugin");
76  
77          return Collections.singletonList(jxrPlugin);
78      }
79  
80      /** {@inheritDoc} */
81      public Organization getOrganization() {
82          Organization organization = new Organization();
83  
84          organization.setName("maven-plugin-tests");
85  
86          return organization;
87      }
88  
89      /** {@inheritDoc} */
90      public String getInceptionYear() {
91          return "2006";
92      }
93  
94      /** {@inheritDoc} */
95      public Build getBuild() {
96          Build build = new Build();
97  
98          build.setDirectory(PlexusTestCase.getBasedir() + "/target/test-harness/checkstyle/multi");
99  
100         return build;
101     }
102 
103     /** {@inheritDoc} */
104     public File getFile() {
105         File file = new File(getBasedir(), "pom.xml");
106 
107         return file;
108     }
109 }