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   * Stub for a MavenProject with a flat structure.
32   * <p/>
33   * 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.
35   *
36   * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
37   * @noinspection ClassNameSameAsAncestorName
38   */
39  public class FlatMultiModuleMavenProjectStub
40      extends org.apache.maven.plugin.testing.stubs.MavenProjectStub
41  {   
42      public void setDistributionManagement( DistributionManagement distributionManagement )
43      {
44          getModel().setDistributionManagement( distributionManagement );
45      }
46  
47      public Model getModel()
48      {
49          Model model = super.getModel();
50          if ( model == null )
51          {
52              model = new Model();
53              setModel( model );
54          }
55          return model;
56      }
57  
58      public DistributionManagement getDistributionManagement()
59      {
60          return getModel().getDistributionManagement();
61      }
62      
63      public List<String> getModules()
64      {
65          List<String> modules = new ArrayList<String>();
66          modules.add( "../core" );
67          modules.add( "../webapp" );
68          modules.add( "../commons" );
69          
70          return modules;
71      }
72      
73      public File getBasedir()
74      {
75          return new File( "/flat-multi-module/root-project" );
76      }
77      
78      public Scm getScm()
79      {
80          Scm scm = new Scm();
81          scm.setConnection( "scm:svn:file://localhost/target/svnroot/flat-multi-module/trunk/root-project" );
82          
83          return scm;
84      }
85  
86  }