o Strengthened IT to cover metadata as well

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@900761 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-01-19 13:11:18 +00:00
parent 6b15c605d1
commit 134bdd165d
71 changed files with 231 additions and 104 deletions

View File

@ -20,6 +20,11 @@ package org.apache.maven.it;
*/
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;
@ -36,7 +41,7 @@ public class MavenITmng3379ParallelArtifactDownloadsTest
public MavenITmng3379ParallelArtifactDownloadsTest()
{
super( ALL_MAVEN_VERSIONS );
super( "[2.0.5,3.0-alpha-1),[3.0-alpha-2,)" );
}
/**
@ -53,7 +58,7 @@ public class MavenITmng3379ParallelArtifactDownloadsTest
verifier.deleteArtifacts( "org.apache.maven.its.mng3379.a" );
verifier.deleteArtifacts( "org.apache.maven.its.mng3379.b" );
verifier.deleteArtifacts( "org.apache.maven.its.mng3379.c" );
verifier.deleteArtifacts( "org.apache.maven.its.mng3379.c" );
verifier.deleteArtifacts( "org.apache.maven.its.mng3379.d" );
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
verifier.getCliOptions().add( "--settings" );
verifier.getCliOptions().add( "settings.xml" );
@ -61,32 +66,93 @@ public class MavenITmng3379ParallelArtifactDownloadsTest
verifier.verifyErrorFreeLog();
verifier.resetStreams();
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.a", "x", "0.1", "", "jar" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.a", "x", "0.1", "", "pom" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.a", "x", "0.1", "tests", "jar" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.a", "x", "0.1", "sources", "jar" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.a", "x", "0.1", "test-javadoc", "jar" );
String gid = "org.apache.maven.its.mng3379.";
assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "", "jar",
"69c041c12f35894230c7c23c49cd245886c6fb6f" );
assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "", "pom",
"10235b64a161e86e91cc6ff7245a4b9c6fdc7d5d" );
assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "tests", "jar",
"69c041c12f35894230c7c23c49cd245886c6fb6f" );
assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "sources", "jar",
"166f8bef02b9e92f99ec3b163d8321dd1d087e34" );
assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "javadoc", "jar",
"4d96e09f7e93870685a317c574f851b407224415" );
assertMetadata( verifier, gid + "a", "x", "0.2-SNAPSHOT",
"e1cfc3a77657fc46bb624dee25c61b290e5b4dd7" );
assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "", "jar",
"efb7c4046565774cd7e44645e02f06ecdf91098d" );
assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "", "pom",
"1c816cc9eaaca1272f24887c461aa359503394f5" );
assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "tests", "jar",
"efb7c4046565774cd7e44645e02f06ecdf91098d" );
assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "sources", "jar",
"9ad231fc04ea1114987c377cc5cbccfbf83e3dbf" );
assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "javadoc", "jar",
"7807daefd3af3be73d3b92f9c5ab1b52510c0767" );
assertMetadata( verifier, gid + "b", "x", "0.2-SNAPSHOT",
"5ccc4edfb503f9a5ccadedf102dff8943250d830" );
assertMetadata( verifier, gid + "b", "x",
"8f38b1041871f22dcb031544d8a3436c335bfcdb" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.b", "x", "0.1", "", "jar" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.b", "x", "0.1", "", "pom" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.b", "x", "0.1", "tests", "jar" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.b", "x", "0.1", "sources", "jar" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.b", "x", "0.1", "test-javadoc", "jar" );
assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "", "jar",
"1eb0d5a421b3074e8a69b0dcca7e325c0636a932" );
assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "", "pom",
"bd9a24117d3ce4f8ef3b8fcfe79a08e5ea141a9b" );
assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "tests", "jar",
"1eb0d5a421b3074e8a69b0dcca7e325c0636a932" );
assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "sources", "jar",
"82f9664b3a910fb861fc4ed2b79e39d8f95e3675" );
assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "javadoc", "jar",
"64a3bfe19b294f67b1c52a2514c58922b88e5f97" );
assertMetadata( verifier, gid + "c", "x", "0.2-SNAPSHOT",
"b31ef40a51bdab4e6e44bfe3f2d1da42e5e42e46" );
assertMetadata( verifier, gid + "c", "x",
"c4848e60d226ec6304df3abd9eba8fdb301b3660" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.c", "x", "0.1", "", "jar" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.c", "x", "0.1", "", "pom" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.c", "x", "0.1", "tests", "jar" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.c", "x", "0.1", "sources", "jar" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.c", "x", "0.1", "test-javadoc", "jar" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.d", "x", "0.1", "", "jar" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.d", "x", "0.1", "", "pom" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.d", "x", "0.1", "tests", "jar" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.d", "x", "0.1", "sources", "jar" );
assertArtifactPresent( verifier, "org.apache.maven.its.mng3379.d", "x", "0.1", "test-javadoc", "jar" );
assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "", "jar",
"3d606c564625a594165bcbbe4a24c8f11b18b5a0" );
assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "", "pom",
"70a3c9795b2871fdd8a66e8fe312359f08d77c7d" );
assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "tests", "jar",
"3d606c564625a594165bcbbe4a24c8f11b18b5a0" );
assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "sources", "jar",
"35a7e140307f4bb67984dc72aa551f0faabacd36" );
assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "javadoc", "jar",
"2fe3487f496fe66f23772b1bada066ec6bd9222f" );
assertMetadata( verifier, gid + "d", "x", "0.2-SNAPSHOT",
"a0d0b5efd5d6f6a921a3f7c1a6a503359fccef04" );
assertMetadata( verifier, gid + "d", "x",
"1d2bf926862f2131f1229328e588b906b087bdb3" );
}
private void assertArtifactPresent( Verifier verifier, String gid, String aid, String ver, String cls, String ext )
private void assertArtifact( Verifier verifier, String gid, String aid, String ver, String cls, String ext, String sha1 )
throws Exception
{
File file = getFile( verifier, gid, aid, ver, cls, ext );
assertTrue( file.getAbsolutePath(), file.isFile() );
assertEquals( sha1, calcHash( file, "SHA-1" ) );
}
private void assertMetadata( Verifier verifier, String gid, String aid, String ver, String sha1 )
throws Exception
{
File file = getFile( verifier, gid, aid, ver, "", "pom" );
file = new File( file.getParent(), "maven-metadata-maven-core-it.xml" );
assertTrue( file.getAbsolutePath(), file.isFile() );
assertEquals( sha1, calcHash( file, "SHA-1" ) );
}
private void assertMetadata( Verifier verifier, String gid, String aid, String sha1 )
throws Exception
{
File file = getFile( verifier, gid, aid, "0.2", "", "pom" );
file = new File( file.getParentFile().getParent(), "maven-metadata-maven-core-it.xml" );
assertTrue( file.getAbsolutePath(), file.isFile() );
assertEquals( sha1, calcHash( file, "SHA-1" ) );
}
private File getFile( Verifier verifier, String gid, String aid, String ver, String cls, String ext )
{
StringBuffer buffer = new StringBuffer( 256 );
buffer.append( verifier.localRepo );
@ -99,8 +165,46 @@ public class MavenITmng3379ParallelArtifactDownloadsTest
buffer.append( '-' ).append( cls );
}
buffer.append( '.' ).append( ext );
File file = new File( buffer.toString() );
assertTrue( file.getAbsolutePath(), file.isFile() );
return new File( buffer.toString() );
}
private String calcHash( File file, String algo )
throws IOException, NoSuchAlgorithmException
{
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

@ -38,97 +38,97 @@ under the License.
<dependency>
<groupId>org.apache.maven.its.mng3379.a</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>[0.2-SNAPSHOT,)</version>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3379.a</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>[0.2-SNAPSHOT,)</version>
<classifier>tests</classifier>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3379.a</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>[0.2-SNAPSHOT,)</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3379.a</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<classifier>test-javadoc</classifier>
<version>[0.2-SNAPSHOT,)</version>
<classifier>javadoc</classifier>
</dependency>
<!-- group B -->
<dependency>
<groupId>org.apache.maven.its.mng3379.b</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>[0.2-SNAPSHOT,)</version>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3379.b</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>[0.2-SNAPSHOT,)</version>
<classifier>tests</classifier>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3379.b</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>[0.2-SNAPSHOT,)</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3379.b</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<classifier>test-javadoc</classifier>
<version>[0.2-SNAPSHOT,)</version>
<classifier>javadoc</classifier>
</dependency>
<!-- group C -->
<dependency>
<groupId>org.apache.maven.its.mng3379.c</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>[0.2-SNAPSHOT,)</version>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3379.c</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>[0.2-SNAPSHOT,)</version>
<classifier>tests</classifier>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3379.c</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>[0.2-SNAPSHOT,)</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3379.c</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<classifier>test-javadoc</classifier>
<version>[0.2-SNAPSHOT,)</version>
<classifier>javadoc</classifier>
</dependency>
<!-- group D -->
<dependency>
<groupId>org.apache.maven.its.mng3379.d</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>[0.2-SNAPSHOT,)</version>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3379.d</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>[0.2-SNAPSHOT,)</version>
<classifier>tests</classifier>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3379.d</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>[0.2-SNAPSHOT,)</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3379.d</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<classifier>test-javadoc</classifier>
<version>[0.2-SNAPSHOT,)</version>
<classifier>javadoc</classifier>
</dependency>
</dependencies>

View File

@ -1 +0,0 @@
b71e548e0427e3a92b1c130d27be6fa52d84c576

View File

@ -1 +0,0 @@
5904b07e6c250f792643b8ca9d8237bdbacd5acf

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.its.mng3379.a</groupId>
<artifactId>x</artifactId>
<version>0.2-SNAPSHOT</version>
<versioning>
<snapshot>
<timestamp>20100119.121141</timestamp>
<buildNumber>1</buildNumber>
</snapshot>
<lastUpdated>20100119121141</lastUpdated>
</versioning>
</metadata>

View File

@ -24,11 +24,10 @@ under the License.
<groupId>org.apache.maven.its.mng3379.a</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<updateReleaseInfo>true</updateReleaseInfo>
</properties>
<distributionManagement>

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?><metadata>
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.its.mng3379.a</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>0.2-SNAPSHOT</version>
<versioning>
<release>0.1</release>
<versions>
<version>0.1</version>
<version>0.2-SNAPSHOT</version>
</versions>
<lastUpdated>20090208133354</lastUpdated>
<lastUpdated>20100119121141</lastUpdated>
</versioning>
</metadata>
</metadata>

View File

@ -1 +0,0 @@
e5cf583eab02c011806a2fba761915a8cfa7d77a

View File

@ -1 +0,0 @@
6840d0bf1653fc445d4486c4a5e280813087a1a5

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.its.mng3379.b</groupId>
<artifactId>x</artifactId>
<version>0.2-SNAPSHOT</version>
<versioning>
<snapshot>
<timestamp>20100119.121231</timestamp>
<buildNumber>1</buildNumber>
</snapshot>
<lastUpdated>20100119121231</lastUpdated>
</versioning>
</metadata>

View File

@ -24,11 +24,10 @@ under the License.
<groupId>org.apache.maven.its.mng3379.b</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<updateReleaseInfo>true</updateReleaseInfo>
</properties>
<distributionManagement>

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?><metadata>
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.its.mng3379.b</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>0.2-SNAPSHOT</version>
<versioning>
<release>0.1</release>
<versions>
<version>0.1</version>
<version>0.2-SNAPSHOT</version>
</versions>
<lastUpdated>20090208133454</lastUpdated>
<lastUpdated>20100119121231</lastUpdated>
</versioning>
</metadata>
</metadata>

View File

@ -1 +0,0 @@
267b6326ac40acae70084d39f8d6653109195ce2

View File

@ -1 +0,0 @@
eae1c10beecc02eb0e4edd5a25e1cb964057b3e5

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.its.mng3379.c</groupId>
<artifactId>x</artifactId>
<version>0.2-SNAPSHOT</version>
<versioning>
<snapshot>
<timestamp>20100119.121243</timestamp>
<buildNumber>1</buildNumber>
</snapshot>
<lastUpdated>20100119121244</lastUpdated>
</versioning>
</metadata>

View File

@ -24,11 +24,10 @@ under the License.
<groupId>org.apache.maven.its.mng3379.c</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<updateReleaseInfo>true</updateReleaseInfo>
</properties>
<distributionManagement>

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?><metadata>
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.its.mng3379.c</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>0.2-SNAPSHOT</version>
<versioning>
<release>0.1</release>
<versions>
<version>0.1</version>
<version>0.2-SNAPSHOT</version>
</versions>
<lastUpdated>20090208133508</lastUpdated>
<lastUpdated>20100119121243</lastUpdated>
</versioning>
</metadata>
</metadata>

View File

@ -1 +0,0 @@
4f0d975441aea90243d1b89183512aac7420b757

View File

@ -1 +0,0 @@
dc011fe3156096fddc8368528b3443c162f33983

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.its.mng3379.d</groupId>
<artifactId>x</artifactId>
<version>0.2-SNAPSHOT</version>
<versioning>
<snapshot>
<timestamp>20100119.121254</timestamp>
<buildNumber>1</buildNumber>
</snapshot>
<lastUpdated>20100119121254</lastUpdated>
</versioning>
</metadata>

View File

@ -24,11 +24,10 @@ under the License.
<groupId>org.apache.maven.its.mng3379.d</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<updateReleaseInfo>true</updateReleaseInfo>
</properties>
<distributionManagement>

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?><metadata>
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.its.mng3379.d</groupId>
<artifactId>x</artifactId>
<version>0.1</version>
<version>0.2-SNAPSHOT</version>
<versioning>
<release>0.1</release>
<versions>
<version>0.1</version>
<version>0.2-SNAPSHOT</version>
</versions>
<lastUpdated>20090208133536</lastUpdated>
<lastUpdated>20100119121254</lastUpdated>
</versioning>
</metadata>
</metadata>

View File

@ -28,8 +28,7 @@ under the License.
<id>maven-core-it</id>
<url>@baseurl@/repo</url>
<releases>
<!-- NOTE: Be sure the verify the integrity -->
<checksumPolicy>fail</checksumPolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<checksumPolicy>ignore</checksumPolicy>