| | |
| | | ! 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. |
| | | ! trunk/opends/resource/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 |
| | | ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | ! trunk/opends/resource/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 2007-2010 Sun Microsystems, Inc. |
| | | ! Portions Copyright 2011-2012 ForgeRock AS. |
| | | ! Copyright 2012 ForgeRock AS. |
| | | ! --> |
| | | <stax> |
| | | <defaultcall function="replication_binarycopy"/> |
| | | <function name="replication_binarycopy"> |
| | | <function name="replication_binarycopy" scope="local"> |
| | | <sequence> |
| | | <block name="'binarycopy'"> |
| | | <sequence> |
| | | <script> |
| | | if not CurrentTestPath.has_key('group'): |
| | | CurrentTestPath['group']='replication' |
| | | CurrentTestPath['suite']=STAXCurrentBlock |
| | | </script> |
| | | <call function="'testSuite_Preamble'"/> |
| | | <!--- Test Suite information |
| | | #@TestSuiteName Replication Binary Copy Tests |
| | | #@TestSuitePurpose Verify that the servers in a replicated topology |
| | | can be initialised by the means of a binary copy |
| | | (backup-restore). |
| | | #@TestSuiteID Binary Copy Tests |
| | | #@TestSuiteGroup Binary Copy |
| | | #@TestGroup Replication |
| | | #@TestScript replication_binarycopy.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'" > |
| | | { 'label' : 'Replication Binarycopy' } |
| | | </call> |
| | | |
| | | |
| | | <!--- Test Case information |
| | | #@TestMarker Replication Binary Copy Tests |
| | | #@TestName Replication: Binary Copy: Off-line |
| | | initialisation |
| | | #@TestID Off-line initialisation |
| | | #@TestPurpose Initialise replicated servers using off-line |
| | | backup/restore |
| | | #@TestPreamble |
| | | #@TestSteps Call dsreplication pre-external-initialization |
| | | #@TestSteps Stop servers |
| | | #@TestSteps Import data on server A |
| | | #@TestSteps Back-up server A |
| | | #@TestSteps Restore back-up on other servers |
| | | #@TestSteps Start servers |
| | | #@TestSteps Call dsreplication post-external-initialization |
| | | #@TestSteps Add entry on server A |
| | | #@TestPostamble |
| | | #@TestResult Success if trees synchronized |
| | | --> |
| | | <testcase name="getTestCaseName('Off-line initialisation')"> |
| | | <sequence> |
| | | <call function="'testCase_Preamble'"/> |
| | | <script> |
| | | m = md5_hash() |
| | | m.update(STAXCurrentTestcase) |
| | | </script> |
| | | <message> |
| | | 'Replication: Binary Copy: Off-line initialisation. \ |
| | | Initialise replicated servers using off-line backup/restore' |
| | | </message> |
| | | |
| | | |
| | | <!-- Pre-initialise the servers in the topology --> |
| | | <message> |
| | | '+++++ binary copy off-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> |
| | | |
| | | <!-- Stop the servers in the topology --> |
| | | <call function="'stopServers'"> |
| | | [_topologyServerList] |
| | | </call> |
| | | <block name="'replication_binarycopy'"> |
| | | <try> |
| | | <sequence> |
| | | <script> |
| | | CurrentTestPath['group'] = 'replication' |
| | | CurrentTestPath['suite'] = 'binarycopy' |
| | | |
| | | <!-- Import data into "master" server --> |
| | | <message> |
| | | '+++++ binary copy off-line: import data on %s:%s' \ |
| | | % (masterHost, master.getPort()) |
| | | </message> |
| | | <call function="'ImportLdifWithScript'"> |
| | | { 'location' : masterHost, |
| | | 'dsPath' : masterPath, |
| | | 'backEnd' : DIRECTORY_INSTANCE_BE, |
| | | 'ldifFile' : '%s/replication/Example.ldif' % masterDataDir |
| | | } |
| | | </call> |
| | | |
| | | <!-- Backup "master" server --> |
| | | <message> |
| | | '+++++ binary copy off-line: back-up server %s:%s' \ |
| | | % (masterHost, master.getPort()) |
| | | </message> |
| | | <call function="'backup'"> |
| | | { 'location' : masterHost, |
| | | 'dsPath' : masterPath, |
| | | 'backupDir' : '%s/replication/master_backup_%s' \ |
| | | % (masterBackupDir,m.hexdigest()) |
| | | } |
| | | </call> |
| | | _group=CurrentTestPath['group'] |
| | | _groupdir='%s/testcases/%s' % (TESTS_DIR,_group) |
| | | _label = 'Replication BinaryCopy' |
| | | </script> |
| | | |
| | | <!-- Copy backup to "consumer" servers and restore it --> |
| | | <paralleliterate var="consumer" in="consumerList"> |
| | | <sequence> |
| | | <script> |
| | | consumerBackupDir = '%s' % consumer.getTmpDir() |
| | | </script> |
| | | <call function="'CopyFolderByExtension'"> |
| | | { 'location' : masterHost, |
| | | 'remotehost' : consumer.getHostname(), |
| | | 'srcfolder' : '%s/replication/master_backup_%s' \ |
| | | % (masterBackupDir,m.hexdigest()), |
| | | 'destfolder' : '%s/replication/master_backup_%s' \ |
| | | % (consumerBackupDir,m.hexdigest()), |
| | | 'extension' : '*' |
| | | } |
| | | </call> |
| | | |
| | | <message> |
| | | '+++++ binary copy off-line: restore back-up on %s:%s' \ |
| | | % (consumer.getHostname(), consumer.getPort()) |
| | | </message> |
| | | <call function="'restore'"> |
| | | { 'location' : consumer.getHostname(), |
| | | 'dsPath' : '%s/%s' % (consumer.getDir(), OPENDSNAME), |
| | | 'backupDir' : '%s/replication/master_backup_%s' \ |
| | | % (consumerBackupDir,m.hexdigest()) |
| | | } |
| | | </call> |
| | | </sequence> |
| | | </paralleliterate> |
| | | |
| | | <!-- Start the servers in the topology --> |
| | | <call function="'startServers'"> |
| | | [_topologyServerList] |
| | | </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> |
| | | |
| | | <!-- Post-initialise the servers in the topology --> |
| | | <message> |
| | | '+++++ binary copy off-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> |
| | | |
| | | <!-- Add entry to "master" server --> |
| | | <message> |
| | | '+++++ binary copy 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> |
| | | |
| | | <!-- 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 Binary Copy Tests |
| | | #@TestName Replication: Binary Copy: 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 Restore back-up on other servers |
| | | #@TestSteps Call dsreplication post-external-initialization |
| | | #@TestSteps Add entry on server A |
| | | #@TestPostamble |
| | | #@TestResult Success if trees synchronized |
| | | --> |
| | | <testcase name="getTestCaseName('On-line initialisation')"> |
| | | <sequence> |
| | | <call function="'testCase_Preamble'"/> |
| | | <script> |
| | | m = md5_hash() |
| | | m.update(STAXCurrentTestcase) |
| | | </script> |
| | | <message> |
| | | 'Replication: Binary Copy: On-line initialisation. Initialise \ |
| | | replicated servers using on-line backup/restore' |
| | | </message> |
| | | |
| | | <!-- Pre-initialise the servers in the topology --> |
| | | <message> |
| | | '+++++ binary copy 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> |
| | | '+++++ binary copy on-line: import data on %s:%s' \ |
| | | % (masterHost, master.getPort()) |
| | | </message> |
| | | <call function="'ImportLdifWithScript'"> |
| | | { 'location' : clientHost, |
| | | 'dsPath' : clientPath, |
| | | 'dsInstanceHost' : masterHost, |
| | | 'dsInstanceAdminPort' : master.getAdminPort(), |
| | | 'dsInstanceDn' : master.getRootDn(), |
| | | 'dsInstancePswd' : master.getRootPwd(), |
| | | '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> |
| | | '+++++ binary copy 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_%s' \ |
| | | % (masterBackupDir,m.hexdigest()) |
| | | } |
| | | </call> |
| | | |
| | | <!-- Copy backup to "consumer" servers and restore it --> |
| | | <paralleliterate var="consumer" in="consumerList"> |
| | | <sequence> |
| | | <script> |
| | | consumerBackupDir = '%s' % consumer.getTmpDir() |
| | | </script> |
| | | |
| | | <call function="'CopyFolderByExtension'"> |
| | | { 'location' : masterHost, |
| | | 'remotehost' : consumer.getHostname(), |
| | | 'srcfolder' : '%s/replication/master_backup_%s' \ |
| | | % (masterBackupDir,m.hexdigest()), |
| | | 'destfolder' : '%s/replication/master_backup_%s' \ |
| | | % (consumerBackupDir,m.hexdigest()), |
| | | 'extension' : '*' |
| | | } |
| | | </call> |
| | | <!--- Test Suite information |
| | | #@TestSuiteName Replication BinaryCopy Tests |
| | | #@TestSuitePurpose Verify that the total-update operations are replicated |
| | | correctly between two servers. |
| | | #@TestSuiteID BinaryCopy Tests |
| | | #@TestSuiteGroup BinaryCopy |
| | | #@TestGroup Replication |
| | | #@TestScript replication_binarycopy.xml |
| | | #@TestHTMLLink http://www.forgerock.org/ |
| | | --> |
| | | |
| | | <message> |
| | | '+++++ binary copy on-line: restore back-up on %s:%s' \ |
| | | % (consumer.getHostname(), consumer.getPort()) |
| | | <call function="'testSuite_Preamble'"/> |
| | | |
| | | <try> |
| | | <sequence> |
| | | |
| | | <import machine="STAF_LOCAL_HOSTNAME" |
| | | file="'%s/testcases/replication/replication_setup.xml' |
| | | % (TESTS_DIR)"/> |
| | | <call function="'replication_setup'" > |
| | | { 'label' : _label } |
| | | </call> |
| | | |
| | | <!-- List of Import of Test Functions --> |
| | | <script> |
| | | importList=[] |
| | | importList.append('binarycopy/binarycopy_tests') |
| | | </script> |
| | | |
| | | <!-- Import the files for this test suite --> |
| | | <iterate var="_import" in="importList"> |
| | | <import machine="STAF_LOCAL_HOSTNAME" |
| | | file="'%s/%s.xml' % (_groupdir,_import)"/> |
| | | </iterate> |
| | | |
| | | <!-- Specific to replication tests --> |
| | | <script> |
| | | msg1 = 'Replication: BinaryCopy:' |
| | | </script> |
| | | |
| | | <!-- List of Test Cases --> |
| | | <script> |
| | | testsList=[] |
| | | testsList.append('replication_binarycopy_001') |
| | | testsList.append('replication_binarycopy_002') |
| | | </script> |
| | | |
| | | <!-- Execute the Tests --> |
| | | <iterate var="__test" in="testsList"> |
| | | <sequence> |
| | | <call function="'%s' % (__test)" /> |
| | | </sequence> |
| | | </iterate> |
| | | |
| | | </sequence> |
| | | |
| | | <catch exception="'STAFException.TestSuite.SetupException'"> |
| | | <sequence> |
| | | <message log="1" level="'fatal'"> |
| | | 'Setup of test suite failed.' |
| | | </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/replication/master_backup_%s' \ |
| | | % (consumerBackupDir,m.hexdigest()) |
| | | } |
| | | </call> |
| | | <rethrow/> |
| | | </sequence> |
| | | </paralleliterate> |
| | | |
| | | <!-- Post-initialise the servers in the topology --> |
| | | <message> |
| | | '+++++ binary copy 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> |
| | | |
| | | <!-- Add entry to "master" server --> |
| | | <message> |
| | | '+++++ binary copy 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> |
| | | |
| | | <!-- 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> |
| | | </catch> |
| | | |
| | | <finally> |
| | | <message>'Test Cases Completed.'</message> |
| | | </finally> |
| | | |
| | | </try> |
| | | |
| | | </sequence> |
| | | |
| | | <import machine="STAF_LOCAL_HOSTNAME" |
| | | file="'%s/testcases/replication/replication_cleanup.xml' |
| | | % (TESTS_DIR)"/> |
| | | <call function="'replication_cleanup'" > |
| | | { 'label' : 'Replication Binarycopy' } |
| | | </call> |
| | | <call function="'testSuite_Postamble'"/> |
| | | </sequence> |
| | | <finally> |
| | | <sequence> |
| | | <!-- Test Suite Cleanup --> |
| | | <message>'Finally: Replication Cleanup.'</message> |
| | | <try> |
| | | <sequence> |
| | | <import machine="STAF_LOCAL_HOSTNAME" |
| | | file="'%s/testcases/replication/replication_cleanup.xml' |
| | | % (TESTS_DIR)"/> |
| | | <call function="'replication_cleanup'"> |
| | | { 'label' : _label } |
| | | </call> |
| | | </sequence> |
| | | <catch exception="'STAFException'"> |
| | | <sequence> |
| | | <message log="1" level="'fatal'">'Cleanup of test suite failed.'</message> |
| | | </sequence> |
| | | </catch> |
| | | <finally> |
| | | <call function="'testSuite_Postamble'"/> |
| | | </finally> |
| | | </try> |
| | | </sequence> |
| | | </finally> |
| | | |
| | | </try> |
| | | </block> |
| | | </sequence> |
| | | </function> |