From 7dd34a41defc7585b4dbfd5a2abfba25cad0031a Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Mon, 29 Dec 2008 16:43:10 +0000 Subject: [PATCH] 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 --- ...mng1021EqualAttachmentBuildNumberTest.java | 45 ++++++++++++++++--- .../src/test/resources/mng-1021/pom.xml | 8 ++-- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1021EqualAttachmentBuildNumberTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1021EqualAttachmentBuildNumberTest.java index d01af72f5b..b10bbbcfad 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1021EqualAttachmentBuildNumberTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1021EqualAttachmentBuildNumberTest.java @@ -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. */ public void testitMNG1021() @@ -43,13 +43,48 @@ public class MavenITmng1021EqualAttachmentBuildNumberTest { File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1021" ); Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.deleteDirectory( "repo" ); + verifier.deleteArtifacts( "org.apache.maven.its.mng1021" ); 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.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 ); } } diff --git a/its/core-it-suite/src/test/resources/mng-1021/pom.xml b/its/core-it-suite/src/test/resources/mng-1021/pom.xml index 04dc50f231..e46e33168f 100644 --- a/its/core-it-suite/src/test/resources/mng-1021/pom.xml +++ b/its/core-it-suite/src/test/resources/mng-1021/pom.xml @@ -22,11 +22,11 @@ under the License. 4.0.0 - org.apache.maven.its.it0079 - maven-it-it0079 + org.apache.maven.its.mng1021 + test SNAPSHOT - Maven Integration Test :: it0079 + Maven Integration Test :: MNG-1021 Test that attached artifacts have the same build number as the main artifact when deployed. @@ -36,7 +36,7 @@ under the License. test Test Repo - file:target/test-repo + file:repo