importldif_indexes_tests.xml revision 87f13d7c78b4de35c94c8b4f84d68453e23e1994
<?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: Indexes -->
<!--- Test Case information
#@TestMarker ImportLDIF: Indexes
#@TestName ImportLDIF: Indexes
#@TestID importldif_indexes_001
#@TestPurpose Verify import LDIF with Indexes
#@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_indexes_001" scope="local">
<testcase name="getTestCaseName('Many Indexes')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Import Ldif: Many Indexes: Preamble - Create many indexes'
</message>
<script>
indexes_five = ['cn', 'givenName', 'sn', 'uid']
</script>
<iterate var="currIndex" in="indexes_five" indexvar="index">
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-local-db-index-prop' ,
'objectType' : 'backend-name' ,
'objectName' : 'userRoot',
'optionsString' : '--index-name %s --add index-type:approximate --add index-type:equality --add index-type:ordering --add index-type:presence --add index-type:substring ' % currIndex ,
'expectedRC' : 0 }
</call>
</iterate>
<script>
indexes_three = ['aci', 'mail', 'member', 'objectclass', 'telephonenumber', 'uniquemember']
</script>
<iterate var="currIndex" in="indexes_three" indexvar="index">
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-local-db-index-prop' ,
'objectType' : 'backend-name' ,
'objectName' : 'userRoot',
'optionsString' : '--index-name %s --add index-type:equality --add index-type:presence --add index-type:substring ' % currIndex ,
'expectedRC' : 0 }
</call>
</iterate>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'create-local-db-index' ,
'objectType' : 'backend-name' ,
'objectName' : 'userRoot',
'optionsString' : '--index-name employeeNumber --set index-type:approximate --set index-type:equality --set index-type:ordering --set index-type:presence --set index-type:substring ' ,
'expectedRC' : 0 }
</call>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'create-local-db-index' ,
'objectType' : 'backend-name' ,
'objectName' : 'userRoot',
'optionsString' : '--index-name employeeNumber --add index-type:approximate --add index-type:equality --add index-type:ordering --add index-type:presence --add index-type:substring ' ,
'expectedRC' : 0 }
</call>
<message>
'Import Ldif: Many Indexes: Preamble - List indexes'
</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'list-local-db-indexes' ,
'objectType' : 'backend-name' ,
'objectName' : 'userRoot',
'expectedRC' : 0 }
</call>
<message>
'Import Ldif: Many Indexes: Preamble - Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
</message>
<call function="'StopDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'dsHost' : DIRECTORY_INSTANCE_HOST,
'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsBindDN' : DIRECTORY_INSTANCE_DN,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
</call>
<message>
'Import Ldif: Many Indexes: Preamble - Make an make-ldif template file'
</message>
<script>
numberOfEntries='160'
</script>
<call function="'MakeAMakeLdifTemplate'">
{ 'numEntries' : numberOfEntries ,
'templateFile' : '%s/import_Entries_160.template' % (remote.temp) }
</call>
<message>
'Import Ldif: Many Indexes: Preamble - Make the ldif file'
</message>
<call function="'MakeLdifWithScript'">
{ 'templateFile' : '%s/import_Entries_160.template' % (remote.temp) ,
'ldifFile' : '%s/import_Entries_160.ldif' % (remote.temp) }
</call>
<message>
'Import Ldif: Many Indexes: Import large ldif file'
</message>
<call function="'ImportLdifWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME ,
'ldifFile' : '%s/import_Entries_160.ldif' % remote.temp,
'backEnd' : 'userRoot'}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{ 'returnString' : returnString ,
'expectedString' : 'skipped 0, rejected 0' }
</call>
<message>
'Import Ldif: Many Indexes: Start DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
</message>
<call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<!--- Check that DS started -->
<call function="'isAlive'">
{ 'noOfLoops' : 10 ,
'noOfMilliSeconds' : 5000 }
</call>
<message>
'Import Ldif: Many Indexes: Search for certain entries that were imported'
</message>
<call function="'checkImport'">
{ 'expectedEntries' : ['uid=user.1,ou=People,dc=com' ,
'uid=user.100,ou=People,dc=com' ,
'uid=user.159,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>