<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
<!--
! 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
! or http://forgerock.org/license/CDDLv1.0.html.
! 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_modifyrdn_multiple"/>
<function name="replication_modifyrdn_multiple">
<sequence>
<block name="'replication-modifyrdn-multiple'">
<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
server1Host = server1.getHostname()
server1Path = '%s/%s' % (server1.getDir(),OPENDSNAME)
server1Dir = server1.getDir()
server2Host = server2.getHostname()
server2Path = '%s/%s' % (server2.getDir(),OPENDSNAME)
server2Dir = server2.getDir()
ldifTemplate = '%s/%s_entries.template' \
% (server1Dir, numberOfEntries)
ldifFile = '%s/%s_entries.ldif' \
% (server1Dir, numberOfEntries)
totalEntries = numberOfEntries + 2
suffix = 'modifyrdn_multiple'
consumer = _topologyServerList[1]
</script>
<testcase name="getTestCaseName('Preamble')">
<sequence>
<call function="'testCase_Preamble'"/>
<!-- Check if 'ldifFile' exists -->
<call function="'GetEntry'">
{
'location' : server1Host ,
'entry' : ldifFile ,
'attribute' : 'TYPE'
}
</call>
<if expr="RC == 48">
<sequence>
<message>
'replication_modifyrdn_multiple: File %s does not exist, create it' \
% ldifFile
</message>
<message>
'replication_modifyrdn_multiple: Make a make-ldif template file'
</message>
<call function="'MakeAMakeLdifTemplate'">
{
'numEntries' : numberOfEntries,
'suffix' : synchroSuffix,
'startFrom' : lowRange,
'additionalAttributes' : True,
'templateFile' : ldifTemplate,
'templateLocation' : server1Host
}
</call>
<message>
'replication_modifyrdn_multiple: Make the ldif file'
</message>
<call function="'MakeLdifWithScript'">
{
'location' : server1Host,
'dsPath' : server1Path,
'templateFile' : ldifTemplate,
'ldifFile' : ldifFile
}
</call>
</sequence>
<else>
<message>
'replication_modifyrdn_multiple: File %s exists, do nothing' % ldifFile
</message>
</else>
</if>
<message>
'replication_modifyrdn_multiple: Import large ldif file'
</message>
<!-- Stop "server1" Directory Server -->
<call function="'StopDsWithScript'">
{ 'location' : server1Host,
'dsPath' : server1Path,
'dsHost' : server1Host,
'dsAdminPort' : server1.getAdminPort(),
'dsBindDN' : server1.getRootDn(),
'dsBindPwd' : server1.getRootPwd()
}
</call>
<!-- Import data into "server1" Directory Server -->
<call function="'ImportLdifWithScript'">
{ 'location' : server1Host,
'dsPath' : server1Path,
'dsBackEnd' : DIRECTORY_INSTANCE_BE,
'dsLdifFile' : ldifFile
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{ 'returnString' : returnString,
'expectedString' : 'Processed %s entries' % totalEntries
}
</call>
<message>
'replication_modifyrdn_multiple: Start DS running on %s:%s' % \
(server1Host, server1.getPort())
</message>
<!-- Start the Directory Server -->
<call function="'StartDsWithScript'">
{ 'location' : server1Host,
'dsPath' : server1Path
}
</call>
<!-- Wait for DS to start -->
<call function="'isAlive'">
{ 'location' : server1Host,
'dsPath' : server1Path,
'dsInstanceHost' : server1Host,
'dsInstancePort' : server1.getPort(),
'dsInstanceDn' : server1.getRootDn(),
'dsInstancePswd' : server1.getRootPwd(),
'noOfLoops' : 10,
'noOfMilliSeconds' : 5000
}
</call>
<!-- Perform the total update -->
<call function="'initializeReplication'">
{ 'location' : clientHost,
'dsPath' : clientPath,
'sourceInstanceHost' : server1Host,
'sourceInstanceAdminPort' : server1.getAdminPort(),
'replicationDnList' : [synchroSuffix]
}
</call>
<!-- If the External Changelog is to be tested, install an
! stand-alone instance whereto replay the changes -->
<if expr="globalTestExternalChangelog">
<sequence>
<message>
'Test ECL: Install stand-alone instance whereto replay \
changes'
</message>
<!-- Create instance with default parameters read from
! config.py -->
<script>
standaloneServer = Server(DIRECTORY_INSTANCE_HOST,
DIRECTORY_INSTANCE_DIR,
DIRECTORY_INSTANCE_PORT,
DIRECTORY_INSTANCE_ADMIN_PORT,
DIRECTORY_INSTANCE_SSL_PORT,
None,
master.getRootDn(),
master.getRootPwd(),
synchroSuffix)
</script>
<call function="'createInstance'">
{ 'dsHost' : standaloneServer.getHostname(),
'dsDir' : standaloneServer.getDir(),
'dsPort' : standaloneServer.getPort(),
'dsAdminPort' : standaloneServer.getAdminPort(),
'dsSslPort' : standaloneServer.getSslPort(),
'dsJmxPort' : standaloneServer.getJmxPort(),
'dsBindDN' : standaloneServer.getRootDn(),
'dsBindPwd' : standaloneServer.getRootPwd(),
'dsBaseDN' : standaloneServer.getBaseDn()
}
</call>
<!-- Copy ldif file from "master" -->
<script>
standaloneLdifFile = '%s/%s_entries.ldif' \
% (standaloneServer.getDir(), numberOfEntries)
</script>
<if expr="masterHost != standaloneServer.getHostname()">
<call function="'copyFile'">
{ 'location' : masterHost,
'srcfile' : ldifFile,
'destfile' : standaloneLdifFile,
'remotehost' : standaloneServer.getHostname()
}
</call>
<else>
<script>
standaloneLdifFile = ldifFile
</script>
</else>
</if>
<!-- Import same data imported into "master" -->
<call function="'ImportLdifWithScript'">
{ 'location' : standaloneServer.getHostname(),
'dsPath' : '%s/%s' % \
(standaloneServer.getDir(), OPENDSNAME),
'dsBackEnd' : DIRECTORY_INSTANCE_BE,
'dsLdifFile' : standaloneLdifFile
}
</call>
<!-- Start the stand-alone Directory Server -->
<call function="'StartDsWithScript'">
{ 'location' : standaloneServer.getHostname() }
</call>
</sequence>
</if>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<testcase name="getTestCaseName('Run ldclt clients')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'replication_modifyrdn_multiple: Run ldclt add'
</message>
<!--<timer duration="timerDuration">
<sequence>-->
<parallel>
<block name="'ldclt-modifyrdn-threads-server1'">
<sequence>
<message>
'replication_modifyrdn: modifyrdn threads on %s:%s' \
% (server1Host, server1.getPort())
</message>
<script>
opt1 = '-e delayedstartup=1'
opt2 = '-e rename,rdn=\"uid:user.[RNDN(%s;%s;6)]\"' \
% (lowRange, highRange)
opt3 = '-N %s -I 68 -I 32 -v -q' % ldcltLoop
opts = '%s %s %s' % (opt1, opt2, opt3)
</script>
<call function="'ldclt'">
{ 'location' : STAF_CLIENT_HOSTNAME,
'dsInstanceHost' : server1Host,
'dsInstancePort' : server1.getPort(),
'dsInstanceDn' : server1.getRootDn(),
'dsInstancePswd' : server1.getRootPwd(),
'dsBaseDn' : baseDN,
'ldcltOptions' : opts,
'outputFile' : 'ldclt_modifyrdn-%s_1.res' % suffix,
'outputPath' : ldcltDir
}
</call>
</sequence>
</block>
<block name="'ldclt-modifyrdn-threads-server2'">
<sequence>
<message>
'replication_modifyrdn: modifyrdn threads on %s:%s' \
% (server2Host, server2.getPort())
</message>
<script>
opt1 = '-e delayedstartup=1'
opt2 = '-e rename,rdn=\"uid:user.[RNDN(%s;%s;6)]\"' \
% (lowRange, highRange)
opt3 = '-N %s -I 68 -I 32 -v -q' % ldcltLoop
opts = '%s %s %s' % (opt1, opt2, opt3)
</script>
<call function="'ldclt'">
{ 'location' : STAF_CLIENT_HOSTNAME,
'dsInstanceHost' : server2Host,
'dsInstancePort' : server2.getPort(),
'dsInstanceDn' : server2.getRootDn(),
'dsInstancePswd' : server2.getRootPwd(),
'dsBaseDn' : baseDN,
'ldcltOptions' : opts,
'outputFile' : 'ldclt_modifyrdn-%s_2.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_modifyrdn_multiple: save jvm information'
</message>
<call function="'ldapSearchWithScript'">
{ 'location' : server1Host,
'dsPath' : server1Path,
'dsInstanceHost' : server1Host,
'dsInstancePort' : server1.getPort(),
'dsInstanceDn' : server1.getRootDn(),
'dsInstancePswd' : server1.getRootPwd(),
'dsBaseDN' : 'cn=JVM Memory Usage,cn=monitor',
'dsFilter' : 'objectclass=*',
'expectedRC' : 'noCheck',
'outputFile' : 'jvm_%s_%s.out' \
% (suffix, loop),
'outputPath' : server1Dir
}
</call>
<call function="'ldapSearchWithScript'">
{ 'location' : server2Host,
'dsPath' : server2Path,
'dsInstanceHost' : server2Host,
'dsInstancePort' : server2.getPort(),
'dsInstanceDn' : server2.getRootDn(),
'dsInstancePswd' : server2.getRootPwd(),
'dsBaseDN' : 'cn=JVM Memory Usage,cn=monitor',
'dsFilter' : 'objectclass=*',
'expectedRC' : 'noCheck',
'outputFile' : 'jvm_%s_%s.out' \
% (suffix, loop),
'outputPath' : server2Dir
}
</call>
<if expr="loop != jvmLoop">
<call function="'Sleep'">
{ 'sleepForMilliSeconds' : jvmSleep }
</call>
</if>
</sequence>
</loop>
</sequence>
</block>
<!-- If the External Changelog is to be tested, install an
! stand-alone instance whereto replay the changes -->
<if expr="globalTestExternalChangelog">
<block name="'ecl-test'">
<sequence>
<message>
'replication_modify: Test ECL: Read and replay \
changes'
</message>
<call function="'eclReadAndPlay'">
{ 'location' : standaloneServer.getHostname(),
'standaloneHost' : standaloneServer.getHostname(),
'standalonePort' : standaloneServer.getPort(),
'replicaHost1' : consumer.getHostname(),
'replicaPort1' : consumer.getPort(),
'replicaHost2' : masterHost,
'replicaPort2' : master.getPort(),
'bindDn' : master.getRootDn(),
'bindPswd' : master.getRootPwd(),
'eclMode' : globalExternalChangelogMode,
'queueSize' : 1000,
'outputFilename' : '%s/eclReadAndPlay.output' \
% standaloneServer.getDir()
}
</call>
</sequence>
</block>
</if>
</parallel>
<!--</sequence>
</timer>
<script>timerRC = RC</script>
<if expr="timerRC == 0">
<sequence>
<message>'Timer exceeds %s' % timerDuration</message>
<tcstatus result="'fail'"/>
</sequence>
</if>-->
<message>
'Copy %s/ldclt_modifyrdn-%s_1.res from %s to %s on %s' % \
(ldcltDir, suffix, STAF_CLIENT_HOSTNAME, logs.sut, STAXServiceMachine)
</message>
<call function="'copyFile'">
{
'location' : STAF_CLIENT_HOSTNAME,
'srcfile' : '%s/ldclt_modifyrdn-%s_1.res' % (ldcltDir, suffix),
'destfile' : '%s/ldclt_modiryrdn-%s_1.res' % (logs.sut, suffix),
'remotehost' : STAXServiceMachine
}
</call>
<message>
'Copy %s/ldclt_modifyrdn-%s_2.res from %s to %s on %s' % \
(ldcltDir, suffix, STAF_CLIENT_HOSTNAME, logs.sut, STAXServiceMachine)
</message>
<call function="'copyFile'">
{
'location' : STAF_CLIENT_HOSTNAME,
'srcfile' : '%s/ldclt_modifyrdn-%s_2.res' % (ldcltDir, suffix),
'destfile' : '%s/ldclt_modifyrdn-%s_2.res' % (logs.sut, suffix),
'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_modifyrdn_multiple: 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_modifyrdn_multiple: 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_modifyrdn_multiple: 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>
<!-- If the External Changelog is to be tested, verify the
! synchronisation of the tree in the stand-alone instance -->
<if expr="globalTestExternalChangelog">
<testcase name="getTestCaseName('Verify stand-alone server tree synchronization')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'replication_modify: Verify the stand-alone server tree \
synchronization'
</message>
<script>
attrsToIgnoreFile = '%s/ignoreAttrsFile.ldifdiff' % \
clientDataDir
tmpFile = '%s/ignoreAttrsFile.ldifdiff' % TMPDIR
ignoreAttrs = []
ignoreAttrs.append('ds-sync-generation-id')
ignoreAttrs.append('ds-sync-hist')
ignoreAttrs.append('ds-sync-state')
ignoreAttrs.append('createTimestamp')
ignoreAttrs.append('modifyTimestamp')
# write out the ldif file
outfile = open(tmpFile,"w")
for line in ignoreAttrs:
outfile.write("%s\n" % line)
outfile.close()
</script>
<if expr="clientHost != STAXServiceMachine">
<call function="'copyFile'">
{ 'location' : masterHost,
'srcfile' : tmpFile,
'destfile' : attrsToIgnoreFile,
'remotehost' : clientHost
}
</call>
<else>
<script>
attrsToIgnoreFile = tmpFile
</script>
</else>
</if>
<!-- Verify the synchronization of the trees among the servers in
the topology -->
<call function="'verifyTrees'">
[ clientHost, clientPath, master, [standaloneServer],
synchroSuffix, None, attrsToIgnoreFile ]
</call>
<!-- Stop the stand-alone Directory Server -->
<call function="'StopDsWithScript'">
{ 'location' : standaloneServer.getHostname() }
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
</if>
<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>