5693N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
5693N/A<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
5693N/A<!--
5693N/A ! CDDL HEADER START
5693N/A !
5693N/A ! The contents of this file are subject to the terms of the
5693N/A ! Common Development and Distribution License, Version 1.0 only
5693N/A ! (the "License"). You may not use this file except in compliance
5693N/A ! with the License.
6982N/A !
6982N/A ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
5693N/A ! or http://forgerock.org/license/CDDLv1.0.html.
5693N/A ! See the License for the specific language governing permissions
5693N/A ! and limitations under the License.
6982N/A !
5693N/A ! When distributing Covered Code, include this CDDL HEADER in each
6982N/A ! file and include the License file at legal-notices/CDDLv1_0.txt.
6982N/A ! If applicable, add the following below this CDDL HEADER, with the
6982N/A ! fields enclosed by brackets "[]" replaced with your own identifying
6982N/A ! information:
5693N/A ! Portions Copyright [yyyy] [name of copyright owner]
5693N/A !
5693N/A ! CDDL HEADER END
5693N/A !
5693N/A ! Copyright 2012 ForgeRock AS.
5693N/A ! -->
5693N/A<stax>
5693N/A
5693N/A <!-- Definition of Test Cases -->
5693N/A
5693N/A <!--- Test Cases : ImportLDIF: Binary Attributes -->
5693N/A
5693N/A <!--- Test Case information
5693N/A #@TestMarker ImportLDIF: Large Import Buffer
5693N/A #@TestName ImportLDIF: Large Import Buffer
5693N/A #@TestID importldif_properties_001
5693N/A #@TestPurpose Verify import LDIF with Large Import Buffer
5693N/A #@TestPreamble Common Setup
5693N/A #@TestStep Make template for makeldif.
5693N/A #@TestStep Create ldif file for import using makeldif.
5693N/A #@TestStep Import the LDIF file.
5693N/A #@TestStep Start the Directory Server.
5693N/A #@TestStep Verify import LDIF operations.
5693N/A #@TestPostamble Common Cleanup
5693N/A #@TestResult Test is successful if the result code is 0
5693N/A -->
5693N/A <function name="importldif_properties_001" scope="local">
5693N/A <testcase name="getTestCaseName('Large Import Buffer')">
5693N/A <sequence>
5693N/A <try>
5693N/A <sequence>
5693N/A
5693N/A <call function="'testCase_Preamble'"/>
5693N/A <message>
5693N/A 'Test Name = %s' % STAXCurrentTestcase
5693N/A </message>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Large Import Buffer: Preamble - Change import buffer size'
5693N/A </message>
5693N/A
5693N/A <call function="'dsconfig'">
5693N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
5693N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5693N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5693N/A 'subcommand' : 'set-backend-prop' ,
5693N/A 'objectType' : 'backend-name' ,
5693N/A 'objectName' : 'userRoot',
5693N/A 'optionsString' : '--set import-queue-size:1000' ,
5693N/A 'expectedRC' : 0 }
5693N/A </call>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Large Import Buffer: Preamble - Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
5693N/A </message>
5693N/A
5693N/A <!-- StopDS -->
5693N/A <call function="'StopDsWithScript'">
5693N/A { 'location' : STAF_REMOTE_HOSTNAME }
5693N/A </call>
5693N/A
5693N/A <script>
5693N/A numberOfEntries = 100000
5693N/A totalEntries = numberOfEntries + 2
5693N/A bin_attr_filename = '%s_entries.ldif' % numberOfEntries
5693N/A import os.path
5693N/A curr_filename=remote.temp + "/" + bin_attr_filename
5693N/A curr_file_exists='0'
5693N/A if os.path.exists(curr_filename):
5693N/A curr_file_exists='1'
5693N/A </script>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Large Import Buffer: Looking for file, %s. File exists? (0=false, 1=true) %s' % (curr_filename, curr_file_exists)
5693N/A </message>
5693N/A
5693N/A <if expr="curr_file_exists=='0'">
5693N/A <sequence>
5693N/A <message>
5693N/A 'Import Ldif: Large Import Buffer: Preamble - Make an make-ldif template file'
5693N/A </message>
5693N/A <call function="'MakeAMakeLdifTemplate'">
5693N/A { 'numEntries' : numberOfEntries ,
5693N/A 'templateFile' : '%s/import_Entries_100k.template' % (remote.temp) ,
5693N/A 'extraLine' : 'jpegPhoto:: &lt;random:base64:38000&gt;'}
5693N/A </call>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Large Import Buffer: Preamble - Make the ldif file'
5693N/A </message>
5693N/A
5693N/A <call function="'MakeLdifWithScript'">
5693N/A { 'templateFile' : '%s/import_Entries_100k.template' % (remote.temp) ,
5693N/A 'ldifFile' : curr_filename }
5693N/A </call>
5693N/A </sequence>
5693N/A </if>
5693N/A
5693N/A <call function="'testStep'">
5693N/A { 'stepMessage' : 'Import the LDIF file.' }
5693N/A </call>
5693N/A
5693N/A <call function="'ImportLdifWithScript'">
5693N/A {
5693N/A 'location' : STAF_REMOTE_HOSTNAME ,
5693N/A 'ldifFile' : ldifFile ,
5693N/A 'backEnd' : 'userRoot'
5693N/A }
5693N/A </call>
5693N/A
5693N/A <script>
5693N/A returnString = STAXResult[0][1]
5693N/A msg = 'Processed %s entries, imported %s, skipped 0, rejected 0' \
5693N/A % (totalEntries,totalEntries)
5693N/A </script>
5693N/A
5693N/A <call function="'checktestString'">
5693N/A {
5693N/A 'returnString' : returnString ,
5693N/A 'expectedString' : msg
5693N/A }
5693N/A </call>
5693N/A
5693N/A <call function="'testStep'">
5693N/A { 'stepMessage' : 'Start the Directory Server.' }
5693N/A </call>
5693N/A
5693N/A <call function="'StartDsWithScript'">
5693N/A { 'location' : STAF_REMOTE_HOSTNAME }
5693N/A </call>
5693N/A
5693N/A <script>
5693N/A returnString = STAXResult[0][1]
5693N/A msg = 'The database backend userRoot containing %s entries has started' \
5693N/A % totalEntries
5693N/A </script>
5693N/A
5693N/A <call function="'checktestString'">
5693N/A {
5693N/A 'returnString' : returnString ,
5693N/A 'expectedString' : msg
5693N/A }
5693N/A </call>
5693N/A
5693N/A <!--- Check that DS started -->
5693N/A <call function="'isAlive'">
5693N/A {
5693N/A 'noOfLoops' : 10 ,
5693N/A 'noOfMilliSeconds' : 5000
5693N/A }
5693N/A </call>
5693N/A
5693N/A <call function="'testStep'">
5693N/A { 'stepMessage' : 'Verify import LDIF operations.' }
5693N/A </call>
5693N/A
5693N/A <call function="'checkImport'">
5693N/A {
5693N/A 'expectedEntries' : ['uid=user.0,ou=People,dc=com' ,
5693N/A 'uid=user.10000,ou=People,dc=com' ,
5693N/A 'uid=user.20000,ou=People,dc=com' ,
5693N/A 'uid=user.30000,ou=People,dc=com' ,
5693N/A 'uid=user.40000,ou=People,dc=com' ,
5693N/A 'uid=user.50000,ou=People,dc=com' ,
5693N/A 'uid=user.60000,ou=People,dc=com' ,
5693N/A 'uid=user.70000,ou=People,dc=com' ,
5693N/A 'uid=user.80000,ou=People,dc=com' ,
5693N/A 'uid=user.90000,ou=People,dc=com' ,
5693N/A 'uid=user.99999,ou=People,dc=com'] ,
5693N/A 'startDS' : 'no'
5693N/A }
5693N/A </call>
5693N/A
5693N/A </sequence>
5693N/A
5693N/A <catch exception="'STAXException'" typevar="eType" var="eInfo">
5693N/A <message log="1" level="'fatal'">
5693N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5693N/A </message>
5693N/A </catch>
5693N/A <finally>
5693N/A <sequence>
5693N/A <call function="'testCase_Postamble'"/>
5693N/A </sequence>
5693N/A </finally>
5693N/A </try>
5693N/A </sequence>
5693N/A </testcase>
5693N/A </function>
5693N/A
5693N/A <!--- Test Case information
5693N/A #@TestMarker ImportLDIF: Many Threads
5693N/A #@TestName ImportLDIF: Many Threads
5693N/A #@TestID importldif_properties_002
5693N/A #@TestPurpose Verify import LDIF with Many Threads
5693N/A #@TestPreamble Common Setup
5693N/A #@TestStep Make template for makeldif.
5693N/A #@TestStep Create ldif file for import using makeldif.
5693N/A #@TestStep Import the LDIF file.
5693N/A #@TestStep Start the Directory Server.
5693N/A #@TestStep Verify import LDIF operations.
5693N/A #@TestPostamble Common Cleanup
5693N/A #@TestResult Test is successful if the result code is 0
5693N/A -->
5693N/A <function name="importldif_properties_002" scope="local">
5693N/A <testcase name="getTestCaseName('Many Threads')">
5693N/A <sequence>
5693N/A <try>
5693N/A <sequence>
5693N/A
5693N/A <call function="'testCase_Preamble'"/>
5693N/A
5693N/A <message>'Update java.properties file %s/%s/config/java.properties' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)</message>
5693N/A <script>
5693N/A rc = java_properties('%s/%s/config/java.properties' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME),
5693N/A 'import-ldif.offline',
5693N/A [ "-server", "-Xms2048m" ])
5693N/A </script>
5693N/A <message>'RC %s' % rc</message>
5693N/A
5693N/A <call function="'dsJavaPropertiesWithScript'">
5693N/A { 'location' : STAF_REMOTE_HOSTNAME }
5693N/A </call>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Many Threads: Preamble - Change import thread count'
5693N/A </message>
5693N/A
5693N/A <call function="'dsconfig'">
5693N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
5693N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5693N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5693N/A 'subcommand' : 'set-backend-prop' ,
5693N/A 'objectType' : 'backend-name' ,
5693N/A 'objectName' : 'userRoot',
5693N/A 'optionsString' : '--set import-thread-count:2048' ,
5693N/A 'expectedRC' : 0 }
5693N/A </call>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Many Threads: Preamble - Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
5693N/A </message>
5693N/A
5693N/A <call function="'StopDsWithScript'">
5693N/A { 'location' : STAF_REMOTE_HOSTNAME,
5693N/A 'dsHost' : DIRECTORY_INSTANCE_HOST,
5693N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
5693N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN,
5693N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
5693N/A </call>
5693N/A
5693N/A <script>
5693N/A numberOfEntries = 100000
5693N/A totalEntries = numberOfEntries + 2
5693N/A bin_attr_filename = '%s_entries.ldif' % numberOfEntries
5693N/A import os.path
5693N/A curr_filename=remote.temp + "/" + bin_attr_filename
5693N/A curr_file_exists='0'
5693N/A if os.path.exists(curr_filename):
5693N/A curr_file_exists='1'
5693N/A </script>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Many Threads: Looking for file, %s. File exists? (0=false, 1=true) %s' % (curr_filename, curr_file_exists)
5693N/A </message>
5693N/A
5693N/A <if expr="curr_file_exists=='0'">
5693N/A <sequence>
5693N/A <message>
5693N/A 'Import Ldif: Many Threads: Preamble - Make an make-ldif template file'
5693N/A </message>
5693N/A <call function="'MakeAMakeLdifTemplate'">
5693N/A { 'numEntries' : numberOfEntries ,
5693N/A 'templateFile' : '%s/import_Entries_100k.template' % (remote.temp) ,
5693N/A 'extraLine' : 'jpegPhoto:: &lt;random:base64:38000&gt;'}
5693N/A </call>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Many Threads: Preamble - Make the ldif file'
5693N/A </message>
5693N/A
5693N/A <call function="'MakeLdifWithScript'">
5693N/A { 'templateFile' : '%s/import_Entries_100k.template' % (remote.temp) ,
5693N/A 'ldifFile' : curr_filename }
5693N/A </call>
5693N/A </sequence>
5693N/A </if>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Many Threads: Import large ldif file'
5693N/A </message>
5693N/A
5693N/A <call function="'ImportLdifWithScript'">
5693N/A { 'location' : STAF_REMOTE_HOSTNAME ,
5693N/A 'difFile' : curr_filename ,
5693N/A 'backEnd' : 'userRoot'}
5693N/A </call>
5693N/A
5693N/A <script>
5693N/A returnString = STAXResult[0][1]
5693N/A </script>
5693N/A
5693N/A <call function="'checktestString'">
5693N/A { 'returnString' : returnString ,
5693N/A 'expectedString' : 'Processed 100002 entries' }
5693N/A </call>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Many Threads: Start DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
5693N/A </message>
5693N/A
5693N/A <call function="'StartDsWithScript'">
5693N/A { 'location' : STAF_REMOTE_HOSTNAME }
5693N/A </call>
5693N/A
5693N/A <!--- Check that DS started -->
5693N/A <call function="'isAlive'">
5693N/A { 'noOfLoops' : 10 ,
5693N/A 'noOfMilliSeconds' : 5000 }
5693N/A </call>
5693N/A <message>
5693N/A 'Import Ldif: Many Threads: Search for certain entries that were imported'
5693N/A </message>
5693N/A
5693N/A <call function="'checkImport'">
5693N/A { 'expectedEntries' : ['uid=user.1,ou=People,dc=com' ,
5693N/A 'uid=user.10000,ou=People,dc=com' ,
5693N/A 'uid=user.20000,ou=People,dc=com' ,
5693N/A 'uid=user.30000,ou=People,dc=com' ,
5693N/A 'uid=user.40000,ou=People,dc=com' ,
5693N/A 'uid=user.50000,ou=People,dc=com' ,
5693N/A 'uid=user.60000,ou=People,dc=com' ,
5693N/A 'uid=user.70000,ou=People,dc=com' ,
5693N/A 'uid=user.80000,ou=People,dc=com' ,
5693N/A 'uid=user.90000,ou=People,dc=com' ,
5693N/A 'uid=user.99999,ou=People,dc=com'] ,
5693N/A 'startDS' : 'no'
5693N/A }
5693N/A </call>
5693N/A
5693N/A </sequence>
5693N/A
5693N/A <catch exception="'STAXException'" typevar="eType" var="eInfo">
5693N/A <message log="1" level="'fatal'">
5693N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5693N/A </message>
5693N/A </catch>
5693N/A <finally>
5693N/A <sequence>
5693N/A <call function="'testCase_Postamble'"/>
5693N/A </sequence>
5693N/A </finally>
5693N/A </try>
5693N/A </sequence>
5693N/A </testcase>
5693N/A </function>
5693N/A
5693N/A <!--- Test Case information
5693N/A #@TestMarker ImportLDIF: Low Index Entry Limit
5693N/A #@TestName ImportLDIF: Low Index Entry Limit
5693N/A #@TestID importldif_properties_003
5693N/A #@TestPurpose Verify import LDIF with Low Index Entry Limit
5693N/A #@TestPreamble Common Setup
5693N/A #@TestStep Make template for makeldif.
5693N/A #@TestStep Create ldif file for import using makeldif.
5693N/A #@TestStep Import the LDIF file.
5693N/A #@TestStep Start the Directory Server.
5693N/A #@TestStep Verify import LDIF operations.
5693N/A #@TestPostamble Common Cleanup
5693N/A #@TestResult Test is successful if the result code is 0
5693N/A -->
5693N/A <function name="importldif_properties_003" scope="local">
5693N/A <testcase name="getTestCaseName('Low Index Entry Limit')">
5693N/A <sequence>
5693N/A <try>
5693N/A <sequence>
5693N/A
5693N/A <call function="'testCase_Preamble'"/>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Low Index Entry Limit: Preamble - Change import thread count'
5693N/A </message>
5693N/A
5693N/A <call function="'dsconfig'">
5693N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
5693N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5693N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5693N/A 'subcommand' : 'set-backend-prop' ,
5693N/A 'objectType' : 'backend-name' ,
5693N/A 'objectName' : 'userRoot',
5693N/A 'optionsString' : '--set index-entry-limit:4' ,
5693N/A 'expectedRC' : 0 }
5693N/A </call>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Low Index Entry Limit: Preamble - Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
5693N/A </message>
5693N/A
5693N/A <call function="'StopDsWithScript'">
5693N/A { 'location' : STAF_REMOTE_HOSTNAME,
5693N/A 'dsHost' : DIRECTORY_INSTANCE_HOST,
5693N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
5693N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN,
5693N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
5693N/A </call>
5693N/A
5693N/A <script>
5693N/A numberOfEntries = 100000
5693N/A totalEntries = numberOfEntries + 2
5693N/A bin_attr_filename = '%s_entries.ldif' % numberOfEntries
5693N/A import os.path
5693N/A curr_filename=remote.temp + "/" + bin_attr_filename
5693N/A curr_file_exists='0'
5693N/A if os.path.exists(curr_filename):
5693N/A curr_file_exists='1'
5693N/A </script>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Low Index Entry Limit: Looking for file, %s. File exists? (0=false, 1=true) %s' % (curr_filename, curr_file_exists)
5693N/A </message>
5693N/A
5693N/A <if expr="curr_file_exists=='0'">
5693N/A <sequence>
5693N/A <message>
5693N/A 'Import Ldif: Low Index Entry Limit: Preamble - Make an make-ldif template file'
5693N/A </message>
5693N/A <call function="'MakeAMakeLdifTemplate'">
5693N/A { 'numEntries' : numberOfEntries ,
5693N/A 'templateFile' : '%s/import_Entries_100k.template' % (remote.temp) ,
5693N/A 'extraLine' : 'jpegPhoto:: &lt;random:base64:38000&gt;'}
5693N/A </call>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Low Index Entry Limit: Preamble - Make the ldif file'
5693N/A </message>
5693N/A
5693N/A <call function="'MakeLdifWithScript'">
5693N/A { 'templateFile' : '%s/import_Entries_100k.template' % (remote.temp) ,
5693N/A 'ldifFile' : curr_filename }
5693N/A </call>
5693N/A </sequence>
5693N/A </if>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Low Index Entry Limit: Import large ldif file'
5693N/A </message>
5693N/A
5693N/A <call function="'ImportLdifWithScript'">
5693N/A { 'location' : STAF_REMOTE_HOSTNAME ,
5693N/A 'ldifFile' : curr_filename ,
5693N/A 'backEnd' : 'userRoot'}
5693N/A </call>
5693N/A
5693N/A <script>
5693N/A returnString = STAXResult[0][1]
5693N/A </script>
5693N/A
5693N/A <call function="'checktestString'">
5693N/A { 'returnString' : returnString ,
5693N/A 'expectedString' : 'Processed 100002 entries' }
5693N/A </call>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Low Index Entry Limit: Start DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
5693N/A </message>
5693N/A
5693N/A <call function="'StartDsWithScript'">
5693N/A { 'location' : STAF_REMOTE_HOSTNAME }
5693N/A </call>
5693N/A
5693N/A <!--- Check that DS started -->
5693N/A <call function="'isAlive'">
5693N/A { 'noOfLoops' : 10 ,
5693N/A 'noOfMilliSeconds' : 5000 }
5693N/A </call>
5693N/A
5693N/A <message>
5693N/A 'Import Ldif: Low Index Entry Limit: Search for certain entries that were imported'
5693N/A </message>
5693N/A
5693N/A <call function="'checkImport'">
5693N/A { 'expectedEntries' : ['uid=user.1,ou=People,dc=com' ,
5693N/A 'uid=user.10000,ou=People,dc=com' ,
5693N/A 'uid=user.20000,ou=People,dc=com' ,
5693N/A 'uid=user.30000,ou=People,dc=com' ,
5693N/A 'uid=user.40000,ou=People,dc=com' ,
5693N/A 'uid=user.50000,ou=People,dc=com' ,
5693N/A 'uid=user.60000,ou=People,dc=com' ,
5693N/A 'uid=user.70000,ou=People,dc=com' ,
5693N/A 'uid=user.80000,ou=People,dc=com' ,
5693N/A 'uid=user.90000,ou=People,dc=com' ,
5693N/A 'uid=user.99999,ou=People,dc=com'] ,
5693N/A 'startDS' : 'no'
5693N/A }
5693N/A </call>
5693N/A
5693N/A </sequence>
5693N/A
5693N/A <catch exception="'STAXException'" typevar="eType" var="eInfo">
5693N/A <message log="1" level="'fatal'">
5693N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5693N/A </message>
5693N/A </catch>
5693N/A <finally>
5693N/A <sequence>
5693N/A <call function="'testCase_Postamble'"/>
5693N/A </sequence>
5693N/A </finally>
5693N/A </try>
5693N/A </sequence>
5693N/A </testcase>
5693N/A </function>
5693N/A</stax>