<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
! 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 legal-notices/CDDLv1_0.txt
! 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 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 2009-2010 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="replication_search"/>
<function name="replication_search">
<sequence>
<block name="'replication-search'">
<sequence>
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group']='replication'
CurrentTestPath['suite']=STAXCurrentBlock
</script>
<call function="'testSuite_Preamble'"/>
<import machine="STAF_LOCAL_HOSTNAME"
file="'%/functional-tests/testcases/replication/replication_setup.xml' % (TESTS_DIR)"/>
<call function="'replication_setup'"/>
<script>
ldcltLoop = testsDuration / 10
lowRange = 100000
highRange = lowRange + numberOfEntries
jvmLoop = testsDuration / 1800 + 1
jvmSleep = 1800000
baseDN = 'ou=People,%s' % synchroSuffix
masterDir = '%s/..' % masterPath
ldifTemplate = '%s/%s_entries.template' \
% (masterDir, numberOfEntries)
ldifFile = '%s/%s_entries.ldif' \
% (masterDir, numberOfEntries)
totalEntries = numberOfEntries + 2
suffix = 'search'
</script>
<testcase name="getTestCaseName('Preamble')">
<sequence>
<call function="'testCase_Preamble'"/>
<!-- Check if 'ldifFile' exists -->
<call function="'GetEntry'">
{
'location' : masterHost ,
'entry' : ldifFile ,
'attribute' : 'TYPE'
}
</call>
<if expr="RC == 48">
<sequence>
<message>
'replication_search: File %s does not exist, create it' \
% ldifFile
</message>
<message>
'replication_search: Make a make-ldif template file'
</message>
<call function="'MakeAMakeLdifTemplate'">
{
'numEntries' : numberOfEntries,
'suffix' : synchroSuffix,
'startFrom' : lowRange,
'additionalAttributes' : True,
'templateFile' : ldifTemplate,
'templateLocation' : masterHost
}
</call>
<message>
'replication_search: Make the ldif file'
</message>
<call function="'MakeLdifWithScript'">
{
'location' : masterHost,
'dsPath' : masterPath,
'templateFile' : ldifTemplate,
'ldifFile' : ldifFile
}
</call>
</sequence>
<else>
<message>
'replication_search: File %s exists, do nothing' \
% ldifFile
</message>
</else>
</if>
<message>
'replication_search: Import large ldif file'
</message>
<!-- Stop "master" Directory Server -->
<call function="'StopDsWithScript'">
{ 'location' : masterHost,
'dsPath' : masterPath,
'dsHost' : masterHost,
'dsAdminPort' : master.getAdminPort(),
'dsBindDN' : master.getRootDn(),
'dsBindPwd' : master.getRootPwd()
}
</call>
<!-- Import data into "master" Directory Server -->
<call function="'ImportLdifWithScript'">
{ 'location' : masterHost,
'dsPath' : masterPath,
'backEnd' : DIRECTORY_INSTANCE_BE,
'ldifFile' : ldifFile
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{ 'returnString' : returnString,
'expectedString' : 'Processed 10002 entries'
}
</call>
<message>
'replication_search: Start DS running on %s:%s' % \
(masterHost, master.getPort())
</message>
<!-- Start the Directory Server -->
<call function="'StartDsWithScript'">
{ 'location' : masterHost,
'dsPath' : masterPath
}
</call>
<!-- Wait for DS to start -->
<call function="'isAlive'">
{ 'location' : masterHost,
'dsPath' : masterPath,
'dsInstanceHost' : masterHost,
'dsInstancePort' : master.getPort(),
'dsInstanceDn' : master.getRootDn(),
'dsInstancePswd' : master.getRootPwd(),
'noOfLoops' : 10,
'noOfMilliSeconds' : 5000
}
</call>
<!-- Perform the total update -->
<call function="'initializeReplication'">
{ 'location' : clientHost,
'dsPath' : clientPath,
'sourceInstanceHost' : masterHost,
'sourceInstanceAdminPort' : master.getAdminPort(),
'replicationDnList' : [synchroSuffix]
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<testcase name="getTestCaseName('Run ldclt clients')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'replication_search: Run ldclt search'
</message>
<!--<timer duration="timerDuration">
<sequence>-->
<parallel>
<block name="'ldclt-search-threads'">
<sequence>
<message>
'replication_search: search threads'
</message>
<script>
opt1 = '-e delayedstartup=1 -r %s -R %s' \
% (lowRange, highRange)
opt3 = '-N %s -I 32 -v -q' % ldcltLoop
opts = '%s %s %s' % (opt1, opt2, opt3)
</script>
<call function="'ldclt'">
{ 'location' : STAF_CLIENT_HOSTNAME,
'dsInstanceHost' : masterHost,
'dsInstancePort' : master.getPort(),
'dsInstanceDn' : master.getRootDn(),
'dsInstancePswd' : master.getRootPwd(),
'dsBaseDn' : baseDN,
'ldcltOptions' : opts,
'outputFile' : 'ldclt_search-%s.res' % suffix,
'outputPath' : ldcltDir
}
</call>
</sequence>
</block>
<block name="'ldclt-jvm'">
<sequence>
<loop from="1" to="jvmLoop" var="loop">
<sequence>
<message>
'LOOP %s out of %s' % (loop, jvmLoop)
</message>
<message>
'replication_search: save jvm information'
</message>
<call function="'ldapSearchWithScript'">
{ 'location' : masterHost,
'dsPath' : masterPath,
'dsInstanceHost' : masterHost,
'dsInstancePort' : master.getPort(),
'dsInstanceDn' : master.getRootDn(),
'dsInstancePswd' : master.getRootPwd(),
'dsBaseDN' : 'cn=JVM Memory Usage,cn=monitor',
'dsFilter' : 'objectclass=*',
'expectedRC' : 'noCheck',
'outputFile' : 'jvm_%s_%s.out' % (suffix, loop),
'outputPath' : masterDir
}
</call>
<if expr="loop != jvmLoop">
<call function="'Sleep'">
{ 'sleepForMilliSeconds' : jvmSleep }
</call>
</if>
</sequence>
</loop>
</sequence>
</block>
</parallel>
<!--</sequence>
</timer>
<script>timerRC = RC</script>
<if expr="timerRC == 0">
<sequence>
<message>'Timer exceeds %s' % timerDuration</message>
<tcstatus result="'fail'"/>
</sequence>
</if>-->
<message>
(ldcltDir, suffix, STAF_CLIENT_HOSTNAME, logs.sut, STAXServiceMachine)
</message>
<call function="'copyFile'">
{
'location' : STAF_CLIENT_HOSTNAME,
'remotehost' : STAXServiceMachine
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<testcase name="getTestCaseName('Check server is still running')">
<sequence>
<call function="'testCase_Preamble'"/>
<paralleliterate var="server" in="_topologyServerList" indexvar="i">
<sequence>
<script>
serverPath = '%s/%s' % (server.getDir(), OPENDSNAME)
</script>
<message>
'replication_search: Check server is still running on \
%s:%s' % (server.getHostname(), server.getPort())
</message>
<!-- Modify entry on one of the servers -->
<call function="'isAlive'">
{ 'location' : server.getHostname(),
'dsPath' : serverPath,
'dsInstanceHost' : server.getHostname(),
'dsInstancePort' : server.getPort(),
'dsInstanceDn' : server.getRootDn(),
'dsInstancePswd' : server.getRootPwd(),
'noOfLoops' : 10,
'noOfMilliSeconds' : 5000
}
</call>
</sequence>
</paralleliterate>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<testcase name="getTestCaseName('Verify replication')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'replication_search: Verify replication is still working'
</message>
<!-- Verify the replication is still working among the servers in
the topology -->
<call function="'verifyReplication'">
[ _topologyServerList, synchroSuffix ]
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<testcase name="getTestCaseName('Verify tree synchronization')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'replication_search: Verify the tree synchronization'
</message>
<!-- Verify the synchronization of the trees among the servers in
the topology -->
<call function="'verifyTrees'">
[ clientHost, clientPath, master, consumerList, synchroSuffix ]
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<import machine="STAF_LOCAL_HOSTNAME"
file="'%/functional-tests/testcases/replication/replication_cleanup.xml' % (TESTS_DIR)"/>
<call function="'replication_cleanup'">
{ 'suiteSuffix' : suffix }
</call>
<call function="'testSuite_Postamble'"/>
</sequence>
</block>
</sequence>
</function>
</stax>