<?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_add_delete"/>
<function name="replication_add_delete">
<sequence>
<block name="'replication-add-delete'">
<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
ldcltDir = '%s/ldclt_dir' % TMPDIR
ldcltTemplate = '%s/ldclt_add.template' % ldcltDir
masterDir = '%s/..' % masterPath
suffix = 'add_delete'
consumer = _topologyServerList[1]
</script>
<testcase name="getTestCaseName('Preamble')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'replication_add_delete: Delete %s on %s' \
% (ldcltDir, STAF_CLIENT_HOSTNAME)
</message>
<call function="'deleteFolder'">
{
'location' : STAF_CLIENT_HOSTNAME ,
'foldername' : ldcltDir
}
</call>
<message>
'replication_add_delete: Create %s on %s' \
% (ldcltDir, STAF_CLIENT_HOSTNAME)
</message>
<call function="'createFolder'">
{
'location' : STAF_CLIENT_HOSTNAME ,
'foldername' : ldcltDir
}
</call>
<message>
'replication_add_delete: Create ldclt template'
</message>
<call function="'MakeALdcltTemplate'">
{
'templateFile' : ldcltTemplate ,
'templateLocation' : STAF_CLIENT_HOSTNAME
}
</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>
<!-- 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_add_delete: Run ldclt add'
</message>
<!--<timer duration="timerDuration">
<sequence>-->
<parallel>
<block name="'ldclt-add-threads'">
<sequence>
<message>
'replication_add_delete: add threads'
</message>
<script>
opt1 = '-e delayedstartup=1 -e object=%s' % ldcltTemplate
opt2 = '-e "rdn=uid:user.[C=INCRN(%s;%s;6)]"' \
% (lowRange, highRange)
opt3 = '-e add -N %s -I 68 -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_add-%s.res' % suffix,
'outputPath' : ldcltDir
}
</call>
</sequence>
</block>
<block name="'ldclt-delete-threads'">
<sequence>
<call function="'Sleep'">
{ 'sleepForMilliSeconds' : 120000 }
</call>
<message>
'replication_add_delete: delete threads'
</message>
<script>
opt1 = '-e delayedstartup=1'
opt2 = '-e delete,rdn=\"uid:user.[RNDN(%s;%s;6)]\"' \
% (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_delete-%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_add_delete: 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>
<!-- 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_add-%s.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_add-%s.res' % (ldcltDir, suffix),
'destfile' : '%s/ldclt_add-%s.res' % (logs.sut, suffix),
'remotehost' : STAXServiceMachine
}
</call>
<message>
'Copy %s/ldclt_delete-%s.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_delete-%s.res' % (ldcltDir, suffix),
'destfile' : '%s/ldclt_delete-%s.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_add_delete: 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_add_delete: 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_add_delete: 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>