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  import java.util.Properties;
24  
25  import org.apache.maven.it.util.ResourceExtractor;
26  
27  /**
28   * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-3052">MNG-3052</a>.
29   *
30   * When a project dependency declares its own repositories, they should be used to
31   * resolve that dependency's dependencies. This includes both steps: determining
32   * the dependency artifact information (version, etc.) AND resolving the actual
33   * artifact itself.
34   *
35   * NOTE: The SNAPSHOT versions are CRITICAL in this test, since they force the
36   * correct resolution of artifact metadata, which depends on having the correct
37   * set of repositories present.
38   *
39   * @author jdcasey
40   */
41  public class MavenITmng3052DepRepoAggregationTest
42      extends AbstractMavenIntegrationTestCase
43  {
44  
45      public MavenITmng3052DepRepoAggregationTest()
46      {
47          super( "(2.0.9,)" ); // only test in 2.0.10+
48      }
49  
50      public void testitMNG3052 ()
51          throws Exception
52      {
53          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3052" ).getCanonicalFile();
54  
55          Verifier verifier = newVerifier( testDir.getAbsolutePath() );
56          verifier.setAutoclean( false );
57          verifier.deleteDirectory( "target" );
58          verifier.deleteArtifacts( "org.apache.maven.its.mng3052" );
59          Properties filterProps = verifier.newDefaultFilterProperties();
60          verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps );
61          verifier.filterFile( "repo-d/org/apache/maven/its/mng3052/direct/0.1-SNAPSHOT/template.pom",
62              "repo-d/org/apache/maven/its/mng3052/direct/0.1-SNAPSHOT/direct-0.1-20090517.133956-1.pom", "UTF-8", filterProps );
63          verifier.addCliOption( "--settings" );
64          verifier.addCliOption( "settings.xml" );
65          verifier.executeGoal( "validate" );
66          verifier.verifyErrorFreeLog();
67          verifier.resetStreams();
68  
69          verifier.assertArtifactPresent( "org.apache.maven.its.mng3052", "direct", "0.1-SNAPSHOT", "jar" );
70          verifier.assertArtifactPresent( "org.apache.maven.its.mng3052", "trans", "0.1-SNAPSHOT", "jar" );
71      }
72  
73  }