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