]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1362] Add simple 'CRUD' pages for project-level metadata along with a "generic...
authorJevica Arianne B. Zurbano <jzurbano@apache.org>
Thu, 27 May 2010 11:54:24 +0000 (11:54 +0000)
committerJevica Arianne B. Zurbano <jzurbano@apache.org>
Thu, 27 May 2010 11:54:24 +0000 (11:54 +0000)
* 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

archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java

index cbec59866afbca5e58f4d6e0ebcaa5bf5eb5a294..606e1b1948984cbe5a1fd049bc993f712e04b350 100644 (file)
@@ -7,7 +7,35 @@
   <version>1.0</version>
   <name>test</name>
   <url>http://maven.apache.org</url>
+  
+  <licenses>
+    <license>
+      <name>Test License</name>
+      <url>http://www.test.org/test.html</url>
+    </license>
+  </licenses>
+  
+  <mailingLists>
+    <mailingList>
+      <name>test user list</name>
+      <subscribe>http://test.net/lists/listinfo/test-user</subscribe>
+      <unsubscribe>http://test.net/lists/listinfo/test-user</unsubscribe>
+      <archive>http://www.test-archive.com/test-user%40lists.test.net/</archive>
+    </mailingList>
+    <mailingList>
+      <name>test developer list</name>
+      <subscribe>http://test.net/lists/listinfo/test-dev</subscribe>
+      <unsubscribe>http://test.net/lists/listinfo/test-dev</unsubscribe>
+      <archive>http://www.test-archive.com/test-dev%40lists.test.net/</archive>
+    </mailingList>
+  </mailingLists>
+  
   <dependencies>
+    <dependency>
+      <groupId>test.group.id</groupId>
+      <artifactId>testArtifactId</artifactId>
+      <version>1.0</version>
+    </dependency>
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
@@ -15,6 +43,7 @@
       <scope>test</scope>
     </dependency>
   </dependencies>
+  
 <distributionManagement>
 <repository>
   <id>test</id>
@@ -22,3 +51,4 @@
 </repository>
 </distributionManagement>
 </project>
+
index 5226f78e2960cd36c30b07a2c08da630079ced98..9018a4edaa09467af8c0495532adfeea659fd0b8 100644 (file)
@@ -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,