From ba5733b716b40fc19104abb1dfa169af8aea44da Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Tue, 9 Jun 2009 19:38:26 +0000 Subject: [PATCH] [MNG-4193] Throw validation error upon multiple repository declarations with the same id o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@783105 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/it/IntegrationTestSuite.java | 1 + .../it/MavenITmng4193UniqueRepoIdTest.java | 100 ++++++++++++++++++ .../src/test/resources/mng-4193/build/pom.xml | 46 ++++++++ .../test/resources/mng-4193/metadata/pom.xml | 64 +++++++++++ .../apache/maven/its/mng4193/a/0.1/a-0.1.jar | Bin 0 -> 1931 bytes .../apache/maven/its/mng4193/a/0.1/a-0.1.pom | 36 +++++++ .../maven/its/mng4193/a/maven-metadata.xml | 13 +++ .../apache/maven/its/mng4193/b/0.1/b-0.1.jar | Bin 0 -> 2109 bytes .../apache/maven/its/mng4193/b/0.1/b-0.1.pom | 57 ++++++++++ .../maven/its/mng4193/b/maven-metadata.xml | 13 +++ .../mng-4193/metadata/settings-template.xml | 43 ++++++++ 11 files changed, 373 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4193UniqueRepoIdTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-4193/build/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-4193/metadata/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/a/0.1/a-0.1.jar create mode 100644 its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/a/0.1/a-0.1.pom create mode 100644 its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/a/maven-metadata.xml create mode 100644 its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/b/0.1/b-0.1.jar create mode 100644 its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/b/0.1/b-0.1.pom create mode 100644 its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/b/maven-metadata.xml create mode 100644 its/core-it-suite/src/test/resources/mng-4193/metadata/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 e8bf53a183..3d41c7bd6e 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 @@ -91,6 +91,7 @@ public class IntegrationTestSuite // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class ); // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng4193UniqueRepoIdTest.class ); suite.addTestSuite( MavenITmng4180PerDependencyExclusionsTest.class ); suite.addTestSuite( MavenITmng4172EmptyDependencySetTest.class ); suite.addTestSuite( MavenITmng4150VersionRangeTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4193UniqueRepoIdTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4193UniqueRepoIdTest.java new file mode 100644 index 0000000000..48f1a0aaf7 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4193UniqueRepoIdTest.java @@ -0,0 +1,100 @@ +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.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * This is a test set for MNG-4193. + * + * @author Benjamin Bentmann + */ +public class MavenITmng4193UniqueRepoIdTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng4193UniqueRepoIdTest() + { + super( "[3.0-alpha-3,)" ); + } + + /** + * Test that duplicate repository id cause a validation error during building. + */ + public void testitProjectBuild() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4193/build" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + try + { + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + fail( "Duplicate repository ids did not cause validation error" ); + } + catch ( VerificationException e ) + { + // expected + } + finally + { + verifier.resetStreams(); + } + } + + /** + * Test that duplicate repository id don't cause a validation error during metadata retrieval. + */ + public void testitMetadataRetrieval() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4193/metadata" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.deleteArtifacts( "org.apache.maven.its.mng4193" ); + verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() ); + verifier.getCliOptions().add( "-s" ); + verifier.getCliOptions().add( "settings.xml" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" ); + Collections.sort( artifacts ); + + List expected = new ArrayList(); + expected.add( "org.apache.maven.its.mng4193:a:jar:0.1" ); + expected.add( "org.apache.maven.its.mng4193:b:jar:0.1" ); + + assertEquals( expected, artifacts ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-4193/build/pom.xml b/its/core-it-suite/src/test/resources/mng-4193/build/pom.xml new file mode 100644 index 0000000000..22d1b36cdd --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4193/build/pom.xml @@ -0,0 +1,46 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4193 + test + 0.1 + jar + + Maven Integration Test :: MNG-4193 + + Test that duplicate repository ids cause a validation error during building. + + + + + + non-unique-id + http://repo1.maven.org + + + non-unique-id + http://repo2.maven.org + + + diff --git a/its/core-it-suite/src/test/resources/mng-4193/metadata/pom.xml b/its/core-it-suite/src/test/resources/mng-4193/metadata/pom.xml new file mode 100644 index 0000000000..e2fa1a1f04 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4193/metadata/pom.xml @@ -0,0 +1,64 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4193 + test + 0.1 + + Maven Integration Test :: MNG-4193 + + Test that duplicate repository ids do not cause a validation error during metadata retrieval. + + + + + + org.apache.maven.its.mng4193 + b + 0.1 + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-dependency-resolution + 2.1-SNAPSHOT + + + test + validate + + target/artifacts.txt + + + test + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/a/0.1/a-0.1.jar b/its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/a/0.1/a-0.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..1dcf1138a6cd0dc29c6b58b0c9cddd6e3c83031b GIT binary patch literal 1931 zcmWIWW@h1H0D+auPFjH(P=XUk`?`iW>U#RQ=?6fSaWJd^Dm!~CjVToj z{XE@VgG2Ou-9G!CIql=Et9OytTUYDcne&^246YbIcv__6b?$_Yx2_Wh`;#SMQ^d3n zs8sBn(;X!29TZ$LS8J_^47bo^;~>!*;nP8%fihmk#a;&<`K|L?Cs5b5F5JuPM1iqw za|Ls8oL-zB1I$^NuIEQ~R&HWhY98DVn2L2U73UYF>m?Q>CTFDTfpzO;mK5vd=B1k$ zS{maqNsmO665(cXFf0Uytj3$yM`tlHFsx!>U@#@wtb+Vpy^7qN(vax<*#;tY?vL!} zEVNw{bl~N+_E?S3Yi3eW(>+vUue!7QbwqENnd`MU^MCE}mY8js{wM6Vzc2Es`4|-b zq30Hd>iOo&88Qr~Vnm&$JwJFiNopUzp3wczdw+yV{JPhBB2Y@_fYyfW7SF@Qzf!VN zt=9=ITQ!w+`xTyhKAT>0UJx|Z=-jv5RAH7HYCbxXf4bki+sX!fRFt>T^9j_KB-yN%t=Hht*Qv>tv;+Zs%;# zxGol=-uWTQ#3cKnN6KYcfz7$QWj$rgSIKI~Y?O78IQV^S-UlPignVPwk>l~uPZi|{w&|*lr?Ak%Qpm^1V>5%D|0WaZgSESU810Wf@b}5L zGNb4v*Co&7KPZbGt45z^`}>6#UkMh^ zws`qCN;HD^^@KUDk27R8+rQf;c64c2?qo4e%gx3spPkoGcAOo5`qP^)hj-6-yXlwE zy0sA>?_8RB{LPCi?(NHG_bk3V!}fi9V9PH1kCQai`eTm2DUez4X6?eR{Fq5v@BV(> zDsuIPhVqNfyf*1w!mgK^d5f!#E!K#k^5*#4z0=LG_~1h0 z->XZ{{OfKBc<=g;7nWZ+z@?4s0?%zFz(igK#5QCl_JX4Pg4Cjt%+%uGGXJyQx?Vb- zzJVUALO%HFc%OazG>A{rH}r$n*XV@$xZ#;?b$xc`B&8%lPx> z9NsTHl{+tWfAZ$G3C{W4ed((ZxD5JQNJtpPoFKFEfFR4xky!PYRWQIwdo9^ zYM+W2fu#>4lL#~J(i7+jD4F$gSaR0oo9ZAfJ+K8ryG9|V9b z-UnpDO@I}HFzc}wgb2;AF*Oq?7IB*lDi|RE + + + + + 4.0.0 + + org.apache.maven.its.mng4193 + a + 0.1 + jar + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/a/maven-metadata.xml b/its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/a/maven-metadata.xml new file mode 100644 index 0000000000..5d241f9b2e --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/a/maven-metadata.xml @@ -0,0 +1,13 @@ + + + org.apache.maven.its.mng4193 + a + 0.1 + + + 0.1 + + 20090609185317 + + diff --git a/its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/b/0.1/b-0.1.jar b/its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/b/0.1/b-0.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..839c3d098cef7e315bcdcecf4cb8ec2dd1510ac8 GIT binary patch literal 2109 zcmWIWW@h1H0D*%mPFjH(P=XUk`?`iW>U#RQ=?6fSaWEVJDm!~CjVToj z{XE@VgG2Ou-9G!CIql=Et9OytTUYDcne&^246YbIcv__6b?$_Yx2_Wh`;#SMQ^d3n zs8sBn(;X!29TZ$LS8J_^47bo^;~>!*;nP8%fihmk#a;&<`K|L?Cs5b5F5JuPM1iqw za|Ls8oL-zB1I$^NuIEQ~R&HWhY98DVn2L2U73UYF>m?Q>CTFDTfpzO;mK5vd=B1k$ zS{maqNsmO6lHg`>Fzf+_>>E>8ZC_>v27Pu022+yFD#*{(tH{k+8{*r4*+XD&^r!k2 zy%r53w>S~EAy;76Iq;A+eWTCAHM!o z>90TQ);$p0D(Gc5JLbq{&ILLm;+tyBcHY!ktUmeqX9JGrFZ~)^&E|_7GAA^LCVc1U zZWH}-^6I%VA7!0TZOhFeJaT%Uo+>Yhzp_B3t?^QTc9-UqEm1kq-fgSav#+_*Vd|Bg z)F5+FJbtbD&C}X9I=eRQG^iCbecy67xW(Xt=3maTkd8vVnCP&^2`MXVI}9#F7`hEbLj~%xj=2)D`F0|~!y63!d$BipI7!wU7 zYbLw<*XEt&Q<&O%?ZHl?2eFO4stZ_F#&Gl_m`b~alV@U<+=2auCwmUn>De0Reh3buf_ipC9~$#vuiBB z8gMLHty6Tl{e17Z-d>|7l`09H6ych82i;gtS_ql>ve;Kg$DX}gdYMy=e_xK|ULmJ? z-5gjyg@Zg)!=)(1Tnk?TM?ns>~ z5vO)#mR|GrTW|Nfoj!4H1yiE~7xVsy@f#JU_C#sgZ9l@a|NJ2Zm+3WzYo>qu>n-%J zKd!%i^Ys%Kf^W@dHuJcy*DZKf{Wiy>#c^NwC)gL<*tV!h>*9+i58}ALpZmMJ&ibpP zSnpEy-K!3qTvI;p^}L<`{2zVDRQB9Z&Gb>wUbJ)nzW41il2vLRR_aUZnPEi?2e^Pd z&$uVK7?>~1fY^qt{8>65PU9CM3w}|Bii= z?lrkAecpR^{kO{-u%=LzT6R#v4h1^aB+GdlN}?tURw z{EBm~sbg_$e(`)$h4nUjS*O=GZ_L@Tq@d(q0&jMw{=8HCeb;Ij1H2iTM3`}x_dp*3 zfdIo>M-Yuv`opwgFaJS`L10OvI*^2GL#hq%Sqv(wApm6YJ|Gir0<7SMS&zNwMreMG zshL1Qj@x8VQ4RqhXPGi$I18`Ipn@G{Huj<&X8MxGMv~2j7WBwgfU0lw)QPY{k(E^E bgRDTL)c|i+HjruTKxoOt!0--e9s>gag01Mv literal 0 HcmV?d00001 diff --git a/its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/b/0.1/b-0.1.pom b/its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/b/0.1/b-0.1.pom new file mode 100644 index 0000000000..76541dd552 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/b/0.1/b-0.1.pom @@ -0,0 +1,57 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4193 + b + 0.1 + jar + + + + maven-core-it + file:///${basedir}/repo + + + + + + + non-unique-id + http://repo1.maven.org + + + non-unique-id + http://repo2.maven.org + + + + + + + org.apache.maven.its.mng4193 + a + 0.1 + + + diff --git a/its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/b/maven-metadata.xml b/its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/b/maven-metadata.xml new file mode 100644 index 0000000000..020c2aac9c --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4193/metadata/repo/org/apache/maven/its/mng4193/b/maven-metadata.xml @@ -0,0 +1,13 @@ + + + org.apache.maven.its.mng4193 + b + 0.1 + + + 0.1 + + 20090609190600 + + diff --git a/its/core-it-suite/src/test/resources/mng-4193/metadata/settings-template.xml b/its/core-it-suite/src/test/resources/mng-4193/metadata/settings-template.xml new file mode 100644 index 0000000000..c985d1a689 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4193/metadata/settings-template.xml @@ -0,0 +1,43 @@ + + + + + + + + maven-core-it-repo + + + maven-core-it + @baseurl@/repo + + ignore + + + false + + + + + + + maven-core-it-repo + +