View Javadoc
1   package org.apache.maven.plugins.javadoc.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.ArrayList;
24  import java.util.Arrays;
25  import java.util.Collections;
26  import java.util.List;
27  import java.util.Set;
28  
29  import org.apache.maven.artifact.Artifact;
30  import org.apache.maven.model.Build;
31  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
32  import org.apache.maven.project.MavenProject;
33  
34  /**
35   * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
36   */
37  public class AggregateResourcesTestMavenProjectStub
38      extends MavenProjectStub
39  {
40      public AggregateResourcesTestMavenProjectStub()
41      {
42          readModel( new File( getBasedir(), "aggregate-resources-test-plugin-config.xml" ) );
43  
44          setGroupId( getModel().getGroupId() );
45          setArtifactId( getModel().getArtifactId() );
46          setVersion( getModel().getVersion() );
47          setName( getModel().getName() );
48          setUrl( getModel().getUrl() );
49          setPackaging( getModel().getPackaging() );
50  
51          setExecutionRoot( true );
52  
53          Build build = new Build();
54          build.setFinalName( getModel().getArtifactId() );
55          build.setSourceDirectory( getBasedir() + "/src/main/java" );
56          build.setDirectory( super.getBasedir() + "/target/test/unit/aggregate-resources-test/target" );
57          setBuild( build );
58  
59          List<String> compileSourceRoots = new ArrayList<>();
60          setCompileSourceRoots( compileSourceRoots );
61      }
62  
63      @Override
64      public File getBasedir()
65      {
66          return new File( super.getBasedir() + "/src/test/resources/unit/aggregate-resources-test" );
67      }
68  
69      @Override
70      public MavenProject getExecutionProject()
71      {
72          return this;
73      }
74      
75      @Override
76      public List<String> getModules()
77      {
78          return Arrays.asList( "project1", "project2" );
79      }
80  
81      @Override
82      public Set<Artifact> getDependencyArtifacts()
83      {
84          return Collections.emptySet();
85      }
86  }