[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
This commit is contained in:
Benjamin Bentmann 2010-05-18 15:48:31 +00:00
parent 7cfe89ecaf
commit c31ca6323b
11 changed files with 370 additions and 0 deletions

View File

@ -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 );

View File

@ -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();
}
}

View File

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

View File

@ -0,0 +1,70 @@
<?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.mng4679</groupId>
<artifactId>test</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<name>Maven Integration Test :: MNG-4679</name>
<description>
Verify that plugins using the 2.x style artifact resolver/collector directly are subject to the snapshot update
mode of the current Maven session.
</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-artifact</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.mng4679</groupId>
<artifactId>dep</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</configuration>
<executions>
<execution>
<id>resolver</id>
<phase>validate</phase>
<goals>
<goal>resolve</goal>
</goals>
</execution>
<execution>
<id>collector</id>
<phase>validate</phase>
<goals>
<goal>collect</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,29 @@
<?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.mng4679</groupId>
<artifactId>dep</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
</project>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.its.mng4679</groupId>
<artifactId>dep</artifactId>
<version>0.1-SNAPSHOT</version>
<versioning>
<snapshot>
<timestamp>20100518.144321</timestamp>
<buildNumber>1</buildNumber>
</snapshot>
<lastUpdated>20100518144321</lastUpdated>
</versioning>
</metadata>

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.mng4679</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,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.its.mng4679</groupId>
<artifactId>dep</artifactId>
<version>0.1-SNAPSHOT</version>
<versioning>
<snapshot>
<timestamp>20100518.144344</timestamp>
<buildNumber>2</buildNumber>
</snapshot>
<lastUpdated>20100518144344</lastUpdated>
</versioning>
</metadata>

View File

@ -0,0 +1,46 @@
<?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>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
<!-- NOTE: This should be overriden by -U from the CLI -->
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>maven-core-it-repo</activeProfile>
</activeProfiles>
</settings>