[MNG-3974] New mirror syntax is not stopping on first match

o Added IT

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@733081 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-01-09 16:50:45 +00:00
parent 0467e649f2
commit 6ae021b3a8
10 changed files with 351 additions and 0 deletions

View File

@ -90,6 +90,7 @@ public class IntegrationTestSuite
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
suite.addTestSuite( MavenITmng3974MirrorOrderingTest.class );
suite.addTestSuite( MavenITmng3970DepResolutionFromProfileReposTest.class );
suite.addTestSuite( MavenITmng3955EffectiveSettingsTest.class );
suite.addTestSuite( MavenITmng3953AuthenticatedDeploymentTest.class );

View File

@ -0,0 +1,65 @@
package org.apache.maven.it;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
/**
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3974">MNG-3974</a>.
*
* @author Benjamin Bentmann
* @version $Id$
*/
public class MavenITmng3974MirrorOrderingTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng3974MirrorOrderingTest()
{
super( "(2.0.9,2.1.0-M1),(2.1.0-M1,3.0-alpha-1),(3.0-alpha-1,)" );
}
/**
* Test that mirror definitions are properly evaluated. In particular, the first matching mirror definition
* from the settings should win, i.e. ordering of mirror definitions matters.
*/
public void testitFirstMatchWins()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3974" );
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteArtifacts( "org.apache.maven.its.mng3974" );
verifier.filterFile( "settings.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
verifier.getCliOptions().add( "--settings" );
verifier.getCliOptions().add( "settings.xml" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier.assertArtifactPresent( "org.apache.maven.its.mng3974", "a", "0.1", "jar" );
verifier.assertArtifactPresent( "org.apache.maven.its.mng3974", "b", "0.1", "jar" );
}
}

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng3974</groupId>
<artifactId>test-1</artifactId>
<version>0.1</version>
<name>Maven Integration Test :: MNG-3974</name>
<description>
Test that mirror definitions are properly evaluated. In particular, the first matching mirror definition
from the settings should win, i.e. ordering of mirror definitions matters.
</description>
<dependencies>
<dependency>
<!-- Provided by repo maven-core-it-a and only this repo -->
<groupId>org.apache.maven.its.mng3974</groupId>
<artifactId>a</artifactId>
<version>0.1</version>
</dependency>
<dependency>
<!-- Provided by repo maven-core-it-b and only this repo -->
<groupId>org.apache.maven.its.mng3974</groupId>
<artifactId>b</artifactId>
<version>0.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<!-- This one will be matched by exact id -->
<id>maven-core-it-a</id>
<url>http://maven.apache.org/null</url>
<releases>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<!-- This one will be matched by pattern -->
<id>maven-core-it-b</id>
<url>http://maven.apache.org/null</url>
<releases>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-dependency-resolution</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<id>test</id>
<phase>validate</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng3974</groupId>
<artifactId>a</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/repo</url>
</repository>
</distributionManagement>
</project>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?><metadata>
<groupId>org.apache.maven.its.mng3974</groupId>
<artifactId>a</artifactId>
<version>0.1</version>
<versioning>
<versions>
<version>0.1</version>
</versions>
<lastUpdated>20090109150820</lastUpdated>
</versioning>
</metadata>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng3974</groupId>
<artifactId>b</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/repo</url>
</repository>
</distributionManagement>
</project>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?><metadata>
<groupId>org.apache.maven.its.mng3974</groupId>
<artifactId>b</artifactId>
<version>0.1</version>
<versioning>
<versions>
<version>0.1</version>
</versions>
<lastUpdated>20090109150838</lastUpdated>
</versioning>
</metadata>

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<settings>
<mirrors>
<!--
NOTE: The next block of mirrors matches the first test repo by exact id.
-->
<!-- The first match should win, so we have all later matching mirrors point to nowhere -->
<mirror>
<id>mirror-a1</id>
<url>@baseurl@/repo-1</url>
<mirrorOf>maven-core-it-a</mirrorOf>
</mirror>
<!-- NOTE: Use multiple mirrors to reduce likelihood of random test success -->
<mirror>
<id>mirror-a2</id>
<url>@baseurl@/null0</url>
<mirrorOf>maven-core-it-a</mirrorOf>
</mirror>
<mirror>
<id>mirror-a3</id>
<url>@baseurl@/null1</url>
<mirrorOf>maven-core-it-a</mirrorOf>
</mirror>
<mirror>
<id>mirror-a4</id>
<url>@baseurl@/null2</url>
<mirrorOf>maven-core-it-a</mirrorOf>
</mirror>
<mirror>
<id>mirror-a5</id>
<url>@baseurl@/null3</url>
<mirrorOf>maven-core-it-a</mirrorOf>
</mirror>
<mirror>
<id>mirror-a6</id>
<url>@baseurl@/null4</url>
<mirrorOf>maven-core-it-a</mirrorOf>
</mirror>
<!--
NOTE: The next block of mirrors matches the second test repo by a pattern which is distinct for each mirror.
-->
<!-- The first match should win, so we have all later matching mirrors point to nowhere -->
<mirror>
<id>mirror-b1</id>
<url>@baseurl@/repo-2</url>
<mirrorOf>maven-core-it-b,foo-a</mirrorOf>
</mirror>
<!-- NOTE: Use multiple mirrors to reduce likelihood of random test success -->
<mirror>
<id>mirror-b2</id>
<url>@baseurl@/null0</url>
<mirrorOf>maven-core-it-b,foo-b</mirrorOf>
</mirror>
<mirror>
<id>mirror-b3</id>
<url>@baseurl@/null1</url>
<mirrorOf>maven-core-it-b,foo-c</mirrorOf>
</mirror>
<mirror>
<id>mirror-b4</id>
<url>@baseurl@/null2</url>
<mirrorOf>maven-core-it-b,foo-d</mirrorOf>
</mirror>
<mirror>
<id>mirror-b5</id>
<url>@baseurl@/null3</url>
<mirrorOf>maven-core-it-b,foo-e</mirrorOf>
</mirror>
<mirror>
<id>mirror-b6</id>
<url>@baseurl@/null4</url>
<mirrorOf>maven-core-it-b,foo-f</mirrorOf>
</mirror>
</mirrors>
</settings>