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