summaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2010-06-11 08:49:48 +0000
committerMaria Odea B. Ching <oching@apache.org>2010-06-11 08:49:48 +0000
commita72aeb4d5eaf3d86b23aeb44a2222563b52d09db (patch)
tree8a0f458b5acbb3358fc0e4e4f491803e9ed1d634 /archiva-modules
parent8f1414a1dcacfb9cbde93f4fa837be4810db9ef6 (diff)
downloadarchiva-a72aeb4d5eaf3d86b23aeb44a2222563b52d09db.tar.gz
archiva-a72aeb4d5eaf3d86b23aeb44a2222563b52d09db.zip
[MRM-1362] Add simple 'CRUD' pages for project-level metadata along with a "generic metadata" plugin
o do not show add property widget if user does not have repository manager role o added selenium test for browsing metadata if user is not a repository manager git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@953612 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java45
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectMetadata.jspf13
2 files changed, 48 insertions, 10 deletions
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 0b72095a2..c5fde87df 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
@@ -160,6 +160,42 @@ public class BrowseTest
@Test( dependsOnMethods = { "testAddMetadataPropertyEmpty" } )
public void testAddMetadataProperty()
{
+ addMetadataProperty();
+ }
+
+ @Test( dependsOnMethods = { "testAddMetadataProperty" } )
+ public void testDeleteMetadataProperty()
+ {
+ deleteMetadataProperty();
+ }
+
+ @Test( dependsOnMethods = { "testDeleteMetadataProperty" })
+ public void testMetadataAccessWithRepositoryObserverRole()
+ {
+ addMetadataProperty();
+
+ logout();
+
+ goToBrowsePage();
+ clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
+ clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" );
+ clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" );
+ clickLinkWithText( "Metadata" );
+
+ waitPage();
+
+ assertTextNotPresent( "No metadata content." );
+ assertButtonWithValueNotPresent( "Add" );
+ assertTextNotPresent( "Add Property" );
+ assertImgWithAltNotPresent( "Delete" );
+
+ login( getAdminUsername(), getAdminPassword() );
+
+ deleteMetadataProperty();
+ }
+
+ private void addMetadataProperty()
+ {
goToBrowsePage();
clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" );
@@ -168,6 +204,7 @@ public class BrowseTest
assertTextPresent( "No metadata content." );
assertButtonWithValuePresent( "Add" );
+ assertTextPresent( "Add Property" );
setFieldValue( "propertyName", "foo" );
setFieldValue( "propertyValue", "bar" );
@@ -179,9 +216,8 @@ public class BrowseTest
assertTextNotPresent( "No metadata content." );
assertTextPresent( "foo=bar" );
}
-
- @Test( dependsOnMethods = { "testAddMetadataProperty" } )
- public void testDeleteMetadataProperty()
+
+ private void deleteMetadataProperty()
{
goToBrowsePage();
clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
@@ -191,6 +227,7 @@ public class BrowseTest
assertTextPresent( "foo=bar" );
assertButtonWithValuePresent( "Add" );
+ assertTextPresent( "Add Property" );
clickImgWithAlt( "Delete" );
@@ -200,7 +237,7 @@ public class BrowseTest
assertTextPresent( "Property successfully deleted." );
assertImgWithAltNotPresent( "Delete" );
assertTextPresent( "No metadata content." );
- }
+ }
private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId,
String artifactInfoArtifactId, String artifactInfoVersion,
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectMetadata.jspf b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectMetadata.jspf
index 3aecceac6..797c941c7 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectMetadata.jspf
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectMetadata.jspf
@@ -24,9 +24,10 @@
<div>
- <div id="effect" class="ui-widget-content ui-corner-all">
- <h3 class="ui-widget-header ui-corner-all">Add Property</h3>
- <redback:ifAuthorized permission="archiva-add-metadata" resource="${repositoryId}">
+ <redback:ifAuthorized permission="archiva-add-metadata" resource="${repositoryId}">
+ <div id="effect" class="ui-widget-content ui-corner-all">
+ <h3 class="ui-widget-header ui-corner-all">Add Property</h3>
+
<s:form action="addMetadataProperty" namespace="/" method="post" validate="true" theme="simple">
<s:hidden name="groupId" value="%{groupId}" />
<s:hidden name="artifactId" value="%{artifactId}" />
@@ -50,9 +51,9 @@
</td>
</tr>
</table>
- </s:form>
- </redback:ifAuthorized>
- </div>
+ </s:form>
+ </div>
+ </redback:ifAuthorized>
<div>
<c:if test="${empty genericMetadata}">