View Javadoc

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