ldifimport.xml revision 2b68af05b4308b32506f1d68f6357cdc458869d7
93N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
93N/A<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
93N/A<!--
343N/A ! CDDL HEADER START
93N/A !
93N/A ! The contents of this file are subject to the terms of the
93N/A ! Common Development and Distribution License, Version 1.0 only
93N/A ! (the "License"). You may not use this file except in compliance
292N/A ! with the License.
292N/A !
292N/A ! You can obtain a copy of the license at
292N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
93N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
93N/A ! See the License for the specific language governing permissions
93N/A ! and limitations under the License.
292N/A !
292N/A ! When distributing Covered Code, include this CDDL HEADER in each
292N/A ! file and include the License file at
292N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
292N/A ! add the following below this CDDL HEADER, with the fields enclosed
292N/A ! by brackets "[]" replaced with your own identifying information:
292N/A ! Portions Copyright [yyyy] [name of copyright owner]
292N/A !
292N/A ! CDDL HEADER END
292N/A !
292N/A ! Copyright 2007-2010 Sun Microsystems, Inc.
93N/A ! -->
93N/A<stax>
93N/A
93N/A <defaultcall function="replication_ldifimport"/>
93N/A
93N/A <function name="replication_ldifimport">
93N/A
93N/A <sequence>
93N/A
93N/A <block name="'ldifimport'">
93N/A
93N/A <sequence>
93N/A
93N/A <script>
93N/A if not CurrentTestPath.has_key('group'):
93N/A CurrentTestPath['group']='replication'
93N/A CurrentTestPath['suite']=STAXCurrentBlock
93N/A </script>
93N/A
93N/A <call function="'testSuite_Preamble'"/>
93N/A
93N/A <!--- Test Suite information
93N/A #@TestSuiteName Replication Ldif Import Tests
93N/A #@TestSuitePurpose Verify that the servers in a replicated topology
93N/A can be initialised by the means of an ldif
93N/A import.
93N/A #@TestSuiteID Ldif Import Tests
259N/A #@TestSuiteGroup Ldif Import
93N/A #@TestGroup Replication
259N/A #@TestScript replication_ldifimport.xml
93N/A #@TestHTMLLink http://opends.dev.java.net/
93N/A -->
93N/A
93N/A
93N/A <import machine="STAF_LOCAL_HOSTNAME"
93N/A file="'%s/testcases/replication/replication_setup.xml'
93N/A % (TESTS_DIR)"/>
93N/A <call function="'replication_setup'" />
93N/A
93N/A
93N/A <!--- Test Case information
93N/A #@TestMarker Replication Ldif Import Tests
93N/A #@TestName Replication: Ldif Import: Off-line
93N/A initialisation
93N/A #@TestID Off-line initialisation
93N/A #@TestPurpose Initialise replicated servers using off-line
93N/A export/import
93N/A #@TestPreamble
93N/A #@TestSteps Call dsreplication pre-external-initialization
93N/A #@TestSteps Stop servers
93N/A #@TestSteps Import data on server A
93N/A #@TestSteps Export suffix on server A
93N/A #@TestSteps Import exported file on other servers
93N/A #@TestSteps Start servers
93N/A #@TestSteps Call dsreplication post-external-initialization
93N/A #@TestSteps Add entry on server A
93N/A #@TestPostamble
93N/A #@TestResult Success if trees synchronized
93N/A -->
93N/A <testcase name="getTestCaseName('Off-line initialisation')">
93N/A <sequence>
93N/A <call function="'testCase_Preamble'"/>
93N/A <message>
93N/A 'Replication: Ldif Import: Off-line initialisation. \
93N/A Initialise replicated servers using off-line export/import'
93N/A </message>
93N/A
93N/A <!-- Pre-initialise the servers in the topology -->
93N/A <message>
93N/A '+++++ ldif import off-line: prepare servers for external \
93N/A initialization'
93N/A </message>
93N/A <call function="'preInitializeReplication'">
93N/A { 'location' : clientHost,
93N/A 'dsPath' : clientPath,
93N/A 'dsInstanceHost' : masterHost,
93N/A 'dsInstanceAdminPort' : master.getAdminPort(),
93N/A 'localOnly' : False,
93N/A 'replicationDnList' : [synchroSuffix],
93N/A 'adminUID' : adminUID,
93N/A 'adminPswd' : adminPswd
93N/A }
93N/A </call>
93N/A
93N/A <!-- Stop the servers in the topology -->
93N/A <call function="'stopServers'">
93N/A [_topologyServerList]
93N/A </call>
93N/A
93N/A
93N/A <!-- Import data into "master" server -->
93N/A <message>
93N/A '+++++ ldif import off-line: import data on %s:%s' \
93N/A % (masterHost, master.getPort())
93N/A </message>
93N/A <call function="'ImportLdifWithScript'">
93N/A { 'location' : masterHost,
93N/A 'dsPath' : masterPath,
93N/A 'backEnd' : DIRECTORY_INSTANCE_BE,
93N/A 'ldifFile' : '%s/replication/Example.ldif' % masterDataDir
93N/A }
93N/A </call>
93N/A
93N/A <!-- Export data from "master" server -->
93N/A <message>
93N/A '+++++ ldif import off-line: export suffix on server %s:%s' \
93N/A % (masterHost, master.getPort())
93N/A </message>
93N/A <call function="'exportLdifWithScript'">
93N/A { 'location' : masterHost,
93N/A 'dsPath' : masterPath,
93N/A 'ldifFile' : '%s/replication/master_export.ldif' \
93N/A % masterDataDir
93N/A }
93N/A </call>
93N/A
93N/A <!-- Copy export file to "consumer" servers and import it -->
93N/A <paralleliterate var="consumer" in="consumerList">
93N/A <sequence>
93N/A <call function="'copyFile'">
93N/A { 'location' : masterHost,
93N/A 'remotehost' : consumer.getHostname(),
93N/A 'srcfile' : '%s/replication/master_export.ldif' \
93N/A % masterDataDir,
93N/A 'destfile' : '%s/%s/replication/master_export.ldif' \
93N/A % (consumer.getDir(),remote.reldatadir)
93N/A }
93N/A </call>
93N/A
93N/A <message>
93N/A '+++++ ldif import off-line: import exported file on %s:%s'\
93N/A % (consumer.getHostname(), consumer.getPort())
93N/A </message>
93N/A <call function="'ImportLdifWithScript'">
93N/A { 'location' : consumer.getHostname(),
93N/A 'dsPath' : '%s/%s' % (consumer.getDir(), OPENDSNAME),
93N/A 'backEnd' : DIRECTORY_INSTANCE_BE,
93N/A 'ldifFile' : '%s/%s/replication/master_export.ldif' \
93N/A % (consumer.getDir(),remote.reldatadir)
93N/A }
93N/A </call>
93N/A </sequence>
93N/A </paralleliterate>
93N/A
93N/A
93N/A
93N/A <!-- Start the servers in the topology -->
93N/A <call function="'startServers'">
93N/A [_topologyServerList]
93N/A </call>
93N/A
93N/A <!-- Check some data was imported into "master" server -->
93N/A <call function="'checkImport'">
93N/A { 'location' : clientHost,
93N/A 'dsPath' : clientPath,
93N/A 'dsHost' : masterHost,
93N/A 'dsPort' : master.getPort(),
93N/A 'dsAdminPort' : master.getAdminPort(),
93N/A 'dsDn' : master.getRootDn(),
93N/A 'dsPswd' : master.getRootPwd(),
93N/A 'expectedEntries' : ['uid=scarter,ou=People,o=example',
93N/A 'uid=dmiller, ou=People, o=example',
93N/A 'uid=rhunt, ou=People, o=example'],
93N/A 'startDS' : 'no'
93N/A }
93N/A </call>
93N/A
93N/A <!-- Post-initialise the servers in the topology -->
93N/A <message>
93N/A '+++++ ldif import off-line: end external server initialization'
93N/A </message>
93N/A <call function="'postInitializeReplication'">
93N/A { 'location' : clientHost,
93N/A 'dsPath' : clientPath,
93N/A 'dsInstanceHost' : masterHost,
93N/A 'dsInstanceAdminPort' : master.getAdminPort(),
93N/A 'replicationDnList' : [synchroSuffix],
93N/A 'adminUID' : adminUID,
93N/A 'adminPswd' : adminPswd
93N/A }
93N/A </call>
93N/A
93N/A <!-- Add entry to "master" server -->
93N/A <message>
93N/A '+++++ ldif import off-line: add entry to %s:%s' \
93N/A % (masterHost, master.getPort())
93N/A </message>
93N/A <call function="'addEntry'">
93N/A { 'location' : clientHost,
93N/A 'dsPath' : clientPath,
93N/A 'dsInstanceHost' : masterHost,
93N/A 'dsInstancePort' : master.getPort(),
93N/A 'dsInstanceDn' : master.getRootDn(),
93N/A 'dsInstancePswd' : master.getRootPwd(),
93N/A 'entryToBeAdded' : '%s/replication/tfitter.ldif' \
93N/A % clientDataDir
93N/A }
93N/A </call>
93N/A
93N/A <!-- Verify the synchronization of the trees among the servers in
93N/A the topology -->
93N/A <!-- If the trees differ, it could be due to Issue 3122
93N/A (Off-line import-export sequence produces no generationID) -->
93N/A <call function="'verifyTrees'">
93N/A [ clientHost, clientPath, master, consumerList, synchroSuffix,
93N/A '3122' ]
93N/A </call>
93N/A
93N/A
93N/A <call function="'testCase_Postamble'"/>
93N/A </sequence>
93N/A </testcase>
93N/A
93N/A
93N/A
93N/A <!--- Test Case information
93N/A #@TestMarker Replication Ldif Import Tests
93N/A #@TestName Replication: Ldif Import: On-line initialisation
93N/A #@TestID On-line initialisation
93N/A #@TestPurpose Initialise replicated servers using on-line
93N/A export/import
93N/A #@TestPreamble
93N/A #@TestSteps Call dsreplication pre-external-initialization
93N/A #@TestSteps Import data on server A
93N/A #@TestSteps Export suffix on server A
93N/A #@TestSteps Import exported file on other servers
93N/A #@TestSteps Call dsreplication post-external-initialization
93N/A #@TestSteps Add entry on server A
93N/A #@TestPostamble
93N/A #@TestResult Success if trees synchronized
93N/A -->
93N/A <testcase name="getTestCaseName('On-line initialisation')">
93N/A <sequence>
93N/A <call function="'testCase_Preamble'"/>
93N/A <message>
93N/A 'Replication: Ldif Import: On-line initialisation. Initialise \
93N/A replicated servers using on-line export/import'
93N/A </message>
93N/A
93N/A <!-- Pre-initialise the servers in the topology -->
93N/A <message>
93N/A '+++++ ldif import on-line: prepare servers for external \
93N/A initialization'
93N/A </message>
93N/A <call function="'preInitializeReplication'">
93N/A { 'location' : clientHost,
93N/A 'dsPath' : clientPath,
93N/A 'dsInstanceHost' : masterHost,
93N/A 'dsInstanceAdminPort' : master.getAdminPort(),
93N/A 'localOnly' : False,
93N/A 'replicationDnList' : [synchroSuffix],
93N/A 'adminUID' : adminUID,
93N/A 'adminPswd' : adminPswd
93N/A }
93N/A </call>
93N/A
93N/A <!-- Import data into "master" server -->
93N/A <message>
93N/A '+++++ ldif import on-line: import data on %s:%s' \
93N/A % (masterHost, master.getPort())
93N/A </message>
93N/A <call function="'ImportLdifWithScript'">
93N/A { 'location' : clientHost,
93N/A 'dsPath' : clientPath,
93N/A 'dsInstanceHost' : masterHost,
93N/A 'dsInstanceAdminPort' : master.getAdminPort(),
93N/A 'dsInstanceDn' : master.getRootDn(),
93N/A 'dsInstancePswd' : master.getRootPwd(),
93N/A 'ldifFile' : '%s/replication/Example.ldif' \
93N/A % masterDataDir
93N/A }
93N/A </call>
93N/A
93N/A <!-- Check some data was imported into "master" server -->
93N/A <call function="'checkImport'">
93N/A { 'location' : clientHost,
93N/A 'dsPath' : clientPath,
93N/A 'dsHost' : masterHost,
93N/A 'dsPort' : master.getPort(),
93N/A 'dsAdminPort' : master.getAdminPort(),
93N/A 'dsDn' : master.getRootDn(),
93N/A 'dsPswd' : master.getRootPwd(),
93N/A 'expectedEntries' : ['uid=scarter,ou=People,o=example',
93N/A 'uid=dmiller, ou=People, o=example',
93N/A 'uid=rhunt, ou=People, o=example'],
93N/A 'startDS' : 'no'
93N/A }
93N/A </call>
93N/A
93N/A <script>
93N/A sourceFile = '%s/replication/master_export_online.ldif' \
93N/A % masterDataDir
93N/A </script>
93N/A
93N/A <!-- Export data from "master" server -->
93N/A <message>
93N/A '+++++ ldif import on-line: export suffix on server %s:%s' \
93N/A % (masterHost, master.getPort())
93N/A </message>
93N/A <call function="'exportLdifWithScript'">
93N/A { 'location' : masterHost,
93N/A 'dsPath' : masterPath,
93N/A 'dsInstanceHost' : masterHost,
93N/A 'dsInstanceAdminPort' : master.getAdminPort(),
93N/A 'dsInstanceDn' : master.getRootDn(),
93N/A 'dsInstancePswd' : master.getRootPwd(),
93N/A 'ldifFile' : sourceFile
93N/A }
93N/A </call>
93N/A
93N/A <!-- Copy export file to "consumer" servers and import it -->
93N/A <paralleliterate var="consumer" in="consumerList">
93N/A <sequence>
93N/A <script>
93N/A filename = 'master_export_online_ldif'
93N/A destinationFile = '%s/%s/replication/%s'\
343N/A % (consumer.getDir(),remote.reldatadir,
93N/A filename)
93N/A </script>
93N/A
93N/A <call function="'copyFile'">
93N/A { 'location' : masterHost,
93N/A 'remotehost' : consumer.getHostname(),
93N/A 'srcfile' : sourceFile,
93N/A 'destfile' : destinationFile
93N/A }
93N/A </call>
343N/A
93N/A <message>
93N/A '+++++ ldif import on-line: import exported file on %s:%s'\
93N/A % (consumer.getHostname(), consumer.getPort())
93N/A </message>
93N/A <call function="'ImportLdifWithScript'">
93N/A { 'location' : clientHost,
93N/A 'dsPath' : clientPath,
93N/A 'dsInstanceHost' : consumer.getHostname(),
93N/A 'dsInstanceAdminPort' : consumer.getAdminPort(),
93N/A 'dsInstanceDn' : consumer.getRootDn(),
93N/A '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'" />
<call function="'testSuite_Postamble'"/>
</sequence>
</block>
</sequence>
</function>
</stax>