o Strengthened IT to check timestamp and build number of all deployed files

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@729937 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2008-12-29 16:43:10 +00:00
parent e66a4a216c
commit 7dd34a41de
2 changed files with 44 additions and 9 deletions

View File

@ -35,7 +35,7 @@ public class MavenITmng1021EqualAttachmentBuildNumberTest
{ {
/** /**
* Test that source attachments have the same build number as the main * Test that source attachments have the same build number and timestamp as the main
* artifact when deployed. * artifact when deployed.
*/ */
public void testitMNG1021() public void testitMNG1021()
@ -43,13 +43,48 @@ public class MavenITmng1021EqualAttachmentBuildNumberTest
{ {
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1021" ); File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1021" );
Verifier verifier = new Verifier( testDir.getAbsolutePath() ); Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.deleteDirectory( "repo" );
verifier.deleteArtifacts( "org.apache.maven.its.mng1021" );
verifier.executeGoal( "initialize" ); verifier.executeGoal( "initialize" );
verifier.assertFilePresent(
"target/test-repo/org/apache/maven/its/it0079/maven-it-it0079/SNAPSHOT/maven-it-it0079-*-1.jar" );
verifier.assertFilePresent(
"target/test-repo/org/apache/maven/its/it0079/maven-it-it0079/SNAPSHOT/maven-it-it0079-*-1-it.jar" );
verifier.verifyErrorFreeLog(); verifier.verifyErrorFreeLog();
verifier.resetStreams(); verifier.resetStreams();
verifier.assertArtifactPresent( "org.apache.maven.its.mng1021", "test", "SNAPSHOT", "pom" );
verifier.assertArtifactPresent( "org.apache.maven.its.mng1021", "test", "SNAPSHOT", "jar" );
String dir = "repo/org/apache/maven/its/mng1021/test/";
String snapshot = getSnapshotVersion( new File( testDir, dir + "SNAPSHOT" ) );
assertTrue( snapshot, snapshot.endsWith( "-1" ) );
verifier.assertFilePresent( dir + "maven-metadata.xml" );
verifier.assertFilePresent( dir + "maven-metadata.xml.md5" );
verifier.assertFilePresent( dir + "maven-metadata.xml.sha1" );
verifier.assertFilePresent( dir + "SNAPSHOT/maven-metadata.xml" );
verifier.assertFilePresent( dir + "SNAPSHOT/maven-metadata.xml.md5" );
verifier.assertFilePresent( dir + "SNAPSHOT/maven-metadata.xml.sha1" );
verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + ".pom" );
verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + ".pom.md5" );
verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + ".pom.sha1" );
verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + ".jar" );
verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + ".jar.md5" );
verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + ".jar.sha1" );
verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + "-it.jar" );
verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + "-it.jar.md5" );
verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + "-it.jar.sha1" );
}
private String getSnapshotVersion( File artifactDir )
{
File[] files = artifactDir.listFiles();
for ( int i = 0; i < files.length; i++ )
{
String name = files[i].getName();
if ( name.endsWith( ".pom" ) )
{
return name.substring( "test-".length(), name.length() - ".pom".length() );
}
}
throw new IllegalStateException( "POM not found in " + artifactDir );
} }
} }

View File

@ -22,11 +22,11 @@ under the License.
<project> <project>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.it0079</groupId> <groupId>org.apache.maven.its.mng1021</groupId>
<artifactId>maven-it-it0079</artifactId> <artifactId>test</artifactId>
<version>SNAPSHOT</version> <version>SNAPSHOT</version>
<name>Maven Integration Test :: it0079</name> <name>Maven Integration Test :: MNG-1021</name>
<description> <description>
Test that attached artifacts have the same build number as the main Test that attached artifacts have the same build number as the main
artifact when deployed. artifact when deployed.
@ -36,7 +36,7 @@ under the License.
<snapshotRepository> <snapshotRepository>
<id>test</id> <id>test</id>
<name>Test Repo</name> <name>Test Repo</name>
<url>file:target/test-repo</url> <url>file:repo</url>
</snapshotRepository> </snapshotRepository>
</distributionManagement> </distributionManagement>