Author: bentmann
Date: Tue Nov 9 12:23:40 2010
New Revision: 1032960
URL: http://svn.apache.org/viewvc?rev=1032960&view=rev
Log:
[MNG-4891] Improve robustness of snapshot dependency resolution in case a
remote repo accidently uses the id "local"
o Added IT
Added:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4891RobustSnapshotResolutionTest.java
(with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/consumer/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/consumer/pom.xml
(with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/producer/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/producer/pom.xml
(with props)
Modified:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4877/settings.xml
Modified:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=1032960&r1=1032959&r2=1032960&view=diff
==============================================================================
---
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
(original)
+++
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
Tue Nov 9 12:23:40 2010
@@ -83,6 +83,7 @@ public class IntegrationTestSuite
//
-------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); --
MNG-3137
+ suite.addTestSuite( MavenITmng4891RobustSnapshotResolutionTest.class );
suite.addTestSuite( MavenITmng4877DeployUsingPrivateKeyTest.class );
suite.addTestSuite( MavenITmng4874UpdateLatestPluginVersionTest.class
);
suite.addTestSuite(
MavenITmng4872ReactorResolutionAttachedWithExclusionsTest.class );
Added:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4891RobustSnapshotResolutionTest.java
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4891RobustSnapshotResolutionTest.java?rev=1032960&view=auto
==============================================================================
---
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4891RobustSnapshotResolutionTest.java
(added)
+++
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4891RobustSnapshotResolutionTest.java
Tue Nov 9 12:23:40 2010
@@ -0,0 +1,71 @@
+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 <a
href="http://jira.codehaus.org/browse/MNG-4891">MNG-4891</a>.
+ *
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng4891RobustSnapshotResolutionTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng4891RobustSnapshotResolutionTest()
+ {
+ super( "[2.0.3,3.0-alpha-1),[3.0.1,)" );
+ }
+
+ /**
+ * Verify that resolution of a local snapshot still succeeds even if the
maven-metadata-local.xml has been
+ * corrupted by a remote repository that misuses the same repo id, i.e.
"local".
+ */
+ public void testit()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(),
"/mng-4891" );
+
+ Verifier verifier = newVerifier( new File( testDir, "producer"
).getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "target" );
+ verifier.deleteArtifacts( "org.apache.maven.its.mng4891" );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ verifier = newVerifier( new File( testDir, "consumer"
).getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "target" );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" );
+
+ assertTrue( artifacts.toString(), artifacts.contains(
"org.apache.maven.its.mng4891:producer:jar:0.1-SNAPSHOT" ) );
+ }
+
+}
Propchange:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4891RobustSnapshotResolutionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4891RobustSnapshotResolutionTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified:
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4877/settings.xml
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4877/settings.xml?rev=1032960&r1=1032959&r2=1032960&view=diff
==============================================================================
---
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4877/settings.xml
(original)
+++
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4877/settings.xml
Tue Nov 9 12:23:40 2010
@@ -19,12 +19,6 @@ specific language governing permissions
under the License.
-->
-<!--
-These settings are meant for ITs that don't download artifacts from remote
servers, i.e. ITs that either use their
-own test repos or can employ the local repository (after bootstrapping). This
configuration uses a file: URL to
-"central" to avoid needless network access for files knowingly not present
externally.
--->
-
<settings>
<servers>
<server>
Added:
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/consumer/pom.xml
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/consumer/pom.xml?rev=1032960&view=auto
==============================================================================
---
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/consumer/pom.xml
(added)
+++
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/consumer/pom.xml
Tue Nov 9 12:23:40 2010
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.mng4891</groupId>
+ <artifactId>consumer</artifactId>
+ <version>0.1</version>
+ <packaging>jar</packaging>
+
+ <name>Maven Integration Test :: MNG-4891 :: Dependency Consumer</name>
+ <description>
+ Verify that resolution of a local snapshot still succeeds even if the
maven-metadata-local.xml has been
+ corrupted by a remote repository that misuses the same repo id, i.e.
"local".
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.mng4891</groupId>
+ <artifactId>producer</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-dependency-resolution</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <configuration>
+ <projectArtifacts>target/artifacts.txt</projectArtifacts>
+ <significantPathLevels>1</significantPathLevels>
+ </configuration>
+ <executions>
+ <execution>
+ <id>resolve</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange:
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/consumer/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/consumer/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/producer/pom.xml
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/producer/pom.xml?rev=1032960&view=auto
==============================================================================
---
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/producer/pom.xml
(added)
+++
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/producer/pom.xml
Tue Nov 9 12:23:40 2010
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.mng4891</groupId>
+ <artifactId>producer</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <name>Maven Integration Test :: MNG-4891 :: Dependency Producer</name>
+ <description>
+ Verify that resolution of a local snapshot still succeeds even if the
maven-metadata-local.xml has been
+ corrupted by a remote repository that misuses the same repo id, i.e.
"local".
+ </description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-artifact</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>install</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>set</goal>
+ <goal>attach-pom</goal>
+ <goal>install</goal>
+ </goals>
+ <configuration>
+ <mainFile>pom.xml</mainFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>deploy</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>deploy-file</goal>
+ </goals>
+ <configuration>
+ <!-- NOTE: Having the repo id clash with the id used internally
for the local repo is the crucial piece here -->
+ <repositoryId>local</repositoryId>
+ <repositoryUrl>file:///${basedir}/target/repo</repositoryUrl>
+ <file>pom.xml</file>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.artifactId}</artifactId>
+ <version>${project.version}</version>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange:
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/producer/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4891/producer/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision