1   package org.apache.maven.project.inheritance.t01;
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.project.MavenProject;
23  import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
24  
25  /**
26   * A test which demonstrates maven's recursive inheritance where
27   * we are testing to make sure that elements stated in a model are
28   * not clobbered by the same elements elsewhere in the lineage.
29   *
30   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
31   * @version $Id: ProjectInheritanceTest.java 495147 2007-01-11 07:47:53Z jvanzyl $
32   */
33  public class ProjectInheritanceTest
34      extends AbstractProjectInheritanceTestCase
35  {
36      // ----------------------------------------------------------------------
37      //
38      // p4 inherits from p3
39      // p3 inherits from p2
40      // p2 inherits from p1
41      // p1 inherits from p0
42      // p0 inhertis from super model
43      //
44      // or we can show it graphically as:
45      //
46      // p4 ---> p3 ---> p2 ---> p1 ---> p0 --> super model
47      //
48      // ----------------------------------------------------------------------
49  
50      public void testProjectInheritance()
51          throws Exception
52      {
53          // ----------------------------------------------------------------------
54          // Check p0 value for org name
55          // ----------------------------------------------------------------------
56  
57          MavenProject p0 = getProject( projectFile( "p0" ) );
58  
59          assertEquals( "p0-org", p0.getOrganization().getName() );
60  
61          // ----------------------------------------------------------------------
62          // Check p1 value for org name
63          // ----------------------------------------------------------------------
64  
65          MavenProject p1 = getProject( projectFile( "p1" ) );
66  
67          assertEquals( "p1-org", p1.getOrganization().getName() );
68  
69          // ----------------------------------------------------------------------
70          // Check p2 value for org name
71          // ----------------------------------------------------------------------
72  
73          MavenProject p2 = getProject( projectFile( "p2" ) );
74  
75          assertEquals( "p2-org", p2.getOrganization().getName() );
76  
77          // ----------------------------------------------------------------------
78          // Check p2 value for org name
79          // ----------------------------------------------------------------------
80  
81          MavenProject p3 = getProject( projectFile( "p3" ) );
82  
83          assertEquals( "p3-org", p3.getOrganization().getName() );
84  
85          // ----------------------------------------------------------------------
86          // Check p4 value for org name
87          // ----------------------------------------------------------------------
88  
89          MavenProject p4 = getProject( projectFile( "p4" ) );
90  
91          assertEquals( "p4-org", p4.getOrganization().getName() );
92      }
93  }