privileges_export_task.xml revision 945930ece8ea73e5184836bf0bf3efad2e3e6c36
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
<!--
! 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
! trunk/opends/resource/legal-notices/OpenDS.LICENSE
! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
! 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 2011 ForgeRock AS.
! -->
<stax>
<defaultcall function="privileges_export_task"/>
<function name="privileges_export_task">
<sequence>
<block name="'privileges-export-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 Export Tasks Tests
#@TestSuitePurpose Test the basic Privileges Support in regard to basic users.
#@TestSuiteGroup Basic Privileges Export Tasks Tests
#@TestScript privileges_export_task.xml
-->
<call function="'common_setup'">
{
'quickStart' : False ,
'startServer' : True ,
'loadData' : True ,
'ldifFile' : '%s/privileges/privileges_startup.ldif' % remote.data ,
'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 Export Tasks Tests
#@TestName ldif-export
#@TestIssue 474
#@TestPurpose Privileges for regular users to add export tasks
#@TestPreamble none
#@TestStep User adding export task.
#@TestStep Admin adding privilege.
#@TestStep User adding export task.
#@TestStep Admin adding global ACI.
#@TestStep User adding export task.
#@TestStep Admin deleting privilege.
#@TestStep Admin deleting global ACI.
#@TestStep User adding export task.
#@TestPostamble none
#@TestResult Success if OpenDS returns 50
for steps 1, 3 and 8, and 0
for all other ldap operations.
Proper entries returned for searches.
-->
<testcase name="getTestCaseName('export-ldif')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Privileges: Export Tasks: export-ldif, user adding export task'
</message>
<call function="'exportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : 'uid=auser,o=Privileges Tests,dc=example,dc=com' ,
'dsInstancePswd' : 'ACIRules' ,
'ldifFile' : '%s/privileges/export_task_out.ldif' % remote.temp ,
'expectedRC' : 1
}
</call>
<script>
resultString = STAXResult[0][1]
</script>
<call function="'searchString'">
{ 'expectedString' : 'Tasks cannot be%sadded due to insufficient access rights' % newLine,
'returnString' : resultString
}
</call>
<message>
'Privileges: Export Tasks: export-ldif, 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' : 'ldif-export' ,
'changetype' : 'add' }
</call>
<message>
'Privileges: Export Tasks: export-ldif, user adding export task'
</message>
<call function="'exportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : 'uid=auser,o=Privileges Tests,dc=example,dc=com' ,
'dsInstancePswd' : 'ACIRules' ,
'ldifFile' : '%s/privileges/export_task_out.ldif' % remote.temp ,
'expectedRC' : 1
}
</call>
<script>
resultString = STAXResult[0][1]
</script>
<call function="'searchString'">
{ 'expectedString' : 'Tasks cannot be%sadded due to insufficient access rights' % newLine,
'returnString' : resultString
}
</call>
<message>
'Privileges: Export Tasks: export-ldif, Admin adding global ACI'
</message>
<script>
aci="(target=\"ldap:///cn=Scheduled Tasks,cn=Tasks\")(targetattr=\"ds-task-class-name || ds-task-export-backend-id || ds-task-export-ldif-file\")(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: Export Tasks: export-ldif, user adding export task'
</message>
<call function="'exportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : 'uid=auser,o=Privileges Tests,dc=example,dc=com' ,
'dsInstancePswd' : 'ACIRules' ,
'ldifFile' : '%s/privileges/export_task_out.ldif' % remote.temp
}
</call>
<message>
'Privileges: Export Tasks: export-ldif, 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' : 'ldif-export' ,
'changetype' : 'delete' }
</call>
<message>
'Privileges: Export Tasks: export-ldif, 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: Export Tasks: export-ldif, user adding export task'
</message>
<call function="'exportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : 'uid=auser,o=Privileges Tests,dc=example,dc=com' ,
'dsInstancePswd' : 'ACIRules' ,
'ldifFile' : '%s/privileges/export_task_out2.ldif' % remote.temp ,
'expectedRC' : 1
}
</call>
<script>
resultString = STAXResult[0][1]
</script>
<call function="'searchString'">
{ 'expectedString' : 'Tasks cannot be%sadded due to insufficient access rights' % newLine,
'returnString' : resultString
}
</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 Export Tasks Tests
#@TestName ldif-export, Directory Manager
#@TestIssue 474
#@TestPurpose Privileges for Directory Manager to add export tasks
#@TestPreamble none
#@TestStep Directory Manager adding export task.
#@TestStep Alternative root user removing privilege from Directory Manager.
#@TestStep Directory Manager adding export task.
#@TestStep Alternative root user putting back privilege to Directory Manager.
#@TestStep Directory Manager adding export task.
#@TestPostamble none
#@TestResult Success if OpenDS returns 50
for step 3, and 0
for all other ldap operations.
-->
<testcase name="getTestCaseName('export-ldif Directory Manager')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Privileges: Export Tasks: export-ldif, Directory Manager, DM adding export task'
</message>
<call function="'exportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'ldifFile' : '%s/privileges/export_task_out3.ldif' % remote.temp
}
</call>
<message>
'Privileges: Export Tasks: export-ldif, 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' : '-ldif-export' ,
'changetype' : 'add' }
</call>
<message>
'Privileges: Export Tasks: export-ldif, Directory Manager, DM adding export task'
</message>
<call function="'exportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'ldifFile' : '%s/privileges/export_task_out4.ldif' % remote.temp ,
'expectedRC' : 1
}
</call>
<script>
resultString = STAXResult[0][1]
</script>
<call function="'searchString'">
{ 'expectedString' : 'You do not have sufficient privileges to initiate an LDIF export',
'returnString' : resultString
}
</call>
<message>
'Privileges: Export Tasks: export-ldif, 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' : '-ldif-export' ,
'changetype' : 'delete' }
</call>
<message>
'Privileges: Export Tasks: export-ldif, Directory Manager, DM adding export task'
</message>
<call function="'exportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'ldifFile' : '%s/privileges/export_task_out5.ldif' % remote.temp
}
</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 Export Tasks Tests
#@TestName ldif-export, New Root User
#@TestIssue 474
#@TestPurpose Privileges for new root user to add export tasks
#@TestPreamble Admin adds new root user.
#@TestStep New root user adding export task.
#@TestStep Alternative root user removing privilege from new root user.
#@TestStep New root user adding export task.
#@TestStep Alternative root user putting back privilege to new root user.
#@TestStep New root user adding export task.
#@TestPostamble none
#@TestResult Success if OpenDS returns 50
for step 3, and 0
for all other ldap operations.
-->
<testcase name="getTestCaseName('export-ldif New Root User')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Privileges: Export Tasks: export-ldif, 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' ,
'entryToBeAdded' : '%s/privileges/add_new_root_user.ldif' % remote.data }
</call>
<message>
'Privileges: Export Tasks: export-ldif, New Root User, new root user adding export task'
</message>
<call function="'exportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : 'cn=Zroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'ldifFile' : '%s/privileges/export_task_out6.ldif' % remote.temp
}
</call>
<message>
'Privileges: Export Tasks: export-ldif, 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' : '-ldif-export' ,
'changetype' : 'add' }
</call>
<message>
'Privileges: Export Tasks: export-ldif, New Root User, new root user adding export task'
</message>
<call function="'exportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : 'cn=Zroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'ldifFile' : '%s/privileges/export_task_out7.ldif' % remote.temp ,
'expectedRC' : 1
}
</call>
<script>
resultString = STAXResult[0][1]
</script>
<call function="'searchString'">
{ 'expectedString' : 'You do not have sufficient privileges to initiate an LDIF export',
'returnString' : resultString
}
</call>
<message>
'Privileges: Export Tasks: export-ldif, 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' : '-ldif-export' ,
'changetype' : 'delete' }
</call>
<message>
'Privileges: Export Tasks: export-ldif, New Root User, new root user adding export task'
</message>
<call function="'exportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : 'cn=Zroot' ,
'dsInstancePswd' : 'PrivsRule' ,
'ldifFile' : '%s/privileges/export_task_out8.ldif' % remote.temp
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
</sequence>
<finally>
<sequence>
<!-- Test Suite Cleanup -->
<message>'Finally: Global Privileges Export 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>