From b2f8624c6ccb7240948d0cd158773232013d1d64 Mon Sep 17 00:00:00 2001
From: andrug <andrug@localhost>
Date: Fri, 04 Apr 2008 09:00:02 +0000
Subject: [PATCH] Major Problem: issue when using NFS path value for TMPDIR variable (staf copy loops for ever  when trying to copy a folder to itself)

---
 opends/tests/system-tests/phases/main_run_lib.xml                       |  347 +++++++++++-----------------
 opends/tests/system-tests/phases/scheduler/scheduler.xml                |   22 +
 opends/tests/system-tests/phases/shared/functions/ldap.xml              |    9 
 opends/tests/system-tests/phases/verdict/verdict.xml                    |   12 
 opends/tests/system-tests/phases/generateLdif/generateLdif.xml          |    9 
 opends/tests/system-tests/phases/parser/parser.py                       |   15 +
 opends/tests/system-tests/phases/parser/parser.xml                      |   33 ++
 opends/tests/system-tests/phases/shared/functions/stafcmd.xml           |   58 +++-
 opends/tests/system-tests/phases/configuration/configuration_opends.xml |   30 ++
 opends/tests/system-tests/phases/log/log.xml                            |   26 +-
 opends/tests/system-tests/phases/main_run.xml                           |   10 
 opends/tests/system-tests/phases/installation/installation_opends.xml   |   29 +
 opends/tests/system-tests/phases/parser/object_lib.xml                  |   66 +++++
 13 files changed, 389 insertions(+), 277 deletions(-)

diff --git a/opends/tests/system-tests/phases/configuration/configuration_opends.xml b/opends/tests/system-tests/phases/configuration/configuration_opends.xml
index d15808e..ccd2ebc 100755
--- a/opends/tests/system-tests/phases/configuration/configuration_opends.xml
+++ b/opends/tests/system-tests/phases/configuration/configuration_opends.xml
@@ -54,9 +54,15 @@
       <!-- ===== Start instances ===== -->
       <paralleliterate in="topoInstances" var="instance">
         <sequence>
+          <call function="'getLogFileName'">
+            { 'type'   : 'instance',
+              'object' : instance,
+              'prefix' : filePrefix
+            }
+          </call>
           <script>
-            logName = '%s_%s' % (instance.getHost(),instance.getName())
-            logFile = '%s/%s_%s.xml' % (LOG_XML_TMP_DIR,filePrefix,logName)
+            logFile = STAXResult
+            
             fileList.append(logFile)
             
             cFileFd = open(logFile,'w')
@@ -111,9 +117,16 @@
                 i += 1
             
             instanceSource = topoInstances[i]
+          </script>
+          <call function="'getLogFileName'">
+            { 'type'   : 'instance',
+              'object' : instance,
+              'prefix' : filePrefix
+            }
+          </call>
+          <script>
+            logFile = STAXResult
             
-            logName = '%s_%s' % (instance.getHost(),instance.getName())
-            logFile = '%s/%s_%s.xml' % (LOG_XML_TMP_DIR,filePrefix,logName)
             # reopen existing files, no need to add in fileList variable 
             # as it has already been added
             cFileFd = open(logFile,'a')
@@ -190,9 +203,14 @@
       <!--== Initialize replication (totalUpdate) ==-->
       <iterate in="topoInstances" var="instance">
         <sequence>
+          <call function="'getLogFileName'">
+            { 'type'   : 'instance',
+              'object' : instance,
+              'prefix' : filePrefix
+            }
+          </call>
           <script>
-            logName = '%s_%s' % (instance.getHost(),instance.getName())
-            logFile = '%s/%s_%s.xml' % (LOG_XML_TMP_DIR,filePrefix,logName)
+            logFile = STAXResult
             # reopen existing files, no need to add in fileList variable
             # as it has already been added
             cFileFd = open(logFile,'a')
diff --git a/opends/tests/system-tests/phases/generateLdif/generateLdif.xml b/opends/tests/system-tests/phases/generateLdif/generateLdif.xml
index d68f570..a5090d6 100755
--- a/opends/tests/system-tests/phases/generateLdif/generateLdif.xml
+++ b/opends/tests/system-tests/phases/generateLdif/generateLdif.xml
@@ -95,9 +95,9 @@
             LOG_MAIN_FD.write(str)
             
             templateFile = '%s/template.ldif' % \
-                            topoElements[0].getInstanceRef().getInstallDir()
+                            topoElements[0].getInstanceRef().getLogDir()
             ldifFile = '%s/data.ldif' % \
-                        topoElements[0].getInstanceRef().getInstallDir()
+                        topoElements[0].getInstanceRef().getLogDir()
           </script>
           
           
@@ -125,7 +125,7 @@
               <script>
                 sys.path.append("%s/phases/parser" % TESTS_DIR )
                 from parser import *
-                localTemplateFile = '%s/template.ldif' % (LOG_DIR)
+                localTemplateFile = '%s/tmp/template.ldif' % (LOG_DIR)
               </script>
               <call function="'generateTemplate'">
               { 'templateFile' : localTemplateFile }
@@ -161,7 +161,8 @@
             'location'     : topoElements[0].getInstanceRef().getHost(),
             'dsPath'       : topoElements[0].getInstanceRef().getInstallDir(),
             'dsLdifFile'   : ldifFile,
-            'dsRejectFile' : '%s/importLdif_rejectedfile.txt' % LOG_TMP_DIR,
+            'dsRejectFile' : '%s/importLdif_rejectedfile.txt' % \
+                             topoElements[0].getInstanceRef().getLogDir(),
             'fileFd'       : LOG_MAIN_FD
           }
           </call>
diff --git a/opends/tests/system-tests/phases/installation/installation_opends.xml b/opends/tests/system-tests/phases/installation/installation_opends.xml
index 6dd7812..82d04ed 100755
--- a/opends/tests/system-tests/phases/installation/installation_opends.xml
+++ b/opends/tests/system-tests/phases/installation/installation_opends.xml
@@ -56,27 +56,31 @@
         <sequence>
           <!-- parallel process, all variables defined and values set below -->
           <!-- are local to this sequence -->
+          
+          <call function="'getLogFileName'">
+            { 'type'   : 'instance',
+              'object' : instance,
+              'prefix' : filePrefix
+            }
+          </call>
           <script>
-            cHost = instance.getHost()
-            cLDAPPort = instance.getLDAPPort()
-            cName = instance.getName()
-            cInstallDir = instance.getInstallDir()
-            logName = '%s_%s' % (cHost,cName)
-            logFile = '%s/%s_%s.xml' % (LOG_XML_TMP_DIR,filePrefix,logName)
+            logFile = STAXResult
+            
             fileList.append(logFile)
             
             # Write start instance tag
             cFileFd = open(logFile,'w')
-            str = '\n&lt;instance name=\"%s\"' % cName
-            str = '%s host=\"%s\" product=\"opends\"&gt;\n' % (str, cHost)
+            str = '\n&lt;instance name=\"%s\"' % instance.getName()
+            str = '%s host=\"%s\" product=\"opends\"&gt;\n' % \
+                  (str, instance.getHost())
             cFileFd.write(str)
           </script>
           
           <!--== clean previous installation if needed ==-->
           <call function="'cleanPreviousOpendsInstall'">
           {
-            'host'               : cHost,
-            'instanceInstallDir' : cInstallDir,
+            'host'               : instance.getHost(),
+            'instanceInstallDir' : instance.getInstallDir(),
             'fileFd'             : cFileFd
           }
           </call>
@@ -92,7 +96,10 @@
           
           
           <!--== Post operations ======-->
-          <message>'%s : %s : installation complete'% (cHost,cName)</message>
+          <message>
+            '%s : %s : installation complete' % \
+            (instance.getHost(),instance.getName())
+          </message>
           
           <script>
             cFileFd.write('&lt;/instance&gt;\n')
diff --git a/opends/tests/system-tests/phases/log/log.xml b/opends/tests/system-tests/phases/log/log.xml
index 963a236..14c6848 100755
--- a/opends/tests/system-tests/phases/log/log.xml
+++ b/opends/tests/system-tests/phases/log/log.xml
@@ -43,11 +43,6 @@
     </function-prolog>
     
     <sequence>
-      <script>
-        logsClientDir = '%s/client' % LOG_DIR
-        logsConfDir = '%s/configuration' % LOG_DIR
-      </script>
-      
       <message log="1">
         'Logs output set to %s' % LOG_DIR
       </message>
@@ -55,13 +50,13 @@
       <!-- Create folders -->
       <call function="'createFolder'">
         { 'location'   : STAF_LOCAL_HOSTNAME, 
-          'foldername' : '%s' % LOG_DIR ,
+          'foldername' : LOG_DIR,
           'fileFd'     : NO_FILE
         }
       </call>
       <call function="'createFolder'">
         { 'location'   : STAF_LOCAL_HOSTNAME, 
-          'foldername' : '%s' % LOG_TMP_DIR ,
+          'foldername' : LOG_TMP_DIR,
           'fileFd'     : NO_FILE
         }
       </call>
@@ -89,17 +84,20 @@
       <if expr="type == 'client'">
         <script>
           logFile = '%s/%s_%s_%s_%s.xml' % \
-                    ( LOG_XML_TMP_DIR,\
-                      prefix,\
-                      object.getName(),\
-                      object.getHost(),\
-                      object.getId() )
+                    ( LOG_TMP_DIR,prefix,\
+                      object.getName(),object.getHost(),object.getId())
         </script>
-      <elseif expr="type == 'host'">
+      <elseif expr="type == 'instance'">
         <script>
-          logFile = '%s/%s_%s.xml' % (LOG_XML_TMP_DIR,prefix,object)
+          logFile = '%s/%s_%s_%s.xml' % \
+          (LOG_TMP_DIR,prefix,object.getName(),object.getHost())
         </script>
       </elseif>
+      <else>
+        <script>
+          logFile = 'getLogFileName_%s' % NOT_DEFINED
+        </script>
+      </else>
       </if>
       <return>
         logFile
diff --git a/opends/tests/system-tests/phases/main_run.xml b/opends/tests/system-tests/phases/main_run.xml
index c860bbc..b94ff65 100644
--- a/opends/tests/system-tests/phases/main_run.xml
+++ b/opends/tests/system-tests/phases/main_run.xml
@@ -140,6 +140,8 @@
                % (TESTS_DIR)"/>
       
       <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+        file="'%s/phases/parser/object_lib.xml' % (TESTS_DIR)"/>
+      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
         file="'%s/phases/log/log.xml' % (TESTS_DIR)"/>
       
       
@@ -201,9 +203,11 @@
       <!-- ============ PREAMBLE ===================================== -->
       <call function="'mainPreamble'">
         {
-          'instances'    : instances,
-          'scheduler'    : scheduler,
-          'runScheduler' : runScheduler
+          'instances'        : instances,
+          'scheduler'        : scheduler,
+          'runInstallation'  : runInstallation,
+          'runConfiguration' : runConfiguration,
+          'runScheduler'     : runScheduler
         }
       </call>
       
diff --git a/opends/tests/system-tests/phases/main_run_lib.xml b/opends/tests/system-tests/phases/main_run_lib.xml
index 1962933..bc49ddd 100644
--- a/opends/tests/system-tests/phases/main_run_lib.xml
+++ b/opends/tests/system-tests/phases/main_run_lib.xml
@@ -99,6 +99,10 @@
           clients list
         </function-arg-description>
       </function-arg-def>
+      <function-arg-def name="runInstallation" type="required">
+      </function-arg-def>
+      <function-arg-def name="runConfiguration" type="required">
+      </function-arg-def>
       <function-arg-def name="runScheduler" type="required">
       </function-arg-def>
     </function-map-args>
@@ -108,22 +112,15 @@
         '=================== PREAMBLE  ========================='
       </message>
       
-      <!--==== Get the list of hosts for each instance ====-->
-      <script>
-        _list = []
-        _listName = []
-        for instance in instances:
-          if instance.getHost() not in _listName:
-            _listName.append(instance.getHost())
-            _list.append(instance)
-      </script>
-      <!--== Do some stuff on instances machines ==-->
-      <paralleliterate in="_list" var="instance">
+      <!--========================================================-->
+      <!--=======          INSTANCE PREAMBLE                 =====-->
+      
+      <!--======= Create instance log dir on instance's host =====-->
+      <paralleliterate in="instances" var="instance">
         <sequence>
-          <!-- Create folders on remote hosts -->
           <call function="'createFolder'">
             { 'location'   : instance.getHost(),
-              'foldername' : LOG_DIR,
+              'foldername' : instance.getLogDir(),
               'fileFd'     : NO_FILE
             }
           </call>
@@ -133,13 +130,24 @@
               'fileFd'     : NO_FILE
             }
           </call>
-          <call function="'createFolder'">
-            { 'location'   : instance.getHost(),
-              'foldername' : LOG_XML_TMP_DIR,
-              'fileFd'     : NO_FILE
-            }
-          </call>
-          <!-- Copy framework files needed to instance host -->
+        </sequence>
+      </paralleliterate>
+      
+      <!--== Copy framework files needed to instance hosts    ==-->
+      <!-- Copy framework one time per host even if several     -->
+      <!-- instances are on a same host                         -->
+      
+      <!--== Get the list of hosts for each instance ==-->
+      <script>
+        _list = []
+        _listName = []
+        for instance in instances:
+          if instance.getHost() not in _listName:
+            _listName.append(instance.getHost())
+            _list.append(instance)
+      </script>
+      <paralleliterate in="_list" var="instance">
+        <sequence>
           <call function="'createFolder'">
             { 'location'   : instance.getHost(),
               'foldername' : LOCAL_TESTS_DIR,
@@ -161,31 +169,53 @@
       </paralleliterate>
       
       
-      <!-- Get opends buildid if instance is already installed -->
-      <paralleliterate in="instances" var="instance">
+      <!--== Get opends buildid if instance is already installed ==-->
+      <if expr="runInstallation == 'false'">
+        <paralleliterate in="instances" var="instance">
+          <sequence>
+            <if expr="instance.getProduct() == 'opends'">
+              <sequence>
+                <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+                 file="'%s/phases/installation/installation_opends.xml' %
+                 (TESTS_DIR)"/>
+                <call function="'getOpendsBuildID'">
+                  { 'instance' : instance }
+                </call>
+              </sequence>
+            </if>
+          </sequence>
+        </paralleliterate>
+      </if>
+      
+      <!--========================================================-->
+      <!--=======          CLIENT PREAMBLE                   =====-->
+      
+      <!--== Get the enabled clients list from all modules ==-->
+      <call function="'getEnabledClients'">{'scheduler':scheduler}</call>
+      <script>clients = STAXResult </script>
+      
+      <!--======= Create instance log dir on instance's host =====-->
+      <paralleliterate in="clients" var="client">
         <sequence>
-          <if expr="instance.getProduct() == 'opends'">
-            <sequence>
-              <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-               file="'%s/phases/installation/installation_opends.xml' %
-               (TESTS_DIR)"/>
-              <call function="'getOpendsBuildID'">
-                { 'instance' : instance }
-              </call>
-            </sequence>
-          </if>
+          <call function="'createFolder'">
+            { 'location'   : client.getHost(),
+              'foldername' : client.getLogDir(),
+              'fileFd'     : NO_FILE
+            }
+          </call>
+          <call function="'createFolder'">
+            { 'location'   : client.getHost(),
+              'foldername' : LOG_TMP_DIR,
+              'fileFd'     : NO_FILE
+            }
+          </call>
         </sequence>
       </paralleliterate>
       
-      <!--== Get the clients list from all modules ==-->
-      <script>
-        clients = []
-        for module in scheduler:
-          if (module.getEnabled() == "true"):
-            clients.extend(module.getClients())
-      </script>
-      
-      <!--==== Get the list of hosts for each client ====-->
+      <!--====== Copy framework files needed to client hosts ======-->
+      <!-- Copy framework one time per host even if several        -->
+      <!-- client on same host                                     -->
+      <!--== Get the list of hosts for each client              ===-->
       <script>
         _list = []
         _listName = []
@@ -196,74 +226,43 @@
       </script>
       <paralleliterate in="_list" var="client">
         <sequence>
-          <if expr="client.getHost() != NOT_DEFINED">
+          <if expr="runScheduler == 'true' or runConfiguration == 'true'">
             <sequence>
-              <!--== Create folders on remote hosts ==-->
-              <call function="'createFolder'">
-              { 'location'   : client.getHost(),
-                'foldername' : LOG_DIR,
-                'fileFd'     : NO_FILE
+              <script>
+                fullHostName = '%s%s' % (client.getHost(),DOMAIN[0])
+              </script>
+              <!-- Copy shared clients -->
+              <call function="'copyFolder'">
+              {
+                'remoteHost'    : fullHostName,
+                'fromDirectory' : '%s/clients' % TESTS_DIR,
+                'toDirectory'   : '%s/clients' % LOCAL_TESTS_DIR,
+                'fileFd'        : NO_FILE
               }
               </call>
-              <call function="'createFolder'">
-              { 'location'   : client.getHost(),
-                'foldername' : LOG_TMP_DIR,
-                'fileFd'     : NO_FILE
+              <!-- Copy clients that are under the scenario directory -->
+              <call function="'isFile'">
+              {
+                'location' : STAXServiceMachine,
+                'fileName' : '%s/scenario/%s/clients' % \
+                             (TESTS_DIR,DIR_NAME),
               }
               </call>
-              <call function="'createFolder'">
-              { 'location'   : client.getHost(),
-                'foldername' : LOG_XML_TMP_DIR,
-                'fileFd'     : NO_FILE
-              }
-              </call>
-              <!-- Copy framework files needed to instance host -->
-              <if expr="runScheduler == 'true'">
-                <sequence>
-                  <call function="'createFolder'">
-                  { 'location'   : client.getHost(),
-                    'foldername' : '%s/clients' % LOCAL_TESTS_DIR,
-                    'fileFd'     : NO_FILE
-                  }
-                  </call>
-                  <script>
-                    fullHostName = '%s%s' % (client.getHost(),DOMAIN[0])
-                  </script>
-                  <!-- Copy shared clients -->
-                  <call function="'copyFolder'">
-                  {
-                    'remoteHost'    : fullHostName,
-                    'fromDirectory' : '%s/clients' % TESTS_DIR,
-                    'toDirectory'   : '%s/clients' % LOCAL_TESTS_DIR,
-                    'fileFd'        : NO_FILE
-                  }
-                  </call>
-                  <!-- Copy clients that are under the scenario directory -->
-                  <call function="'isFile'">
-                  {
-                    'location' : STAXServiceMachine,
-                    'fileName' : '%s/scenario/%s/clients' % \
-                                 (TESTS_DIR,DIR_NAME),
-                  }
-                  </call>
-                  <script>
-                    fileExist = STAXResult
-                  </script>
-                  <if expr="fileExist == TRUE">
-                    <call function="'copyFolder'">
-                    {
-                      'remoteHost'    : fullHostName,
-                      'fromDirectory' : '%s/scenario/%s/clients' % \
-                                        (TESTS_DIR,DIR_NAME),
-                      'toDirectory'   : '%s/scenario/%s/clients' % \
-                                        (LOCAL_TESTS_DIR,DIR_NAME),
-                      'fileFd'        : NO_FILE
-                    }
-                    </call>
-                  </if>
-                </sequence>
+              <script>
+                fileExist = STAXResult
+              </script>
+              <if expr="fileExist == TRUE">
+                <call function="'copyFolder'">
+                {
+                  'remoteHost'    : fullHostName,
+                  'fromDirectory' : '%s/scenario/%s/clients' % \
+                                    (TESTS_DIR,DIR_NAME),
+                  'toDirectory'   : '%s/scenario/%s/clients' % \
+                                    (LOCAL_TESTS_DIR,DIR_NAME),
+                  'fileFd'        : NO_FILE
+                }
+                </call>
               </if>
-              
             </sequence>
           </if>
         </sequence>
@@ -301,27 +300,23 @@
         '=================== POSTAMBLE  ========================='
       </message>
       
-      <script> hosts = [] </script>
       
+      <!--========================================================-->
+      <!--=======          INSTANCE PREAMBLE                 =====-->
       <iterate in="instances" var="instance">
         <sequence>
-          <!--== Create instance directory on main host ==-->
-          <call function="'createFolder'">
-            { 'location'   : STAXServiceMachine,
-              'foldername' : '%s/%s' % (LOG_DIR,instance.getName()) ,
-              'fileFd'     : NO_FILE
+          <!--== Copy instance directory on main host ==-->
+          <call function="'copyFolder'">
+            { 'location'      : instance.getHost(),
+              'remoteHost'    : STAXServiceMachine,
+              'fromDirectory' : instance.getLogDir(),
+              'toDirectory'   : instance.getLogDir(),
+              'fileFd'        : NO_FILE
             }
           </call>
           
           
           <!--== Log cn=monitor replication stuff ==-->
-          <script>
-            clientHostFullName = '%s%s' % (instance.getHost(),DOMAIN[0])
-            if (clientHostFullName != STAXServiceMachine):
-              outputFile = '%s/cnMonitor.txt' % LOG_DIR
-            else:
-              outputFile = '%s/%s/cnMonitor.txt' % (LOG_DIR,instance.getName())
-          </script>
           <call function="'ldapSearch'">
             { 'location'       : instance.getHost(),
               'dsPath'         : instance.getInstallDir(),
@@ -334,62 +329,52 @@
               'dsFilter'       : 'objectclass=*',
               'expectedRC'     : 0,
               'fileFd'         : NO_FILE,
-              'outputFile'     : outputFile
+              'outputFile'     : '%s/cnMonitor.txt' % instance.getLogDir()
             }
           </call>
-          <if expr="clientHostFullName != STAXServiceMachine">
-            <call function="'copyFile'">
-            {
-              'srcFile'    : '%s/cnMonitor.txt' % LOG_DIR,
-              'destFile'   : '%s/%s/cnMonitor.txt'%(LOG_DIR,instance.getName()),
-              'location'   : instance.getHost(),
-              'remoteHost' : STAXServiceMachine,
-              'fileFd'     : NO_FILE
-            }
-            </call>
-          </if>
-          
-          <!--== Save conf.ldif file ==-->
           <call function="'copyFile'">
           {
-            'srcFile'    : '%s/config/config.ldif'%(instance.getInstallDir()),
-            'destFile'   : '%s/%s/config.ldif' % (LOG_DIR,instance.getName()),
+            'srcFile'    : '%s/cnMonitor.txt' % instance.getLogDir(),
+            'destFile'   : '%s/cnMonitor.txt' % instance.getLogDir(),
             'location'   : instance.getHost(),
             'remoteHost' : STAXServiceMachine,
             'fileFd'     : NO_FILE
           }
           </call>
           
-          <!--== Move tmp folder from remote hosts to main host ==-->
-          <call function="'moveFolder'">
+          <!--== Save conf.ldif file ==-->
+          <call function="'copyFile'">
           {
-            'sourceHost' : instance.getHost(),
-            'directory'  : '%s/tmp' % LOG_DIR,
-            'hosts'      : hosts
+            'srcFile'    : '%s/config/config.ldif' % instance.getInstallDir(),
+            'destFile'   : '%s/config.ldif' % instance.getLogDir(),
+            'location'   : instance.getHost(),
+            'remoteHost' : STAXServiceMachine,
+            'fileFd'     : NO_FILE
           }
           </call>
-          <script> hosts = STAXResult </script>
+          
         </sequence>
       </iterate>
       
-      <!--== Get the clients list from all modules ==-->
-      <script>
-        clients = []
-        for module in scheduler:
-          if (module.getEnabled() == "true"):
-            clients.extend(module.getClients())
-      </script>
+      
+      <!--========================================================-->
+      <!--=======          CLIENT PREAMBLE                   =====-->
+      
+      <!--== Get the enabled clients list from all modules ==-->
+      <call function="'getEnabledClients'">{'scheduler':scheduler}</call>
+      <script>clients = STAXResult </script>
       
       <iterate in="clients" var="client">
         <sequence>
-          <call function="'moveFolder'">
-          {
-            'sourceHost' : client.getHost(),
-            'directory'  : '%s/tmp' % LOG_DIR,
-            'hosts'      : hosts
-          }
+          <call function="'copyFolder'">
+            { 'location'      : client.getHost(),
+              'remoteHost'    : STAXServiceMachine,
+              'fromDirectory' : client.getLogDir(),
+              'toDirectory'   : client.getLogDir(),
+              'fileFd'        : NO_FILE
+            }
           </call>
-          <script> hosts = STAXResult </script>
+          
         </sequence>
       </iterate>
       
@@ -430,64 +415,6 @@
   </function>
   
   
-  
-  <!-- ************************************************************ -->
-  <function name="moveFolder" scope="local">
-   <function-prolog>
-      'copy remote directory to STAXServiceMachine and delete it'
-    </function-prolog>
-    <function-map-args>
-      <function-arg-def name="sourceHost" type="required">
-        <function-arg-description>
-          remote source host name where directory will be get
-        </function-arg-description>
-      </function-arg-def>
-      <function-arg-def name="directory" type="required">
-        <function-arg-description>
-          directory path
-        </function-arg-description>
-      </function-arg-def>
-      <function-arg-def name="hosts" type="optional" default="[]">
-        <function-arg-description>
-          if sourceHost is in the hosts list, then do nothing
-          add the sourceHost in the list if operations are done
-        </function-arg-description>
-      </function-arg-def>
-    </function-map-args>
-    <sequence>
-      <script>
-        sourceHostFullName = '%s%s' % (sourceHost,DOMAIN[0])
-      </script>
-      <if expr="sourceHost not in hosts
-                and sourceHostFullName != STAXServiceMachine
-                and sourceHost != NOT_DEFINED">
-        <sequence>
-          <call function="'copyFolder'">
-          {
-            'location'      : sourceHost,
-            'fromDirectory' : directory,
-            'toDirectory'   : directory,
-            'remoteHost'    : STAXServiceMachine,
-            'fileFd'        : NO_FILE
-          }
-          </call>
-          <!--
-          <call function="'deleteFolder'">
-            { 'location'   : sourceHost, 
-              'foldername' : '%s' % directory,
-              'fileFd'     : NO_FILE,
-              'expectedRC' : [0]
-            }
-          </call>
-          -->
-          <script>
-            hosts.append(sourceHost)
-          </script>
-        </sequence>
-      </if>
-      <return> hosts </return> 
-    </sequence>
-  </function>
 
 
 </stax>
diff --git a/opends/tests/system-tests/phases/parser/object_lib.xml b/opends/tests/system-tests/phases/parser/object_lib.xml
new file mode 100644
index 0000000..b613efb
--- /dev/null
+++ b/opends/tests/system-tests/phases/parser/object_lib.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
+<!--
+ ! CDDL HEADER START
+ !
+ ! The contents of this file are subject to the terms of the
+ ! 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.
+ ! 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,
+ ! 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 2008 Sun Microsystems, Inc.
+ ! -->
+<stax>
+  <!-- ************************************************************ -->
+  <!--                    Libs for instance object                  -->
+  <!-- ************************************************************ -->
+  
+  
+  
+  
+  
+  <!-- ************************************************************ -->
+  <!--                    Libs for client object                    -->
+  <!-- ************************************************************ -->
+  
+  
+  <!-- ************************************************************ -->
+  <function name="getEnabledClients" scope="local">
+   <function-prolog>
+      'return the list of enabled clients defined in the scheduler'
+    </function-prolog>
+    <function-map-args>
+      <function-arg-def name="scheduler" type="required">
+        <function-arg-description>
+          scheduler object
+        </function-arg-description>
+      </function-arg-def>
+    </function-map-args>
+    <sequence>
+      <script>
+        clients = []
+        for module in scheduler:
+          if (module.getEnabled() == "true"):
+            clients.extend(module.getClients())
+      </script>
+      
+      <return>clients</return>
+    </sequence>
+  </function>
+</stax>
+
diff --git a/opends/tests/system-tests/phases/parser/parser.py b/opends/tests/system-tests/phases/parser/parser.py
index 7580e99..f142b72 100755
--- a/opends/tests/system-tests/phases/parser/parser.py
+++ b/opends/tests/system-tests/phases/parser/parser.py
@@ -207,6 +207,7 @@
     self.buildId     = NOT_DEFINED
     self.binDir      = NOT_DEFINED
     self.synchroDate = NOT_DEFINED
+    self.logDir      = NOT_DEFINED
     
   def getId(self):
     return self.iid
@@ -261,7 +262,12 @@
     
   def setSynchroDate(self,synchroDate):
     self.synchroDate = synchroDate
-
+    
+  def getLogDir(self):
+    return self.logDir
+    
+  def setLogDir(self,logDir):
+    self.logDir = logDir
 
 ###########################
 class OpendsInstance(Instance):
@@ -316,6 +322,7 @@
     self.stop       = NOT_DEFINED
     self.dependency = NOT_DEFINED
     self.result     = NOT_DEFINED
+    self.logDir     = NOT_DEFINED
     
   def getId(self):
     return self.iid
@@ -355,6 +362,12 @@
     
   def setResult(self,result):
     self.result = result
+    
+  def getLogDir(self):
+    return self.logDir
+    
+  def setLogDir(self,logDir):
+    self.logDir = logDir
 
 
 ###########################
diff --git a/opends/tests/system-tests/phases/parser/parser.xml b/opends/tests/system-tests/phases/parser/parser.xml
index 9c611b8..266e03e 100755
--- a/opends/tests/system-tests/phases/parser/parser.xml
+++ b/opends/tests/system-tests/phases/parser/parser.xml
@@ -40,12 +40,14 @@
     
     <sequence>
       
+      <!--=================================================================-->
       <!--==========  Load XML file  =========-->
       <message log="1"> 
         'configuration file is : %s' % configurationFile
       </message>
       <call function="'parseXML'">configurationFile</call>
       
+      <!--=================================================================-->
       <!--==========  Parse xml  =========-->
       <script>
         instances = []
@@ -65,7 +67,8 @@
       </script>
       
       
-      <!--========  Set some attributes to add in objects   ======-->
+      <!--=================================================================-->
+      <!--========  Set some attributes to add in instance objects   ======-->
       <paralleliterate in="instances" var="instance">
         <sequence>
           <call function="'getOSvariables'">
@@ -95,10 +98,29 @@
           <script>
             instance.setSynchroDate(STAXResult[0])
           </script>
+          <!-- Set log dir for each instance -->
+          <script>
+            instance.setLogDir('%s/%s' % (LOG_DIR,instance.getName()))
+          </script>
         </sequence>
       </paralleliterate>
       
       
+      <!--========  Set some attributes to add in client objects   ======-->
+      <!--== Get the enabled clients list from all modules ==-->
+      <call function="'getEnabledClients'">{'scheduler':scheduler}</call>
+      <script>clients = STAXResult </script>
+      <paralleliterate in="clients" var="client">
+        <sequence>
+          <script>
+            client.setLogDir('%s/client_%s_id%s' % \
+            (LOG_DIR,client.getName(),client.getId()))
+          </script>
+        </sequence>
+      </paralleliterate>
+      
+      
+      <!--=================================================================-->
       <!--========  Basic configuration checks       ======-->
       
       <!-- replace localhost by real host name -->
@@ -128,6 +150,10 @@
             portLdaps1 = instance.getLDAPSPort()
             portJmx1   = instance.getJMXPort()
             
+            if host1 == NOT_DEFINED:
+              msg = '%s\nERROR : instance %s has host %s'%\
+                    (msg,name1,host1)
+            
             for instance2 in instances:
               name2      = instance2.getName()
               product2   = instance2.getProduct()
@@ -164,6 +190,11 @@
         i = 0
         while i &lt; nbClients:
           client1 = clients.pop()
+          
+          if client1.getHost() == NOT_DEFINED:
+              msg = '%s\nERROR : client %s has host %s'%\
+                    (msg,client1.getHost(),host1)
+          
           for client2 in clients:
             if client1.getId() == client2.getId():
               msg = '%s\ERROR: clients %s and %s have same id %s, must NOT!'%\
diff --git a/opends/tests/system-tests/phases/scheduler/scheduler.xml b/opends/tests/system-tests/phases/scheduler/scheduler.xml
index a9f3c8c..c13c5b6 100755
--- a/opends/tests/system-tests/phases/scheduler/scheduler.xml
+++ b/opends/tests/system-tests/phases/scheduler/scheduler.xml
@@ -368,10 +368,19 @@
           </elseif>
           <else>
             <sequence>
+              <script>
+                str = 'ERROR : cant find files %s/%s.xml and %s/%s.xml' % \
+                (localWorkingDir,client.getName(),\
+                 sharedWorkingdir,client.getName())
+              </script>
               <message>
-                'ERROR : cant find files %s and %s' % \
-                (localClientXmlFile,clientXmlFile)
+                str
               </message>
+              <call function="'writeMessage'">
+              { 'fileFd'  : fileFd,
+                'content' : str
+              }
+              </call>
               <script>ERR_NUM[0] += 1</script>
             </sequence>
           </else>
@@ -403,11 +412,16 @@
       <if expr="timerKilled == TRUE">
         <sequence>
           <!-- TBD: The client has been killed, we have to make sure that 
-               xml result structure is coherent... -->
+               xml result structure is coherent...
+               Another issue: in this case we can not get the client RC
+          -->
           <message>
-            'WARNING: client %s has been killed, %s is probably over loaded'%\
+            'ERROR: client %s has been killed, %s is probably over loaded'%\
             (client.getName(),client.getHost())
           </message>
+          <script>
+            ERR_NUM[0] += 1
+          </script>
           <!-- 
           <call function="'writeEndTagOperation'">{'fileFd'  : fileFd}</call>
           -->
diff --git a/opends/tests/system-tests/phases/shared/functions/ldap.xml b/opends/tests/system-tests/phases/shared/functions/ldap.xml
index 93dbdd0..fb574a2 100755
--- a/opends/tests/system-tests/phases/shared/functions/ldap.xml
+++ b/opends/tests/system-tests/phases/shared/functions/ldap.xml
@@ -251,9 +251,12 @@
             failedServers = []
             failingServerList = ''
             referenceServerPath = instance.getInstallDir()
-            referenceTree = '%s/%s_%s_referenceTree.ldif' % (LOG_TMP_DIR,filePrefix,instance.getName()),
-            sampleTree = '%s/%s_%s_sampleTree.ldif' % (LOG_TMP_DIR,filePrefix,instance.getName()),
-            treeDiffs = '%s/%s_%s_treeDiffs.ldif' % (LOG_TMP_DIR,filePrefix,instance.getName())
+            referenceTree = '%s/%s_%s_referenceTree.ldif' % \
+                      (instance.getLogDir(),filePrefix,instance.getName()),
+            sampleTree = '%s/%s_%s_sampleTree.ldif' % \
+                      (instance.getLogDir(),filePrefix,instance.getName()),
+            treeDiffs = '%s/%s_%s_treeDiffs.ldif' % \
+                      (instance.getLogDir(),filePrefix,instance.getName())
             
             dsAttributes = 'dn postalAddress postalCode description \
     uid employeeNumber initials givenName pager mobile \
diff --git a/opends/tests/system-tests/phases/shared/functions/stafcmd.xml b/opends/tests/system-tests/phases/shared/functions/stafcmd.xml
index 0992780..f79d6e3 100755
--- a/opends/tests/system-tests/phases/shared/functions/stafcmd.xml
+++ b/opends/tests/system-tests/phases/shared/functions/stafcmd.xml
@@ -195,7 +195,8 @@
         'fileFd'  : fileFd }
       </call>
       <call function="'writeMessage'">
-        { 'content'  : 'Copy directory %s FROM machine %s TO machine %s into %s' % (fromDirectory,location,remoteHost,toDirectory),
+        { 'content'  : 'Copy directory %s FROM machine %s TO machine %s into %s' %\
+                       (fromDirectory,location,remoteHost,toDirectory),
           'fileFd'   : fileFd }
       </call>
       
@@ -204,29 +205,52 @@
           <call function="'writeMessage'">
           {
             'content' : 'SKIP : same directory %s, same host %s' % \
-                        (remoteHost,remoteHost),
+                        (fromDirectory,remoteHost),
             'fileFd'  : fileFd 
           }
           </call>
         </sequence>
       <else>
         <sequence>
-          <stafcmd name="'STAF Command: copy directory'">
-            <location>'%s' % location</location>
-            <service>'fs'</service>
-            <request>
-                'COPY DIRECTORY %s TODIRECTORY %s TOMACHINE %s RECURSE CASEINSENSITIVE' % (fromDirectory,toDirectory,remoteHost)
-            </request>
-          </stafcmd>
-          <script>
-            cmdRC=RC
-            cmdResult=STAFResult
-          </script>
-          <call function="'checkRC'">
-            { 'returncode' : cmdRC ,
-              'result'     : cmdResult,
-              'fileFd'     : fileFd }
+          
+          <call function="'isFile'">
+          {
+            'location' : remoteHost,
+            'fileName' : toDirectory
+          }
           </call>
+          <script>
+            fileExist = STAXResult
+          </script>
+          <if expr="fileExist == TRUE">
+            <call function="'writeMessage'">
+            {
+              'content' : 'SKIP: remote folder %s exists (NFS?) on %s' % \
+                          (toDirectory,remoteHost),
+              'fileFd'  : fileFd 
+            }
+            </call>
+          <else>
+            <sequence>
+              <stafcmd name="'STAF Command: copy directory'">
+                <location>'%s' % location</location>
+                <service>'fs'</service>
+                <request>
+                    'COPY DIRECTORY %s TODIRECTORY %s TOMACHINE %s RECURSE CASEINSENSITIVE' % (fromDirectory,toDirectory,remoteHost)
+                </request>
+              </stafcmd>
+              <script>
+                cmdRC=RC
+                cmdResult=STAFResult
+              </script>
+              <call function="'checkRC'">
+                { 'returncode' : cmdRC ,
+                  'result'     : cmdResult,
+                  'fileFd'     : fileFd }
+              </call>
+            </sequence>
+          </else>
+          </if>
         </sequence>
       </else>
       </if>
diff --git a/opends/tests/system-tests/phases/verdict/verdict.xml b/opends/tests/system-tests/phases/verdict/verdict.xml
index 74e6f2e..7f69a63 100755
--- a/opends/tests/system-tests/phases/verdict/verdict.xml
+++ b/opends/tests/system-tests/phases/verdict/verdict.xml
@@ -96,11 +96,17 @@
               <!-- parallel process, all variables defined        -->
               <!-- and values set below are local to the sequence -->
               <script>
-                
                 instance = topoInstance.getInstanceRef()
+              </script>
+              <call function="'getLogFileName'">
+                { 'type'   : 'instance',
+                  'object' : instance,
+                  'prefix' : 'verdict'
+                }
+              </call>
+              <script>
+                logFile = STAXResult
                 
-                logName = '%s_%s' % (instance.getHost(),instance.getName())
-                logFile = '%s/verdict_%s.xml' % (LOG_XML_TMP_DIR,logName)
                 fileList.append(logFile)
                 
                 cFileFd = open(logFile,'w')

--
Gitblit v1.10.0