1   package org.apache.maven.plugin.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.List;
25  
26  import org.apache.maven.model.Build;
27  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
28  import org.apache.maven.project.MavenProject;
29  
30  /**
31   * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
32   * @version $Id: AggregateTestMavenProjectStub.html 829392 2012-08-19 17:29:37Z hboutemy $
33   */
34  public class AggregateTestMavenProjectStub
35      extends MavenProjectStub
36  {
37      private Build build;
38  
39      public AggregateTestMavenProjectStub()
40      {
41          readModel( new File( getBasedir(), "aggregate-test-plugin-config.xml" ) );
42  
43          setGroupId( getModel().getGroupId() );
44          setArtifactId( getModel().getArtifactId() );
45          setVersion( getModel().getVersion() );
46          setName( getModel().getName() );
47          setUrl( getModel().getUrl() );
48          setPackaging( getModel().getPackaging() );
49          setExecutionRoot( true );
50  
51          build = new Build();
52          build.setFinalName( getModel().getArtifactId() );
53          build.setDirectory( super.getBasedir() + "/target/test/unit/aggregate-test/target" );
54  
55          List compileSourceRoots = new ArrayList();
56          compileSourceRoots.add( getBasedir() + "/src/main/java" );
57          setCompileSourceRoots( compileSourceRoots );
58      }
59  
60      /** {@inheritDoc} */
61      public Build getBuild()
62      {
63          return build;
64      }
65  
66      /** {@inheritDoc} */
67      public void setBuild( Build build )
68      {
69          this.build = build;
70      }
71  
72      /** {@inheritDoc} */
73      public File getBasedir()
74      {
75          return new File( super.getBasedir() + "/src/test/resources/unit/aggregate-test" );
76      }
77  
78      /** {@inheritDoc} */
79      public MavenProject getExecutionProject()
80      {
81          return this;
82      }
83  }