<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
! CDDL HEADER START
!
! The contents of this file are subject to the terms of the
! Common Development and Distribution License, Version 1.0 only
! (the "License"). You may not use this file except in compliance
! with the License.
!
! You can obtain a copy of the license at
! See the License for the specific language governing permissions
! and limitations under the License.
!
! When distributing Covered Code, include this CDDL HEADER in each
! file and include the License file at
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
! add the following below this CDDL HEADER, with the fields enclosed
! by brackets "[]" replaced with your own identifying information:
! Portions Copyright [yyyy] [name of copyright owner]
!
! CDDL HEADER END
!
! Copyright 2008-2009 Sun Microsystems, Inc.
! Portions Copyright 2013 ForgeRock AS
! -->
<stax>
<defaultcall function="privileges_backup_task"/>
<function name="privileges_backup_task">
<sequence>
<block name="'privileges-backup-task'">
<try>
<sequence>
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group']='privileges'
CurrentTestPath['suite']=STAXCurrentBlock
</script>
<call function="'testSuite_Preamble'"/>
<!---
Place suite-specific test information here.
#@TestSuiteName Privileges Backup Tasks Tests
#@TestSuitePurpose Test the basic Privileges Support in regard to basic users.
#@TestSuiteGroup Basic Privileges Backup Tasks Tests
#@TestScript privileges_backup_task.xml
-->
<call function="'common_setup'">
{
'quickStart' : False ,
'startServer' : True ,
'loadData' : True ,
'stopServer' : False
}
</call>
<import machine="STAF_LOCAL_HOSTNAME"
file="'%s/testcases/privileges/privileges_acis.xml' % (TESTS_DIR)"/>
<call function="'privileges_acis'"/>
<!---
Place test-specific test information here.
The tag, TestMarker, must be the same as the tag, TestSuiteName.
#@TestMarker Privileges Backup Tasks Tests
#@TestName backend-backup
#@TestIssue none
#@TestPurpose Privileges for regular users to add backup tasks
#@TestPreamble none
#@TestStep User adding backup task.
#@TestStep Admin adding privilege.
#@TestStep User adding backup task.
#@TestStep Admin adding global ACI.
#@TestStep User adding backup task.
#@TestStep Admin deleting privilege.
#@TestStep Admin deleting global ACI.
#@TestStep User adding backup task.
#@TestPostamble none
#@TestResult Success if OpenDS returns 50
for steps 1, 3, and 8 and 0
for all other ldap operations.
-->
<testcase name="getTestCaseName('backend-backup')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Privileges: Backup Tasks: backend-backup, user adding backup task'
</message>
<call function="'backupTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : 'uid=auser,o=Privileges Tests,dc=example,dc=com' ,
'dsInstancePswd' : 'ACIRules' ,
'taskID' : '3' ,
'expectedRC' : 50
}
</call>
<message>
'Privileges: Backup Tasks: backend-backup, Admin adding privilege'
</message>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToModify' : 'uid=auser,o=Privileges Tests,dc=example,dc=com' ,
'attributeName' : 'ds-privilege-name' ,
'newAttributeValue' : 'backend-backup' ,
'changetype' : 'add' }
</call>
<message>
'Privileges: Backup Tasks: backend-backup, user adding backup task'
</message>
<call function="'backupTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : 'uid=auser,o=Privileges Tests,dc=example,dc=com' ,
'dsInstancePswd' : 'ACIRules' ,
'taskID' : '3' ,
'expectedRC' : 50
}
</call>
<message>
'Privileges: Backup Tasks: backend-backup, Admin adding global ACI'
</message>
<script>
aci="(target=\"ldap:///cn=Scheduled Tasks,cn=Tasks\")(targetattr=\"ds-task-class-name || ds-backup-id || ds-task-backup-backend-id || ds-backup-directory-path\")(version 3.0; acl \"Allows writes for tasks\"; allow (write,add,delete) userdn=\"ldap:///anyone\";)"
</script>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToModify' : 'cn=Access Control Handler,cn=config' ,
'attributeName' : 'ds-cfg-global-aci' ,
'newAttributeValue' : aci ,
'changetype' : 'add' }
</call>
<message>
'Privileges: Backup Tasks: backend-backup, user adding backup task'
</message>
<call function="'backupTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : 'uid=auser,o=Privileges Tests,dc=example,dc=com' ,
'dsInstancePswd' : 'ACIRules' ,
'taskID' : '3' ,
}
</call>
<message>
'Privileges: Backup Tasks: backend-backup, Admin deleting privilege'
</message>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToModify' : 'uid=auser,o=Privileges Tests,dc=example,dc=com' ,
'attributeName' : 'ds-privilege-name' ,
'newAttributeValue' : 'backend-backup' ,
'changetype' : 'delete' }
</call>
<message>
'Privileges: Backup Tasks: backend-backup, Admin deleting global ACI'
</message>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToModify' : 'cn=Access Control Handler,cn=config' ,
'attributeName' : 'ds-cfg-global-aci' ,
'newAttributeValue' : aci ,
'changetype' : 'delete' }
</call>
<message>
'Privileges: Backup Tasks: backend-backup, user adding backup task'
</message>
<call function="'backupTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : 'uid=auser,o=Privileges Tests,dc=example,dc=com' ,
'dsInstancePswd' : 'ACIRules' ,
'taskID' : '3.1' ,
'expectedRC' : 50
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!---
Place test-specific test information here.
The tag, TestMarker, must be the same as the tag, TestSuiteName.
#@TestMarker Privileges Backup Tasks Tests
#@TestName backend-backup, Directory Manager
#@TestIssue none
#@TestPurpose Privileges for Directory Manager to add backup tasks
#@TestPreamble none
#@TestStep Directory Manager adding backup task.
#@TestStep Alternative root user removing privilege.
#@TestStep Directory Manager adding backup task.
#@TestStep Alternative root user putting back privilege.
#@TestStep Directory Manager adding backup task.
#@TestPostamble none
#@TestResult Success if OpenDS returns 50
for steps 1 and 5 and 0
for all other ldap operations.
-->
<testcase name="getTestCaseName('backend-backup Directory Manager')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Privileges: Backup Tasks: backend-backup, Directory Manager, DM adding backup task'
</message>
<call function="'backupTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'taskID' : '3.2' ,
}
</call>
<message>
'Privileges: Backup Tasks: backend-backup, Directory Manager, alternative root user removing privilege'
</message>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'cn=Aroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'DNToModify' : 'cn=Directory Manager,cn=Root DNs,cn=config' ,
'attributeName' : 'ds-privilege-name' ,
'newAttributeValue' : '-backend-backup' ,
'changetype' : 'add' }
</call>
<message>
'Privileges: Backup Tasks: backend-backup, Directory Manager, DM adding backup task'
</message>
<call function="'backupTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'taskID' : '3.3' ,
'expectedRC' : 50
}
</call>
<message>
'Privileges: Backup Tasks: backend-backup, Directory Manager, alternative root user putting back privilege'
</message>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'cn=Aroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'DNToModify' : 'cn=Directory Manager,cn=Root DNs,cn=config' ,
'attributeName' : 'ds-privilege-name' ,
'newAttributeValue' : '-backend-backup' ,
'changetype' : 'delete' }
</call>
<message>
'Privileges: Backup Tasks: backend-backup, Directory Manager, DM adding backup task'
</message>
<call function="'backupTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'taskID' : '3.4' ,
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!---
Place test-specific test information here.
The tag, TestMarker, must be the same as the tag, TestSuiteName.
#@TestMarker Privileges Backup Tasks Tests
#@TestName backend-backup, New Root User
#@TestIssue none
#@TestPurpose Privileges for new root user to add backup tasks
#@TestPreamble Admin adds new root user.
#@TestStep New root user adding backup task.
#@TestStep Alternative root user removing privilege.
#@TestStep New root user adding backup task.
#@TestStep Alternative root user putting back privilege.
#@TestStep New root user adding backup task.
#@TestPostamble none
#@TestResult Success if OpenDS returns 50
for steps 1 and 5 and 0
for all other ldap operations.
-->
<testcase name="getTestCaseName('backend-backup New Root User')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Privileges: Backup Tasks: backend-backup, New Root User, preamble, alternative root user adding new root user'
</message>
<call function="'addEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'cn=Aroot' ,
'dsInstancePswd' : 'PrivsRule' ,
</call>
<message>
'Privileges: Backup Tasks: backend-backup, New Root User, new root user adding backup task'
</message>
<call function="'backupTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : 'cn=Zroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'taskID' : '3.5' ,
}
</call>
<message>
'Privileges: Backup Tasks: backend-backup, New Root User, alternative root user removing privilege'
</message>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'cn=Aroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'DNToModify' : 'cn=Zroot Manager,cn=Root DNs,cn=config' ,
'attributeName' : 'ds-privilege-name' ,
'newAttributeValue' : '-backend-backup' ,
'changetype' : 'add' }
</call>
<message>
'Privileges: Backup Tasks: backend-backup, New Root User, new root user adding backup task'
</message>
<call function="'backupTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : 'cn=Zroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'taskID' : '3.6' ,
'expectedRC' : 50
}
</call>
<message>
'Privileges: Backup Tasks: backend-backup, New Root User, alternative root user putting back privilege'
</message>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'cn=Aroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'DNToModify' : 'cn=Zroot Manager,cn=Root DNs,cn=config' ,
'attributeName' : 'ds-privilege-name' ,
'newAttributeValue' : '-backend-backup' ,
'changetype' : 'delete' }
</call>
<message>
'Privileges: Backup Tasks: backend-backup, New Root User, new root user adding backup task'
</message>
<call function="'backupTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : 'cn=Zroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'taskID' : '3.7' ,
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
</sequence>
<finally>
<sequence>
<!-- Test Suite Cleanup -->
<message>'Finally: Global Privileges Backup Task Cleanup.'</message>
<try>
<call function="'common_cleanup'" />
<catch exception="'STAFException'">
<sequence>
<message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
</sequence>
</catch>
<finally>
<call function="'testSuite_Postamble'"/>
</finally>
</try>
</sequence>
</finally>
</try>
</block>
</sequence>
</function>
</stax>