View Javadoc
1   package org.apache.maven.plugins.release.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 java.io.File;
23  import java.util.ArrayList;
24  import java.util.List;
25  
26  import org.apache.maven.model.DistributionManagement;
27  import org.apache.maven.model.Model;
28  import org.apache.maven.model.Scm;
29  
30  /**
31   * <p>Stub for a MavenProject with a flat structure.</p>
32   * 
33   * <p>TODO: shouldn't need to do this, but the "stub" in the harness just throws away values you set.
34   * Just overriding the ones I need for this plugin.</p>
35   *
36   * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
37   */
38  /*
39   * @noinspection ClassNameSameAsAncestorName
40   */
41  public class FlatMultiModuleMavenProjectStub
42      extends org.apache.maven.plugin.testing.stubs.MavenProjectStub
43  {   
44      public void setDistributionManagement( DistributionManagement distributionManagement )
45      {
46          getModel().setDistributionManagement( distributionManagement );
47      }
48  
49      public Model getModel()
50      {
51          Model model = super.getModel();
52          if ( model == null )
53          {
54              model = new Model();
55              setModel( model );
56          }
57          return model;
58      }
59  
60      public DistributionManagement getDistributionManagement()
61      {
62          return getModel().getDistributionManagement();
63      }
64      
65      public List<String> getModules()
66      {
67          List<String> modules = new ArrayList<String>();
68          modules.add( "../core" );
69          modules.add( "../webapp" );
70          modules.add( "../commons" );
71          
72          return modules;
73      }
74      
75      public File getBasedir()
76      {
77          return new File( "/flat-multi-module/root-project" ).getAbsoluteFile();
78      }
79      
80      public Scm getScm()
81      {
82          Scm scm = new Scm();
83          scm.setConnection( "scm:svn:file://localhost/target/svnroot/flat-multi-module/trunk/root-project" );
84          
85          return scm;
86      }
87      
88      @Override
89      public String getGroupId()
90      {
91          return "GROUPID";
92      }
93      
94      @Override
95      public String getArtifactId()
96      {
97          return "ARTIFACTID";
98      }
99      
100     @Override
101     public String getVersion()
102     {
103         return "VERSION";
104     }
105 }