KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > maven > project > inheritance > t01 > ProjectInheritanceTest


1 package org.apache.maven.project.inheritance.t01;
2
3 /*
4  * Copyright 2001-2005 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 import org.apache.maven.project.MavenProject;
20 import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
21
22 /**
23  * A test which demonstrates maven's recursive inheritance where
24  * we are testing to make sure that elements stated in a model are
25  * not clobbered by the same elements elsewhere in the lineage.
26  *
27  * @author <a HREF="mailto:jason@maven.org">Jason van Zyl</a>
28  * @version $Id: ProjectInheritanceTest.java 240178 2005-08-26 07:31:18Z brett $
29  */

30 public class ProjectInheritanceTest
31     extends AbstractProjectInheritanceTestCase
32 {
33     // ----------------------------------------------------------------------
34
//
35
// p4 inherits from p3
36
// p3 inherits from p2
37
// p2 inherits from p1
38
// p1 inherits from p0
39
// p0 inhertis from super model
40
//
41
// or we can show it graphically as:
42
//
43
// p4 ---> p3 ---> p2 ---> p1 ---> p0 --> super model
44
//
45
// ----------------------------------------------------------------------
46

47     public void testProjectInheritance()
48         throws Exception JavaDoc
49     {
50         // ----------------------------------------------------------------------
51
// Check p0 value for org name
52
// ----------------------------------------------------------------------
53

54         MavenProject p0 = getProject( projectFile( "p0" ) );
55
56         assertEquals( "p0-org", p0.getOrganization().getName() );
57
58         // ----------------------------------------------------------------------
59
// Check p1 value for org name
60
// ----------------------------------------------------------------------
61

62         MavenProject p1 = getProject( projectFile( "p1" ) );
63
64         assertEquals( "p1-org", p1.getOrganization().getName() );
65
66         // ----------------------------------------------------------------------
67
// Check p2 value for org name
68
// ----------------------------------------------------------------------
69

70         MavenProject p2 = getProject( projectFile( "p2" ) );
71
72         assertEquals( "p2-org", p2.getOrganization().getName() );
73
74         // ----------------------------------------------------------------------
75
// Check p2 value for org name
76
// ----------------------------------------------------------------------
77

78         MavenProject p3 = getProject( projectFile( "p3" ) );
79
80         assertEquals( "p3-org", p3.getOrganization().getName() );
81
82         // ----------------------------------------------------------------------
83
// Check p4 value for org name
84
// ----------------------------------------------------------------------
85

86         MavenProject p4 = getProject( projectFile( "p4" ) );
87
88         assertEquals( "p4-org", p4.getOrganization().getName() );
89     }
90 }
91
Popular Tags