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