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.model.Model;
25  import org.apache.maven.model.Scm;
26  import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
27  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
28  
29  import java.io.File;
30  import java.io.FileReader;
31  import java.util.ArrayList;
32  import java.util.List;
33  
34  /**
35   * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
36   */
37  public class JavadocJarInvalidDestdirMavenProjectStub
38      extends MavenProjectStub
39  {
40      private Scm scm;
41  
42      private Build build;
43  
44      public JavadocJarInvalidDestdirMavenProjectStub()
45      {
46  
47          MavenXpp3Reader pomReader = new MavenXpp3Reader();
48          Model model = null;
49  
50          try
51          {
52              model = pomReader.read( new FileReader( new File( getBasedir() +
53                  "/src/test/resources/unit/javadocjar-invalid-destdir/javadocjar-invalid-destdir-plugin-config.xml" ) ) );
54              setModel( model );
55          }
56          catch ( Exception e )
57          {
58  
59          }
60  
61          setGroupId( model.getGroupId() );
62          setArtifactId( model.getArtifactId() );
63          setVersion( model.getVersion() );
64          setName( model.getName() );
65          setUrl( model.getUrl() );
66          setPackaging( model.getPackaging() );
67  
68          Scm scm = new Scm();
69          scm.setConnection( "scm:svn:http://svn.apache.org/maven/sample/trunk" );
70          setScm( scm );
71  
72          Artifact artifact =
73              new JavadocPluginArtifactStub( getGroupId(), getArtifactId(), getVersion(), getPackaging() );
74          artifact.setArtifactHandler( new DefaultArtifactHandlerStub() );
75          setArtifact( artifact );
76  
77          Build build = new Build();
78          build.setFinalName( "javadocjar-invalid-destdir" );
79          build.setDirectory( getBasedir() + "/target/test/unit/javadocjar-invalid-destdir/target" );
80          setBuild( build );
81  
82          String basedir = getBasedir().getAbsolutePath();
83          List compileSourceRoots = new ArrayList();
84          compileSourceRoots.add(
85              basedir + "/src/test/resources/unit/javadocjar-invalid-destdir/javadocjar/invalid/destdir" );
86          setCompileSourceRoots( compileSourceRoots );
87      }
88  
89      public Scm getScm()
90      {
91          return scm;
92      }
93  
94      public void setScm( Scm scm )
95      {
96          this.scm = scm;
97      }
98  
99      public Build getBuild()
100     {
101         return build;
102     }
103 
104     public void setBuild( Build build )
105     {
106         this.build = build;
107     }
108 
109 }