resynchronization.xml revision d25372dc8e65a9ed019a88fdf659ca61313f1b31
<?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
! trunk/opends/resource/legal-notices/OpenDS.LICENSE
! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
! 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
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2007-2008 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="replication_resynchronization"/>
<function name="replication_resynchronization">
<sequence>
<block name="'resynchronization'">
<sequence>
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group']='replication'
CurrentTestPath['suite']=STAXCurrentBlock
</script>
<call function="'testSuite_Preamble'"/>
<!--- Test Suite information
#@TestSuiteName Replication Re-Synchronization Tests
#@TestSuitePurpose Verify that the servers in a replicated topology
can be initialised with an old backup and still
re-synchronize.
#@TestSuiteID Re-Synchronization Tests
#@TestSuiteGroup Re-Synchronization
#@TestGroup Replication
#@TestScript replication_resynchronization.xml
#@TestHTMLLink http://opends.dev.java.net/
-->
<import machine="STAF_LOCAL_HOSTNAME"
file="'%s/testcases/replication/replication_setup.xml'
% (TESTS_DIR)"/>
<call function="'replication_setup'">
{ 'dataFile' : 'Example.ldif' }
</call>
<!--- Test Case information
#@TestMarker Replication Re-Synchronization Tests
#@TestName Replication: Re-Synchronization: Off-line
initialisation
#@TestID Off-line initialisation
#@TestPurpose Initialise replicated servers using off-line
backup/restore
#@TestPreamble Back-up server A
#@TestSteps Add entry on server A
#@TestSteps Stop servers
#@TestSteps Restore back-up on other servers
#@TestSteps Start servers
#@TestPostamble
#@TestResult Success if trees synchronized
-->
<testcase name="getTestCaseName('Off-line initialisation')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Replication: Re-Synchronization: Off-line initialisation. \
Initialise replicated servers using off-line backup/restore'
</message>
<!-- Add entry to "master" server -->
<message>
'+++++ resynchronization off-line: add entry to %s:%s' \
% (masterHost, master.getPort())
</message>
<call function="'addEntry'">
{ 'location' : clientHost,
'dsPath' : clientPath,
'dsInstanceHost' : masterHost,
'dsInstancePort' : master.getPort(),
'dsInstanceDn' : master.getRootDn(),
'dsInstancePswd' : master.getRootPwd(),
'entryToBeAdded' : '%s/replication/tfitter.ldif' \
% clientDataDir
}
</call>
<!-- Stop the "consumer" servers -->
<call function="'stopServers'">
[consumerList]
</call>
<!-- Copy master backup to "consumer" servers and restore it -->
<paralleliterate var="consumer" in="consumerList">
<sequence>
<call function="'CopyFolderByExtension'">
{ 'location' : masterHost,
'remotehost' : consumer.getHostname(),
'srcfolder' : masterBackupDir,
'destfolder' : '%s/%s/replication/master_backup' \
% (consumer.getDir(),remote.reldatadir),
'extension' : '*'
}
</call>
<message>
'+++++ resynchronization off-line: restore backup on %s:%s'\
% (consumer.getHostname(), consumer.getPort())
</message>
<call function="'restore'">
{ 'location' : consumer.getHostname(),
'dsPath' : '%s/%s' % (consumer.getDir(), OPENDSNAME),
'backupDir' : '%s/%s/replication/master_backup' \
% (consumer.getDir(),remote.reldatadir)
}
</call>
</sequence>
</paralleliterate>
<!-- Start the "consumer" servers -->
<call function="'startServers'">
[consumerList]
</call>
<!-- 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>
<!--- Test Case information
#@TestMarker Replication Re-Synchronization Tests
#@TestName Replication: Re-Synchronization: On-line
initialisation
#@TestID On-line initialisation
#@TestPurpose Initialise replicated servers using on-line
backup/restore
#@TestPreamble
#@TestSteps Call dsreplication pre-external-initialization
#@TestSteps Import data on server A
#@TestSteps Back-up server A
#@TestSteps Add entry on server A
#@TestSteps Restore back-up on other servers
#@TestSteps Call dsreplication post-external-initialization
#@TestPostamble
#@TestResult Success if trees synchronized
-->
<testcase name="getTestCaseName('On-line initialisation')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Replication: Re-Synchronization: On-line initialisation. \
Initialise replicated servers using on-line backup/restore'
</message>
<!-- Pre-initialise the servers in the topology -->
<message>
'+++++ resynchronization on-line: prepare servers for external \
initialization'
</message>
<call function="'preInitializeReplication'">
{ 'location' : clientHost,
'dsPath' : clientPath,
'dsInstanceHost' : masterHost,
'dsInstanceAdminPort' : master.getAdminPort(),
'localOnly' : False,
'replicationDnList' : [synchroSuffix],
'adminUID' : adminUID,
'adminPswd' : adminPswd
}
</call>
<!-- Import data into "master" server -->
<message>
'+++++ resynchronization on-line: import data on %s:%s' \
% (masterHost, master.getPort())
</message>
<call function="'importLdifTask'">
{ 'location' : clientHost,
'dsPath' : clientPath,
'dsInstanceHost' : masterHost,
'dsInstancePort' : master.getPort(),
'dsInstanceDn' : master.getRootDn(),
'dsInstancePswd' : master.getRootPwd(),
'taskID' : 'import task',
'ldifFile' : '%s/replication/Example.ldif' \
% masterDataDir
}
</call>
<!-- Check some data was imported into "master" server -->
<call function="'checkImport'">
{ 'location' : clientHost,
'dsPath' : clientPath,
'dsHost' : masterHost,
'dsPort' : master.getPort(),
'dsAdminPort' : master.getAdminPort(),
'dsDn' : master.getRootDn(),
'dsPswd' : master.getRootPwd(),
'expectedEntries' : ['uid=scarter,ou=People,o=example',
'uid=dmiller, ou=People, o=example',
'uid=rhunt, ou=People, o=example'],
'startDS' : 'no'
}
</call>
<!-- Backup "master" server -->
<message>
'+++++ resynchronization on-line: back-up server %s:%s' \
% (masterHost, master.getPort())
</message>
<call function="'backupTask'">
{ 'location' : clientHost,
'dsPath' : clientPath,
'dsInstanceHost' : masterHost,
'dsInstancePort' : master.getPort(),
'dsInstanceDn' : master.getRootDn(),
'dsInstancePswd' : master.getRootPwd(),
'taskID' : 'backup task',
'backupDir' : '%s/replication/master_backup_online' \
% masterDataDir
}
</call>
<!-- Add entry to "master" server -->
<message>
'+++++ resynchronization on-line: add entry to %s:%s' \
% (masterHost, master.getPort())
</message>
<call function="'addEntry'">
{ 'location' : clientHost,
'dsPath' : clientPath,
'dsInstanceHost' : masterHost,
'dsInstancePort' : master.getPort(),
'dsInstanceDn' : master.getRootDn(),
'dsInstancePswd' : master.getRootPwd(),
'entryToBeAdded' : '%s/replication/tfitter.ldif' \
% clientDataDir
}
</call>
<!-- Copy backup to "consumer" servers and restore it -->
<paralleliterate var="consumer" in="consumerList">
<sequence>
<call function="'CopyFolderByExtension'">
{ 'location' : masterHost,
'remotehost' : consumer.getHostname(),
'srcfolder' : '%s/replication/master_backup_online' \
% masterDataDir,
'destfolder' : '%s/%s/replication/master_backup_online' \
% (consumer.getDir(),remote.reldatadir),
'extension' : '*'
}
</call>
<message>
'+++++ resynchronization on-line: restore back-up on %s:%s'\
% (consumer.getHostname(), consumer.getPort())
</message>
<call function="'restoreTask'">
{ 'location' : clientHost,
'dsPath' : clientPath,
'dsInstanceHost' : consumer.getHostname(),
'dsInstancePort' : consumer.getPort(),
'dsInstanceDn' : consumer.getRootDn(),
'dsInstancePswd' : consumer.getRootPwd(),
'taskID' : 'restore task',
'backupDir' : '%s/%s/replication/master_backup_online' \
% (consumer.getDir(),remote.reldatadir)
}
</call>
</sequence>
</paralleliterate>
<!-- Post-initialise the servers in the topology -->
<message>
'+++++ resynchronization on-line: end external server \
initialization'
</message>
<call function="'postInitializeReplication'">
{ 'location' : clientHost,
'dsPath' : clientPath,
'dsInstanceHost' : masterHost,
'dsInstanceAdminPort' : master.getAdminPort(),
'replicationDnList' : [synchroSuffix],
'adminUID' : adminUID,
'adminPswd' : adminPswd
}
</call>
<!-- 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="'%s/testcases/replication/replication_cleanup.xml'
% (TESTS_DIR)"/>
<call function="'replication_cleanup'" />
<call function="'testSuite_Postamble'"/>
</sequence>
</block>
</sequence>
</function>
</stax>