From 483edff5ab71903515df31eea17548683895559a Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Mon, 3 Jan 2011 15:23:22 +0000 Subject: [PATCH] [MNG-4955] [regression] Outdated remote snapshots are preferred over locally installed snapshots o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@1054648 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/it/IntegrationTestSuite.java | 1 + ...55LocalVsRemoteSnapshotResolutionTest.java | 75 ++++++++++++++++++ .../src/test/resources/mng-4955/dep/dep.jar | Bin 0 -> 345 bytes .../src/test/resources/mng-4955/dep/pom.xml | 59 ++++++++++++++ .../src/test/resources/mng-4955/pom.xml | 65 +++++++++++++++ .../dep-0.1-20110103.120652-1.jar | Bin 0 -> 1964 bytes .../dep-0.1-20110103.120652-1.pom | 36 +++++++++ .../dep/0.1-SNAPSHOT/maven-metadata.xml | 25 ++++++ .../resources/mng-4955/settings-template.xml | 45 +++++++++++ 9 files changed, 306 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4955LocalVsRemoteSnapshotResolutionTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-4955/dep/dep.jar create mode 100644 its/core-it-suite/src/test/resources/mng-4955/dep/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-4955/pom.xml create mode 100644 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 create mode 100644 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 create mode 100644 its/core-it-suite/src/test/resources/mng-4955/repo/org/apache/maven/its/mng4955/dep/0.1-SNAPSHOT/maven-metadata.xml create mode 100644 its/core-it-suite/src/test/resources/mng-4955/settings-template.xml 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 0000000000000000000000000000000000000000..0eba4526c4e38b949e03b1a7f9ff222de7a32170 GIT binary patch literal 345 zcmWIWW@Zs#-~d98Y-KwJB*4kQ!r%MB z$s^K|S{W?UpK1O`QxktG9xgV0$ulwSif5{?Gd~r5EMf#ZWLDE}LwBGxAROS$$Rxsm v>JOMBLHg{~FZSdcFez!u1aYen)?fHx}}NEH(h)&l8cAPxfnC~QNx literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..ceb3def2adf38d8a66357cec89d99e0a8b0292bc GIT binary patch literal 1964 zcmWIWW@h1H0D;>X%64D|l;8x?zOEsTx}JV+`Tw#DVS(&e+ zpQoE^aEP9-+h^Z1r+vJ2^)B*y>uQ}lbAEG>!4=~NPm6TC&YjTl)^*}wf3hTOikS8R zm5QBnx`TwhgMv%uYONKK;TD=~93)yJd^+eeP{zx+*z3R}zm=7dojYd+Y!r!IKP6`Z z>#{1gk8W;zV)n!^z+8su0e)nc2W8KxEF=jv7D=9Gp+=g&3} zsdIm1KWCxsmY@SKuXyba(7I-(73IFnDg5h2#`Ybovu`dlnf2{{xzCBz+22~;6#v#c z-XgxQ}5``av>kvghdln#joxxpMU<(_j|5Stkwzd`&fH@=TlbUSyK~KW{5WL zSjt*ww9~{klqYSIu&U_|p1wypWjqxrTuTzxDT|s26?19!JnBC8z;*9S_ANm@rals~ z3@JUlXD?UIi-|it>3T$L(cYDZ9@?5~pLrlvwQ^o!XKzMik@d7|2Uz1wm^rQou32xyV~-c5dSf-`i(Bp6r-**W+QsTa803`|?Yg%MXh585}I# zWB5$AUMfp^7n>q)$*i~5%+t`)9)%dpfF_&rVn#OG%OBZmv zL|m3zv+CNkgE@2VX@^9F2w%S#y_?_n=IJf0Z6*A|0UBL>6@_e`&kjDf@ZQ8}qw@3Y zAG`MUAMf=1K0mQ){wW)C?(%9C|7V)>(gc?Gulua(xnAu+fQroFxaib}%5Hh0DNhgH z%Xxl#uSCp6UF{!}#67%2WYb`?X=B>gwaA9e&N32D~Tb%cZ*yd7WJ6dx~T3%~@A2h^sO6&A#99>dWDq zksjM3ojF6>^fMDb#B4HCVSlb@XLm0{YR->Hsru7-&ni9Q%8CtH*=;X#-E{L0X-%n@ z349xKsB3-50*7y!d|M?#*G!%DI6JoAyyE!jj011Qe=Mrab2@aoc1v(+in#3diF^L; zT=3)YgID4kd!3S+lhZ$izn<_%oO98=mw%;UnU@1x`UsUd@2Lf*_XZ#a6-DsU2a$0pb%T{{dkZ04_Y8a$5B~5U}@ibzL?01$Z+ui7?|X zSb@F+0s)4%jvyNDQG_<^1uaN12rOw-2a<4YNX0I~1k5rHR3Jit0K@ + + + + + 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 + +