@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" ) + "/" );
assertTextPresent( "No metadata content." );
assertButtonWithValuePresent( "Add" );
+ assertTextPresent( "Add Property" );
setFieldValue( "propertyName", "foo" );
setFieldValue( "propertyValue", "bar" );
assertTextNotPresent( "No metadata content." );
assertTextPresent( "foo=bar" );
}
-
- @Test( dependsOnMethods = { "testAddMetadataProperty" } )
- public void testDeleteMetadataProperty()
+
+ private void deleteMetadataProperty()
{
goToBrowsePage();
clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
assertTextPresent( "foo=bar" );
assertButtonWithValuePresent( "Add" );
+ assertTextPresent( "Add Property" );
clickImgWithAlt( "Delete" );
assertTextPresent( "Property successfully deleted." );
assertImgWithAltNotPresent( "Delete" );
assertTextPresent( "No metadata content." );
- }
+ }
private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId,
String artifactInfoArtifactId, String artifactInfoVersion,
<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}" />
</td>
</tr>
</table>
- </s:form>
- </redback:ifAuthorized>
- </div>
+ </s:form>
+ </div>
+ </redback:ifAuthorized>
<div>
<c:if test="${empty genericMetadata}">