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 org.apache.maven.it.Verifier;
23  import org.apache.maven.it.util.ResourceExtractor;
24  
25  import java.io.File;
26  import java.util.Properties;
27  
28  /**
29   * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-5000">MNG-5000</a>. Note this is a subtle
30   * variation and not a duplicate of the test for MNG-2006.
31   * 
32   * @author Benjamin Bentmann
33   * @version $Id: MavenITmng5000ChildPathAwareUrlInheritanceTest.java 1072612 2011-02-20 15:33:06Z bentmann $
34   */
35  public class MavenITmng5000ChildPathAwareUrlInheritanceTest
36      extends AbstractMavenIntegrationTestCase
37  {
38  
39      public MavenITmng5000ChildPathAwareUrlInheritanceTest()
40      {
41          super( "[2.0.11,2.0.99),[2.2.0,3.0-alpha-1),[3.0.3,)" );
42      }
43  
44      /**
45       * Verify that child path aware URL adjustment still works when the child's artifactId doesn't match the name
46       * of its base directory as given in the parent's module section.
47       */
48      public void testit()
49          throws Exception
50      {
51          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5000" );
52  
53          Verifier verifier = newVerifier( new File( testDir, "different-from-artifactId" ).getAbsolutePath() );
54          verifier.setAutoclean( false );
55          verifier.deleteDirectory( "target" );
56          verifier.executeGoal( "validate" );
57          verifier.verifyErrorFreeLog();
58          verifier.resetStreams();
59  
60          Properties props = verifier.loadProperties( "target/pom.properties" );
61          assertEquals( "http://project.url/child", props.getProperty( "project.url" ) );
62          assertEquals( "http://viewvc.project.url/child", props.getProperty( "project.scm.url" ) );
63          assertEquals( "http://scm.project.url/child", props.getProperty( "project.scm.connection" ) );
64          assertEquals( "https://scm.project.url/child", props.getProperty( "project.scm.developerConnection" ) );
65          assertEquals( "http://site.project.url/child", props.getProperty( "project.distributionManagement.site.url" ) );
66      }
67  
68  }