From 657761fa9531cff773a379f602340efe5fb44e2a Mon Sep 17 00:00:00 2001
From: smaguin <smaguin@localhost>
Date: Mon, 30 Jun 2008 08:28:46 +0000
Subject: [PATCH] add postamble and preamble to client

---
 opends/tests/system-tests/scenario/singleServer/clients/secureModifyEntries/secureModifyEntries.xml |  227 ++++++--------------------------------------------------
 1 files changed, 24 insertions(+), 203 deletions(-)

diff --git a/opends/tests/system-tests/scenario/singleServer/clients/secureModifyEntries/secureModifyEntries.xml b/opends/tests/system-tests/scenario/singleServer/clients/secureModifyEntries/secureModifyEntries.xml
index 21cb5bc..29bba75 100644
--- a/opends/tests/system-tests/scenario/singleServer/clients/secureModifyEntries/secureModifyEntries.xml
+++ b/opends/tests/system-tests/scenario/singleServer/clients/secureModifyEntries/secureModifyEntries.xml
@@ -28,12 +28,13 @@
 <stax>
 
   <defaultcall function="secureModifyEntries"/>
-
+  
+  
   <!-- ************************************************************ -->
-  <function name="secureModifyEntries" scope="local">
-    
+  <!-- Client is automatically called by the scheduler and must     -->
+  <!-- always define all the parameters below                       -->
+  <function name="secureModifyEntries">
     <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,110 +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_secureModifyEntries_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:
-          authentication = cParams[6][1]
-        except IndexError:
-          authentication = NOT_DEFINED
-        try:
-          certAlias = cParams[7][1]
-        except IndexError:
-          certAlias = NOT_DEFINED
-        try:
-          operation = cParams[8][1]
-        except IndexError:
-          operation = NOT_DEFINED
-        try:
-          delaySec = cParams[9][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('-Dauthentication="%s"' % authentication)
-            
-            parms.append('-DbindDN="%s"' % DIRECTORY_INSTANCE_DN)
-            parms.append('-DbindPW="%s"' % DIRECTORY_INSTANCE_PSWD)
-                          
-            parms.append('-Doperation="%s"' % operation)
-            if delaySec != NOT_DEFINED:
-              parms.append('-DdelaySec="%s"' % delaySec) 
-            parms = ' '.join(parms)
-      </script>
-        
       <if expr="msg.find('ERROR') != -1">
         <sequence>
           <message>'%s' % msg</message>
@@ -176,80 +87,12 @@
         </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',
             'fileFd'  : fileFd }
           </call>
+
           <call function="'writeMessage'">
           { 'fileFd'  : fileFd,
             'content' : 'Do ldapmodify on %s:%s' % \
@@ -272,21 +115,19 @@
                         (client.getHost(),client.getName(),
                          serverInstance.getName())
           </script>
-         <call function="'writeMessage'">
-          { 'fileFd'  : fileFd,
-            'content' : 'DEBUG %s' % cParam
-          }
-          </call>
+        
           <process name="'%s' % titleName">
             <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'">
@@ -299,33 +140,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>
@@ -334,7 +154,8 @@
       
     </sequence>
     
-  </function>   
+  </function>
+  
   
 </stax>
 

--
Gitblit v1.10.0