From c31ca6323ba1d2a7e522375d8a02c168394c1517 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Tue, 18 May 2010 15:48:31 +0000 Subject: [PATCH] [MNG-4679] [regression] command line option "-update-snapshots" does not work for dependency:copy-dependencies o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@945714 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/it/IntegrationTestSuite.java | 1 + .../java/org/apache/maven/it/ItUtils.java | 72 ++++++++++++++ ...enITmng4679SnapshotUpdateInPluginTest.java | 90 ++++++++++++++++++ .../src/test/resources/mng-4679/pom.xml | 70 ++++++++++++++ .../dep-0.1-20100518.144321-1.jar | Bin 0 -> 1966 bytes .../dep-0.1-20100518.144321-1.pom | 29 ++++++ .../dep/0.1-SNAPSHOT/maven-metadata.xml | 13 +++ .../dep-0.1-20100518.144344-2.jar | Bin 0 -> 1966 bytes .../dep-0.1-20100518.144344-2.pom | 36 +++++++ .../dep/0.1-SNAPSHOT/maven-metadata.xml | 13 +++ .../resources/mng-4679/settings-template.xml | 46 +++++++++ 11 files changed, 370 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/ItUtils.java create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4679SnapshotUpdateInPluginTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-4679/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-4679/repo-1/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/dep-0.1-20100518.144321-1.jar create mode 100644 its/core-it-suite/src/test/resources/mng-4679/repo-1/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/dep-0.1-20100518.144321-1.pom create mode 100644 its/core-it-suite/src/test/resources/mng-4679/repo-1/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/maven-metadata.xml create mode 100644 its/core-it-suite/src/test/resources/mng-4679/repo-2/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/dep-0.1-20100518.144344-2.jar create mode 100644 its/core-it-suite/src/test/resources/mng-4679/repo-2/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/dep-0.1-20100518.144344-2.pom create mode 100644 its/core-it-suite/src/test/resources/mng-4679/repo-2/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/maven-metadata.xml create mode 100644 its/core-it-suite/src/test/resources/mng-4679/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 f7a3b4850d..4cdc1216f2 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 @@ -82,6 +82,7 @@ public class IntegrationTestSuite // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class ); // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng4679SnapshotUpdateInPluginTest.class ); suite.addTestSuite( MavenITmng4677DisabledPluginConfigInheritanceTest.class ); suite.addTestSuite( MavenITmng4666CoreRealmImportTest.class ); suite.addTestSuite( MavenITmng4654ArtifactHandlerForMainArtifactTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/ItUtils.java b/its/core-it-suite/src/test/java/org/apache/maven/it/ItUtils.java new file mode 100644 index 0000000000..342f8f140a --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/ItUtils.java @@ -0,0 +1,72 @@ +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 java.io.File; +import java.io.FileInputStream; +import java.security.DigestInputStream; +import java.security.MessageDigest; + +/** + * @author Benjamin Bentmann + */ +class ItUtils +{ + + public static String calcHash( File file, String algo ) + throws Exception + { + MessageDigest digester = MessageDigest.getInstance( algo ); + + FileInputStream is = new FileInputStream( file ); + try + { + DigestInputStream dis = new DigestInputStream( is, digester ); + + for ( byte[] buffer = new byte[1024 * 4]; dis.read( buffer ) >= 0; ) + { + // just read it + } + } + finally + { + is.close(); + } + + byte[] digest = digester.digest(); + + StringBuffer hash = new StringBuffer( digest.length * 2 ); + + for ( int i = 0; i < digest.length; i++ ) + { + int b = digest[i] & 0xFF; + + if ( b < 0x10 ) + { + hash.append( '0' ); + } + + hash.append( Integer.toHexString( b ) ); + } + + return hash.toString(); + } + +} diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4679SnapshotUpdateInPluginTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4679SnapshotUpdateInPluginTest.java new file mode 100644 index 0000000000..6fc674752c --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4679SnapshotUpdateInPluginTest.java @@ -0,0 +1,90 @@ +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.Properties; + +/** + * This is a test set for MNG-4679. + * + * @author Benjamin Bentmann + */ +public class MavenITmng4679SnapshotUpdateInPluginTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng4679SnapshotUpdateInPluginTest() + { + super( "[2.0.3,3.0-alpha-1),[3.0-beta-2,)" ); + } + + /** + * Verify that plugins using the 2.x style artifact resolver/collector directly are subject to the snapshot update + * mode of the current Maven session. + */ + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4679" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteArtifacts( "org.apache.maven.its.mng4679" ); + verifier.getCliOptions().add( "-s" ); + verifier.getCliOptions().add( "settings.xml" ); + + Properties filterProps = verifier.newDefaultFilterProperties(); + + filterProps.setProperty( "@repo@", "repo-1" ); + verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); + verifier.setLogFileName( "log-force-1.txt" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + + assertChecksum( verifier, "jar", "cc7df75103468dd798397a81d0162d70faf92455" ); + assertChecksum( verifier, "pom", "7de357a948a8bb2357759c7c585adb504e579bad" ); + + filterProps.setProperty( "@repo@", "repo-2" ); + verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); + verifier.setLogFileName( "log-force-2.txt" ); + verifier.deleteDirectory( "target" ); + verifier.getCliOptions().add( "-U" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + + verifier.resetStreams(); + + assertChecksum( verifier, "jar", "f3d46277c2ab45ff9bbd97605c942bed7fc27f97" ); + assertChecksum( verifier, "pom", "8f17048dee72cc6ec33e9ab30fa00a910e1d6997" ); + } + + private void assertChecksum( Verifier verifier, String ext, String checksum ) + throws Exception + { + String path = verifier.getArtifactPath( "org.apache.maven.its.mng4679", "dep", "0.1-SNAPSHOT", ext ); + String actual = ItUtils.calcHash( new File( path ), "SHA-1" ); + assertEquals( checksum, actual ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-4679/pom.xml b/its/core-it-suite/src/test/resources/mng-4679/pom.xml new file mode 100644 index 0000000000..b6be2fd8e2 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4679/pom.xml @@ -0,0 +1,70 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4679 + test + 0.1 + jar + + Maven Integration Test :: MNG-4679 + + Verify that plugins using the 2.x style artifact resolver/collector directly are subject to the snapshot update + mode of the current Maven session. + + + + + + org.apache.maven.its.plugins + maven-it-plugin-artifact + 2.1-SNAPSHOT + + + + org.apache.maven.its.mng4679 + dep + 0.1-SNAPSHOT + + + + + + resolver + validate + + resolve + + + + collector + validate + + collect + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-4679/repo-1/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/dep-0.1-20100518.144321-1.jar b/its/core-it-suite/src/test/resources/mng-4679/repo-1/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/dep-0.1-20100518.144321-1.jar new file mode 100644 index 0000000000000000000000000000000000000000..1314dfd354b09014969924b9bc3786ae5bb0ef7f GIT binary patch literal 1966 zcmWIWW@h1H0Dw#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*yV)n!^z+8su0e)nc2W8KxEF=jv7D=9Gp+=g&3} zsdIm1KWCxsmY@SKL*9C=jJUlbLv|)t>{WMmnMYzdX|pe7+^WBCs5m|Mmhh(YZ+FWG z&)aWeYGb@~r%3uePlK-woletYLelTW+I_xX{e0r<9ezJfeUE+KChn6F)-*98jOWob zu^%U&T>27XIOC+>lq(6w7G0Zf8a|k)IiYE1U&sZIGnz{by7aA@#lJ3-zu;wf%^WjCkxC*=N{yJF_G1vmQpw6BzGWV@v_tw~QH z(YJcTs;FqT&4pF#0}=y$W8CxK+L@&4Ulx;(BojJ9&Ut(wIgsJS+ zo9E_#PbzTTzUF~6WAb&pVZg*B7O(dU)&B3cn&KZ4s(I~CD$T`%3oZz+osj#*Bh=&D zalxzSRM-6QV&zJi|0tk4@MzRZ%YE0rRy3FI>0!H5*QkH%xthwJJMPw@?qwGXrBA+| z&)sFuv#w6?wuXwCMVVUtR=$(<6BS;~y|EYqwt=M@gsJqMf^XDAiFFd8qe`T1PZ2ve{?7YrYuuco6aD*Y>C*1B1T}j#Kh3sMXMOB&UIBwQO(!HdsgP>~1$Ad3$InQ#+e1tiRR>_sF(^E*t<1PV;tCWDGh z2mm?Df)T@6cuj^BpfJ<17ojlomo&DKVLG%xMT9K&^op>g4p?%dg)BiYfGk0z-T-e_ RHjsJjKxhxF3nE!TJODJsnN9!z literal 0 HcmV?d00001 diff --git a/its/core-it-suite/src/test/resources/mng-4679/repo-1/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/dep-0.1-20100518.144321-1.pom b/its/core-it-suite/src/test/resources/mng-4679/repo-1/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/dep-0.1-20100518.144321-1.pom new file mode 100644 index 0000000000..11ea6a2c22 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4679/repo-1/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/dep-0.1-20100518.144321-1.pom @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4679 + dep + 0.1-SNAPSHOT + jar + diff --git a/its/core-it-suite/src/test/resources/mng-4679/repo-1/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/maven-metadata.xml b/its/core-it-suite/src/test/resources/mng-4679/repo-1/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/maven-metadata.xml new file mode 100644 index 0000000000..5d0d567010 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4679/repo-1/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,13 @@ + + + org.apache.maven.its.mng4679 + dep + 0.1-SNAPSHOT + + + 20100518.144321 + 1 + + 20100518144321 + + diff --git a/its/core-it-suite/src/test/resources/mng-4679/repo-2/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/dep-0.1-20100518.144344-2.jar b/its/core-it-suite/src/test/resources/mng-4679/repo-2/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/dep-0.1-20100518.144344-2.jar new file mode 100644 index 0000000000000000000000000000000000000000..7b443059d3e82ef30fdff2625b36ca074eb121f4 GIT binary patch literal 1966 zcmWIWW@h1H0DO*UW#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*yV)n!^z+8su0e)nc2W8KxEF=jv7D=9Gp+=g&3} zsdIm1KWCxsmY@SKL*9C=jJUlbLv|)t>{WMmnMYzdX|pe7+^WBCs5m|Mmhh(YZ+FWG z&)aWeYGb@~r%3uePlK-woletYLelTW+I_xX{e0r<9ezJfeUE+KChn6F)-*98jOWob zu^%U&T>27XIOC+>lq(6w7G0Zf8a|k)IiYE1U&sZIGnz{by7aA@#lJ3-zu;wf%^WjCkxC*=N{yJF_G1vmQpw6BzGWV@v_tw~QH z(YJcTs;FqT&4pF#0}=y$W8CxK+L@&4Ulx;(BojJ9&Ut(wIgsJS+ zo9E_#PbzTTzUF~6WAb&pVZg*B7O(dU)&B3cn&KZ4s(I~CD$T`%3oZz+osj#*Bh=&D zalxzSRM-6QV&zJi|0tk4@MzRZ%YE0rRy3FI>0!H5*QkH%xthwJJMPw@?qwGXrBA+| z&)sFuv#w6?wuXwCMVVUtR=$(<6BS;~y|EYqwt=M@gsJqMf^XDAiFFd8qe`T1PZ2ve{?7YrYuuco6aD*Y>C*1B1T}j#Kh3sMXMOB&UIBwQO(!HdsgP>~1$Ad3$InQ#+e1tiRR>_sF(^E*t<1PV;tCWDGh z2mm?Df)T@6cuj^BpfJ<17ojlomo&DKVLG%xMT9K&^op>g4p?%dg)BiYfGk0z-T-e_ RHjsJjKxhxF3nE!TJOGAVnOgt= literal 0 HcmV?d00001 diff --git a/its/core-it-suite/src/test/resources/mng-4679/repo-2/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/dep-0.1-20100518.144344-2.pom b/its/core-it-suite/src/test/resources/mng-4679/repo-2/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/dep-0.1-20100518.144344-2.pom new file mode 100644 index 0000000000..5ab5d65716 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4679/repo-2/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/dep-0.1-20100518.144344-2.pom @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4679 + dep + 0.1-SNAPSHOT + jar + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-4679/repo-2/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/maven-metadata.xml b/its/core-it-suite/src/test/resources/mng-4679/repo-2/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/maven-metadata.xml new file mode 100644 index 0000000000..8bd5523937 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4679/repo-2/org/apache/maven/its/mng4679/dep/0.1-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,13 @@ + + + org.apache.maven.its.mng4679 + dep + 0.1-SNAPSHOT + + + 20100518.144344 + 2 + + 20100518144344 + + diff --git a/its/core-it-suite/src/test/resources/mng-4679/settings-template.xml b/its/core-it-suite/src/test/resources/mng-4679/settings-template.xml new file mode 100644 index 0000000000..989a2c3d50 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4679/settings-template.xml @@ -0,0 +1,46 @@ + + + + + + + + maven-core-it-repo + + + maven-core-it + @baseurl@/@repo@ + + false + + + true + ignore + + never + + + + + + + maven-core-it-repo + +