mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

ugaston
07.23.2008 e3bdec086e224de9a9062a088498d3bc43888d0a
Fix replication initialisation suites
3 files modified
740 ■■■■■ changed files
opends/tests/functional-tests/testcases/replication/binarycopy/binarycopy.xml 181 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/replication/ldifimport/ldifimport.xml 343 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/replication/resynchronization/resynchronization.xml 216 ●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/replication/binarycopy/binarycopy.xml
@@ -54,9 +54,6 @@
                        % (TESTS_DIR)"/>
          <call function="'replication_setup'" />
          
          <script>
            synchroSuffix = master.getSynchronizedSuffixList()[0].getSuffixDn()
          </script>
          
          <!--- Test Case information
          #@TestMarker          Replication Binary Copy Tests
@@ -66,9 +63,16 @@
          #@TestPurpose         Initialise replicated servers using off-line 
                                backup/restore
          #@TestPreamble
          #@TestSteps
          #@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
          #@TestResult          Success if trees synchronized
          -->
          <testcase name="getTestCaseName('Off-line initialisation')">
            <sequence>
@@ -77,12 +81,35 @@
                 '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,
                  'dsInstancePort'    : master.getPort(),
                  'localOnly'         : False,
                  'replicationDnList' : [synchroSuffix],
                  'adminUID'          : adminUID,
                  'adminPswd'         : adminPswd
                }
              </call>
              <!-- Stop the servers in the topology -->
              <call function="'stopServers'">
                [_topologyServerList]
              </call>
              
              <!-- 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,
@@ -91,21 +118,11 @@
                }
              </call>
              
              <!-- Check some data was imported into "master" server -->
              <call function="'checkImport'">
                { 'location'        : clientHost,
                  'dsPath'          : clientPath,
                  'dsHost'          : masterHost,
                  'dsPort'          : master.getPort(),
                  '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']
               }
              </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,
@@ -116,18 +133,6 @@
              <!-- Copy backup to "consumer" servers and restore it -->
              <paralleliterate var="consumer" in="consumerList">
                <sequence>
                  <if expr="os.path.exists('%s/config/schematokens.dat'
                                           % masterPath)" >
                    <call function="'copyFile'">
                      { 'location'   : masterHost,
                        'srcfile'    : '%s/config/schematokens.dat' \
                                       % masterPath,
                        'destfile'   : '%s/%s/config/schematokens.dat' \
                                       % (consumer.getDir(),OPENDSNAME),
                        'remotehost' : consumer.getHostname()
                      }
                    </call>
                  </if>
                  <call function="'CopyFolderByExtension'">
                    { 'location'   : masterHost,
                      'remotehost' : consumer.getHostname(),
@@ -138,6 +143,11 @@
                      '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),
@@ -153,8 +163,41 @@
                [_topologyServerList]
              </call>
              
              <!-- Check some data was imported into "master" server -->
              <call function="'checkImport'">
                { 'location'        : clientHost,
                  'dsPath'          : clientPath,
                  'dsHost'          : masterHost,
                  'dsPort'          : master.getPort(),
                  '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,
                  'dsInstancePort'    : master.getPort(),
                  '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,
@@ -183,9 +226,14 @@
          #@TestPurpose         Initialise replicated servers using on-line
                                backup/restore
          #@TestPreamble
          #@TestSteps
          #@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
          #@TestResult          Success if trees synchronized
          -->
          <testcase name="getTestCaseName('On-line initialisation')">
            <sequence>
@@ -195,26 +243,28 @@
                 replicated servers using on-line backup/restore'
              </message>
              
              <!-- Clean the servers in the topology
              <call function="'deleteTrees'">
                [_topologyServerList, synchroSuffix, False]
              </call> -->
              <!-- Delete manually added entry so that replication server won't
                add it automatically later on -->
              <call function="'ldapDeleteWithScript'">
              <!-- 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' :  master.getHostname(),
                  'dsInstanceHost'    : masterHost,
                  'dsInstancePort' :  master.getPort(),
                  'dsInstanceDn'   :  master.getRootDn(),
                  'dsInstancePswd' :  master.getRootPwd(),
                  'dsDn'           :  ['uid=tfitter, ou=People,%s' \
                                       % synchroSuffix]
                  '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="'importLdifTask'">
                { 'location'       : clientHost,
                  'dsPath'         : clientPath,
@@ -244,6 +294,10 @@
              </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,
@@ -260,18 +314,6 @@
              <!-- Copy backup to "consumer" servers and restore it -->
              <paralleliterate var="consumer" in="consumerList">
                <sequence>
                  <if expr="os.path.exists
                            ('%s/config/schematokens.dat' % masterPath)">
                    <call function="'copyFile'">
                      { 'location'   : masterHost,
                        'srcfile'    : '%s/config/schematokens.dat' \
                                       % masterPath,
                        'destfile'   : '%s/%s/config/schematokens.dat' \
                                       % (consumer.getDir(),OPENDSNAME),
                        'remotehost' : consumer.getHostname()
                      }
                    </call>
                  </if>
                  <call function="'CopyFolderByExtension'">
                    { 'location'   : masterHost,
                      'remotehost' : consumer.getHostname(),
@@ -283,6 +325,10 @@
                    }
                  </call>
                  
                  <message>
                    '+++++ binary copy on-line: restore back-up on %s:%s' \
                    % (consumer.getHostname(), consumer.getPort())
                  </message>
                  <call function="'restoreTask'">
                    { 'location'       : clientHost,
                      'dsPath'         : clientPath,
@@ -298,7 +344,26 @@
                </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,
                  'dsInstancePort'    : master.getPort(),
                  '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,
opends/tests/functional-tests/testcases/replication/ldifimport/ldifimport.xml
@@ -47,7 +47,9 @@
          <!--- 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.
          #@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
@@ -57,30 +59,55 @@
            
                                                                        
          <import machine="STAF_LOCAL_HOSTNAME"
            file="'%s/testcases/replication/replication_setup.xml' % (TESTS_DIR)"/>
            file="'%s/testcases/replication/replication_setup.xml'
                  % (TESTS_DIR)"/>
          <call function="'replication_setup'" />
                                    
          <script>
            synchroSuffix = master.getSynchronizedSuffixList()[0].getSuffixDn()
          </script>
            
          <!--- Test Case information
          #@TestMarker          Replication Ldif Import Tests
          #@TestName            Replication: Ldif Import: Off-line initialisation
          #@TestName            Replication: Ldif Import: Off-line
                                initialisation
          #@TestID                  Off-line initialisation
          #@TestPurpose         Initialise replicated servers using off-line export/import
          #@TestPurpose         Initialise replicated servers using off-line
                                export/import
          #@TestPreamble
          #@TestSteps
          #@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
          #@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'
                '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,
                  'dsInstancePort'    : master.getPort(),
                  'localOnly'         : False,
                  'replicationDnList' : [synchroSuffix],
                  'adminUID'          : adminUID,
                  'adminPswd'         : adminPswd
                }
              </call>
              <!-- Stop the servers in the topology -->  
              <call function="'stopServers'">
                [_topologyServerList]
@@ -88,32 +115,29 @@
              
                                
              <!-- 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,
                  'dsBackEnd'    : 'userRoot',             
                  'dsLdifFile'   : '%s/replication/Example.ldif' % masterDataDir }
                  'dsLdifFile' : '%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(),
                  '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'] }
              </call>
              <!-- Export data from  "master" server -->  
              <message>
                '+++++ ldif import off-line: export suffix on server %s:%s' \
                % (masterHost, master.getPort())
              </message>
              <call function="'exportLdif'">
                { 'location'  :  masterHost,
                  'dsPath'  :  masterPath,
                  'ldifFile'  :  '%s/replication/master_export.ldif' % masterDataDir }
                  'ldifFile'  : '%s/replication/master_export.ldif' \
                                % masterDataDir
                }
              </call>                
                
              <!-- Copy export file  to "consumer" servers and import it -->
@@ -122,15 +146,24 @@
                  <call function="'copyFile'">
                    { 'location'   :  masterHost,
                      'remotehost'  :  consumer.getHostname(),
                      'srcfile'  :  '%s/replication/master_export.ldif' % masterDataDir,
                      'destfile' :  '%s/%s/replication/master_export.ldif' % (consumer.getDir(),relativeDataDir) }
                      'srcfile'    : '%s/replication/master_export.ldif' \
                                     % masterDataDir,
                      'destfile'   : '%s/%s/replication/master_export.ldif' \
                                     % (consumer.getDir(),relativeDataDir)
                    }
                  </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),
                      'dsBackEnd'    : 'userRoot',  
                      'dsLdifFile'   :  '%s/%s/replication/master_export.ldif' % (consumer.getDir(),relativeDataDir) }
                      'dsLdifFile' : '%s/%s/replication/master_export.ldif' \
                                     % (consumer.getDir(),relativeDataDir)
                    }
                  </call>                                             
                </sequence>                  
              </paralleliterate>
@@ -142,74 +175,6 @@
                [_topologyServerList]
              </call>                
                
              <!-- Add entry to "master" server -->
              <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
          #@TestPostamble
          #@TestResult
          -->
          <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>
              <!-- Clean the servers in the topology
              <call function="'deleteTrees'">
                [_topologyServerList, synchroSuffix, False]
              </call> -->
              <!-- Delete manually added entry so that replication server won't add it automatically later on -->
              <call function="'ldapDeleteWithScript'">
                { 'location'  :  clientHost,
                  'dsPath'  :  clientPath,
                  'dsInstanceHost'  :  master.getHostname(),
                  'dsInstancePort'  :  master.getPort(),
                  'dsInstanceDn'  : master.getRootDn(),
                  'dsInstancePswd' :  master.getRootPwd(),
                  'dsDn'  :  ['uid=tfitter, ou=People,%s' % synchroSuffix] }
              </call>
              <!-- Import data into "master" server -->
              <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,
@@ -221,11 +186,142 @@
                  'expectedEntries' : ['uid=scarter,ou=People,o=example',
                                       'uid=dmiller, ou=People, o=example',
                                       'uid=rhunt, ou=People, o=example'], 
                  'startDS'  : 'no' }
                  '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,
                  'dsInstancePort'    : master.getPort(),
                  '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>
              <script>
                knownIssue(3122)
              </script>
              <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,
                  'dsInstancePort'    : master.getPort(),
                  '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="'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(),
                  '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' \
                             % masterDataDir
              </script>
              <!-- Export data from  "master" server -->  
              <message>
                '+++++ ldif import on-line: export suffix on server %s:%s' \
                % (masterHost, master.getPort())
              </message>
              <call function="'exportLdifTask'">
                { 'location'  :  masterHost,
                  'dsPath'  :  masterPath,
@@ -234,19 +330,32 @@
                  'dsInstanceDn'  :  master.getRootDn(),
                  'dsInstancePswd'  :  master.getRootPwd(),
                  'taskID'  :  'export task',
                  'ldifFile'  :  '%s/replication/master_export_online.ldif' % masterDataDir }
                  'ldifFile'       : sourceFile
                }
              </call>                
                
              <!-- Copy export file  to "consumer" servers and import it -->
              <paralleliterate var="consumer" in="consumerList">
                <sequence>
                  <script>
                    filename = 'master_export_online_ldif'
                    destinationFile = '%s/%s/replication/%s'\
                                      % (consumer.getDir(),relativeDataDir,
                                         filename)
                  </script>
                  <call function="'copyFile'">
                    { 'location'   :  masterHost,
                      'remotehost'  :  consumer.getHostname(),
                      'srcfile'  :  '%s/replication/master_export_online.ldif' % masterDataDir,
                      'destfile' :  '%s/%s/replication/master_export_online.ldif' % (consumer.getDir(),relativeDataDir) }
                      'srcfile'    : sourceFile,
                      'destfile'   : destinationFile
                    }
                  </call>         
                  <message>
                    '+++++ ldif import on-line: import exported file on %s:%s'\
                    % (consumer.getHostname(), consumer.getPort())
                  </message>
                  <call function="'importLdifTask'">
                    { 'location'  :  clientHost,
                      'dsPath'  :  clientPath,
@@ -255,14 +364,32 @@
                      'dsInstanceDn'  :  consumer.getRootDn(),
                      'dsInstancePswd'  :  consumer.getRootPwd(),
                      'taskID'  :  'import task',
                      'ldifFile'  :  '%s/%s/replication/master_export_online.ldif' % (consumer.getDir(),relativeDataDir) }
                      '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,
                  'dsInstancePort'    : master.getPort(),
                  '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,
@@ -270,10 +397,13 @@
                  'dsInstancePort' : master.getPort(), 
                  'dsInstanceDn'   : master.getRootDn(),
                  'dsInstancePswd' : master.getRootPwd(),
                  'entryToBeAdded' : '%s/replication/tfitter.ldif' % clientDataDir }
                  'entryToBeAdded' : '%s/replication/tfitter.ldif' \
                                     % clientDataDir
                }
              </call>
                
              <!-- Verify the synchronization of the trees among the servers in the topology -->
              <!-- Verify the synchronization of the trees among the servers in
                the topology -->
              <call function="'verifyTrees'">
                [ clientHost, clientPath, master, consumerList, synchroSuffix ]
              </call> 
@@ -286,7 +416,8 @@
                                                            
          
          <import machine="STAF_LOCAL_HOSTNAME"
            file="'%s/testcases/replication/replication_cleanup.xml' % (TESTS_DIR)"/>
            file="'%s/testcases/replication/replication_cleanup.xml'
                  % (TESTS_DIR)"/>
          <call function="'replication_cleanup'" />
                          
          <call function="'testSuite_Postamble'"/>
opends/tests/functional-tests/testcases/replication/resynchronization/resynchronization.xml
@@ -39,7 +39,9 @@
          <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.
          #@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
@@ -48,74 +50,41 @@
          -->
          
          <import machine="STAF_LOCAL_HOSTNAME"
                  file="'%s/testcases/replication/replication_setup.xml' % (TESTS_DIR)"/>
          <call function="'replication_setup'" />
                  file="'%s/testcases/replication/replication_setup.xml'
                        % (TESTS_DIR)"/>
          <call function="'replication_setup'">
            { 'dataFile' : 'Example.ldif' }
          </call>
          
          <script>
            synchroSuffix = master.getSynchronizedSuffixList()[0].getSuffixDn()
          </script>
          
          <!--- Test Case information
          #@TestMarker          Replication Re-Synchronization Tests
          #@TestName            Replication: Re-Synchronization: Off-line initialisation
          #@TestName            Replication: Re-Synchronization: Off-line
                                initialisation
          #@TestID                  Off-line initialisation
          #@TestPurpose         Initialise replicated servers using off-line backup/restore
          #@TestPreamble
          #@TestSteps
          #@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
          #@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'
                'Replication: Re-Synchronization: Off-line initialisation. \
                Initialise replicated servers using off-line backup/restore'
              </message>
              
              <!-- Stop the servers in the topology -->
              <call function="'stopServers'">
                [_topologyServerList]
              </call>
              <!-- Import data into "master" server -->
              <call function="'ImportLdifWithScript'">
                { 'location'   : masterHost,
                  'dsPath'     : masterPath,
                  'dsBackEnd'  : 'userRoot',
                  'dsLdifFile' : '%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(),
                  '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']
                }
              </call>
              <!-- Backup "master" server -->
              <call function="'backup'">
                { 'location'  :  masterHost,
                  'dsPath'    :  masterPath,
                  'backupDir' :  '%s/replication/master_backup' % masterDataDir
                }
              </call>
              <!-- Start the "master" server -->
              <call function="'StartDsWithScript'">
                { 'location'  :  masterHost,
                  'dsPath'  :  masterPath
                }
              </call>
              <!-- 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,
@@ -123,34 +92,38 @@
                  'dsInstancePort' : master.getPort(), 
                  'dsInstanceDn'   : master.getRootDn(),
                  'dsInstancePswd' : master.getRootPwd(),
                  'entryToBeAdded' : '%s/replication/tfitter.ldif' % clientDataDir
                  'entryToBeAdded' : '%s/replication/tfitter.ldif' \
                                     % clientDataDir
                }
              </call>
              
              <!-- Copy backup to "consumer" servers and restore it -->
              <!-- Stop the "consumer" servers -->
              <call function="'stopServers'">
                [consumerList]
              </call>
              <!-- Copy master backup to "consumer" servers and restore it -->
              <paralleliterate var="consumer" in="consumerList">
                <sequence>
                  <if expr="os.path.exists('%s/config/schematokens.dat' % dsPath)">
                    <call function="'copyFile'">
                      { 'srcfile'    : '%s/config/schematokens.dat' % dsPath,
                        'destfile'   : '%s/%s/config/schematokens.dat' % (consumer.getDir(),OPENDSNAME),
                        'remotehost' : consumer.getHostname()
                      }
                    </call>
                  </if>
                  <call function="'CopyFolderByExtension'">
                    { 'location'   : masterHost,
                      'remotehost' : consumer.getHostname(),
                      'srcfolder'  : '%s/replication/master_backup' % masterDataDir,
                      'destfolder' : '%s/%s/replication/master_backup' % (consumer.getDir(),relativeDataDir),
                      'srcfolder'  : masterBackupDir,
                      'destfolder' : '%s/%s/replication/master_backup' \
                                     % (consumer.getDir(),relativeDataDir),
                      '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(),relativeDataDir)
                      'backupDir' :  '%s/%s/replication/master_backup' \
                                     % (consumer.getDir(),relativeDataDir)
                    }
                  </call>
                </sequence>
@@ -161,7 +134,8 @@
                [consumerList]
              </call>
              
              <!-- Verify the synchronization of the trees among the servers in the topology -->
              <!-- Verify the synchronization of the trees among the servers in
                the topology -->
              <call function="'verifyTrees'">
                [ clientHost, clientPath, master, consumerList, synchroSuffix ]
              </call>
@@ -171,39 +145,51 @@
          
          <!--- Test Case information
          #@TestMarker          Replication Re-Synchronization Tests
          #@TestName            Replication: Re-Synchronization: On-line initialisation
          #@TestName            Replication: Re-Synchronization: On-line
                                initialisation
          #@TestID                  On-line initialisation
          #@TestPurpose         Initialise replicated servers using on-line backup/restore
          #@TestPurpose         Initialise replicated servers using on-line
                                backup/restore
          #@TestPreamble
          #@TestSteps
          #@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
          #@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'
                'Replication: Re-Synchronization: On-line initialisation. \
                Initialise replicated servers using on-line backup/restore'
              </message>
              
              <!-- Clean the servers in the topology
              <call function="'deleteTrees'">
                [_topologyServerList, synchroSuffix, False]
              </call> -->
              <!-- Delete manually added entry so that replication server won't add it automatically later on -->
              <call function="'ldapDeleteWithScript'">
              <!-- 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' : master.getHostname(),
                  'dsInstanceHost'    : masterHost,
                  'dsInstancePort' : master.getPort(),
                  'dsInstanceDn'   : master.getRootDn(),
                  'dsInstancePswd' : master.getRootPwd(),
                  'dsDn'           : ['uid=tfitter, ou=People,%s' % synchroSuffix]
                  '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,
@@ -212,7 +198,8 @@
                  'dsInstanceDn'   : master.getRootDn(),
                  'dsInstancePswd' : master.getRootPwd(),
                  'taskID'         : 'import task',
                  'ldifFile'       : '%s/replication/Example.ldif' % masterDataDir
                  'ldifFile'       : '%s/replication/Example.ldif' \
                                     % masterDataDir
                }
              </call>
              
@@ -232,6 +219,10 @@
              </call>
                
              <!-- Backup "master" server -->  
              <message>
                '+++++ resynchronization on-line: back-up server %s:%s' \
                % (masterHost, master.getPort())
              </message>
              <call function="'backupTask'">
                { 'location'       : clientHost,
                  'dsPath'         : clientPath,
@@ -240,11 +231,16 @@
                  'dsInstanceDn'   : master.getRootDn(),
                  'dsInstancePswd' : master.getRootPwd(),
                  'taskID'         : 'backup task',
                  'backupDir'      : '%s/replication/master_backup_online' % masterDataDir
                  '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,
@@ -252,30 +248,29 @@
                  'dsInstancePort' : master.getPort(), 
                  'dsInstanceDn'   : master.getRootDn(),
                  'dsInstancePswd' : master.getRootPwd(),
                  'entryToBeAdded' : '%s/replication/tfitter.ldif' % clientDataDir
                  'entryToBeAdded' : '%s/replication/tfitter.ldif' \
                                     % clientDataDir
                }
              </call>
              
              <!-- Copy backup to "consumer" servers and restore it -->
              <paralleliterate var="consumer" in="consumerList">
                <sequence>
                  <if expr="os.path.exists('%s/config/schematokens.dat' % dsPath)">
                    <call function="'copyFile'">
                      { 'srcfile'    : '%s/config/schematokens.dat' % dsPath,
                        'destfile'   : '%s/%s/config/schematokens.dat' % (consumer.getDir(),OPENDSNAME),
                        'remotehost' : consumer.getHostname()
                      }
                    </call>
                  </if>
                  <call function="'CopyFolderByExtension'">
                    { 'location'   : masterHost,
                      'remotehost' : consumer.getHostname(),
                      'srcfolder'  : '%s/replication/master_backup_online' % masterDataDir,
                      'destfolder' : '%s/%s/replication/master_backup_online' % (consumer.getDir(),relativeDataDir),
                      'srcfolder'  : '%s/replication/master_backup_online' \
                                     % masterDataDir,
                      'destfolder' : '%s/%s/replication/master_backup_online' \
                                     % (consumer.getDir(),relativeDataDir),
                      'extension'  : '*'
                    }
                  </call>
                  
                  <message>
                    '+++++ resynchronization on-line: restore back-up on %s:%s'\
                    % (consumer.getHostname(), consumer.getPort())
                  </message>
                  <call function="'restoreTask'">
                    { 'location'       : clientHost,
                      'dsPath'         : clientPath,
@@ -284,13 +279,31 @@
                      'dsInstanceDn'   : consumer.getRootDn(),
                      'dsInstancePswd' : consumer.getRootPwd(),
                      'taskID'         : 'restore task',
                      'backupDir'      : '%s/%s/replication/master_backup_online' % (consumer.getDir(),relativeDataDir)
                      'backupDir'   : '%s/%s/replication/master_backup_online' \
                                      % (consumer.getDir(),relativeDataDir)
                    }
                  </call>
                </sequence>
              </paralleliterate>
              
              <!-- Verify the synchronization of the trees among the servers in the topology -->
              <!-- 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,
                  'dsInstancePort'    : master.getPort(),
                  '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>
@@ -300,7 +313,8 @@
          </testcase>
          
          <import machine="STAF_LOCAL_HOSTNAME"
                  file="'%s/testcases/replication/replication_cleanup.xml' % (TESTS_DIR)"/>
                  file="'%s/testcases/replication/replication_cleanup.xml'
                        % (TESTS_DIR)"/>
          <call function="'replication_cleanup'" />
          
          <call function="'testSuite_Postamble'"/>