| | |
| | | ! 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_ldifimport"/> |
| | | |
| | | <function name="replication_ldifimport"> |
| | | |
| | | <function name="replication_ldifimport" scope="local"> |
| | | <sequence> |
| | | |
| | | <block name="'ldifimport'"> |
| | | |
| | | <sequence> |
| | | |
| | | <script> |
| | | if not CurrentTestPath.has_key('group'): |
| | | CurrentTestPath['group']='replication' |
| | | CurrentTestPath['suite']=STAXCurrentBlock |
| | | </script> |
| | | |
| | | <call function="'testSuite_Preamble'"/> |
| | | |
| | | <!--- Test Suite information |
| | | #@TestSuiteName Replication Ldif Import Tests |
| | | #@TestSuitePurpose Verify that the servers in a replicated topology |
| | | can be initialised by the means of an ldif |
| | | import. |
| | | #@TestSuiteID Ldif Import Tests |
| | | #@TestSuiteGroup Ldif Import |
| | | #@TestGroup Replication |
| | | #@TestScript replication_ldifimport.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 LDIFimport' } |
| | | </call> |
| | | |
| | | |
| | | <!--- Test Case information |
| | | #@TestMarker Replication Ldif Import Tests |
| | | #@TestName Replication: Ldif Import: Off-line |
| | | initialisation |
| | | #@TestID Off-line initialisation |
| | | #@TestPurpose Initialise replicated servers using off-line |
| | | export/import |
| | | #@TestPreamble |
| | | #@TestSteps Call dsreplication pre-external-initialization |
| | | #@TestSteps Stop servers |
| | | #@TestSteps Import data on server A |
| | | #@TestSteps Export suffix on server A |
| | | #@TestSteps Import exported file 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'"/> |
| | | <message> |
| | | 'Replication: Ldif Import: Off-line initialisation. \ |
| | | Initialise replicated servers using off-line export/import' |
| | | </message> |
| | | |
| | | <!-- Pre-initialise the servers in the topology --> |
| | | <message> |
| | | '+++++ ldif import 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_ldifimport'"> |
| | | <try> |
| | | <sequence> |
| | | <script> |
| | | CurrentTestPath['group'] = 'replication' |
| | | CurrentTestPath['suite'] = 'ldifimport' |
| | | |
| | | |
| | | <!-- Import data into "master" server --> |
| | | <message> |
| | | '+++++ ldif import 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> |
| | | _group=CurrentTestPath['group'] |
| | | _groupdir='%s/testcases/%s' % (TESTS_DIR,_group) |
| | | _label = 'Replication LDIFImport' |
| | | </script> |
| | | |
| | | <!-- Export data from "master" server --> |
| | | <message> |
| | | '+++++ ldif import off-line: export suffix on server %s:%s' \ |
| | | % (masterHost, master.getPort()) |
| | | </message> |
| | | <call function="'exportLdifWithScript'"> |
| | | { 'location' : masterHost, |
| | | 'dsPath' : masterPath, |
| | | 'ldifFile' : '%s/replication/master_export_offline.ldif' \ |
| | | % masterBackupDir |
| | | } |
| | | </call> |
| | | |
| | | <!-- Copy export file to "consumer" servers and import it --> |
| | | <paralleliterate var="consumer" in="consumerList"> |
| | | <sequence> |
| | | <script> |
| | | consumerDataDir = '%s' % consumer.getDataDir() |
| | | consumerBackupDir = '%s' % consumer.getTmpDir() |
| | | </script> |
| | | <call function="'copyFile'"> |
| | | { 'location' : masterHost, |
| | | 'remotehost' : consumer.getHostname(), |
| | | 'srcfile' : '%s/replication/master_export_offline.ldif' \ |
| | | % masterBackupDir, |
| | | 'destfile' : '%s/replication/master_export_offline.ldif' \ |
| | | % consumerBackupDir |
| | | } |
| | | </call> |
| | | |
| | | <message> |
| | | '+++++ ldif import off-line: import exported file on %s:%s'\ |
| | | % (consumer.getHostname(), consumer.getPort()) |
| | | </message> |
| | | <call function="'ImportLdifWithScript'"> |
| | | { 'location' : consumer.getHostname(), |
| | | 'dsPath' : '%s/%s' % (consumer.getDir(), OPENDSNAME), |
| | | 'backEnd' : DIRECTORY_INSTANCE_BE, |
| | | 'ldifFile' : '%s/replication/master_export_offline.ldif' \ |
| | | % consumerBackupDir |
| | | } |
| | | </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> |
| | | '+++++ ldif import 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> |
| | | '+++++ ldif import 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 Ldif Import Tests |
| | | #@TestName Replication: Ldif Import: On-line initialisation |
| | | #@TestID On-line initialisation |
| | | #@TestPurpose Initialise replicated servers using on-line |
| | | export/import |
| | | #@TestPreamble |
| | | #@TestSteps Call dsreplication pre-external-initialization |
| | | #@TestSteps Import data on server A |
| | | #@TestSteps Export suffix on server A |
| | | #@TestSteps Import exported file 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'"/> |
| | | <message> |
| | | 'Replication: Ldif Import: On-line initialisation. Initialise \ |
| | | replicated servers using on-line export/import' |
| | | </message> |
| | | |
| | | <!-- Pre-initialise the servers in the topology --> |
| | | <message> |
| | | '+++++ ldif import 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> |
| | | '+++++ ldif import 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> |
| | | |
| | | <script> |
| | | sourceFile = '%s/replication/master_export_online.ldif' \ |
| | | % masterBackupDir |
| | | </script> |
| | | |
| | | <!-- Export data from "master" server --> |
| | | <message> |
| | | '+++++ ldif import on-line: export suffix on server %s:%s' \ |
| | | % (masterHost, master.getPort()) |
| | | </message> |
| | | <call function="'exportLdifWithScript'"> |
| | | { 'location' : masterHost, |
| | | 'dsPath' : masterPath, |
| | | 'dsInstanceHost' : masterHost, |
| | | 'dsInstanceAdminPort' : master.getAdminPort(), |
| | | 'dsInstanceDn' : master.getRootDn(), |
| | | 'dsInstancePswd' : master.getRootPwd(), |
| | | 'ldifFile' : sourceFile |
| | | } |
| | | </call> |
| | | |
| | | <!-- Copy export file to "consumer" servers and import it --> |
| | | <paralleliterate var="consumer" in="consumerList"> |
| | | <sequence> |
| | | <script> |
| | | consumerDataDir = '%s' % consumer.getDataDir() |
| | | consumerBackupDir = '%s' % consumer.getTmpDir() |
| | | </script> |
| | | <script> |
| | | filename = 'master_export_online.ldif' |
| | | destinationFile = '%s/replication/%s'\ |
| | | % (consumerBackupDir,filename) |
| | | </script> |
| | | |
| | | <call function="'copyFile'"> |
| | | { 'location' : masterHost, |
| | | 'remotehost' : consumer.getHostname(), |
| | | 'srcfile' : sourceFile, |
| | | 'destfile' : destinationFile |
| | | } |
| | | </call> |
| | | |
| | | <message> |
| | | '+++++ ldif import on-line: import exported file on %s:%s'\ |
| | | % (consumer.getHostname(), consumer.getPort()) |
| | | </message> |
| | | <call function="'ImportLdifWithScript'"> |
| | | { 'location' : clientHost, |
| | | 'dsPath' : clientPath, |
| | | 'dsInstanceHost' : consumer.getHostname(), |
| | | 'dsInstanceAdminPort' : consumer.getAdminPort(), |
| | | 'dsInstanceDn' : consumer.getRootDn(), |
| | | 'dsInstancePswd' : consumer.getRootPwd(), |
| | | 'ldifFile' : destinationFile |
| | | } |
| | | </call> |
| | | </sequence> |
| | | </paralleliterate> |
| | | |
| | | <!-- Post-initialise the servers in the topology --> |
| | | <message> |
| | | '+++++ ldif import 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> |
| | | '+++++ ldif import 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> |
| | | |
| | | |
| | | |
| | | |
| | | <import machine="STAF_LOCAL_HOSTNAME" |
| | | file="'%s/testcases/replication/replication_cleanup.xml' |
| | | % (TESTS_DIR)"/> |
| | | <call function="'replication_cleanup'" > |
| | | { 'label' : 'Replication LDIFimport' } |
| | | </call> |
| | | |
| | | <call function="'testSuite_Postamble'"/> |
| | | <!--- Test Suite information |
| | | #@TestSuiteName Replication LDIFImport Tests |
| | | #@TestSuitePurpose Verify that the total-update operations are replicated |
| | | correctly between two servers. |
| | | #@TestSuiteID LDIFImport Tests |
| | | #@TestSuiteGroup LDIFImport |
| | | #@TestGroup Replication |
| | | #@TestScript replication_ldifimport.xml |
| | | #@TestHTMLLink http://www.forgerock.org/ |
| | | --> |
| | | |
| | | </sequence> |
| | | <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('ldifimport/ldifimport_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: LDIFImport:' |
| | | </script> |
| | | |
| | | <!-- List of Test Cases --> |
| | | <script> |
| | | testsList=[] |
| | | testsList.append('replication_ldifimport_001') |
| | | testsList.append('replication_ldifimport_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> |
| | | <rethrow/> |
| | | </sequence> |
| | | </catch> |
| | | |
| | | <finally> |
| | | <message>'Test Cases Completed.'</message> |
| | | </finally> |
| | | |
| | | </try> |
| | | |
| | | </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> |
| | | |
| | | </stax> |