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 Jason van Zyl 31 */ 32 public class ProjectInheritanceTest 33 extends AbstractProjectInheritanceTestCase 34 { 35 // ---------------------------------------------------------------------- 36 // 37 // p4 inherits from p3 38 // p3 inherits from p2 39 // p2 inherits from p1 40 // p1 inherits from p0 41 // p0 inherits from super model 42 // 43 // or we can show it graphically as: 44 // 45 // p4 ---> p3 ---> p2 ---> p1 ---> p0 --> super model 46 // 47 // ---------------------------------------------------------------------- 48 49 public void testProjectInheritance() 50 throws Exception 51 { 52 // ---------------------------------------------------------------------- 53 // Check p0 value for org name 54 // ---------------------------------------------------------------------- 55 56 MavenProject p0 = getProject( projectFile( "maven.t01", "p0" ) ); 57 58 assertEquals( "p0-org", p0.getOrganization().getName() ); 59 60 // ---------------------------------------------------------------------- 61 // Check p1 value for org name 62 // ---------------------------------------------------------------------- 63 64 MavenProject p1 = getProject( projectFile( "maven.t01", "p1" ) ); 65 66 assertEquals( "p1-org", p1.getOrganization().getName() ); 67 68 // ---------------------------------------------------------------------- 69 // Check p2 value for org name 70 // ---------------------------------------------------------------------- 71 72 MavenProject p2 = getProject( projectFile( "maven.t01", "p2" ) ); 73 74 assertEquals( "p2-org", p2.getOrganization().getName() ); 75 76 // ---------------------------------------------------------------------- 77 // Check p2 value for org name 78 // ---------------------------------------------------------------------- 79 80 MavenProject p3 = getProject( projectFile( "maven.t01", "p3" ) ); 81 82 assertEquals( "p3-org", p3.getOrganization().getName() ); 83 84 // ---------------------------------------------------------------------- 85 // Check p4 value for org name 86 // ---------------------------------------------------------------------- 87 88 MavenProject p4 = getProject( projectFile( "maven.t01", "p4" ) ); 89 90 assertEquals( "p4-org", p4.getOrganization().getName() ); 91 } 92 }