<?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-2010 Sun Microsystems, Inc.
! Portions Copyright 2011-2013 ForgeRock AS.
! -->
<stax>
<defaultcall function="privileges_restore_task"/>
<function name="privileges_restore_task">
<sequence>
<block name="'privileges-restore-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 Restore Tasks Tests
#@TestSuitePurpose Test the basic Privileges Support in regard to basic users.
#@TestSuiteGroup Basic Privileges Restore Tasks Tests
#@TestScript privileges_restore_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 Restore Tasks Tests
#@TestName backend-restore
#@TestIssue none
#@TestPurpose Privileges for regular users to add restore tasks
#@TestPreamble Admin add import task to add entries.
#@TestStep Admin adding backup task.
#@TestStep Admin delete entry.
#@TestStep Admin search entry that was deleted.
#@TestStep Admin adding privilege.
#@TestStep User adding restore task.
#@TestStep Admin adding global ACI.
#@TestStep User adding restore task.
#@TestStep Admin deleting global ACI.
#@TestStep Admin searching deleted entry that was restored.
#@TestPostamble none
#@TestResult Success if OpenDS returns 50
for step 5, 32 for step 3, and 0
for all other ldap operations.
Proper entries returned for searches.
-->
<testcase name="getTestCaseName('backend-restore')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Privileges: Restore Tasks: backend-restore, Admin adding import task to create entries'
</message>
<call function="'ImportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, Admin adding backup task'
</message>
<call function="'backupTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'taskID' : '6' ,
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, Admin deleting entry'
</message>
<call function="'modifyEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
</call>
<message>
'Privileges: Restore Tasks: backend-restore, Admin searching entry'
</message>
<call function="'SearchObject'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'uid=tmorris,ou=People,ou=restore task,o=Privileges Tests,dc=example,dc=com' ,
'dsFilter' : 'objectclass=*' ,
'attributes' : 'cn sn uid',
'expectedRC' : 32
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, 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-restore' ,
'changetype' : 'add' }
</call>
<message>
'Privileges: Restore Tasks: backend-restore, user adding restore task'
</message>
<call function="'restoreTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : 'uid=auser,o=Privileges Tests,dc=example,dc=com' ,
'dsInstancePswd' : 'ACIRules',
'taskID' : '6.1',
'expectedRC' : 50
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, Admin adding global ACI'
</message>
<script>
aci="(target=\"ldap:///cn=Scheduled Tasks,cn=Tasks\")(targetattr=\"ds-task-class-name || ds-task-id || ds-backup-directory-path || ds-task-restore-verify-only\")(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: Restore Tasks: backend-restore, user adding restore task'
</message>
<call function="'restoreTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : 'uid=auser,o=Privileges Tests,dc=example,dc=com' ,
'dsInstancePswd' : 'ACIRules',
'taskID' : '6.2',
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, 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: Restore Tasks: backend-restore, Admin searching entry'
</message>
<call function="'SearchObject'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'uid=tmorris,ou=People,ou=restore task,o=Privileges Tests,dc=example,dc=com' ,
'dsFilter' : 'objectclass=*' ,
'attributes' : 'cn sn uid'}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{ 'returnString' : returnString ,
'expectedString' : 'dn: uid=tmorris,ou=People,ou=restore task,o=Privileges Tests' }
</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 Restore Tasks Tests
#@TestName backend-restore, Directory Manager
#@TestIssue none
#@TestPurpose Privileges for Directory Manager to add restore tasks
#@TestPreamble Alternative root user add import task to add entries.
#@TestStep Alternative root user adding backup task.
#@TestStep Alternative root user delete entry.
#@TestStep Alternative root user search entry that was deleted.
#@TestStep Alternative root user removing privilege from Directory Manager.
#@TestStep Directory Manager adding restore task.
#@TestStep Alternative root user putting back privilege to Directory Manager.
#@TestStep Directory Manager adding restore task.
#@TestStep Alternative root user searching deleted entry that was restored.
#@TestPostamble none
#@TestResult Success if OpenDS returns 50
for step 5, 32 for step 3, and 0
for all other ldap operations.
Proper entries returned for searches.
-->
<testcase name="getTestCaseName('backend-restore Directory Manager')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Privileges: Restore Tasks: backend-restore, Directory Manager, alternative root user adding import task to create entries'
</message>
<call function="'ImportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : 'cn=Aroot' ,
'dsInstancePswd' : 'PrivsRule' ,
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, Directory Manager, alternative root user adding backup task'
</message>
<call function="'backupTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : 'cn=Aroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'taskID' : '6.3' ,
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, Directory Manager, alternative root user deleting entry'
</message>
<call function="'modifyEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'cn=Aroot' ,
'dsInstancePswd' : 'PrivsRule' ,
</call>
<message>
'Privileges: Restore Tasks: backend-restore, Directory Manager, alternative root user searching entry'
</message>
<call function="'SearchObject'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'cn=Aroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'dsBaseDN' : 'uid=tmorris,ou=People,ou=restore task,o=Privileges Tests,dc=example,dc=com' ,
'dsFilter' : 'objectclass=*' ,
'attributes' : 'cn sn uid',
'expectedRC' : 32
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, 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-restore' ,
'changetype' : 'add' }
</call>
<message>
'Privileges: Restore Tasks: backend-restore, Directory Manager, DM adding restore task'
</message>
<call function="'restoreTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'taskID' : '6.4',
'expectedRC' : 50
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, 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-restore' ,
'changetype' : 'delete' }
</call>
<message>
'Privileges: Restore Tasks: backend-restore, Directory Manager, DM adding restore task'
</message>
<call function="'restoreTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'taskID' : '6.5',
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, Directory Manager, alternative root user searching entry'
</message>
<call function="'SearchObject'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'cn=Aroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'dsBaseDN' : 'uid=tmorris,ou=People,ou=restore task,o=Privileges Tests,dc=example,dc=com' ,
'dsFilter' : 'objectclass=*' ,
'attributes' : 'cn sn uid'}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{ 'returnString' : returnString ,
'expectedString' : 'dn: uid=tmorris,ou=People,ou=restore task,o=Privileges Tests' }
</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 Restore Tasks Tests
#@TestName backend-restore, New User Root
#@TestIssue none
#@TestPurpose Privileges for new root user to add restore tasks
#@TestPreamble Alternative root user adding new root user.
#@TestStep Alternative root user add import task to add entries.
#@TestStep Alternative root user adding backup task.
#@TestStep Alternative root user delete entry.
#@TestStep Alternative root user search entry that was deleted.
#@TestStep Alternative root user removing privilege from new root user.
#@TestStep New root user adding restore task.
#@TestStep Alternative root user putting back privilege to new root user.
#@TestStep New root user adding restore task.
#@TestStep Alternative root user searching deleted entry that was restored.
#@TestPostamble none
#@TestResult Success if OpenDS returns 50
for step 6, 32 for step 4, and 0
for all other ldap operations.
Proper entries returned for searches.
-->
<testcase name="getTestCaseName('backend-restore New User Root')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Privileges: Restore Tasks: backend-restore, New User Root, 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: Restore Tasks: backend-restore, New User Root, alternative root user adding import task to create entries'
</message>
<call function="'ImportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : 'cn=Aroot' ,
'dsInstancePswd' : 'PrivsRule' ,
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, New User Root, new root user adding backup task'
</message>
<call function="'backupTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : 'cn=Zroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'taskID' : '6.6' ,
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, New User Root, alternative root user deleting entry'
</message>
<call function="'modifyEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'cn=Aroot' ,
'dsInstancePswd' : 'PrivsRule' ,
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, New User Root, alternative root user searching entry'
</message>
<call function="'SearchObject'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'cn=Aroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'dsBaseDN' : 'uid=tmorris,ou=People,ou=restore task,o=Privileges Tests,dc=example,dc=com' ,
'dsFilter' : 'objectclass=*' ,
'attributes' : 'cn sn uid',
'expectedRC' : 32
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, New User Root, 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-restore' ,
'changetype' : 'add' }
</call>
<message>
'Privileges: Restore Tasks: backend-restore, New User Root, new root user adding restore task'
</message>
<call function="'restoreTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : 'cn=Zroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'taskID' : '6.7',
'expectedRC' : 50
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, New User Root, 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-restore' ,
'changetype' : 'delete' }
</call>
<message>
'Privileges: Restore Tasks: backend-restore, New User Root, new root user adding restore task'
</message>
<call function="'restoreTask'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : 'cn=Zroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'taskID' : '6.8',
}
</call>
<message>
'Privileges: Restore Tasks: backend-restore, New User Root, alternative root user searching entry'
</message>
<call function="'SearchObject'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'cn=Aroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'dsBaseDN' : 'uid=tmorris,ou=People,ou=restore task,o=Privileges Tests,dc=example,dc=com' ,
'dsFilter' : 'objectclass=*' ,
'attributes' : 'cn sn uid'}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{ 'returnString' : returnString ,
'expectedString' : 'dn: uid=tmorris,ou=People,ou=restore task,o=Privileges Tests' }
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
</sequence>
<finally>
<sequence>
<!-- Test Suite Cleanup -->
<message>'Finally: Global Privileges Restore 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>