6350N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
6350N/A<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
6350N/A<!--
6350N/A ! CDDL HEADER START
6350N/A !
6350N/A ! The contents of this file are subject to the terms of the
6350N/A ! Common Development and Distribution License, Version 1.0 only
6350N/A ! (the "License"). You may not use this file except in compliance
6350N/A ! with the License.
6350N/A !
6350N/A ! You can obtain a copy of the license at
6350N/A ! trunk/opends/resource/legal-notices/CDDLv1_0.txt
6350N/A ! or http://forgerock.org/license/CDDLv1.0.html.
6350N/A ! See the License for the specific language governing permissions
6350N/A ! and limitations under the License.
6350N/A !
6350N/A ! When distributing Covered Code, include this CDDL HEADER in each
6350N/A ! file and include the License file at
6350N/A ! trunk/opends/resource/legal-notices/CDDLv1_0.txt. If applicable,
6350N/A ! add the following below this CDDL HEADER, with the fields enclosed
6350N/A ! by brackets "[]" replaced with your own identifying information:
6350N/A ! Portions Copyright [yyyy] [name of copyright owner]
6350N/A !
6350N/A ! CDDL HEADER END
6350N/A !
6350N/A ! Copyright 2013 ForgeRock AS
6350N/A ! -->
6350N/A<stax>
6350N/A
6350N/A <!-- Definition of Test Cases -->
6350N/A
6350N/A <!--- Test Cases : Basic : Replication Operations -->
6350N/A
6350N/A <!--- Test Case information
6350N/A #@TestMarker Basic: replication operations
6350N/A #@TestName Basic: replication operations
6350N/A #@TestID basic_replication_operations_000
6350N/A #@TestPurpose Preamble
6350N/A #@TestPreamble Common Setup
6350N/A #@TestStep Import sample data
6350N/A #@TestPostamble Common Cleanup
6350N/A #@TestResult Test is successful if the result code is 0
6350N/A -->
6350N/A <function name="basic_replication_operations_000" scope="local">
6350N/A <testcase name="getTestCaseName('Preamble')">
6350N/A <sequence>
6350N/A <call function="'testCase_Preamble'"/>
6350N/A
6350N/A <script>
6350N/A ldifTemplate = '%s/import_Entries_100k.template' % remote.temp
6350N/A </script>
6350N/A
6350N/A <message>
6350N/A 'Preamble: Stop DS running on port %s' % master.getPort()
6350N/A </message>
6350N/A
6350N/A <call function="'StopDsWithScript'">
6350N/A { 'location' : masterHost,
6350N/A 'dsPath' : masterPath,
6350N/A 'dsHost' : masterHost,
6350N/A 'dsAdminPort' : master.getAdminPort(),
6350N/A 'dsBindDN' : master.getRootDn(),
6350N/A 'dsBindPwd' : master.getRootPwd() }
6350N/A </call>
6350N/A
6350N/A <!-- Check if 'ldifFile' exists -->
6350N/A <call function="'GetEntry'">
6350N/A {
6350N/A 'location' : masterHost ,
6350N/A 'entry' : ldifFile ,
6350N/A 'attribute' : 'TYPE'
6350N/A }
6350N/A </call>
6350N/A <if expr="RC == 48">
6350N/A <sequence>
6350N/A <message>
6350N/A 'Preamble: File %s does not exist, create it' % ldifFile
6350N/A </message>
6350N/A
6350N/A <message>
6350N/A 'Preamble: Make an make-ldif template file'
6350N/A </message>
6350N/A
6350N/A <call function="'MakeAMakeLdifTemplate'">
6350N/A {
6350N/A 'suffix' : synchroSuffix,
6350N/A 'numEntries' : numberOfEntries ,
6350N/A 'additionalAttributes' : True ,
6350N/A 'extraLine' : 'userpassword: password' ,
6350N/A 'templateFile' : ldifTemplate ,
6350N/A 'templateLocation' : masterHost
6350N/A }
6350N/A </call>
6350N/A
6350N/A <message>
6350N/A 'Preamble: Make the ldif file'
6350N/A </message>
6350N/A
6350N/A <call function="'MakeLdifWithScript'">
6350N/A {
6350N/A 'location' : masterHost,
6350N/A 'dsPath' : masterPath,
6350N/A 'templateFile' : ldifTemplate ,
6350N/A 'ldifFile' : ldifFile
6350N/A }
6350N/A </call>
6350N/A </sequence>
6350N/A <else>
6350N/A <message>
6350N/A 'Preamble: File %s exists, do nothing' % ldifFile
6350N/A </message>
6350N/A </else>
6350N/A </if>
6350N/A
6350N/A <message>
6350N/A 'Preamble: Import the ldif file'
6350N/A </message>
6350N/A
6350N/A <call function="'ImportLdifWithScript'">
6350N/A {
6350N/A 'location' : masterHost ,
6350N/A 'dsPath' : masterPath,
6350N/A 'ldifFile' : ldifFile ,
6350N/A 'backEnd' : 'userRoot'
6350N/A }
6350N/A </call>
6350N/A
6350N/A <message>
6350N/A 'Preamble: Start DS to run on port %s' % master.getPort()
6350N/A </message>
6350N/A
6350N/A <call function="'StartDsWithScript'">
6350N/A { 'location' : masterHost,
6350N/A 'dsPath' : masterPath }
6350N/A </call>
6350N/A
6350N/A <message>
6350N/A 'Preamble: Perform the total update'
6350N/A </message>
6350N/A
6350N/A <call function="'initializeReplication'">
6350N/A { 'location' : clientHost,
6350N/A 'dsPath' : clientPath,
6350N/A 'sourceInstanceHost' : masterHost,
6350N/A 'sourceInstanceAdminPort' : master.getAdminPort(),
6350N/A 'replicationDnList' : [synchroSuffix]
6350N/A }
6350N/A </call>
6350N/A
6350N/A <message>
6350N/A 'Preamble: Verify the tree synchronization'
6350N/A </message>
6350N/A
6350N/A <call function="'verifyTreesSdk'">
6350N/A [ clientHost, clientPath, master, consumerList, synchroSuffix ]
6350N/A </call>
6350N/A
6350N/A <call function="'testCase_Postamble'"/>
6350N/A
6350N/A </sequence>
6350N/A </testcase>
6350N/A </function>
6350N/A
6350N/A <!--- Test Case information
6350N/A #@TestMarker Basic: replication operations
6350N/A #@TestName Basic: replication operations
6350N/A #@TestID basic_replication_operations_001
6350N/A #@TestPurpose Verify basic LDAP modify operations
6350N/A #@TestPreamble Common Setup
6350N/A #@TestStep Run LDAP modify operations
6350N/A #@TestPostamble Common Cleanup
6350N/A #@TestResult Test is successful if the result code is 0
6350N/A -->
6350N/A <function name="basic_replication_operations_001" scope="local">
6350N/A <testcase name="getTestCaseName('modrate')">
6350N/A <sequence>
6350N/A <try>
6350N/A <sequence>
6350N/A <call function="'testCase_Preamble'"/>
6350N/A <message>
6350N/A 'Test Name = %s' % STAXCurrentTestcase
6350N/A </message>
6350N/A
6350N/A <call function="'testStep'">
6350N/A { 'stepMessage' : 'ModRate.' }
6350N/A </call>
6350N/A
6350N/A <timer duration="timerDuration">
6350N/A <sequence>
6350N/A <call function="'modRate'">
6350N/A { 'dsPath' : masterPath,
6350N/A 'dsInstanceHost' : masterHost,
6350N/A 'dsInstancePort' : master.getPort(),
6350N/A 'dsInstanceDn' : master.getRootDn(),
6350N/A 'dsInstancePswd' : master.getRootPwd(),
6350N/A 'dsBaseDN' : '"uid=user.%s,ou=People,o=example"',
6350N/A 'extraParams' : '-g "rand(0,%s)" -g "randstr(40)" -c 10' % (numberOfEntries - 1),
6350N/A 'attribute' : 'description' ,
6350N/A 'formatString' : '"%s"',
6350N/A 'outputFile' : 'replication_modrate.res',
6350N/A 'outputPath' : remote.temp
6350N/A }
6350N/A </call>
6350N/A </sequence>
6350N/A </timer>
6350N/A
6350N/A <call function="'getFile'">
6350N/A { 'location' : masterHost ,
6350N/A 'filename' : '%s/replication_modrate.res' % remote.temp
6350N/A }
6350N/A </call>
6350N/A <message>
6350N/A cmdResult
6350N/A </message>
6350N/A
6350N/A <script>
6350N/A import re
6350N/A f=open('%s/replication_modrate.res' % remote.temp)
6350N/A errorFound=False
6350N/A for line in f.readlines():
6350N/A line = line.replace('\n','')
6350N/A if re.search('^[0-9].*', line) is not None:
6350N/A if line.split()[7] != '0.0':
6350N/A errorFound=True
6350N/A </script>
6350N/A <if expr="errorFound == False">
6350N/A <tcstatus result="'pass'"/>
6350N/A <else>
6350N/A <sequence>
6350N/A <message>'Error found during modrate'</message>
6350N/A <tcstatus result="'fail'"/>
6350N/A </sequence>
6350N/A </else>
6350N/A </if>
6350N/A
6350N/A <call function="'testStep'">
6350N/A { 'stepMessage' : 'Do search on the master.' }
6350N/A </call>
6350N/A
6350N/A <call function="'ldapSearchWithScript'">
6350N/A {
6350N/A 'dsPath' : masterPath,
6350N/A 'dsInstanceHost' : masterHost,
6350N/A 'dsInstancePort' : master.getPort(),
6350N/A 'dsInstanceDn' : master.getRootDn(),
6350N/A 'dsInstancePswd' : master.getRootPwd(),
6350N/A 'dsBaseDN' : synchroSuffix,
6350N/A 'dsFilter' : 'objectclass=*',
6350N/A 'dsAttributes' : 'dn'
6350N/A }
6350N/A </call>
6350N/A
6350N/A <call function="'testStep'">
6350N/A { 'stepMessage' : 'Do search on the client.' }
6350N/A </call>
6350N/A
6350N/A <call function="'ldapSearchWithScript'">
6350N/A {
6350N/A 'dsPath' : clientPath,
6350N/A 'dsInstanceHost' : clientHost,
6350N/A 'dsInstancePort' : client.getPort(),
6350N/A 'dsInstanceDn' : client.getRootDn(),
6350N/A 'dsInstancePswd' : client.getRootPwd(),
6350N/A 'dsBaseDN' : synchroSuffix,
6350N/A 'dsFilter' : 'objectclass=*',
6350N/A 'dsAttributes' : 'dn'
6350N/A }
6350N/A </call>
6350N/A
6350N/A <call function="'testStep'">
6350N/A { 'stepMessage' : 'Verify the tree synchronization.' }
6350N/A </call>
6350N/A
6350N/A <call function="'verifyTreesSdk'">
6350N/A [ clientHost, clientPath, master, consumerList, synchroSuffix ]
6350N/A </call>
6350N/A </sequence>
6350N/A
6350N/A <catch exception="'STAXException'" typevar="eType" var="eInfo">
6350N/A <message log="1" level="'fatal'">
6350N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
6350N/A </message>
6350N/A </catch>
6350N/A <finally>
6350N/A <sequence>
6350N/A <call function="'testCase_Postamble'"/>
6350N/A </sequence>
6350N/A </finally>
6350N/A </try>
6350N/A </sequence>
6350N/A </testcase>
6350N/A </function>
6350N/A
6350N/A <!--- Test Case information
6350N/A #@TestMarker Basic: replication operations
6350N/A #@TestName Basic: replication operations
6350N/A #@TestID basic_replication_operations_002
6350N/A #@TestPurpose Verify basic LDAP authentication operations
6350N/A #@TestPreamble Common Setup
6350N/A #@TestStep Run LDAP authentication operations
6350N/A #@TestPostamble Common Cleanup
6350N/A #@TestResult Test is successful if the result code is 0
6350N/A -->
6350N/A <function name="basic_replication_operations_002" scope="local">
6350N/A <testcase name="getTestCaseName('addrate')">
6350N/A <sequence>
6350N/A <try>
6350N/A <sequence>
6350N/A <call function="'testCase_Preamble'"/>
6350N/A <message>
6350N/A 'Test Name = %s' % STAXCurrentTestcase
6350N/A </message>
6350N/A
6350N/A <call function="'testStep'">
6350N/A { 'stepMessage' : 'Addrate.' }
6350N/A </call>
6350N/A
6350N/A <timer duration="timerDuration">
6350N/A <sequence>
6350N/A <call function="'addRate'">
6350N/A { 'dsPath' : masterPath,
6350N/A 'dsInstanceHost' : masterHost,
6350N/A 'dsInstancePort' : master.getPort(),
6350N/A 'dsInstanceDn' : master.getRootDn(),
6350N/A 'dsInstancePswd' : master.getRootPwd(),
6350N/A 'templateFile' : addTemplate,
6350N/A 'extraParams' : '-g "inc(%s,%s)" -g "randstr(5)" -g "randstr(5)" -g "randstr(5)" -g "randstr(5)" -m 100000' \
6350N/A % (numberOfEntries, 2 * numberOfEntries),
6350N/A 'outputFile' : 'replication_addrate.res',
6350N/A 'outputPath' : remote.temp
6350N/A }
6350N/A </call>
6350N/A </sequence>
6350N/A </timer>
6350N/A
6350N/A <call function="'getFile'">
6350N/A { 'location' : masterHost ,
6350N/A 'filename' : '%s/replication_addrate.res' % remote.temp
6350N/A }
6350N/A </call>
6350N/A <message>
6350N/A cmdResult
6350N/A </message>
6350N/A
6350N/A <script>
6350N/A import re
6350N/A f=open('%s/replication_addrate.res' % remote.temp)
6350N/A errorFound=False
6350N/A for line in f.readlines():
6350N/A line = line.replace('\n','')
6350N/A if re.search('^[0-9].*', line) is not None:
6350N/A if line.split()[7] != '0.0':
6350N/A errorFound=True
6350N/A </script>
6350N/A <if expr="errorFound == False">
6350N/A <tcstatus result="'pass'"/>
6350N/A <else>
6350N/A <sequence>
6350N/A <message>'Error found during addrate'</message>
6350N/A <tcstatus result="'fail'"/>
6350N/A </sequence>
6350N/A </else>
6350N/A </if>
6350N/A
6350N/A <call function="'testStep'">
6350N/A { 'stepMessage' : 'Do search on the master and check number of entries.' }
6350N/A </call>
6350N/A
6350N/A <call function="'ldapSearchWithScript'">
6350N/A {
6350N/A 'dsPath' : masterPath,
6350N/A 'dsInstanceHost' : masterHost,
6350N/A 'dsInstancePort' : master.getPort(),
6350N/A 'dsInstanceDn' : master.getRootDn(),
6350N/A 'dsInstancePswd' : master.getRootPwd(),
6350N/A 'dsCountEntries' : 'True' ,
6350N/A 'dsBaseDN' : synchroSuffix,
6350N/A 'dsFilter' : 'objectclass=*',
6350N/A 'dsAttributes' : 'dn',
6350N/A 'outputFile' : 'ldapsearch_add_master.out' ,
6350N/A 'outputPath' : remote.temp
6350N/A }
6350N/A </call>
6350N/A
6350N/A <call function="'grep'">
6350N/A {
6350N/A 'location' : STAF_REMOTE_HOSTNAME ,
6350N/A 'filename' : '%s/ldapsearch_add_master.out' % remote.temp ,
6350N/A 'testString': 'Total number of matching entries: 200002'
6350N/A }
6350N/A </call>
6350N/A
6350N/A <call function="'testStep'">
6350N/A { 'stepMessage' : 'Do search on the client and check number of entries.' }
6350N/A </call>
6350N/A
6350N/A <call function="'ldapSearchWithScript'">
6350N/A {
6350N/A 'dsPath' : clientPath,
6350N/A 'dsInstanceHost' : clientHost,
6350N/A 'dsInstancePort' : client.getPort(),
6350N/A 'dsInstanceDn' : client.getRootDn(),
6350N/A 'dsInstancePswd' : client.getRootPwd(),
6350N/A 'dsCountEntries' : 'True' ,
6350N/A 'dsBaseDN' : synchroSuffix,
6350N/A 'dsFilter' : 'objectclass=*',
6350N/A 'dsAttributes' : 'dn',
6350N/A 'outputFile' : 'ldapsearch_add_client.out' ,
6350N/A 'outputPath' : remote.temp
6350N/A }
6350N/A </call>
6350N/A
6350N/A <call function="'grep'">
6350N/A {
6350N/A 'location' : STAF_REMOTE_HOSTNAME ,
6350N/A 'filename' : '%s/ldapsearch_add_client.out' % remote.temp ,
6350N/A 'testString': 'Total number of matching entries: 200002'
6350N/A }
6350N/A </call>
6350N/A
6350N/A <call function="'testStep'">
6350N/A { 'stepMessage' : 'Verify the tree synchronization.' }
6350N/A </call>
6350N/A
6350N/A <call function="'verifyTreesSdk'">
6350N/A [ clientHost, clientPath, master, consumerList, synchroSuffix ]
6350N/A </call>
6350N/A </sequence>
6350N/A
6350N/A <catch exception="'STAXException'" typevar="eType" var="eInfo">
6350N/A <message log="1" level="'fatal'">
6350N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
6350N/A </message>
6350N/A </catch>
6350N/A <finally>
6350N/A <sequence>
6350N/A <call function="'testCase_Postamble'"/>
6350N/A </sequence>
6350N/A </finally>
6350N/A </try>
6350N/A </sequence>
6350N/A </testcase>
6350N/A </function>
6350N/A
6350N/A <!--- Test Case information
6350N/A #@TestMarker Basic: replication operations
6350N/A #@TestName Basic: replication operations
6350N/A #@TestID basic_replication_operations_003
6350N/A #@TestPurpose Verify basic LDAP search operations
6350N/A #@TestPreamble Common Setup
6350N/A #@TestStep Run LDAP search operations
6350N/A #@TestPostamble Common Cleanup
6350N/A #@TestResult Test is successful if the result code is 0
6350N/A -->
6350N/A <function name="basic_replication_operations_003" scope="local">
6350N/A <testcase name="getTestCaseName('delrate')">
6350N/A <sequence>
6350N/A <try>
6350N/A <sequence>
6350N/A <call function="'testCase_Preamble'"/>
6350N/A <message>
6350N/A 'Test Name = %s' % STAXCurrentTestcase
6350N/A </message>
6350N/A
6350N/A <call function="'testStep'">
6350N/A { 'stepMessage' : 'DelRate.' }
6350N/A </call>
6350N/A
6350N/A <timer duration="timerDuration">
6350N/A <sequence>
6350N/A <call function="'delRate'">
6350N/A { 'dsPath' : masterPath,
6350N/A 'dsInstanceHost' : masterHost,
6350N/A 'dsInstancePort' : master.getPort(),
6350N/A 'dsInstanceDn' : master.getRootDn(),
6350N/A 'dsInstancePswd' : master.getRootPwd(),
6350N/A 'dsBaseDN' : '"uid=user.%s,ou=People,o=example"',
6350N/A 'extraParams' : '-g "inc(0,%s)" -m 100000' % (numberOfEntries - 1),
6350N/A 'outputFile' : 'replication_delrate.res',
6350N/A 'outputPath' : remote.temp
6350N/A }
6350N/A </call>
6350N/A </sequence>
6350N/A </timer>
6350N/A
6350N/A <call function="'getFile'">
6350N/A { 'location' : masterHost ,
6350N/A 'filename' : '%s/replication_delrate.res' % remote.temp
6350N/A }
6350N/A </call>
6350N/A <message>
6350N/A cmdResult
6350N/A </message>
6350N/A
6350N/A <script>
6350N/A import re
6350N/A f=open('%s/replication_delrate.res' % remote.temp)
6350N/A errorFound=False
6350N/A for line in f.readlines():
6350N/A line = line.replace('\n','')
6350N/A if re.search('^[0-9].*', line) is not None:
6350N/A if line.split()[7] != '0.0':
6350N/A errorFound=True
6350N/A </script>
6350N/A <if expr="errorFound == False">
6350N/A <tcstatus result="'pass'"/>
6350N/A <else>
6350N/A <sequence>
6350N/A <message>'Error found during delrate'</message>
6350N/A <tcstatus result="'fail'"/>
6350N/A </sequence>
6350N/A </else>
6350N/A </if>
6350N/A
6350N/A <call function="'testStep'">
6350N/A { 'stepMessage' : 'Do search on the master and check number of entries.' }
6350N/A </call>
6350N/A
6350N/A <call function="'ldapSearchWithScript'">
6350N/A {
6350N/A 'dsPath' : masterPath,
6350N/A 'dsInstanceHost' : masterHost,
6350N/A 'dsInstancePort' : master.getPort(),
6350N/A 'dsInstanceDn' : master.getRootDn(),
6350N/A 'dsInstancePswd' : master.getRootPwd(),
6350N/A 'dsCountEntries' : 'True' ,
6350N/A 'dsBaseDN' : synchroSuffix,
6350N/A 'dsFilter' : 'objectclass=*',
6350N/A 'dsAttributes' : 'dn',
6350N/A 'outputFile' : 'ldapsearch_del_master.out' ,
6350N/A 'outputPath' : remote.temp
6350N/A }
6350N/A </call>
6350N/A
6350N/A <call function="'grep'">
6350N/A {
6350N/A 'location' : STAF_REMOTE_HOSTNAME ,
6350N/A 'filename' : '%s/ldapsearch_del_master.out' % remote.temp ,
6350N/A 'testString': 'Total number of matching entries: 100002'
6350N/A }
6350N/A </call>
6350N/A
6350N/A <call function="'testStep'">
6350N/A { 'stepMessage' : 'Do search on the client and check number of entries.' }
6350N/A </call>
6350N/A
6350N/A <call function="'ldapSearchWithScript'">
6350N/A {
6350N/A 'dsPath' : clientPath,
6350N/A 'dsInstanceHost' : clientHost,
6350N/A 'dsInstancePort' : client.getPort(),
6350N/A 'dsInstanceDn' : client.getRootDn(),
6350N/A 'dsInstancePswd' : client.getRootPwd(),
6350N/A 'dsCountEntries' : 'True' ,
6350N/A 'dsBaseDN' : synchroSuffix,
6350N/A 'dsFilter' : 'objectclass=*',
6350N/A 'dsAttributes' : 'dn',
6350N/A 'outputFile' : 'ldapsearch_del_client.out' ,
6350N/A 'outputPath' : remote.temp
6350N/A }
6350N/A </call>
6350N/A
6350N/A <call function="'grep'">
6350N/A {
6350N/A 'location' : STAF_REMOTE_HOSTNAME ,
6350N/A 'filename' : '%s/ldapsearch_del_client.out' % remote.temp ,
6350N/A 'testString': 'Total number of matching entries: 100002'
6350N/A }
6350N/A </call>
6350N/A
6350N/A <call function="'testStep'">
6350N/A { 'stepMessage' : 'Verify the tree synchronization.' }
6350N/A </call>
6350N/A
6350N/A <call function="'verifyTreesSdk'">
6350N/A [ clientHost, clientPath, master, consumerList, synchroSuffix ]
6350N/A </call>
6350N/A </sequence>
6350N/A
6350N/A <catch exception="'STAXException'" typevar="eType" var="eInfo">
6350N/A <message log="1" level="'fatal'">
6350N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
6350N/A </message>
6350N/A </catch>
6350N/A <finally>
6350N/A <sequence>
6350N/A <call function="'testCase_Postamble'"/>
6350N/A </sequence>
6350N/A </finally>
6350N/A </try>
6350N/A </sequence>
6350N/A </testcase>
6350N/A </function>
6350N/A</stax>