From 2b5dcd96c914a84a130237de17b43184670c4e52 Mon Sep 17 00:00:00 2001
From: al_xipe <al_xipe@localhost>
Date: Sun, 26 Aug 2007 00:50:01 +0000
Subject: [PATCH] schematokens fix for replication tests

---
 opendj-sdk/opends/tests/functional-tests/testcases/replication/replication.xml                         |   32 ++--------
 opendj-sdk/opends/tests/functional-tests/testcases/replication/binarycopy/binarycopy.xml               |   28 +++++----
 opendj-sdk/opends/tests/functional-tests/testcases/replication/resynchronization/resynchronization.xml |   28 +++++----
 opendj-sdk/opends/tests/functional-tests/testcases/replication/totalupdate/totalupdate.xml             |   91 ++++++++++++++----------------
 4 files changed, 81 insertions(+), 98 deletions(-)

diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/replication/binarycopy/binarycopy.xml b/opendj-sdk/opends/tests/functional-tests/testcases/replication/binarycopy/binarycopy.xml
index affe125..67f5af5 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/replication/binarycopy/binarycopy.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/replication/binarycopy/binarycopy.xml
@@ -110,12 +110,14 @@
               <!-- Copy backup to "consumer" servers and restore it -->
               <paralleliterate var="consumer" in="consumerList">
                 <sequence>
-                  <call function="'copyFile'">
-                    { 'srcfile'    : '%s/config/schematokens.dat' % dsPath,
-                      'destfile'   : '%s/%s/config/schematokens.dat' % (consumer.getDir(),OPENDSNAME),
-                      'remotehost' : consumer.getHostname()
-                    }
-                  </call>
+                  <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(),
@@ -237,12 +239,14 @@
               <!-- Copy backup to "consumer" servers and restore it -->
               <paralleliterate var="consumer" in="consumerList">
                 <sequence>
-                  <call function="'copyFile'">
-                    { 'srcfile'    : '%s/config/schematokens.dat' % dsPath,
-                      'destfile'   : '%s/%s/config/schematokens.dat' % (consumer.getDir(),OPENDSNAME),
-                      'remotehost' : consumer.getHostname()
-                    }
-                  </call>
+                  <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(),
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/replication/replication.xml b/opendj-sdk/opends/tests/functional-tests/testcases/replication/replication.xml
index d945bd9..9dcaa0e 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/replication/replication.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/replication/replication.xml
@@ -37,31 +37,13 @@
             CurrentTestPath['group']='replication'
           </script>
           <call function="'testGroup_Preamble'"/>
-          
-          <import machine="STAF_LOCAL_HOSTNAME"
-                  file="'%s/testcases/replication/totalupdate/totalupdate.xml' % (TESTS_DIR)"/>
-          <call function="'main_totalupdate'" />
-          
-          <import machine="STAF_LOCAL_HOSTNAME"
-                  file="'%s/testcases/replication/binarycopy/binarycopy.xml' % (TESTS_DIR)"/>
-          <call function="'replication_binarycopy'" />
-          
-          <import machine="STAF_LOCAL_HOSTNAME"
-                  file="'%s/testcases/replication/ldifimport/ldifimport.xml' % (TESTS_DIR)"/>
-          <call function="'replication_ldifimport'" />
-          
-          <import machine="STAF_LOCAL_HOSTNAME"
-                  file="'%s/testcases/replication/resynchronization/resynchronization.xml' % (TESTS_DIR)"/>
-          <call function="'replication_resynchronization'" />
-          
-          <import machine="STAF_LOCAL_HOSTNAME"
-                  file="'%s/testcases/replication/basic/replication_basic.xml' % (TESTS_DIR)"/>
-          <call function="'replication_basic'" />
-          
-          <import machine="STAF_LOCAL_HOSTNAME"
-            file="'%s/testcases/replication/schema/schema.xml' % (TESTS_DIR)"/>
-          <call function="'replication_schema'" />
-          
+          <iterate  var="_test" in="['totalupdate','binarycopy','ldifimport','resynchronization','basic','schema']">
+            <sequence>
+              <import machine="STAF_LOCAL_HOSTNAME"
+                      file="'%s/testcases/replication/%s/%s.xml' % (TESTS_DIR,_test,_test)"/>
+              <call function="'replication_%s'% _test" />
+            </sequence>
+          </iterate>
           <call function="'testGroup_Postamble'"/>
         </sequence>
       </block>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/replication/resynchronization/resynchronization.xml b/opendj-sdk/opends/tests/functional-tests/testcases/replication/resynchronization/resynchronization.xml
index 740fa75..2220092 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/replication/resynchronization/resynchronization.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/replication/resynchronization/resynchronization.xml
@@ -130,12 +130,14 @@
               <!-- Copy backup to "consumer" servers and restore it -->
               <paralleliterate var="consumer" in="consumerList">
                 <sequence>
-                  <call function="'copyFile'">
-                    { 'srcfile'    : '%s/config/schematokens.dat' % dsPath,
-                      'destfile'   : '%s/%s/config/schematokens.dat' % (consumer.getDir(),OPENDSNAME),
-                      'remotehost' : consumer.getHostname()
-                    }
-                  </call>
+                  <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(),
@@ -257,12 +259,14 @@
               <!-- Copy backup to "consumer" servers and restore it -->
               <paralleliterate var="consumer" in="consumerList">
                 <sequence>
-                  <call function="'copyFile'">
-                    { 'srcfile'    : '%s/config/schematokens.dat' % dsPath,
-                      'destfile'   : '%s/%s/config/schematokens.dat' % (consumer.getDir(),OPENDSNAME),
-                      'remotehost' : consumer.getHostname()
-                    }
-                  </call>
+                  <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(),
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/replication/totalupdate/totalupdate.xml b/opendj-sdk/opends/tests/functional-tests/testcases/replication/totalupdate/totalupdate.xml
index e009781..0ce00b9 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/replication/totalupdate/totalupdate.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/replication/totalupdate/totalupdate.xml
@@ -26,29 +26,23 @@
  !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  ! -->
 <stax>
-
-  <defaultcall function="main_totalupdate"/>
-
-  <function name="main_totalupdate">
-
+  <defaultcall function="replication_totalupdate"/>
+  <function name="replication_totalupdate">
     <sequence>
-
       <block name="'total-update'">
-
         <sequence>
-            
           <script>
             if not CurrentTestPath.has_key('group'):
-              CurrentTestPath['group']='replication'                 
+              CurrentTestPath['group']='replication'
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
-
+          
           <call function="'testSuite_Preamble'"/>
                                                 
           <import machine="STAF_LOCAL_HOSTNAME"
             file="'%s/testcases/replication/replication_setup.xml' % (TESTS_DIR)"/>
           <call function="'replication_setup'" />
-
+          
           <script>
             server1DataDir = '%s/%s' % (server1.getDir(),relativeDataDir)
           </script>
@@ -58,58 +52,63 @@
             <sequence>
             
               <call function="'testCase_Preamble'"/>
-
-              <!-- Stop the Directory Server -->              
+              
+              <!-- Stop the Directory Server -->
               <call function="'StopDsWithScript'">
                 { 'location'  : server1.getHostname(),
-                  'dsPath'    : '%s/%s' % (server1.getDir(),OPENDSNAME),                
+                  'dsPath'    : '%s/%s' % (server1.getDir(),OPENDSNAME),
                   'dsHost'    : server1.getHostname(),
                   'dsPort'    : server1.getPort(),
                   'dsBindDN'  : server1.getRootDn(),
-                  'dsBindPwd' : server1.getRootPwd() }
+                  'dsBindPwd' : server1.getRootPwd()
+                }
               </call>
-
+              
               <!-- Check that the Directory Server is stopped -->
               
-              <!-- Import data into Directory Server -->              
+              <!-- Import data into Directory Server -->
               <call function="'ImportLdifWithScript'">
                 { 'location'     : server1.getHostname() ,
                   'dsPath'       : '%s/%s' % (server1.getDir(),OPENDSNAME),
                   'dsBackEnd'    : 'userRoot',          
-                  'dsLdifFile'   : '%s/replication/Example.ldif' % server1DataDir }
+                  'dsLdifFile'   : '%s/replication/Example.ldif' % server1DataDir
+                }
               </call>
-
-              <!-- Check some data was imported into Directory Server -->    
+              
+              <!-- Check some data was imported into Directory Server -->
               <call function="'checkImport'">
-                { 'location'  : server1.getHostname(),
-                  'dsPath'    : '%s/%s' % (server1.getDir(),OPENDSNAME),                
-                  'dsHost'    : server1.getHostname(),
-                  'dsPort'    : server1.getPort(),
-                  'dsDn'      : server1.getRootDn(),
-                  'dsPswd'    : server1.getRootPwd(),
+                { 'location'        : server1.getHostname(),
+                  'dsPath'          : '%s/%s' % (server1.getDir(),OPENDSNAME),
+                  'dsHost'          : server1.getHostname(),
+                  'dsPort'          : server1.getPort(),
+                  'dsDn'            : server1.getRootDn(),
+                  'dsPswd'          : server1.getRootPwd(),
                   'expectedEntries' : ['uid=scarter,ou=People,o=example',
                                        'uid=dmiller, ou=People, o=example',
-                                       'uid=rhunt, ou=People, o=example'] }
+                                       'uid=rhunt, ou=People, o=example']
+                }
               </call>
-
+              
               <!-- Start the Directory Server -->
               <call function="'StartDsWithScript'">
                 { 'location'  : server1.getHostname(),
-                  'dsPath'    : '%s/%s' % (server1.getDir(),OPENDSNAME) }
+                  'dsPath'    : '%s/%s' % (server1.getDir(),OPENDSNAME)
+                }
               </call>
-
+              
               <!-- Wait for DS to start -->
               <call function="'isAlive'">
                 { 'location'         : server1.getHostname(),
-                  'dsPath'           : '%s/%s' % (server1.getDir(),OPENDSNAME),              
+                  'dsPath'           : '%s/%s' % (server1.getDir(),OPENDSNAME),
                   'dsInstanceHost'   : server1.getHostname() ,
                   'dsInstancePort'   : server1.getPort() ,
                   'dsInstanceDn'     : server1.getRootDn() ,
                   'dsInstancePswd'   : server1.getRootPwd() ,
                   'noOfLoops'        : 10 ,
-                  'noOfMilliSeconds' : 2000 }
+                  'noOfMilliSeconds' : 2000
+                }
               </call>
-          
+              
               <!-- Perform the total update -->
               <call function="'TotalUpdateTask'">
                 { 'location'        : server1.getHostname(),
@@ -120,13 +119,14 @@
                   'dsInstancePswd'  : server2.getRootPwd(),
                   'taskID'          : 'task',
                   'domainDN'        : 'o=example',
-                  'replicaServerID' : '1' }
+                  'replicaServerID' : '1'
+                }
               </call>
-       
+              
               <script>
                 STAXCode, STAXReason=STAXResult
               </script>
-               
+              
               <if expr="STAXCode != 0">
                 <sequence>
                   <message>
@@ -136,10 +136,10 @@
                 </sequence>
               </if>
               
-              <!-- Verify the total update -->  
+              <!-- Verify the total update -->
               <call function="'checkImport'">
                 { 'location'  : server2.getHostname(),
-                  'dsPath'    : '%s/%s' % (server2.getDir(),OPENDSNAME),                
+                  'dsPath'    : '%s/%s' % (server2.getDir(),OPENDSNAME),
                   'dsHost'    : server2.getHostname(),
                   'dsPort'    : server2.getPort(),
                   'dsDn'      : server2.getRootDn(),
@@ -147,27 +147,20 @@
                   'expectedEntries' : ['uid=scarter,ou=People,o=example',
                                        'uid=dmiller, ou=People, o=example',
                                        'uid=rhunt, ou=People, o=example'],
-                  'startDS'  : 'no' }
+                  'startDS'  : 'no'
+                }
               </call>
-                                                       
               <call function="'testCase_Postamble'"/>
-              
             </sequence>
-            
-          </testcase>          
+          </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>

--
Gitblit v1.10.0