diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index 214653658b..0c0403dce6 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java @@ -90,6 +90,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng5009AggregationCycleTest.class ); suite.addTestSuite( MavenITmng5000ChildPathAwareUrlInheritanceTest.class ); suite.addTestSuite( MavenITmng4992MapStylePropertiesParamConfigTest.class ); + suite.addTestSuite( MavenITmng4987TimestampBasedSnapshotSelectionTest.class ); suite.addTestSuite( MavenITmng4975ProfileInjectedPluginExecutionOrderTest.class ); suite.addTestSuite( MavenITmng4973ExtensionVisibleToPluginInReactorTest.class ); suite.addTestSuite( MavenITmng4966AbnormalUrlPreservationTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4987TimestampBasedSnapshotSelectionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4987TimestampBasedSnapshotSelectionTest.java new file mode 100644 index 0000000000..e351b29948 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4987TimestampBasedSnapshotSelectionTest.java @@ -0,0 +1,67 @@ +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; +import java.util.List; + +/** + * This is a test set for MNG-4987. + * + * @author Benjamin Bentmann + */ +public class MavenITmng4987TimestampBasedSnapshotSelectionTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng4987TimestampBasedSnapshotSelectionTest() + { + super( "[2.0.3,3.0-alpha-1),[3.0.3,)" ); + } + + /** + * Verify that snapshot version resolution from multiple (3+) repositories properly selects the repo with the + * newest metadata according to its timestamps, regardless of the declaration order of the repos. + */ + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4987" ); + + Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.deleteArtifacts( "org.apache.maven.its.mng4987" ); + verifier.getCliOptions().add( "-s" ); + verifier.getCliOptions().add( "settings.xml" ); + verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + List compile = verifier.loadLines( "target/compile.txt", "UTF-8" ); + + assertTrue( compile.toString(), compile.get( 1 ).toString().startsWith( "dep-0.1-" ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-4987/pom.xml b/its/core-it-suite/src/test/resources/mng-4987/pom.xml new file mode 100644 index 0000000000..0d8c5d389a --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4987/pom.xml @@ -0,0 +1,67 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4987 + test + 0.1 + jar + + Maven Integration Test :: MNG-4987 + + Verify that snapshot version resolution from multiple (3+) repositories properly selects the repo with the + newest metadata according to its timestamps, regardless of the declaration order of the repos. + + + + + org.apache.maven.its.mng4987 + dep + 0.1-SNAPSHOT + compile + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-dependency-resolution + 2.1-SNAPSHOT + + target/compile.txt + 1 + + + + resolve + validate + + compile + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-4987/repo-1/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/maven-metadata.xml b/its/core-it-suite/src/test/resources/mng-4987/repo-1/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/maven-metadata.xml new file mode 100644 index 0000000000..3e41554d0c --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4987/repo-1/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,13 @@ + + + org.apache.maven.its.mng4987 + dep + 0.1-SNAPSHOT + + + 20110223.154347 + 4 + + 20110223154347 + + diff --git a/its/core-it-suite/src/test/resources/mng-4987/repo-2/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/maven-metadata.xml b/its/core-it-suite/src/test/resources/mng-4987/repo-2/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/maven-metadata.xml new file mode 100644 index 0000000000..771dea8c24 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4987/repo-2/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,13 @@ + + + org.apache.maven.its.mng4987 + dep + 0.1-SNAPSHOT + + + 20110223.154503 + 3 + + 20110223154503 + + diff --git a/its/core-it-suite/src/test/resources/mng-4987/repo-3/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/maven-metadata.xml b/its/core-it-suite/src/test/resources/mng-4987/repo-3/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/maven-metadata.xml new file mode 100644 index 0000000000..9344f0bd3f --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4987/repo-3/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,13 @@ + + + org.apache.maven.its.mng4987 + dep + 0.1-SNAPSHOT + + + 20110223.154530 + 2 + + 20110223154530 + + diff --git a/its/core-it-suite/src/test/resources/mng-4987/repo-4/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/dep-0.1-20110223.154749-1.jar b/its/core-it-suite/src/test/resources/mng-4987/repo-4/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/dep-0.1-20110223.154749-1.jar new file mode 100644 index 0000000000..4803567d08 Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-4987/repo-4/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/dep-0.1-20110223.154749-1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-4987/repo-4/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/dep-0.1-20110223.154749-1.pom b/its/core-it-suite/src/test/resources/mng-4987/repo-4/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/dep-0.1-20110223.154749-1.pom new file mode 100644 index 0000000000..72ccf981af --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4987/repo-4/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/dep-0.1-20110223.154749-1.pom @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4987 + dep + 0.1-SNAPSHOT + jar + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-4987/repo-4/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/maven-metadata.xml b/its/core-it-suite/src/test/resources/mng-4987/repo-4/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/maven-metadata.xml new file mode 100644 index 0000000000..e56fb8274b --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4987/repo-4/org/apache/maven/its/mng4987/dep/0.1-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,13 @@ + + + org.apache.maven.its.mng4987 + dep + 0.1-SNAPSHOT + + + 20110223.154749 + 1 + + 20110223154749 + + diff --git a/its/core-it-suite/src/test/resources/mng-4987/settings-template.xml b/its/core-it-suite/src/test/resources/mng-4987/settings-template.xml new file mode 100644 index 0000000000..d6d10a582a --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4987/settings-template.xml @@ -0,0 +1,77 @@ + + + + + + + + maven-core-it-repo + + + + maven-core-it-1 + @baseurl@/repo-1 + + false + + + ignore + + + + maven-core-it-3 + @baseurl@/repo-3 + + false + + + ignore + + + + maven-core-it-4 + @baseurl@/repo-4 + + false + + + ignore + + + + maven-core-it-2 + @baseurl@/repo-2 + + false + + + ignore + + + + + + + maven-core-it-repo + +