[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
This commit is contained in:
Benjamin Bentmann 2011-01-03 15:23:22 +00:00
parent f01de836ab
commit 483edff5ab
9 changed files with 306 additions and 0 deletions

View File

@ -83,6 +83,7 @@ public class IntegrationTestSuite
// ------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
suite.addTestSuite( MavenITmng4955LocalVsRemoteSnapshotResolutionTest.class );
suite.addTestSuite( MavenITmng4936EventSpyTest.class ); suite.addTestSuite( MavenITmng4936EventSpyTest.class );
suite.addTestSuite( MavenITmng4925ContainerLookupRealmDuringMojoExecTest.class ); suite.addTestSuite( MavenITmng4925ContainerLookupRealmDuringMojoExecTest.class );
suite.addTestSuite( MavenITmng4913UserPropertyVsDependencyPomPropertyTest.class ); suite.addTestSuite( MavenITmng4913UserPropertyVsDependencyPomPropertyTest.class );

View File

@ -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 <a href="http://jira.codehaus.org/browse/MNG-4955">MNG-4955</a>.
*
* @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" ) );
}
}

View File

@ -0,0 +1,59 @@
<?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.mng4955</groupId>
<artifactId>dep</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Maven Integration Test :: MNG-4955 :: Dependency</name>
<description>
Verify that dependency resolution prefers newer local snapshots over outdated remote snapshots that use the new
metadata format.
</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>dep.jar</mainFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,65 @@
<?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.mng4955</groupId>
<artifactId>test</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<name>Maven Integration Test :: MNG-4955</name>
<description>
Verify that dependency resolution prefers newer local snapshots over outdated remote snapshots that use the new
metadata format.
</description>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.mng4955</groupId>
<artifactId>dep</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>
<compileClassPath>target/classpath.txt</compileClassPath>
</configuration>
<executions>
<execution>
<id>resolve</id>
<phase>validate</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,36 @@
<?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.mng4955</groupId>
<artifactId>dep</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/repo</url>
</repository>
</distributionManagement>
</project>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
<groupId>org.apache.maven.its.mng4955</groupId>
<artifactId>dep</artifactId>
<version>0.1-SNAPSHOT</version>
<versioning>
<snapshot>
<timestamp>20110103.120652</timestamp>
<buildNumber>1</buildNumber>
</snapshot>
<lastUpdated>20110103120652</lastUpdated>
<snapshotVersions>
<snapshotVersion>
<extension>jar</extension>
<value>0.1-20110103.120652-1</value>
<updated>20110103120652</updated>
</snapshotVersion>
<snapshotVersion>
<extension>pom</extension>
<value>0.1-20110103.120652-1</value>
<updated>20110103120652</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
</metadata>

View File

@ -0,0 +1,45 @@
<?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.
-->
<settings>
<profiles>
<profile>
<id>maven-core-it-repo</id>
<repositories>
<repository>
<id>maven-core-it</id>
<url>@baseurl@/repo</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<checksumPolicy>ignore</checksumPolicy>
<!-- NOTE: Be sure to enforce metadata refresh to exhibit bug -->
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>maven-core-it-repo</activeProfile>
</activeProfiles>
</settings>