View Javadoc
1   package org.apache.maven.plugins.source.stubs;
2   
3   import static org.apache.maven.plugins.source.stubs.Project001Stub.readModelFromFile;
4   
5   import java.io.File;
6   import java.util.List;
7   
8   import org.apache.maven.model.Build;
9   import org.apache.maven.model.Model;
10  import org.apache.maven.model.Resource;
11  
12  /*
13   * Licensed to the Apache Software Foundation (ASF) under one
14   * or more contributor license agreements.  See the NOTICE file
15   * distributed with this work for additional information
16   * regarding copyright ownership.  The ASF licenses this file
17   * to you under the Apache License, Version 2.0 (the
18   * "License"); you may not use this file except in compliance
19   * with the License.  You may obtain a copy of the License at
20   *
21   *   http://www.apache.org/licenses/LICENSE-2.0
22   *
23   * Unless required by applicable law or agreed to in writing,
24   * software distributed under the License is distributed on an
25   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26   * KIND, either express or implied.  See the License for the
27   * specific language governing permissions and limitations
28   * under the License.
29   */
30  
31  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
32  
33  /**
34   * @author <a href="mailto:oching@exist.com">Maria Odea Ching</a>
35   */
36  public class Project005Stub
37      extends MavenProjectStub
38  {
39      private Build build;
40  
41      private List<Resource> resources;
42  
43      private List<Resource> testResources;
44  
45      public Project005Stub()
46      {
47          Model model;
48          try
49          {
50              model = readModelFromFile( new File( getBasedir(), "target/test-classes/unit/project-005/pom.xml" ) );
51              setModel( model );
52  
53              setGroupId( model.getGroupId() );
54              setArtifactId( model.getArtifactId() );
55              setVersion( model.getVersion() );
56              setName( model.getName() );
57              setUrl( model.getUrl() );
58              setPackaging( model.getPackaging() );
59  
60              Build build = new Build();
61              build.setFinalName( getArtifactId() + "-" + getVersion() );
62              build.setDirectory( getBasedir() + "/target/test/unit/project-005/target" );
63              setBuild( build );
64  
65              SourcePluginArtifactStub artifact =
66                  new SourcePluginArtifactStub( getGroupId(), getArtifactId(), getVersion(), getPackaging(), null );
67              artifact.setArtifactHandler( new DefaultArtifactHandlerStub() );
68              artifact.setType( "jar" );
69              artifact.setBaseVersion( "1.0-SNAPSHOT" );
70              setArtifact( artifact );
71  
72          }
73          catch ( Exception e )
74          {
75              e.printStackTrace();
76          }
77      }
78  
79      public Build getBuild()
80      {
81          return build;
82      }
83  
84      public void setBuild( Build build )
85      {
86          this.build = build;
87      }
88  
89      public List<Resource> getResources()
90      {
91          return resources;
92      }
93  
94      public void setResources( List<Resource> resources )
95      {
96          this.resources = resources;
97      }
98  
99      public List<Resource> getTestResources()
100     {
101         return testResources;
102     }
103 
104     public void setTestResources( List<Resource> testResources )
105     {
106         this.testResources = testResources;
107     }
108 
109 }