1 package org.apache.maven.it;
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 java.io.File;
23
24 import org.apache.maven.it.util.ResourceExtractor;
25
26 /**
27 * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-2068">MNG-2068</a>.
28 *
29 * Verify that a multimodule build, built from the middle node in an inheritance hierarchy,
30 * can find all parent POMs necessary to build each project in the reactor using ONLY the
31 * relativePath from the parent specification (in this case, the implied one of '../pom.xml').
32 *
33 * @author jdcasey
34 *
35 */
36 public class MavenITmng2068ReactorRelativeParentsTest
37 extends AbstractMavenIntegrationTestCase
38 {
39
40 public MavenITmng2068ReactorRelativeParentsTest()
41 {
42 super( "(2.0.6,)" ); // only test in 2.0.7+
43 }
44
45 /**
46 * Test successful lineage construction when parent inherits groupId+version from grand-parent.
47 *
48 * @throws Exception in case of failure
49 */
50 public void testitInheritedIdFields()
51 throws Exception
52 {
53 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2068/test-1" );
54 File projectDir = new File( testDir, "parent" );
55
56 Verifier verifier = newVerifier( projectDir.getAbsolutePath() );
57 verifier.setAutoclean( false );
58 verifier.deleteArtifacts( "org.apache.maven.its.mng2068" );
59 verifier.executeGoal( "validate" );
60 verifier.verifyErrorFreeLog();
61 verifier.resetStreams();
62 }
63
64 /**
65 * Test successful lineage construction when parent specifies groupId+version itself.
66 *
67 * @throws Exception in case of failure
68 */
69 public void testitExplicitIdFields()
70 throws Exception
71 {
72 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2068/test-2" );
73 File projectDir = new File( testDir, "parent" );
74
75 Verifier verifier = newVerifier( projectDir.getAbsolutePath() );
76 verifier.setAutoclean( false );
77 verifier.deleteArtifacts( "org.apache.maven.its.mng2068" );
78 verifier.executeGoal( "validate" );
79 verifier.verifyErrorFreeLog();
80 verifier.resetStreams();
81 }
82
83 /**
84 * Test that the implied relative path for the parent POM works, even two levels deep.
85 *
86 * @throws Exception in case of failure
87 */
88 public void testitComplex()
89 throws Exception
90 {
91 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2068/test-3" );
92 File projectDir = testDir;
93
94 Verifier verifier = newVerifier( projectDir.getAbsolutePath() );
95 verifier.setAutoclean( false );
96 verifier.deleteArtifacts( "org.apache.maven.its.mng2068" );
97 verifier.executeGoal( "validate" );
98 verifier.verifyErrorFreeLog();
99 verifier.resetStreams();
100 }
101
102 }