importldif_tasks_tests.xml revision 75e4d72341a69fa125aeab6e326e49a5422a9eac
<?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/CDDLv1_0.txt
! or http://forgerock.org/license/CDDLv1.0.html.
! 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/CDDLv1_0.txt. 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 2012-2013 ForgeRock AS.
! -->
<stax>
<!-- Definition of Test Cases -->
<!--- Test Cases : ImportLDIF: Tasks -->
<!--- Test Case information
#@TestMarker ImportLDIF: Tasks
#@TestName ImportLDIF: Tasks
#@TestID importldif_tasks_001
#@TestPurpose Verify import LDIF with Tasks
#@TestPreamble Common Setup
#@TestStep Make template for makeldif.
#@TestStep Create ldif file for import using makeldif.
#@TestStep Import the LDIF file.
#@TestStep Start the Directory Server.
#@TestStep Verify import LDIF operations.
#@TestPostamble Common Cleanup
#@TestResult Test is successful if the result code is 0
-->
<function name="importldif_tasks_001" scope="local">
<testcase name="getTestCaseName('Tasks')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<script>
numberOfEntries = 100000
totalEntries = numberOfEntries + 2
bin_attr_filename = '%s_entries.ldif' % numberOfEntries
import os.path
curr_filename=remote.temp + "/" + bin_attr_filename
curr_file_exists='0'
if os.path.exists(curr_filename):
curr_file_exists='1'
</script>
<message>
'Import Ldif Tasks: Binary Attribute: Looking for file, %s. File exists? (0=false, 1=true) %s' % (curr_filename, curr_file_exists)
</message>
<if expr="curr_file_exists=='0'">
<sequence>
<message>
'Import Ldif Tasks: Binary Attribute: Preamble - Make an make-ldif template file'
</message>
<call function="'MakeAMakeLdifTemplate'">
{ 'numEntries' : numberOfEntries ,
'templateFile' : '%s/import_Entries_100k.template' % (remote.temp) ,
'extraLine' : 'jpegPhoto:: &lt;random:base64:38000&gt;'}
</call>
<message>
'Import Ldif Tasks: Binary Attribute: Preamble - Make the ldif file'
</message>
<call function="'MakeLdifWithScript'">
{ 'templateFile' : '%s/import_Entries_100k.template' % (remote.temp) ,
'ldifFile' : curr_filename }
</call>
</sequence>
</if>
<message>
'Import Ldif Tasks: Binary Attribute: Import large ldif file'
</message>
<call function="'ImportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'ldifFile' : curr_filename ,
'numLdapCheckTries' : 1000,
'sleepBetweenLdapCheckTries' : 300000
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC ,
'result' : STAXResult
}
</call>
<message>
'Import Ldif Tasks: Binary Attribute: Search for certain entries that were imported'
</message>
<call function="'checkImport'">
{ 'expectedEntries' : ['uid=user.1,ou=People,dc=com' ,
'uid=user.10000,ou=People,dc=com' ,
'uid=user.20000,ou=People,dc=com' ,
'uid=user.30000,ou=People,dc=com' ,
'uid=user.40000,ou=People,dc=com' ,
'uid=user.50000,ou=People,dc=com' ,
'uid=user.60000,ou=People,dc=com' ,
'uid=user.70000,ou=People,dc=com' ,
'uid=user.80000,ou=People,dc=com' ,
'uid=user.90000,ou=People,dc=com' ,
'uid=user.99999,ou=People,dc=com'] ,
'startDS' : 'no'
}
</call>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker ImportLDIF: Tasks
#@TestName ImportLDIF: Tasks
#@TestID importldif_tasks_001
#@TestPurpose Verify import LDIF with Tasks
#@TestPreamble Common Setup
#@TestStep Make template for makeldif.
#@TestStep Create ldif file for import using makeldif.
#@TestStep Import the LDIF file.
#@TestStep Start the Directory Server.
#@TestStep Verify import LDIF operations.
#@TestPostamble Common Cleanup
#@TestResult Test is successful if the result code is 0
-->
<function name="importldif_tasks_002" scope="local">
<testcase name="getTestCaseName('Tasks Load')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Import Ldif Tasks: Binary Attribute With Load: Preamble - Make an make-ldif template file'
</message>
<script>
numberOfEntries='100'
</script>
<call function="'MakeAMakeLdifTemplate'">
{ 'numEntries' : numberOfEntries ,
'templateFile' : '%s/import_Entries_100.template' % (remote.temp) }
</call>
<message>
'Import Ldif Tasks: Binary Attribute With Load: Preamble - Make the ldif file'
</message>
<call function="'MakeLdifWithScript'">
{ 'templateFile' : '%s/import_Entries_100.template' % (remote.temp) ,
'ldifFile' : '%s/import_Entries_100.ldif' % (remote.temp) }
</call>
<message>
'Import Ldif Tasks: Binary Attribute With Load: Import large ldif file'
</message>
<call function="'ImportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'ldifFile' : '%s/import_Entries_100.ldif' % remote.temp
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC ,
'result' : STAXResult
}
</call>
<script>
import os.path
curr_filename=remote.temp + "/" + bin_attr_filename
curr_file_exists='0'
if os.path.exists(curr_filename):
curr_file_exists='1'
numberOfEntries='100000'
</script>
<message>
'Import Ldif Tasks: Binary Attribute: Looking for file, %s. File exists? (0=false, 1=true) %s' % (curr_filename, curr_file_exists)
</message>
<if expr="curr_file_exists=='0'">
<sequence>
<message>
'Import Ldif Tasks: Binary Attribute: Preamble - Make an make-ldif template file'
</message>
<call function="'MakeAMakeLdifTemplate'">
{ 'numEntries' : numberOfEntries ,
'templateFile' : '%s/import_Entries_100k.template' % (remote.temp) ,
'extraLine' : 'jpegPhoto:: &lt;random:base64:38000&gt;'}
</call>
<message>
'Import Ldif Tasks: Binary Attribute: Preamble - Make the ldif file'
</message>
<call function="'MakeLdifWithScript'">
{ 'templateFile' : '%s/import_Entries_100k.template' % (remote.temp) ,
'ldifFile' : curr_filename }
</call>
</sequence>
</if>
<script>
clientList = ['dummyClient1', 'dummyClient2', 'dummyClient3', 'dummyClient4',
'dummyClient5', 'dummyClient6', 'dummyClient7', 'dummyClient8',
'dummyClient9', 'dummyClient10', 'dummyClient11', 'dummyClient12',
'dummyClient13', 'dummyClient14', 'dummyClient15', 'dummyClient16']
</script>
<parallel>
<sequence>
<message>
'Import Ldif Tasks: Binary Attribute With Load: Import Large Ldif File - Sleep 2 s to ensure modify load starts'
</message>
<call function="'Sleep'">
{ 'sleepForMilliSeconds' : 2000 }
</call>
<message>
'Import Ldif Tasks: Binary Attribute With Load: Import Large Ldif File - Add import task'
</message>
<call function="'ImportLdifWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'ldifFile' : curr_filename ,
'numLdapCheckTries' : 1000,
'sleepBetweenLdapCheckTries' : 300000
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC ,
'result' : STAXResult
}
</call>
<iterate var="mlClient" in="clientList" indexvar="index">
<terminate block="'main.import_ldif.tasks-bin-attr-with-load.ModifyLoad_%s' % mlClient"/>
</iterate>
</sequence>
<paralleliterate var="client" in="clientList">
<sequence>
<block name="'ModifyLoad_%s' % client">
<loop>
<sequence>
<call function="'loadOfModifies'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'partialDNToModify' : 'ou=People,dc=com' ,
'attributeName' : 'description' ,
'newAttributeValue' : 'Modify load forever' ,
'changetype' : 'replace',
'numEntries' : '100' ,
'clientID' : client }
</call>
<if expr="STAXCode == 32" >
<break/>
</if>
</sequence>
</loop>
</block>
</sequence>
</paralleliterate>
</parallel>
<message>
'Import Ldif Tasks: Binary Attribute With Load: Search for certain entries that were imported'
</message>
<call function="'checkImport'">
{ 'expectedEntries' : ['uid=user.1,ou=People,dc=com' ,
'uid=user.10000,ou=People,dc=com' ,
'uid=user.20000,ou=People,dc=com' ,
'uid=user.30000,ou=People,dc=com' ,
'uid=user.40000,ou=People,dc=com' ,
'uid=user.50000,ou=People,dc=com' ,
'uid=user.60000,ou=People,dc=com' ,
'uid=user.70000,ou=People,dc=com' ,
'uid=user.80000,ou=People,dc=com' ,
'uid=user.90000,ou=People,dc=com' ,
'uid=user.99999,ou=People,dc=com'] ,
'startDS' : 'no'
}
</call>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
</stax>