01: package org.apache.maven.project.inheritance.t00;
02:
03: /*
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "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.model.MailingList;
23: import org.apache.maven.project.MavenProject;
24: import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
25:
26: /**
27: * A test which demonstrates maven's recursive inheritance where
28: * a distinct value is taken from each parent contributing to the
29: * the final model of the project being assembled. There is no
30: * overriding going on amongst the models being used in this test:
31: * each model in the lineage is providing a value that is not present
32: * anywhere else in the lineage. We are just making sure that values
33: * down in the lineage are bubbling up where they should.
34: *
35: * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
36: * @version $Id: ProjectInheritanceTest.java 513038 2007-02-28 22:54:19Z jvanzyl $
37: */
38: public class ProjectInheritanceTest extends
39: AbstractProjectInheritanceTestCase {
40: // ----------------------------------------------------------------------
41: //
42: // p4 inherits from p3
43: // p3 inherits from p2
44: // p2 inherits from p1
45: // p1 inherits from p0
46: // p0 inhertis from super model
47: //
48: // or we can show it graphically as:
49: //
50: // p4 ---> p3 ---> p2 ---> p1 ---> p0 --> super model
51: //
52: // ----------------------------------------------------------------------
53:
54: public void testProjectInheritance() throws Exception {
55: MavenProject p4 = getProject(projectFile("p4"));
56:
57: assertEquals("p4", p4.getName());
58:
59: // ----------------------------------------------------------------------
60: // Value inherited from p3
61: // ----------------------------------------------------------------------
62:
63: assertEquals("2000", p4.getInceptionYear());
64:
65: // ----------------------------------------------------------------------
66: // Value taken from p2
67: // ----------------------------------------------------------------------
68:
69: assertEquals("mailing-list", ((MailingList) p4
70: .getMailingLists().get(0)).getName());
71:
72: // ----------------------------------------------------------------------
73: // Value taken from p1
74: // ----------------------------------------------------------------------
75:
76: assertEquals("scm-url/p2/p3/p4", p4.getScm().getUrl());
77:
78: // ----------------------------------------------------------------------
79: // Value taken from p4
80: // ----------------------------------------------------------------------
81:
82: assertEquals("Codehaus", p4.getOrganization().getName());
83:
84: // ----------------------------------------------------------------------
85: // Value taken from super model
86: // ----------------------------------------------------------------------
87:
88: assertEquals("4.0.0", p4.getModelVersion());
89:
90: assertEquals("4.0.0", p4.getModelVersion());
91: }
92: }
|