View Javadoc

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 org.apache.maven.artifact.Artifact;
23  import org.apache.maven.model.Build;
24  import org.apache.maven.plugin.testing.stubs.ArtifactStub;
25  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
26  
27  import java.io.File;
28  import java.util.ArrayList;
29  import java.util.HashSet;
30  import java.util.List;
31  import java.util.Set;
32  
33  /**
34   * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
35   * @version $Id: ProxyTestMavenProjectStub.html 867202 2013-06-24 11:56:53Z olamy $
36   */
37  public class ProxyTestMavenProjectStub
38      extends MavenProjectStub
39  {
40      private Set<Artifact> dependencyArtifacts = new HashSet<Artifact>();
41  
42      public ProxyTestMavenProjectStub()
43      {
44          readModel( new File( getBasedir(), "proxy-test-plugin-config.xml" ) );
45  
46          setGroupId( getModel().getGroupId() );
47          setArtifactId( getModel().getArtifactId() );
48          setVersion( getModel().getVersion() );
49          setName( getModel().getName() );
50          setUrl( getModel().getUrl() );
51          setPackaging( getModel().getPackaging() );
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/proxy-test/target" );
57          setBuild( build );
58  
59          List<String> compileSourceRoots = new ArrayList<String>();
60          compileSourceRoots.add( getBasedir() + "/src/main/java" );
61          setCompileSourceRoots( compileSourceRoots );
62  
63          ArtifactStub artifact = new ArtifactStub();
64          artifact.setGroupId( "commons-logging" );
65          artifact.setArtifactId( "commons-logging" );
66          artifact.setVersion( "1.1.1" );
67          artifact.setScope( Artifact.SCOPE_RUNTIME );
68          artifact.setType( "jar" );
69          artifact.setFile( getBasedir() );
70  
71          dependencyArtifacts.add( artifact );
72      }
73  
74      /** {@inheritDoc} */
75      public File getBasedir()
76      {
77          return new File( super.getBasedir() + "/src/test/resources/unit/proxy-test" );
78      }
79  
80      public Set<Artifact> getDependencyArtifacts()
81      {
82          return dependencyArtifacts;
83      }
84  }