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 9d25de9bbd..413e31b6c1 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 @@ -83,6 +83,7 @@ public class IntegrationTestSuite // ------------------------------------------------------------------------------------------------------------- // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng4955LocalVsRemoteSnapshotResolutionTest.class ); suite.addTestSuite( MavenITmng4936EventSpyTest.class ); suite.addTestSuite( MavenITmng4925ContainerLookupRealmDuringMojoExecTest.class ); suite.addTestSuite( MavenITmng4913UserPropertyVsDependencyPomPropertyTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4955LocalVsRemoteSnapshotResolutionTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4955LocalVsRemoteSnapshotResolutionTest.java new file mode 100644 index 0000000000..17a64dd6cc --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4955LocalVsRemoteSnapshotResolutionTest.java @@ -0,0 +1,75 @@ +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-4955. + * + * @author Benjamin Bentmann + */ +public class MavenITmng4955LocalVsRemoteSnapshotResolutionTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng4955LocalVsRemoteSnapshotResolutionTest() + { + super( "[2.0.10,2.0.99),[2.1.0,3.0-alpha-1),[3.0.2,)" ); + } + + /** + * Verify that dependency resolution prefers newer local snapshots over outdated remote snapshots that use the new + * metadata format. + */ + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4955" ); + + Verifier verifier = newVerifier( new File( testDir, "dep" ).getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.deleteArtifacts( "org.apache.maven.its.mng4955" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier = newVerifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + 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 classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" ); + + File jarFile = new File( classpath.get( 1 ).toString() ); + assertEquals( "eeff09b1b80e823eeb2a615b1d4b09e003e86fd3", ItUtils.calcHash( jarFile, "SHA-1" ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-4955/dep/dep.jar b/its/core-it-suite/src/test/resources/mng-4955/dep/dep.jar new file mode 100644 index 0000000000..0eba4526c4 Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-4955/dep/dep.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-4955/dep/pom.xml b/its/core-it-suite/src/test/resources/mng-4955/dep/pom.xml new file mode 100644 index 0000000000..4456e864c6 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4955/dep/pom.xml @@ -0,0 +1,59 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4955 + dep + 0.1-SNAPSHOT + jar + + Maven Integration Test :: MNG-4955 :: Dependency + + Verify that dependency resolution prefers newer local snapshots over outdated remote snapshots that use the new + metadata format. + + + + + + org.apache.maven.its.plugins + maven-it-plugin-artifact + 2.1-SNAPSHOT + + + install + validate + + set + attach-pom + install + + + dep.jar + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-4955/pom.xml b/its/core-it-suite/src/test/resources/mng-4955/pom.xml new file mode 100644 index 0000000000..e1aa70c6c7 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4955/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4955 + test + 0.1 + jar + + Maven Integration Test :: MNG-4955 + + Verify that dependency resolution prefers newer local snapshots over outdated remote snapshots that use the new + metadata format. + + + + + org.apache.maven.its.mng4955 + dep + 0.1-SNAPSHOT + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-dependency-resolution + 2.1-SNAPSHOT + + target/classpath.txt + + + + resolve + validate + + compile + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-4955/repo/org/apache/maven/its/mng4955/dep/0.1-SNAPSHOT/dep-0.1-20110103.120652-1.jar b/its/core-it-suite/src/test/resources/mng-4955/repo/org/apache/maven/its/mng4955/dep/0.1-SNAPSHOT/dep-0.1-20110103.120652-1.jar new file mode 100644 index 0000000000..ceb3def2ad Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-4955/repo/org/apache/maven/its/mng4955/dep/0.1-SNAPSHOT/dep-0.1-20110103.120652-1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-4955/repo/org/apache/maven/its/mng4955/dep/0.1-SNAPSHOT/dep-0.1-20110103.120652-1.pom b/its/core-it-suite/src/test/resources/mng-4955/repo/org/apache/maven/its/mng4955/dep/0.1-SNAPSHOT/dep-0.1-20110103.120652-1.pom new file mode 100644 index 0000000000..8784e24667 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4955/repo/org/apache/maven/its/mng4955/dep/0.1-SNAPSHOT/dep-0.1-20110103.120652-1.pom @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4955 + dep + 0.1-SNAPSHOT + jar + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-4955/repo/org/apache/maven/its/mng4955/dep/0.1-SNAPSHOT/maven-metadata.xml b/its/core-it-suite/src/test/resources/mng-4955/repo/org/apache/maven/its/mng4955/dep/0.1-SNAPSHOT/maven-metadata.xml new file mode 100644 index 0000000000..64e2bd6177 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4955/repo/org/apache/maven/its/mng4955/dep/0.1-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,25 @@ + + + org.apache.maven.its.mng4955 + dep + 0.1-SNAPSHOT + + + 20110103.120652 + 1 + + 20110103120652 + + + jar + 0.1-20110103.120652-1 + 20110103120652 + + + pom + 0.1-20110103.120652-1 + 20110103120652 + + + + diff --git a/its/core-it-suite/src/test/resources/mng-4955/settings-template.xml b/its/core-it-suite/src/test/resources/mng-4955/settings-template.xml new file mode 100644 index 0000000000..4d0bfd9796 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4955/settings-template.xml @@ -0,0 +1,45 @@ + + + + + + + + maven-core-it-repo + + + maven-core-it + @baseurl@/repo + + false + + + ignore + + always + + + + + + + maven-core-it-repo + +