From 2ee860c6a09c9145034f266061dabef4c654f337 Mon Sep 17 00:00:00 2001 From: "Jevica Arianne B. Zurbano" Date: Thu, 27 May 2010 11:54:24 +0000 Subject: [PATCH] [MRM-1362] Add simple 'CRUD' pages for project-level metadata along with a "generic metadata" plugin * added mailingLists, licenses, and dependency in test artifact's pom * added Selenium test for delete of metadata properties (mailing list, dependency, and license) git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@948793 13f79535-47bb-0310-9956-ffa450edef68 --- .../internal/test/test/1.0/test-1.0.pom | 30 +++++++ .../apache/archiva/web/test/BrowseTest.java | 80 +++++++++++++++++++ 2 files changed, 110 insertions(+) diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom index cbec59866..606e1b194 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom @@ -7,7 +7,35 @@ 1.0 test http://maven.apache.org + + + + Test License + http://www.test.org/test.html + + + + + + test user list + http://test.net/lists/listinfo/test-user + http://test.net/lists/listinfo/test-user + http://www.test-archive.com/test-user%40lists.test.net/ + + + test developer list + http://test.net/lists/listinfo/test-dev + http://test.net/lists/listinfo/test-dev + http://www.test-archive.com/test-dev%40lists.test.net/ + + + + + test.group.id + testArtifactId + 1.0 + junit junit @@ -15,6 +43,7 @@ test + test @@ -22,3 +51,4 @@ + 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 5226f78e2..9018a4eda 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 @@ -138,6 +138,86 @@ public class BrowseTest String secondSnapshotVersion = getText( "//div[@id='download']/div[@id='accordion']/p[1]/a/" ); Assert.assertTrue( secondSnapshotVersion.endsWith( "-2" ) ); } + + public void testMetadataPageDisplay() + { + goToBrowsePage(); + clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" ); + clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" ); + clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" ); + clickLinkWithText( "Metadata" ); + + assertMinimalMetadataDisplay(); + } + + public void testDeleteMetadataDependency() + { + String depArtifactId = "testArtifactId"; + + goToBrowsePage(); + clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" ); + clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" ); + clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" ); + clickLinkWithText( "Metadata" ); + + assertMinimalMetadataDisplay(); + assertTextPresent( "dependencies" ); + assertTextPresent( depArtifactId ); + + String xPath = "//li[contains(text(),'" + depArtifactId + "')]/a/img[contains(@src,'delete.gif')]"; + clickLinkWithXPath( xPath ); + + assertTextNotPresent( depArtifactId ); + } + + public void testDeleteMetadataMailingList() + { + String listName = "test user list"; + + goToBrowsePage(); + clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" ); + clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" ); + clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" ); + clickLinkWithText( "Metadata" ); + + assertMinimalMetadataDisplay(); + assertTextPresent( "mailingLists" ); + assertTextPresent( listName ); + + String xPath = "//li[contains(text(),'" + listName + "')]/a/img[contains(@src,'delete.gif')]"; + clickLinkWithXPath( xPath ); + + assertTextNotPresent( listName ); + } + + public void testDeleteMetadataLicense() + { + String licenseName = "Test License"; + + goToBrowsePage(); + clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" ); + clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" ); + clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" ); + clickLinkWithText( "Metadata" ); + + assertMinimalMetadataDisplay(); + assertTextPresent( "licenses" ); + assertTextPresent( licenseName ); + + String xPath = "//li[contains(text(),'" + licenseName + "')]/a/img[contains(@src,'delete.gif')]"; + clickLinkWithXPath( xPath ); + + assertTextNotPresent( licenseName ); + assertTextNotPresent( "licenses" ); + } + + private void assertMinimalMetadataDisplay() + { + assertTextPresent( "project.metadata.id=" ); + assertTextPresent( "project.url=" ); + assertTextPresent( "project.name=" ); + assertTextPresent( "project.description=" ); + } private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId, String artifactInfoArtifactId, String artifactInfoVersion, -- 2.39.5