From: Maria Odea B. Ching Date: Sat, 1 May 2010 08:13:00 +0000 (+0000) Subject: [MRM-1353] Build number is always 1 for SNAPSHOT artifacts uploaded via web upload... X-Git-Tag: archiva-1.3.1~13 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=90a86e31c13e60bad6c58fc3f80d1004aaaba2de;p=archiva.git [MRM-1353] Build number is always 1 for SNAPSHOT artifacts uploaded via web upload form o added selenium test git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-1.3.x@939944 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java index a82a8f584..7d9c27f94 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java @@ -22,6 +22,7 @@ package org.apache.archiva.web.test; import java.io.File; import org.apache.archiva.web.test.parent.AbstractBrowseTest; +import org.testng.Assert; import org.testng.annotations.Test; @Test( groups = { "browse" }, dependsOnMethods = { "testAddArtifactNullValues" } ) @@ -83,6 +84,43 @@ public class BrowseTest assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "continuum", "continuum-core", "1.0-SNAPSHOT", "jar" ); } + // MRM-1353 + @Test( groups = { "requiresUpload" } ) + public void testBuildNumberOfSnapshotArtifact() + { + String snapshotsRepo = getProperty( "SNAPSHOTS_REPOSITORY" ); + + String path = "src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar"; + // TODO: do this differently as uploading doesn't work on browsers other than *chrome (below as well) + // upload a snapshot artifact to repository 'releases' + addArtifact( "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar", path, snapshotsRepo ); + assertTextPresent( "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '" + + snapshotsRepo + "'" ); + + goToBrowsePage(); + assertBrowsePage(); + assertGroupsPage( "archiva/" ); + assertArtifactsPage( "archiva-multiple-artifacts/" ); + assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar" ); + + + addArtifact( "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar", path, snapshotsRepo ); + assertTextPresent( "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '" + + snapshotsRepo + "'" ); + + goToBrowsePage(); + assertBrowsePage(); + assertGroupsPage( "archiva/" ); + assertArtifactsPage( "archiva-multiple-artifacts/" ); + assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar" ); + + String firstSnapshotVersion = getText( "//div[@id='tabArea']/table[@class='infoTable']/tbody/tr[6]/td/a[1]" ); + Assert.assertTrue( firstSnapshotVersion.endsWith( "-1" ) ); + + String secondSnapshotVersion = getText( "//div[@id='tabArea']/table[@class='infoTable']/tbody/tr[6]/td/a[2]" ); + Assert.assertTrue( secondSnapshotVersion.endsWith( "-2" ) ); + } + private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId, String artifactInfoArtifactId, String artifactInfoVersion, String artifactInfoPackaging ) { diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java index d4d090a5b..888e89c41 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java @@ -152,6 +152,11 @@ public abstract class AbstractSeleniumTest { { return getSelenium().getHtmlSource(); } + + public String getText( String locator ) + { + return getSelenium().getText( locator ); + } public void assertTextPresent( String text ) {