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