KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.apache.maven.project.inheritance.t03;
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 java.io.File JavaDoc;
20 import java.util.List JavaDoc;
21
22 import org.apache.maven.model.Build;
23 import org.apache.maven.model.MailingList;
24 import org.apache.maven.model.Plugin;
25 import org.apache.maven.model.PluginExecution;
26 import org.apache.maven.project.MavenProject;
27 import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
28 import org.codehaus.plexus.util.xml.Xpp3Dom;
29
30 /**
31  * A test which demonstrates maven's recursive inheritance where
32  * a distinct value is taken from each parent contributing to the
33  * the final model of the project being assembled. There is no
34  * overriding going on amongst the models being used in this test:
35  * each model in the lineage is providing a value that is not present
36  * anywhere else in the lineage. We are just making sure that values
37  * down in the lineage are bubbling up where they should.
38  *
39  * @author <a HREF="mailto:jason@maven.org">Jason van Zyl</a>
40  * @version $Id: ProjectInheritanceTest.java 391202 2006-04-04 00:40:13Z jdcasey $
41  */

42 public class ProjectInheritanceTest
43     extends AbstractProjectInheritanceTestCase
44 {
45     // ----------------------------------------------------------------------
46
//
47
// p1 inherits from p0
48
// p0 inhertis from super model
49
//
50
// or we can show it graphically as:
51
//
52
// p1 ---> p0 --> super model
53
//
54
// ----------------------------------------------------------------------
55

56     public void testProjectInheritance()
57         throws Exception JavaDoc
58     {
59         File JavaDoc localRepo = getLocalRepositoryPath();
60         File JavaDoc pom0 = new File JavaDoc( localRepo, "p0/pom.xml" );
61         
62         File JavaDoc pom0Basedir = pom0.getParentFile();
63         
64         File JavaDoc pom1 = new File JavaDoc( pom0Basedir, "p1/pom.xml" );
65         
66         // load everything...
67
MavenProject project0 = getProject( pom0 );
68         MavenProject project1 = getProject( pom1 );
69
70         assertEquals( pom0Basedir, project1.getParent().getBasedir() );
71     }
72 }
73
Popular Tags