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