1   package org.apache.maven.project.inheritance.t03;
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.List;
24  
25  import org.apache.maven.model.Build;
26  import org.apache.maven.model.MailingList;
27  import org.apache.maven.model.Plugin;
28  import org.apache.maven.model.PluginExecution;
29  import org.apache.maven.project.MavenProject;
30  import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
31  import org.codehaus.plexus.util.xml.Xpp3Dom;
32  
33  /**
34   * A test which demonstrates maven's recursive inheritance where
35   * a distinct value is taken from each parent contributing to the
36   * the final model of the project being assembled. There is no
37   * overriding going on amongst the models being used in this test:
38   * each model in the lineage is providing a value that is not present
39   * anywhere else in the lineage. We are just making sure that values
40   * down in the lineage are bubbling up where they should.
41   *
42   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
43   * @version $Id: ProjectInheritanceTest.java 640549 2008-03-24 20:05:11Z bentmann $
44   */
45  public class ProjectInheritanceTest
46      extends AbstractProjectInheritanceTestCase
47  {
48      // ----------------------------------------------------------------------
49      //
50      // p1 inherits from p0
51      // p0 inhertis from super model
52      //
53      // or we can show it graphically as:
54      //
55      // p1 ---> p0 --> super model
56      //
57      // ----------------------------------------------------------------------
58  
59      public void testProjectInheritance()
60          throws Exception
61      {
62          File localRepo = getLocalRepositoryPath();
63          File pom0 = new File( localRepo, "p0/pom.xml" );
64          
65          File pom0Basedir = pom0.getParentFile();
66          
67          File pom1 = new File( pom0Basedir, "p1/pom.xml" );
68          
69          // load everything...
70          MavenProject project0 = getProject( pom0 );
71          MavenProject project1 = getProject( pom1 );
72  
73          assertEquals( pom0Basedir, project1.getParent().getBasedir() );
74      }
75  }