From e39398018aba01db52cf8d2df110045c61712ee6 Mon Sep 17 00:00:00 2001
From: smaguin <smaguin@localhost>
Date: Mon, 30 Jun 2008 08:32:15 +0000
Subject: [PATCH] Split clients to have preamble,run,postamble

---
 opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModifyPostamble.xml |  116 ++++++++++
 opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModify.xml          |  219 ++-----------------
 opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModifyPreamble.xml  |  164 ++++++++++++++
 opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModifyLib.xml       |  136 ++++++++++++
 4 files changed, 444 insertions(+), 191 deletions(-)

diff --git a/opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModify.xml b/opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModify.xml
index 9530410..be25610 100644
--- a/opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModify.xml
+++ b/opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModify.xml
@@ -28,12 +28,13 @@
 <stax>
 
   <defaultcall function="secureUserpasswordModify"/>
-
+  
+  
   <!-- ************************************************************ -->
-  <function name="secureUserpasswordModify" scope="local">
-    
+  <!-- Client is automatically called by the scheduler and must     -->
+  <!-- always define all the parameters below                       -->
+  <function name="secureUserpasswordModify">
     <function-map-args>
-      <function-arg-def name="workingDir" type="required"/>
       <function-arg-def name="client"     type="required"/>
       <function-arg-def name="instances"  type="required"/>
       <function-arg-def name="duration"   type="required"/>
@@ -42,7 +43,6 @@
       <function-arg-def name="fileFd"     type="required"/>
     </function-map-args>
     
-
     <sequence>
       <!-- ===================   Comments   =================== -->
       <!-- client is run under paralleliterate tag              -->
@@ -54,100 +54,21 @@
         msg = ''
       </script>
       
-      <!-- ==================    Preamble   =================== -->
+      <!-- ==================    Parser     =================== -->
       <!-- parse the client parameters :                        -->
       <!-- params is [[param1,val1],[param2,val2],...]          -->
       <!-- get the ldap instance parameters                     -->
+      <import machine="'%s' % (client.getHost())"
+              file="'%s/%sLib.xml' % (client.getPath(),client.getName())"/>
+      <call function="'%sParser' % client.getName()">
+      {
+        'client'     : client,
+        'instances'  : instances,
+        'duration'   : duration,
+        'suffix'     : suffix
+      }
+      </call>
       
-  
-      <script>
-        compilDir = '%s/%s_%s' % (workingDir,client.getHost(),client.getId())
-        
-        outFile = '%s/client_secureUserpasswordModify_id%s.txt' % \
-                  (client.getLogDir(),client.getId())
-        
-        #
-        # Extract client parameters from client.getParams()
-        #
-        cParams = client.getParams()
-        try:
-          serverInstanceFromClient = cParams[0][1]
-        except IndexError:
-          serverInstanceFromClient = NOT_DEFINED
-          msg = '%s\nERROR: serverInstanceFromClient undefined,mandatory' % msg
-        try:
-          baseDn = cParams[1][1]
-        except IndexError:
-          baseDn = NOT_DEFINED
-          msg = '%s\nERROR: baseDn undefined,mandatory' % msg
-        try:
-          nbCnx = cParams[2][1]
-        except IndexError:
-          nbCnx = NOT_DEFINED
-          msg = '%s\nERROR: nbCnx undefined,mandatory' % msg
-        try:
-          nbMaxOp = cParams[3][1]
-        except IndexError:
-          nbMaxOp = NOT_DEFINED
-          msg = '%s\nERROR: nbMaxOperations undefined,mandatory' % msg
-        try:
-          attributeName = cParams[4][1]
-        except IndexError:
-          attributeName = NOT_DEFINED
-        try:
-          protocol = cParams[5][1]
-        except IndexError:
-          protocol = NOT_DEFINED
-        try:
-          certAlias = cParams[6][1]
-        except IndexError:
-          certAlias = NOT_DEFINED
-        try:
-          delaySec = cParams[7][1]
-        except IndexError:
-          delaySec = NOT_DEFINED          
-        #
-        # setup parms to run the client
-        #
-        if serverInstanceFromClient != NOT_DEFINED:
-          sys.path.append("%s/phases/scheduler" % TESTS_DIR )
-          from scheduler import getInstance
-          serverInstance = getInstance(serverInstanceFromClient,instances)
-          if (serverInstance == 'ERROR'):
-            msg = '%s\nERROR: cant find client instance named' % msg
-            msg = '%s %s in server instance list' % \
-                  (msg,serverInstanceFromClient)
-            
-          else:
-            # remove sec, try to finish before timer kill -9 the client
-            duration = duration - 120
-          
-            # keystorePath
-            keystorePath = "%s/CERT_%s_%s/config" % (client.getLogDir(),client.getName(),client.getId())
-            
-            parms=[]
-            if (protocol == 'ssl'):
-              parms.append('-Dhostname=%s -Dport=%s' % \
-                       (serverInstance.getHost(),serverInstance.getLDAPSPort()))
-            else:
-              parms.append('-Dhostname=%s -Dport=%s' % \
-                       (serverInstance.getHost(),serverInstance.getLDAPPort()))
-                       
-            parms.append('-Dsuffix="%s"' % baseDn)
-            
-            parms.append('-Dnb_threads=%s -DNB_MAX_mod=%s -DmaxDuration=%s' % (nbCnx,nbMaxOp,duration))
-            parms.append('-Dprotocol="%s"' % protocol)
-            if attributeName != NOT_DEFINED:
-              parms.append('-DattributeName="%s"' % attributeName)
-            
-            parms.append('-DbindDN="%s"' % DIRECTORY_INSTANCE_DN)
-            parms.append('-DbindPW="%s"' % DIRECTORY_INSTANCE_PSWD)
-                          
-            if delaySec != NOT_DEFINED:
-              parms.append('-DdelaySec="%s"' % delaySec) 
-            parms = ' '.join(parms)
-      </script>
-        
       <if expr="msg.find('ERROR') != -1">
         <sequence>
           <message>'%s' % msg</message>
@@ -166,75 +87,6 @@
         </sequence>
       <else>
         <sequence>
-          
-          <!-- ==== Add execute permission to build.ksh file ==== -->
-          <call function="'writeStartTagOperation'">
-          { 'tagName' : 'chmod',
-            'fileFd'  : fileFd }
-          </call>
-          <call function="'writeMessage'">
-          {'content' : 'Add execute permission to build.ksh file',
-           'fileFd'  : fileFd}
-          </call>
-          
-          
-          <process name="'%s: chmod +x build.ksh' % client.getHost()">
-            <location>client.getHost()</location>
-            <command mode="'shell'">'chmod +x build.ksh'</command>
-            <parms/>
-            <workdir>workingDir</workdir>
-            <envs>['PATH=/bin:/usr/bin']</envs>
-            <stderr mode="'stdout'"/>
-            <stdout/>
-            <returnstdout/>
-          </process>
-          <call function="'checkRC'">
-            { 'returncode' : RC,
-              'result'     : STAXResult[0][1],
-              'fileFd'     : fileFd }
-          </call>
-          <script>
-            errNum += STAXResult
-          </script>
-          <call function="'writeEndTagOperation'">{'fileFd'  : fileFd}</call>
-          
-          
-          <!-- ==== Build client : run build.ksh file ==== -->
-          <call function="'writeStartTagOperation'">
-          { 'tagName' : 'build',
-            'fileFd'  : fileFd }
-          </call>
-        
-          
-          <!-- Build Client in unique directory (compilDir), avoid          -->
-          <!-- conflict if same client is run several time at the same time -->
-          <process name="'%s: build %s' % (client.getHost(),client.getName())">
-            <location>client.getHost()</location>
-            <command mode="'shell'">'./build.ksh'</command>
-            <parms/>
-            <workdir>workingDir</workdir>
-            <envs>['PATH=%s/bin:/bin:/usr/bin' % JAVA_HOME,'COMPILDIR=%s' % compilDir ]</envs>
-            <stderr mode="'stdout'"/>
-            <stdout/>
-            <returnstdout/>
-          </process>
-          <call function="'checkRC'">
-            { 'returncode' : RC,
-              'result'     : STAXResult[0][1],
-              'fileFd'     : fileFd }
-          </call>
-          <if expr="RC != 0">
-            <message>
-              'FAILED to build client %s on %s' % \
-              (client.getName(),client.getHost())
-            </message>
-          </if>
-          <script>
-            errNum += STAXResult
-          </script>
-          <call function="'writeEndTagOperation'">{'fileFd'  : fileFd}</call>
-          
-          
           <!-- ========== Run the client ========== -->
           <call function="'writeStartTagOperation'">
           { 'tagName' : 'run',
@@ -242,7 +94,14 @@
           </call>
           <call function="'writeMessage'">
           { 'fileFd'  : fileFd,
-            'content' : 'Do ldapmodify on %s:%s' % \
+            'content' : 'Do secure or non secure ldapsearchs on %s:%s' % \
+                        (serverInstance.getHost(),serverInstance.getLDAPPort())
+          }
+          </call>
+          
+          <call function="'writeMessage'">
+          { 'fileFd'  : fileFd,
+            'content' : 'Do userpassword modify on %s:%s' % \
                         (serverInstance.getHost(),serverInstance.getLDAPSPort())
           }
           </call>
@@ -271,12 +130,13 @@
             <location>client.getHost()</location>
             <command>'%s/bin/java' % JAVA_HOME</command>
             <parms>cParam </parms>
-            <workdir>workingDir</workdir>
+            <workdir>client.getPath()</workdir>
             <envs>['PATH=%s/bin:/bin:/usr/bin' % JAVA_HOME]</envs>
             <stderr mode="'stdout'"/>
             <stdout>outFile</stdout>
             <returnstdout/>
           </process>
+
           <!-- TBD : result should be STAXResult[0][1] : problem when
                      javaexception, with carac " and < >-->
           <call function="'checkRC'">
@@ -289,33 +149,12 @@
           </script>
           <call function="'writeEndTagOperation'">{'fileFd'  : fileFd}</call>
           
-          <!-- ========== Postamble ========== -->
           <call function="'writeMessage'">
           {'content' : 'Output file %s' % outFile,
+           'xlink'   : outFile,
            'fileFd'  : fileFd}
           </call>
           
-          
-          <process name="'%s:%s: Grep' % (client.getHost(),client.getName())">
-            <location>client.getHost()</location>
-            <command mode="'shell'">
-              "grep 'TOTAL' %s | cut -d ' ' -f3-" % outFile
-            </command>
-            <envs>['PATH=/bin:/usr/bin']</envs>
-            <stderr mode="'stdout'"/>
-            <stdout/>
-            <returnstdout/>
-          </process>
-          <script>
-            summary = STAXResult[0][1]
-          </script>
-         
-          
-          <call function="'writeMessage'">
-          {'content' : 'Summary %s' % (summary),
-           'fileFd'  : fileFd}
-          </call>
-         
         </sequence>
       </else>
       </if>
@@ -324,7 +163,5 @@
       
     </sequence>
     
-  </function>   
-  
+  </function>
 </stax>
-
diff --git a/opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModifyLib.xml b/opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModifyLib.xml
new file mode 100755
index 0000000..572c5da
--- /dev/null
+++ b/opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModifyLib.xml
@@ -0,0 +1,136 @@
+<?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>
+
+  <defaultcall function="secureUserpasswordModifyParser"/>
+  
+  
+  <!-- ************************************************************ -->
+  <!-- Client Parser -->
+  <!-- This function must NOT have scope=local has its variables may -->
+  <!-- be used by the caller -->
+  <function name="secureUserpasswordModifyParser">
+    <function-map-args>
+      <function-arg-def name="client"     type="required"/>
+      <function-arg-def name="instances"  type="required"/>
+      <function-arg-def name="duration"   type="required"/>
+      <function-arg-def name="suffix"     type="required"/>
+    </function-map-args>
+
+   <sequence>  
+      <script>
+        compilDir = '%s/%s_%s' % (client.getPath(),client.getHost(),client.getId())
+        
+
+	#
+        # Extract client parameters from client.getParams()
+        #
+        cParams = client.getParams()
+        try:
+          serverInstanceFromClient = cParams[0][1]
+        except IndexError:
+          serverInstanceFromClient = NOT_DEFINED
+          msg = '%s\nERROR: serverInstanceFromClient undefined,mandatory' % msg
+        try:
+          baseDn = cParams[1][1]
+        except IndexError:
+          baseDn = NOT_DEFINED
+          msg = '%s\nERROR: baseDn undefined,mandatory' % msg
+        try:
+          nbCnx = cParams[2][1]
+        except IndexError:
+          nbCnx = NOT_DEFINED
+          msg = '%s\nERROR: nbCnx undefined,mandatory' % msg
+        try:
+          nbMaxOp = cParams[3][1]
+        except IndexError:
+          nbMaxOp = NOT_DEFINED
+          msg = '%s\nERROR: nbMaxOperations undefined,mandatory' % msg
+        try:
+          attributeName = cParams[4][1]
+        except IndexError:
+          attributeName = NOT_DEFINED
+        try:
+          protocol = cParams[5][1]
+        except IndexError:
+          protocol = NOT_DEFINED
+        try:
+          certAlias = cParams[6][1]
+        except IndexError:
+          certAlias = NOT_DEFINED
+        try:
+          delaySec = cParams[7][1]
+        except IndexError:
+          delaySec = NOT_DEFINED          
+        #
+        # setup parms to run the client
+        #
+        if serverInstanceFromClient != NOT_DEFINED:
+          sys.path.append("%s/phases/scheduler" % TESTS_DIR )
+          from scheduler import getInstance
+          serverInstance = getInstance(serverInstanceFromClient,instances)
+          if (serverInstance == 'ERROR'):
+            msg = '%s\nERROR: cant find client instance named' % msg
+            msg = '%s %s in server instance list' % \
+                  (msg,serverInstanceFromClient)
+            
+          else:
+            # remove sec, try to finish before timer kill -9 the client
+            duration = duration - 20
+          
+            # keystorePath
+            keystorePath = "%s/CERT_%s_%s/config" % (client.getLogDir(),client.getName(),client.getId())
+            
+            parms=[]
+            if (protocol == 'ssl'):
+              parms.append('-Dhostname=%s -Dport=%s' % \
+                       (serverInstance.getHost(),serverInstance.getLDAPSPort()))
+            else:
+              parms.append('-Dhostname=%s -Dport=%s' % \
+                       (serverInstance.getHost(),serverInstance.getLDAPPort()))
+                       
+            parms.append('-Dsuffix="%s"' % baseDn)
+            
+            parms.append('-Dnb_threads=%s -DNB_MAX_mod=%s -DmaxDuration=%s' % (nbCnx,nbMaxOp,duration))
+            parms.append('-Dprotocol="%s"' % protocol)
+            if attributeName != NOT_DEFINED:
+              parms.append('-DattributeName="%s"' % attributeName)
+            
+            parms.append('-DbindDN="%s"' % DIRECTORY_INSTANCE_DN)
+            parms.append('-DbindPW="%s"' % DIRECTORY_INSTANCE_PSWD)
+                          
+            if delaySec != NOT_DEFINED:
+              parms.append('-DdelaySec="%s"' % delaySec) 
+            parms = ' '.join(parms)
+      </script>    
+
+    </sequence>
+  </function>
+  
+</stax>
+
diff --git a/opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModifyPostamble.xml b/opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModifyPostamble.xml
new file mode 100755
index 0000000..9aff53e
--- /dev/null
+++ b/opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModifyPostamble.xml
@@ -0,0 +1,116 @@
+<?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>
+
+  <defaultcall function="secureUserpasswordModifyPostamble"/>
+
+  <!-- ************************************************************ -->
+  <!-- Client postamble is automatically called by the scheduler    -->
+  <!-- and must always define all the parameters below              -->
+  <function name="secureUserpasswordModifyPostamble" scope="local">
+    <function-map-args>
+      <function-arg-def name="client"     type="required"/>
+      <function-arg-def name="instances"  type="required"/>
+      <function-arg-def name="duration"   type="required"/>
+      <function-arg-def name="suffix"     type="required"/>
+      <function-arg-def name="outFile"    type="required"/>
+      <function-arg-def name="fileFd"     type="required"/>
+    </function-map-args>
+    
+    <sequence>
+      <!-- ===================   Comments   =================== -->
+      <!-- client is run under paralleliterate tag              -->
+      <!-- each variables defined are internal                  -->
+      <!-- client should have its own err_num variable in order -->
+      <!-- to inform scheduler if it has pass/fail status       -->
+      <script>
+        errNum = 0
+        msg = ''
+      </script>
+      <!-- ==================    Parser     =================== -->
+      <!-- parse the client parameters :                        -->
+      <!-- params is [[param1,val1],[param2,val2],...]          -->
+      <!-- get the ldap instance parameters                     -->
+      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+              file="'%s/%sLib.xml' % (client.getPath(),client.getName())"/>
+      <call function="'%sParser' % client.getName()">
+      {
+        'client'     : client,
+        'instances'  : instances,
+        'duration'   : duration,
+        'suffix'     : suffix
+      }
+      </call>
+
+
+      <if expr="msg.find('ERROR') != -1">
+        <sequence>
+          <message>'%s' % msg</message>
+          <call function="'writeOperationResult'">
+            {
+              'returncode' : '1',
+              'expected'   : '0',
+              'result'     : msg,
+              'status'     : 'ERROR',
+              'fileFd'     : fileFd
+            }
+          </call>
+          <script>
+            errNum += 1
+          </script>
+        </sequence>
+      <else>
+        <sequence>
+          <process name="'%s:%s: Grep' % (client.getHost(),client.getName())">
+            <location>client.getHost()</location>
+            <command mode="'shell'">
+              "grep 'ERROR' %s " % outFile
+            </command>
+            <envs>['PATH=/bin:/usr/bin']</envs>
+            <stderr mode="'stdout'"/>
+            <stdout/>
+            <returnstdout/>
+          </process>
+          <script>
+            if RC == 0:
+              errNum +=1
+            summary = STAXResult[0][1]
+          </script>
+          <call function="'writeMessage'">
+          {'content' : 'Summary %s' % (summary),
+           'fileFd'  : fileFd}
+          </call>
+        </sequence>
+      </else>
+      </if>
+      <return> errNum </return>
+      
+    </sequence>
+  </function>
+
+</stax>
diff --git a/opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModifyPreamble.xml b/opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModifyPreamble.xml
new file mode 100755
index 0000000..2596d64
--- /dev/null
+++ b/opends/tests/system-tests/scenario/singleServer/clients/secureUserpasswordModify/secureUserpasswordModifyPreamble.xml
@@ -0,0 +1,164 @@
+<?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>
+
+  <defaultcall function="secureUserpasswordModifyPreamble"/>
+
+  <!-- ************************************************************ -->
+  <!-- Client preamble is automatically called by the scheduler     -->
+  <!-- and must always define all the parameters below              -->
+  <function name="secureUserpasswordModifyPreamble" scope="local">
+    <function-map-args>
+      <function-arg-def name="client"     type="required"/>
+      <function-arg-def name="instances"  type="required"/>
+      <function-arg-def name="duration"   type="required"/>
+      <function-arg-def name="suffix"     type="required"/>
+      <function-arg-def name="outFile"    type="required"/>
+      <function-arg-def name="fileFd"     type="required"/>
+    </function-map-args>
+    
+    <sequence>
+      <!-- ===================   Comments   =================== -->
+      <!-- client is run under paralleliterate tag              -->
+      <!-- each variables defined are internal                  -->
+      <!-- client should have its own err_num variable in order -->
+      <!-- to inform scheduler if it has pass/fail status       -->
+      <script>
+        errNum = 0
+        msg = ''
+      </script>
+      <!-- ==================    Parser     =================== -->
+      <!-- parse the client parameters :                        -->
+      <!-- params is [[param1,val1],[param2,val2],...]          -->
+      <!-- get the ldap instance parameters                     -->
+      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+              file="'%s/%sLib.xml' % (client.getPath(),client.getName())"/>
+      <call function="'%sParser' % client.getName()">
+      {
+        'client'     : client,
+        'instances'  : instances,
+        'duration'   : duration,
+        'suffix'     : suffix
+      }
+      </call>
+      <if expr="msg.find('ERROR') != -1">
+        <sequence>
+          <message>'%s' % msg</message>
+          <call function="'writeOperationResult'">
+            {
+              'returncode' : '1',
+              'expected'   : '0',
+              'result'     : msg,
+              'status'     : 'ERROR',
+              'fileFd'     : fileFd
+            }
+          </call>
+          <script>
+            errNum += 1
+          </script>
+        </sequence>
+      <else>
+        <sequence>
+          <!-- ==== Add execute permission to build.ksh file ==== -->
+          <call function="'writeStartTagOperation'">
+          { 'tagName' : 'chmod',
+            'fileFd'  : fileFd }
+          </call>
+          <call function="'writeMessage'">
+          {'content' : 'Add execute permission to build.ksh file',
+           'fileFd'  : fileFd}
+          </call>
+          
+          <process name="'%s: chmod +x build.ksh' % client.getHost()">
+            <location>client.getHost()</location>
+            <command mode="'shell'">'chmod +x build.ksh'</command>
+            <parms/>
+            <workdir>client.getPath()</workdir>
+            <envs>['PATH=/bin:/usr/bin']</envs>
+            <stderr mode="'stdout'"/>
+            <stdout/>
+            <returnstdout/>
+          </process>
+          <call function="'checkRC'">
+            { 'returncode' : RC,
+              'result'     : STAXResult[0][1],
+              'fileFd'     : fileFd }
+          </call>
+          <script>
+            errNum += STAXResult
+          </script>
+          <call function="'writeEndTagOperation'">{'fileFd'  : fileFd}</call>
+          
+          
+          <!-- ==== Build client : run build.ksh file ==== -->
+          <call function="'writeStartTagOperation'">
+          { 'tagName' : 'build',
+            'fileFd'  : fileFd }
+          </call>
+          <call function="'writeMessage'">
+          {'content' : 'Build client',
+           'fileFd'  : fileFd}
+          </call>
+          
+          <!-- Build Client in unique directory (compilDir), avoid          -->
+          <!-- conflict if same client is run several time at the same time -->
+          <process name="'%s: build %s' % (client.getHost(),client.getName())">
+            <location>client.getHost()</location>
+            <command mode="'shell'">'./build.ksh'</command>
+            <parms/>
+            <workdir>client.getPath()</workdir>
+            <envs>['PATH=%s/bin:/bin:/usr/bin' % JAVA_HOME,'COMPILDIR=%s' % compilDir ]</envs>
+            <stderr mode="'stdout'"/>
+            <stdout/>
+            <returnstdout/>
+          </process>
+          <call function="'checkRC'">
+            { 'returncode' : RC,
+              'result'     : STAXResult[0][1],
+              'fileFd'     : fileFd }
+          </call>
+          <if expr="RC != 0">
+            <message>
+              'FAILED to build client %s on %s' % \
+              (client.getName(),client.getHost())
+            </message>
+          </if>
+          <script>
+            errNum += STAXResult
+          </script>
+          <call function="'writeEndTagOperation'">{'fileFd'  : fileFd}</call>
+        </sequence>
+      </else>
+      </if>
+      
+      <return> errNum </return>
+      
+    </sequence>
+  </function>
+
+</stax>

--
Gitblit v1.10.0