View Javadoc
1   package org.apache.maven.plugin.war.stub;
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.HashSet;
24  import java.util.Properties;
25  import java.util.Set;
26  
27  import org.apache.maven.artifact.Artifact;
28  import org.apache.maven.model.Build;
29  import org.apache.maven.model.Organization;
30  import org.apache.maven.project.MavenProject;
31  
32  /**
33   * Stub
34   */
35  public class MavenProjectBasicStub
36      extends MavenProject
37  {
38      protected String testRootDir;
39  
40      protected Properties properties;
41  
42      public MavenProjectBasicStub()
43          throws Exception
44      {
45          super( new ModelStub() );
46          properties = new Properties();
47      }
48  
49      public Set<Artifact> getArtifacts()
50      {
51          return new HashSet<Artifact>();
52      }
53  
54      public String getName()
55      {
56          return "Test Project ";
57      }
58  
59      public File getBasedir()
60      {
61          // create an isolated environment
62          // see setupTestEnvironment for details
63          //return new File( testRootDir );
64          return null;
65      }
66  
67      public String getGroupId()
68      {
69          return "org.apache.maven.plugin.test";
70      }
71  
72      public String getArtifactId()
73      {
74          return "maven-war-plugin-test";
75      }
76  
77      public String getPackaging()
78      {
79          return "jar";
80      }
81  
82      public String getVersion()
83      {
84          return "0.0-Test";
85      }
86  
87      public void addProperty( String key, String value )
88      {
89          properties.put( key, value );
90      }
91  
92      public Properties getProperties()
93      {
94          return properties;
95      }
96  
97      public String getDescription()
98      {
99          return "Test Description";
100     }
101 
102     public Organization getOrganization()
103     {
104         return new Organization()
105         {
106             public String getName()
107             {
108                 return "Test Name";
109             }
110         };
111     }
112 
113     @Override
114     public Build getBuild()
115     {
116         Build build = super.getBuild();
117 
118         build.setDirectory( System.getProperty( "project.build.directory" ) );
119 
120         return build;
121     }
122 }