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 org.apache.maven.model.Build;
23  import org.apache.maven.model.Organization;
24  import org.apache.maven.model.ReportPlugin;
25  import org.apache.maven.artifact.DependencyResolutionRequiredException;
26  import org.codehaus.plexus.PlexusTestCase;
27  
28  import java.util.ArrayList;
29  import java.util.List;
30  import java.util.Collections;
31  import java.io.File;
32  
33  /**
34   * @author Edwin Punzalan
35   */
36  public class MinMavenProjectStub
37      extends org.apache.maven.plugin.testing.stubs.MavenProjectStub
38  {
39      /**
40       * @see org.apache.maven.project.MavenProject#getCompileClasspathElements()
41       */
42      public List getCompileClasspathElements()
43          throws DependencyResolutionRequiredException
44      {
45          return Collections.singletonList( PlexusTestCase.getBasedir() + "/target/classes" );
46      }
47  
48      /**
49       * @see org.apache.maven.project.MavenProject#getTestClasspathElements()
50       */
51      public List getTestClasspathElements()
52          throws DependencyResolutionRequiredException
53      {
54          List list = new ArrayList( getCompileClasspathElements() );
55          list.add( PlexusTestCase.getBasedir() + "/target/test-classes" );
56          return list;
57      }
58  
59      /**
60       * @see org.apache.maven.project.MavenProject#getBasedir()
61       */
62      public File getBasedir()
63      {
64          return new File( PlexusTestCase.getBasedir() );
65      }
66  
67      /**
68       * @see org.apache.maven.project.MavenProject#getReportPlugins()
69       */
70      public List getReportPlugins()
71      {
72          ReportPlugin jxrPlugin = new ReportPlugin();
73  
74          jxrPlugin.setArtifactId( "maven-jxr-plugin" );
75  
76          return Collections.singletonList( jxrPlugin );
77      }
78  
79      /**
80       * @see org.apache.maven.project.MavenProject#getOrganization()
81       */
82      public Organization getOrganization()
83      {
84          Organization organization = new Organization();
85  
86          organization.setName( "maven-plugin-tests" );
87  
88          return organization;
89      }
90  
91      /**
92       * @see org.apache.maven.project.MavenProject#getInceptionYear()
93       */
94      public String getInceptionYear()
95      {
96          return "2006";
97      }
98  
99      /**
100      * @see org.apache.maven.project.MavenProject#getBuild()
101      */
102     public Build getBuild()
103     {
104         Build build = new Build();
105 
106         build.setDirectory( PlexusTestCase.getBasedir() + "/target/test-harness/checkstyle/min" );
107 
108         return build;
109     }
110 
111     public File getFile()
112     {
113         File file = new File( getBasedir(), "pom.xml" );
114 
115         return file; 
116     }
117 }