From e1c8a524cf81af215762d8bae27d73361b5db4b3 Mon Sep 17 00:00:00 2001
From: al_xipe <al_xipe@localhost>
Date: Mon, 13 Aug 2007 02:19:20 +0000
Subject: [PATCH] this commit includes some code refactoring but mainly code to support emma in the functional tests and the new XSL sheet for dynamic report drill down

---
 opends/tests/functional-tests/testcases/security/security.xml                      |  126 -
 opends/tests/functional-tests/shared/functions/utils.xml                           |  194 ++
 opends/tests/functional-tests/testcases/sample/sample.xml                          |  113 +
 opends/tests/functional-tests/testcases/runTestJob.xml                             |  261 ++--
 opends/tests/functional-tests/testcases/runFuncTests.xml                           |  223 +++
 opends/tests/functional-tests/staf-installer.xml                                   |   23 
 opends/tests/functional-tests/shared/functions/baselib.xml                         |  151 +-
 opends/tests/functional-tests/testcases/aci/aci.xml                                |    4 
 opends/tests/functional-tests/testcases/quickstart/quickstart.xml                  |  119 -
 opends/tests/functional-tests/shared/functions/dsadm.xml                           |  264 +--
 opends/tests/functional-tests/shared/functions/topology.xml                        |   26 
 opends/tests/functional-tests/shared/functions/security.xml                        | 1463 ++++++++++++-------------
 opends/tests/functional-tests/testcases/security/client_auth/client_auth_setup.xml |    2 
 opends/tests/functional-tests/shared/functions/ldap.xml                            |  460 ++-----
 opends/tests/functional-tests/testcases/indexes/indexes.xml                        |   48 
 15 files changed, 1,788 insertions(+), 1,689 deletions(-)

diff --git a/opends/tests/functional-tests/shared/functions/baselib.xml b/opends/tests/functional-tests/shared/functions/baselib.xml
index 0b3151b..bcb7210 100755
--- a/opends/tests/functional-tests/shared/functions/baselib.xml
+++ b/opends/tests/functional-tests/shared/functions/baselib.xml
@@ -26,7 +26,6 @@
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
 <stax>
-        
   <function name="GetDirectoryServerVars">
     <function-prolog>
       This function gets variables associated with the Directory Server
@@ -45,108 +44,104 @@
         <function-arg-property name="type" value="hostname"/>
       </function-arg-def>
     </function-map-args>
-
+    
     <sequence>
-
       <script>
         mylocation=location
         mypath=dsPath
-     
         DSInfo=directory_server_information()
       </script>
-
+      
       <message>'Get Information about server %s %s' % (mylocation,dsPath)</message>
-
+      
       <!-- Obtain the variables for the system from start-ds -->          
       <call function="'StartDsWithScript'">
-        { 'location'  : mylocation,
-          'dsPath'    : mypath,
-          'dsSystemInfo' : 'true' }
+        { 'location'     : mylocation,
+          'dsPath'       : mypath,
+          'dsSystemInfo' : 'true'
+        }
       </call>
-
+      
       <if expr="RC != 0">
         <message>
           'Unable to obtain system information variables for %s %s.'  % (mylocation,mypath)
         </message>                 
-      <else>
-        <script>
-          DSInfo.SystemList=STAXResult[1].split('\n')
-  
-          DSInfo.ServerDict['server version']= \
-            DSInfo.getServerVersion(DSInfo.SystemList[0])
-                    
-          for DSInfo.line in DSInfo.SystemList:
-            DSInfo.key=DSInfo.line[0:DSInfo.line.find(':')].strip()
-            DSInfo.value= \
-              DSInfo.line[DSInfo.line.find(':')+1:len(DSInfo.line)].strip()
-            DSInfo.SystemDict[DSInfo.key]=DSInfo.value
-  
-          DSInfo.ServerDict['server buildid']= \
-            DSInfo.getServerValueFromKey('Build ID',DSInfo.SystemDict)
-          DSInfo.ServerDict['java version']= \
-            DSInfo.getServerValueFromKey('Java Version',DSInfo.SystemDict)
-          DSInfo.ServerDict['java vendor']= \
-            DSInfo.getServerValueFromKey('Java Vendor',DSInfo.SystemDict)
-          DSInfo.ServerDict['jvm version']= \
-            DSInfo.getServerValueFromKey('JVM Version',DSInfo.SystemDict)
-          DSInfo.ServerDict['jvm vendor']= \
-            DSInfo.getServerValueFromKey('JVM Vendor',DSInfo.SystemDict)
-          DSInfo.ServerDict['system os']= \
-            DSInfo.getServerValueFromKey('Operating System',DSInfo.SystemDict)
-          DSInfo.ServerDict['system name']= \
-            DSInfo.getServerValueFromKey('System Name',DSInfo.SystemDict)
-          
-          DSInfoServersDict[mypath]=DSInfo.ServerDict
-        </script>
-      
-      </else>
-
+        <else>
+          <sequence>
+            <message>
+              'Processing [%s]' % STAXResult
+            </message>
+            <script>
+              DSInfo.SystemList=STAXResult[0][1].split('\n')
+              DSInfo.ServerDict['server version']= \
+              DSInfo.getServerVersion(DSInfo.SystemList[0])
+              
+              for DSInfo.line in DSInfo.SystemList:
+                DSInfo.key=DSInfo.line[0:DSInfo.line.find(':')].strip()
+                DSInfo.value= \
+                  DSInfo.line[DSInfo.line.find(':')+1:len(DSInfo.line)].strip()
+                DSInfo.SystemDict[DSInfo.key]=DSInfo.value
+              
+              DSInfo.ServerDict['server buildid']= \
+                DSInfo.getServerValueFromKey('Build ID',DSInfo.SystemDict)
+              DSInfo.ServerDict['java version']= \
+                DSInfo.getServerValueFromKey('Java Version',DSInfo.SystemDict)
+              DSInfo.ServerDict['java vendor']= \
+                DSInfo.getServerValueFromKey('Java Vendor',DSInfo.SystemDict)
+              DSInfo.ServerDict['jvm version']= \
+                DSInfo.getServerValueFromKey('JVM Version',DSInfo.SystemDict)
+              DSInfo.ServerDict['jvm vendor']= \
+                DSInfo.getServerValueFromKey('JVM Vendor',DSInfo.SystemDict)
+              DSInfo.ServerDict['system os']= \
+                DSInfo.getServerValueFromKey('Operating System',DSInfo.SystemDict)
+              DSInfo.ServerDict['system name']= \
+                DSInfo.getServerValueFromKey('System Name',DSInfo.SystemDict)
+              
+              DSInfoServersDict[mypath]=DSInfo.ServerDict
+            </script>
+          </sequence>
+        </else>
       </if>
       
       <!-- Obtain the secret variables for the system from start-ds -->
       <call function="'StartDsWithScript'">
         { 'location'    : mylocation,
           'dsPath'      : mypath,
-          'dsBuildInfo' : 'true' }
+          'dsBuildInfo' : 'true'
+        }
       </call>
-
+      
       <if expr="RC != 0">
         <message>
           'Unable to obtain build information variables for %s %s.'  % (mylocation,mypath)
-        </message>                 
-      <else>
-      
-        <script>
-          DSInfo.SystemList=STAXResult[1].split('\n')
-                    
-          for DSInfo.line in DSInfo.SystemList:
-            DSInfo.key=DSInfo.line[0:DSInfo.line.find(':')].strip()
-            DSInfo.value= \
-              DSInfo.line[DSInfo.line.find(':')+1:len(DSInfo.line)].strip()
-            DSInfo.SystemDict[DSInfo.key]=DSInfo.value
-  
-          DSInfo.ServerDict['svn revision']= \
-            DSInfo.getServerValueFromKey('Revision Number',DSInfo.SystemDict)        
-          DSInfo.ServerDict['major version']= \
-            DSInfo.getServerValueFromKey('Major Version',DSInfo.SystemDict)
-          DSInfo.ServerDict['minor version']= \
-            DSInfo.getServerValueFromKey('Minor Version',DSInfo.SystemDict)
-          DSInfo.ServerDict['point version']= \
-            DSInfo.getServerValueFromKey('Point Version',DSInfo.SystemDict)
-          DSInfo.ServerDict['version qualifier']= \
-            DSInfo.getServerValueFromKey('Version Qualifier',DSInfo.SystemDict)
-          DSInfo.ServerDict['fix ids']= \
-            DSInfo.getServerValueFromKey('Fix IDs',DSInfo.SystemDict)
-          DSInfo.ServerDict['debug build']= \
-            DSInfo.getServerValueFromKey('Debug Build',DSInfo.SystemDict)            
-        </script>
-      
-      </else>
-      
+        </message>
+        <else>
+          <script>
+            DSInfo.SystemList=STAXResult[0][1].split('\n')
+            
+            for DSInfo.line in DSInfo.SystemList:
+              DSInfo.key=DSInfo.line[0:DSInfo.line.find(':')].strip()
+              DSInfo.value= \
+                DSInfo.line[DSInfo.line.find(':')+1:len(DSInfo.line)].strip()
+              DSInfo.SystemDict[DSInfo.key]=DSInfo.value
+            
+            DSInfo.ServerDict['svn revision']= \
+              DSInfo.getServerValueFromKey('Revision Number',DSInfo.SystemDict)        
+            DSInfo.ServerDict['major version']= \
+              DSInfo.getServerValueFromKey('Major Version',DSInfo.SystemDict)
+            DSInfo.ServerDict['minor version']= \
+              DSInfo.getServerValueFromKey('Minor Version',DSInfo.SystemDict)
+            DSInfo.ServerDict['point version']= \
+              DSInfo.getServerValueFromKey('Point Version',DSInfo.SystemDict)
+            DSInfo.ServerDict['version qualifier']= \
+              DSInfo.getServerValueFromKey('Version Qualifier',DSInfo.SystemDict)
+            DSInfo.ServerDict['fix ids']= \
+              DSInfo.getServerValueFromKey('Fix IDs',DSInfo.SystemDict)
+            DSInfo.ServerDict['debug build']= \
+              DSInfo.getServerValueFromKey('Debug Build',DSInfo.SystemDict)            
+          </script>
+        </else>
       </if>
-                          
     </sequence>
-    
   </function>
-  
 </stax>
diff --git a/opends/tests/functional-tests/shared/functions/dsadm.xml b/opends/tests/functional-tests/shared/functions/dsadm.xml
index aca3a6d..323af89 100755
--- a/opends/tests/functional-tests/shared/functions/dsadm.xml
+++ b/opends/tests/functional-tests/shared/functions/dsadm.xml
@@ -137,19 +137,13 @@
       <message>
         '%s %s' % (STAFCmd, STAFCmdParams)
       </message>
-            
-      <process name="'Setup DS Script'">
-        <location>'%s' % location</location>
-        <command>'%s' % STAFCmd</command>
-        <parms>'%s' % STAFCmdParams</parms>
-        <workdir>'%s' % dsPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <console use="'same'"/>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'">
+        { 'name'      : 'Setup DS Script',
+          'command'   : STAFCmd,
+          'arguments' : STAFCmdParams,
+          'path'      : dsPath
+        }
+      </call>
       <call function="'checkRC'">
         { 'returncode' : RC ,
           'result'     : STAXResult }
@@ -321,18 +315,12 @@
         '%s %s' % (STAFCmd, STAFCmdParams)
       </message>
             
-      <process name="'Setup DS Script'">
-        <location>'%s' % location</location>
-        <command>'%s' % STAFCmd</command>
-        <parms>'%s' % STAFCmdParams</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <console use="'same'"/>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'">
+        { 'name'      : 'Setup DS Script',
+          'command'   : STAFCmd,
+          'arguments' : STAFCmdParams
+        }
+      </call>
       <call function="'checkRC'">
         { 'returncode' : RC ,
           'result'     : STAXResult }
@@ -423,30 +411,22 @@
         '%s %s' % (STAFCmd, STAFCmdParams)
       </message>
       
-      <process name="'Start DS Script'">
-        <location>'%s' % location</location>
-        <command>'%s' % STAFCmd</command>
-        <parms>'%s' % STAFCmdParams</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <console use="'same'"/>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
-
+      <call function="'runCommand'">
+        { 'command'   : STAFCmd,
+          'arguments' : STAFCmdParams,
+          'location'  : location
+        }
+      </call>
       <script>
         startRC=RC
         startResult=STAXResult
       </script>
-      
       <call function="'checkRC'">
           { 'returncode' : startRC ,
             'result'     : startResult }
       </call>
      
-      <return>startResult[0]</return>
+      <return>startResult</return>
           
     </sequence>
     
@@ -670,17 +650,12 @@
         '%s %s' % (STAFCmd, STAFCmdParams)
       </message>
             
-      <process name="'Stop DS Script'">
-        <location>'%s' % (location)</location>
-        <command>'%s' % (STAFCmd)</command>
-        <parms>'%s' % (STAFCmdParams)</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'">
+        { 'name'      : 'Stop DS Script',
+          'command'   : STAFCmd,
+          'arguments' : STAFCmdParams
+        }
+      </call>
       <call function="'checkRC'">
         { 'returncode' : RC ,
           'result'     : STAXResult }
@@ -694,17 +669,14 @@
       This function generates a server jks certificate
     </function-prolog>
     <sequence>
-      <process name="'Generate Server JKS Certificate'">
-        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
-        <command>'%s/bin/keytool' % JAVA_HOME</command> 
-        <parms>'-genkey -alias server-cert -keyalg rsa -dname "cn=client,O=Sun Microsystems,C=US" -keystore "keystore" -storepass "servercert" -keypass "servercert"'</parms>
-        <workdir>'%s/../config' % (OPENDS_BINPATH)</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
-        </envs>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'">
+        { 'name'      : 'Generate Server JKS Certificate',
+          'command'   : '%s/bin/keytool' % JAVA_HOME,
+          'arguments' : '-genkey -alias server-cert -keyalg rsa -dname "cn=client,O=Sun Microsystems,C=US" -keystore "keystore" -storepass "servercert" -keypass "servercert"',
+          'path'      : '%s/../config' % (OPENDS_BINPATH),
+          'location'  : STAF_REMOTE_HOSTNAME
+        }
+      </call>
       <call function="'checkRC'">
           { 'returncode' : RC ,
             'result'     : STAXResult }
@@ -717,17 +689,14 @@
       This function generates a server PKCS12 certificate
     </function-prolog>
     <sequence>
-      <process name="'Generate Server PKCS12 Certificate'">
-        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
-        <command>'%s/bin/keytool' % JAVA_HOME</command> 
-        <parms>'-genkey -alias server-cert -keyalg rsa -dname "cn=client,O=Sun Microsystems,C=US" -keystore "keystore" -storepass "servercert" -keypass "servercert" -storetype "PKCS12"'</parms>
-        <workdir>'%s/../config' % (OPENDS_BINPATH)</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
-        </envs>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'">
+        { 'name'      : 'Generate Server PKCS12 Certificate',
+          'command'   : '%s/bin/keytool' % JAVA_HOME,
+          'arguments' : '-genkey -alias server-cert -keyalg rsa -dname "cn=client,O=Sun Microsystems,C=US" -keystore "keystore" -storepass "servercert" -keypass "servercert" -storetype "PKCS12"',
+          'path'      : '%s/../config' % (OPENDS_BINPATH),
+          'location'  : STAF_REMOTE_HOSTNAME
+        }
+      </call>
       <call function="'checkRC'">
           { 'returncode' : RC ,
             'result'     : STAXResult }
@@ -740,17 +709,14 @@
       This function self-signs a server JKS certificate
     </function-prolog>
     <sequence>
-      <process name="'Self-Signs Server JKS Certificate'">
-        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
-        <command>'%s/bin/keytool' % JAVA_HOME</command> 
-        <parms>'-selfcert -alias server-cert -keystore "keystore" -storepass "servercert"'</parms>
-        <workdir>'%s/../config' % (OPENDS_BINPATH)</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
-        </envs>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'">
+        { 'name'      : 'Self-Signs Server JKS Certificate',
+          'command'   : '%s/bin/keytool' % JAVA_HOME,
+          'arguments' : '-selfcert -alias server-cert -keystore "keystore" -storepass "servercert"',
+          'path'      : '%s/../config' % (OPENDS_BINPATH),
+          'location'  : STAF_REMOTE_HOSTNAME
+        }
+      </call>
       <call function="'checkRC'">
           { 'returncode' : RC ,
             'result'     : STAXResult }
@@ -763,17 +729,14 @@
       This function self-signs a server PKCS12 certificate
     </function-prolog>
     <sequence>
-      <process name="'Self-Signs Server PKCS12 Certificate'">
-        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
-        <command>'%s/bin/keytool' % JAVA_HOME</command> 
-        <parms>'-selfcert -alias server-cert -keystore "keystore" -storepass "servercert" -storetype "PKCS12"'</parms>
-        <workdir>'%s/../config' % (OPENDS_BINPATH)</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
-        </envs>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'">
+        { 'name'      : 'Self-Signs Server PKCS12 Certificate',
+          'command'   : '%s/bin/keytool' % JAVA_HOME,
+          'arguments' : '-selfcert -alias server-cert -keystore "keystore" -storepass "servercert" -storetype "PKCS12"',
+          'path'      : '%s/../config' % (OPENDS_BINPATH),
+          'location'  : STAF_REMOTE_HOSTNAME
+        }
+      </call>
       <call function="'checkRC'">
           { 'returncode' : RC ,
             'result'     : STAXResult }
@@ -828,17 +791,12 @@
       <message>
         '%s/import-ldif%s -l %s -n %s %s' % (dsBinPath,fileExt,ldifFile,backEnd,extraParams)
       </message>
-      <process name="'Offline Import'">
-        <location>'%s' % location </location>
-        <command>'%s/import-ldif%s' % (dsBinPath,fileExt)</command>
-        <parms>'-l %s -n %s %s' % (ldifFile,backEnd,extraParams)</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'">
+        { 'name'      : 'Offline Import',
+          'command'   : '%s/import-ldif%s' % (dsBinPath,fileExt),
+          'arguments' : '-l %s -n %s %s' % (ldifFile,backEnd,extraParams)
+        }
+      </call>
       <script>
         importRC=RC
         importResult=STAXResult
@@ -1073,18 +1031,12 @@
         '%s %s' % (STAFCmd, STAFCmdParams)
       </message>
             
-      <process name="'Offline Import Script'">
-        <location>'%s' % location</location>
-        <command>'%s' % STAFCmd</command>
-        <parms>'%s' % STAFCmdParams</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>         
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
-      
+      <call function="'runCommand'">
+        { 'name'      : 'Offline Import Script',
+          'command'   : STAFCmd,
+          'arguments' : STAFCmdParams
+        }
+      </call>
       <call function="'checkRC'">
         { 'returncode' : RC ,
           'result'     : STAXResult }
@@ -1309,7 +1261,7 @@
       <!-- Start the task using ldap task interface -->
       <call function="'StartLdapTask'">
         { 'location'   : myLocation,
-          'dsPath'  :  myPath,
+          'dsPath'     :  myPath,
           'taskLabel'  : 'Online Import Task',
           'dsHost'     : dsInstanceHost,
           'dsPort'     : dsInstancePort,
@@ -1323,7 +1275,7 @@
         <sequence>
           <call function="'CheckLdapTask'">
             { 'location'   : myLocation,
-              'dsPath'  :  myPath,
+              'dsPath'     :  myPath,
               'dsTaskDn'   : taskDN,
               'dsHost'     : dsInstanceHost,
               'dsPort'     : dsInstancePort,
@@ -1567,17 +1519,12 @@
       <message> 
         '%s/export-ldif%s -l %s -n %s %s' % (dsBinPath,fileExt,ldifFile,backEnd,extraParams)
       </message>
-      <process name="'Ldif Export'">
-        <location>'%s' % location </location>
-        <command>'%s/export-ldif%s' % (dsBinPath,fileExt)</command>
-        <parms>'-l %s -n %s %s' % (ldifFile,backEnd,extraParams)</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'">
+        { 'name'      : 'Ldif Export',
+          'command'   : '%s/export-ldif%s' % (dsBinPath,fileExt),
+          'arguments' : '-l %s -n %s %s' % (ldifFile,backEnd,extraParams)
+        }
+      </call>
       <script>
         exportRC=RC
         exportResult=STAXResult
@@ -1857,17 +1804,13 @@
       <message>
         'backup%s -n %s -d %s %s' % (fileExt,backEnd,backupDir,extraParams)
       </message>
-      <process name="'Offline Backup'">
-        <location>'%s' % myLocation </location>
-        <command>'%s/backup%s' % (dsBinPath,fileExt)</command>
-        <parms>'-d %s -n %s %s' % (backupDir,backEnd,extraParams)</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-              ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'">
+        { 'name'      : 'Offline Backup',
+          'location'  : myLocation,
+          'command'   : '%s/backup%s' % (dsBinPath,fileExt),
+          'arguments' : '-d %s -n %s %s' % (backupDir,backEnd,extraParams)
+        }
+      </call>
       <script>
         backupRC=RC
         backupResult=STAXResult
@@ -2111,17 +2054,13 @@
       <message>
         'restore%s -d %s %s' % (fileExt,backupDir,extraParams)
       </message>
-      <process name="'Offline restore'">
-        <location>'%s' % myLocation </location>
-        <command>'%s/restore%s' % (dsBinPath,fileExt)</command>
-        <parms>'-d %s %s' % (backupDir,extraParams)</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'">
+        { 'name'      : 'Offline Restore',
+          'location'  : myLocation,
+          'command'   : '%s/restore%s' % (dsBinPath,fileExt),
+          'arguments' : '-d %s %s' % (backupDir,extraParams)
+        }
+      </call>
       <script>
         restoreRC=RC
         restoreResult=STAXResult
@@ -3183,17 +3122,14 @@
           </message>
 
           <!-- Search for task status -->
-          <process name="'Search On line Import Task'">
-            <location>'%s' % myLocation</location>
-            <command>'%s' % STAFCmd</command>
-            <parms>'%s' % STAFCmdParams</parms>
-            <workdir>'%s' % dsBinPath</workdir>
-            <envs>
-              ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-            </envs>
-            <stderr mode="'stdout'"/>
-            <returnstdout/>
-          </process>
+          
+          <call function="'runCommand'">
+            { 'name'      : 'Search On line Import Task',
+              'command'   : STAFCmd,
+              'arguments' : STAFCmdParams,
+              'location'  : myLocation
+            }
+          </call>
           
           <script>
             STAFCmdRC=RC
diff --git a/opends/tests/functional-tests/shared/functions/ldap.xml b/opends/tests/functional-tests/shared/functions/ldap.xml
index 91fa816..981eb2a 100755
--- a/opends/tests/functional-tests/shared/functions/ldap.xml
+++ b/opends/tests/functional-tests/shared/functions/ldap.xml
@@ -87,7 +87,6 @@
         </function-arg-def>		
     </function-map-args>
     <sequence>
-    
       <!-- Local variables -->
       <script>
         mylocation=location
@@ -106,7 +105,7 @@
       </script>
 
       <!-- Set common ldap arguments -->      
-      <call function="'_ldapCommonArgs'"/>
+      <call function="'_ldapCommonArgs'" />
       
       <script>          
         if extraParams:
@@ -117,24 +116,13 @@
  
         STAFCmdParams=' '.join(STAFCmdParamsList)
       </script>
-      
-      <message>
-        '%s %s' % (STAFCmd, STAFCmdParams)
-      </message>
-            
-      <process name="'Add Entry from ldif file'">
-        <location>'%s' % mylocation</location>
-        <command>'%s' % STAFCmd</command>
-        <parms>'%s' % STAFCmdParams</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <console use="'same'"/>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
-      
+      <call function="'runCommand'">
+        { 'command'   : STAFCmd,
+          'arguments' : STAFCmdParams,
+          'location'  : mylocation,
+          'name'      : 'Add Entry From LDIF'
+        }
+      </call>
       <script>
         STAXCode=RC
         STAXReason=STAXResult
@@ -142,14 +130,16 @@
       <call function="'checktestRC'">
         { 'returncode' : STAXCode ,
           'result'     : STAXReason,
-          'expected'   : expectedRC }
+          'expected'   : expectedRC
+        }
       </call>
       <return>
         STAXReason
       </return>
     </sequence>
   </function>
-
+  
+  
   <!-- ldapmodify Function With Script-->
   <function name="ldapModifyWithScript">
     <function-prolog>
@@ -484,18 +474,14 @@
       <message>
         '%s %s' % (STAFCmd, STAFCmdParams)
       </message>
-            
-      <process name="'LDAP Modify Script'">
-        <location>'%s' % location</location>
-        <command>'%s' % STAFCmd</command>
-        <parms>'%s' % STAFCmdParams</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>         
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      
+      <call function="'runCommand'">
+        { 'name'      : 'LDAP Modify Script',
+          'command'   : STAFCmd,
+          'arguments' : STAFCmdParams,
+          'location'  : location
+        }
+      </call>
       
       <script>
         STAXCode=RC
@@ -512,6 +498,7 @@
     </sequence>
   </function>
   
+  
   <function name="modifyEntry">
     <function-prolog>
       This function modifies an entry in the Directory Server
@@ -606,19 +593,13 @@
       <message>
         '%s %s' % (STAFCmd, STAFCmdParams)
       </message>
-            
-      <process name="'Modify Entry from ldif file'">
-        <location>'%s' % location</location>
-        <command>'%s' % STAFCmd</command>
-        <parms>'%s' % STAFCmdParams</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <console use="'same'"/>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'">
+        { 'location'  : location,
+          'command'   : STAFCmd,
+          'arguments' : STAFCmdParams,
+          'name'      : 'Modify Entry from ldif file'
+        }
+      </call>
       
       <script>
         STAXCode=RC
@@ -634,7 +615,8 @@
       </return>
     </sequence>
   </function>
-
+  
+  
   <!-- ldapsearch Function With Script-->
   <function name="ldapSearchWithScript">
     <function-prolog>
@@ -1101,7 +1083,7 @@
         '%s %s' % (STAFCmd, STAFCmdParams)
       </message>
       
-      <process name="'LDAP Search Script'">
+      <process name="'LDAP Search Script to file'">
         <location>'%s' % location</location>
         <command>'%s' % STAFCmd</command>
         <parms>'%s' % STAFCmdParams</parms>
@@ -1129,6 +1111,7 @@
     </sequence>
   </function>
   
+  
   <function name="SearchObject">
     <function-prolog>
       This function searches the Directory Server with optional arguments possible
@@ -1259,20 +1242,14 @@
       <message>
         '%s %s' % (STAFCmd, STAFCmdParams)
       </message>
-            
-      <process name="'Search Base Object'">
-        <location>'%s' % location</location>
-        <command>'%s' % STAFCmd</command>
-        <parms>'%s' % STAFCmdParams</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <console use="'same'"/>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
-
+      
+      <call function="'runCommand'">
+        { 'command'   : STAFCmd,
+          'arguments' : STAFCmdParams,
+          'location'  : location,
+          'name'      : 'ldapsearch'
+        }
+      </call>
       <script>
         STAXCode=RC
         STAXReason=STAXResult
@@ -1290,7 +1267,8 @@
     </sequence>
 
   </function>
-
+  
+  
   <function name="SearchObjectNoPwd">
     <function-prolog>
       This function searches the Directory Server with optional arguments possible
@@ -1351,20 +1329,13 @@
       </function-arg-def>
     </function-map-args>
     <sequence>
-      <message>
-          'ldapsearch%s -h %s -p %s -D "%s" %s -b "%s" "%s"' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,extraParams,dsBaseDN,dsFilter)
-      </message>
-      <process name="'Search Base Object No Password'">
-        <location>'%s' % location </location>
-        <command>'%s/ldapsearch%s' % (dsBinPath,fileExt)</command>
-        <parms>'-h %s -p %s -D "%s" %s -b "%s" "%s"' % (dsInstanceHost,dsInstancePort,dsInstanceDn,extraParams,dsBaseDN,dsFilter)</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'" >
+        { 'name'      : 'Search Base Object No Password',
+          'command'   : '%s/ldapsearch%s' % (dsBinPath,fileExt),
+          'arguments' : '-h %s -p %s -D "%s" %s -b "%s" "%s"' % (dsInstanceHost,dsInstancePort,dsInstanceDn,extraParams,dsBaseDN,dsFilter),
+          'location'  : location
+        }
+      </call>
       <script>
         STAXCode=RC
         STAXReason=STAXResult
@@ -1380,6 +1351,7 @@
     </sequence>
   </function>
   
+  
   <function name="AnonSearchObject">
     <function-prolog>
       This function searches the Directory Server anonymously with optional arguments possible
@@ -1435,20 +1407,13 @@
         </function-arg-def>		
     </function-map-args>
     <sequence>
-      <message>
-        'ldapsearch%s -h %s -p %s %s -b "%s" "%s"' % (fileExt,dsInstanceHost,dsInstancePort,extraParams,dsBaseDN,dsFilter)
-      </message>
-      <process name="'Anonymous Search Base Object'">
-        <location>'%s' % location </location>
-        <command>'%s/ldapsearch%s' % (dsBinPath,fileExt)</command>
-        <parms>'-h %s -p %s %s -b "%s" "%s"' % (dsInstanceHost,dsInstancePort,extraParams,dsBaseDN,dsFilter)</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'" >
+        { 'name'      : 'Anonymous Search Base Object',
+          'location'  : location,
+          'command'   : '%s/ldapsearch%s' % (dsBinPath,fileExt),
+          'arguments' : '-h %s -p %s %s -b "%s" "%s"' % (dsInstanceHost,dsInstancePort,extraParams,dsBaseDN,dsFilter)
+        }
+      </call>
       <script>
         STAXCode=RC
         STAXReason=STAXResult
@@ -1464,7 +1429,8 @@
     </sequence>
   </function>
   
-    <!-- ldapdelete Function With Script-->
+  
+  <!-- ldapdelete Function With Script-->
   <function name="ldapDeleteWithScript">
     <function-prolog>
       This function performs an ldapdelete using the script
@@ -1761,18 +1727,13 @@
         '%s %s' % (STAFCmd, STAFCmdParams)
       </message>
             
-      <process name="'LDAP Delete Script'">
-        <location>'%s' % location</location>
-        <command>'%s' % STAFCmd</command>
-        <parms>'%s' % STAFCmdParams</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>         
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
-      
+      <call function="'runCommand'">
+        { 'name'      : 'LDAP Delete Script',
+          'command'   : STAFCmd,
+          'arguments' : STAFCmdParams,
+          'location'  : location
+        }
+      </call>
       <script>
         STAXCode=RC
         STAXReason=STAXResult
@@ -1788,6 +1749,7 @@
     </sequence>
   </function>
   
+  
   <function name="DeleteEntry">
     <function-prolog>
       This function an entry in the Directory Server
@@ -1883,20 +1845,14 @@
       <message>
         '%s %s' % (STAFCmd, STAFCmdParams)
       </message>
-            
-      <process name="'Delete Object'">
-        <location>'%s' % location</location>
-        <command>'%s' % STAFCmd</command>
-        <parms>'%s' % STAFCmdParams</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <console use="'same'"/>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
-
+      
+      <call function="'runCommand'">
+        { 'name'      : 'Delete Object',
+          'command'   : STAFCmd,
+          'arguments' : STAFCmdParams,
+          'location'  : location
+        }
+      </call>
       <script>
         STAXCode=RC
         STAXReason=STAXResult
@@ -1912,7 +1868,8 @@
     </sequence>
     
   </function>
-
+  
+  
   <!-- ldapcompare Function With Script-->
   <function name="ldapCompareWithScript">
     <function-prolog>
@@ -2215,22 +2172,13 @@
         STAFCmdParams=' '.join(STAFCmdParamsList)
       </script>
       
-      <message>
-        '%s %s' % (STAFCmd, STAFCmdParams)
-      </message>
-            
-      <process name="'LDAP Compare Script'">
-        <location>'%s' % location</location>
-        <command>'%s' % STAFCmd</command>
-        <parms>'%s' % STAFCmdParams</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>         
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
-      
+      <call function="'runCommand'" >
+        { 'name'      : 'LDAP Compare Script',
+          'command'   : STAFCmd,
+          'arguments' : STAFCmdParams,
+          'location'  : location
+        }
+      </call>
       <script>
         STAXCode=RC
         STAXReason=STAXResult
@@ -2246,6 +2194,7 @@
     </sequence>
   </function>
   
+  
   <function name="compareEntry">
     <function-prolog>
       This function compares the attribute and value an entry to the Directory Server
@@ -2345,23 +2294,13 @@
         STAFCmdParams=' '.join(STAFCmdParamsList)
       </script>
       
-      <message>
-        '%s %s' % (STAFCmd, STAFCmdParams)
-      </message>
-            
-      <process name="'Compare Object'">
-        <location>'%s' % location</location>
-        <command>'%s' % STAFCmd</command>
-        <parms>'%s' % STAFCmdParams</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>
-        <console use="'same'"/>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
-      
+      <call function="'runCommand'" >
+        { 'name'      : 'Compare Object',
+          'command'   : STAFCmd,
+          'arguments' : STAFCmdParams,
+          'location'  : location
+        }
+      </call>
       <script>
         STAXCode=RC
         STAXReason=STAXResult
@@ -2376,7 +2315,7 @@
       </return>
     </sequence>
   </function>
-
+  
   
   <function name="_ldapCommonArgs">
     <function-prolog>
@@ -2400,6 +2339,7 @@
               
   </function>
   
+  
   <!-- ldappasswordmodify Function With Script-->
   <function name="ldapPasswordModifyWithScript">
     <function-prolog>
@@ -2644,21 +2584,13 @@
         STAFCmdParams=' '.join(STAFCmdParamsList)
       </script>
       
-      <message>
-        '%s %s' % (STAFCmd, STAFCmdParams)
-      </message>
-            
-      <process name="'LDAP Password Modify Script'">
-        <location>'%s' % location</location>
-        <command>'%s' % STAFCmd</command>
-        <parms>'%s' % STAFCmdParams</parms>
-        <workdir>'%s' % dsBinPath</workdir>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>         
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <call function="'runCommand'" >
+        { 'name'      : 'LDAP Password Modify Script',
+          'command'   : STAFCmd,
+          'arguments' : STAFCmdParams,
+          'location'  : location
+        }
+      </call>
       <script>
         STAXCode=RC
         STAXReason=STAXResult
@@ -2674,6 +2606,7 @@
     </sequence>
   </function>
   
+  
 	<!-- Modify an attribute -->
   <function name="modifyAnAttribute">
     <function-prolog>
@@ -2808,25 +2741,20 @@
 
         if changetype:
           STAFCmdParamsList.append('-t "%s"' % changetype)
-		  		  
+        
         STAFCmdParams=' '.join(STAFCmdParamsList)
-		  		 
+        
         STAFCmd='modifyAnAttribute' 
-   
-    </script>
-      <process name="'Modify An Attribut value'">
-        <location>'%s' % location</location>
-        <command>'java'</command>
-        <workdir>'%s' % TESTS_JAVA_DIR</workdir>
-		  <parms>'%s %s' % (STAFCmd,STAFCmdParams)</parms>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s' % TESTS_JAVA_DIR]
-        </envs>
-        <console use="'same'"/>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
-
+      </script>
+      <call function="'runCommand'" >
+        { 'name'      : 'Modify An Attribute value',
+          'command'   : 'java',
+          'arguments' : '%s %s' % (STAFCmd,STAFCmdParams),
+          'location'  : location,
+          'path'      : TESTS_JAVA_DIR,
+          'env'       : ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s' % TESTS_JAVA_DIR]
+        }
+      </call>
       <script>
         STAXCode=RC
         STAXReason=STAXResult
@@ -2842,7 +2770,7 @@
     </sequence>
     
   </function>
-
+  
 	
 	<!-- Add a New entry-->
   <function name="addAnEntry">
@@ -2850,116 +2778,93 @@
       This function modifies an entry in the Directory Server
     </function-prolog>
     <function-map-args>
- 
       <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
         <function-arg-description>
           Location of target host
         </function-arg-description>
         <function-arg-property name="type" value="hostname"/>
       </function-arg-def>
-		
       <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
         <function-arg-description>
           Pathname to installation root
         </function-arg-description>
         <function-arg-property name="type" value="filepath"/>
       </function-arg-def>
-		
       <function-arg-def name="dsInstanceHost" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
         <function-arg-description>
           Directory server hostname or IP address
         </function-arg-description>
-		<function-arg-property name="type" value="hostname"/>
-      </function-arg-def>      
-		
+        <function-arg-property name="type" value="hostname" />
+      </function-arg-def>
       <function-arg-def name="dsInstancePort" type="required">
          <function-arg-description>
           Directory server port number
         </function-arg-description>		  
         <function-arg-property name="type" value="Port number"/>
       </function-arg-def>
-		
       <function-arg-def name="dsInstanceDn" type="required">
         <function-arg-description>
           Bind DN
         </function-arg-description>
         <function-arg-property name="type" value="DN"/>
       </function-arg-def> 
-		     
       <function-arg-def name="dsInstancePswd" type="required">
         <function-arg-description>
           Bind password
         </function-arg-description>
         <function-arg-property name="type" value="string"/>
-      </function-arg-def>          
-		
-	   <function-arg-def name="DNToAdd" type="required">
+      </function-arg-def>
+	    <function-arg-def name="DNToAdd" type="required">
         <function-arg-description>
           DN to add
         </function-arg-description>
         <function-arg-property name="type" value="DN"/>
       </function-arg-def>
-			
       <function-arg-def name="listAttributes" type="required">
         <function-arg-description>
           Attributes to add
         </function-arg-description>
         <function-arg-property name="type" value="string"/>
       </function-arg-def>
-
       <function-arg-def name="expectedRC" type="optional" default="0">
         <function-arg-description>
           expected value. Default is 0
         </function-arg-description>
-      </function-arg-def>	
+      </function-arg-def>
     </function-map-args>
     <sequence>
-    
       <!-- Local variables -->
       <script>
         mylocation=location
-      
-		
-      <!-- Build the Command -->
-      
+        
+        # build the command
         STAFCmdParamsList=[]
-        STAFCmdParams=''	
-        STAFCmd=''			  	
-		</script>
-		  
+        STAFCmdParams=''
+        STAFCmd=''
+      </script>
      <!-- Set common ldap arguments -->      
       <call function="'_ldapCommonArgs'"/>
 
-	<iterate var="anAttributeToAdd" in="listAttributes">
-	<script>
-        STAFCmdParamsList.append('-v "%s"' % anAttributeToAdd)
-	</script>
-	</iterate>
-                  		
+      <iterate var="anAttributeToAdd" in="listAttributes">
       <script>
- 
+        STAFCmdParamsList.append('-v "%s"' % anAttributeToAdd)
+      </script>
+      </iterate>
+      <script>
         if DNToAdd:
           STAFCmdParamsList.append('-d "%s"' % DNToAdd)
-
         STAFCmdParams=' '.join(STAFCmdParamsList)
-		  		 
         STAFCmd='addAnEntry' 
-     </script>
-    
-
-      <process name="'Add a new  entry'">
-        <location>'%s' % location</location>
-        <command>'java'</command>
-        <workdir>'%s' % TESTS_JAVA_DIR</workdir>
-		  <parms>'%s %s' % (STAFCmd,STAFCmdParams)</parms>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s' % TESTS_JAVA_DIR]
-        </envs>
-        <console use="'same'"/>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
-
+      </script>
+      <call function="'runCommand'" >
+        { 'name'      : 'Add New Entry',
+          'command'   : 'java',
+          'arguments' : '%s %s' % (STAFCmd,STAFCmdParams),
+          'location'  : location,
+          'env'       : ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s' % TESTS_JAVA_DIR],
+          'path'      : TESTS_JAVA_DIR
+        }
+      </call>
       <script>
         STAXCode=RC
         STAXReason=STAXResult
@@ -2969,16 +2874,13 @@
           'result'     : STAXReason,
           'expected'   : expectedRC }
       </call>
-      
       <return>
         STAXReason
       </return>
-      
     </sequence>
-    
   </function>
   
-
+  
 	<!-- Modify an attribute -->
   <function name="modifyDn">
     <function-prolog>
@@ -2991,116 +2893,97 @@
         </function-arg-description>
         <function-arg-property name="type" value="hostname"/>
       </function-arg-def>
-		
       <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
         <function-arg-description>
           Pathname to installation root
         </function-arg-description>
         <function-arg-property name="type" value="filepath"/>
       </function-arg-def>
-		
       <function-arg-def name="dsInstanceHost" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
         <function-arg-description>
           Directory server hostname or IP address
         </function-arg-description>
-		<function-arg-property name="type" value="hostname"/>
-      </function-arg-def>      
-		
+        <function-arg-property name="type" value="hostname"/>
+      </function-arg-def>
       <function-arg-def name="dsInstancePort" type="required">
         <function-arg-description>
           Directory server port number
-        </function-arg-description>		  
+        </function-arg-description>
         <function-arg-property name="type" value="Port number"/>
       </function-arg-def>
-		
       <function-arg-def name="dsInstanceDn" type="required">
         <function-arg-description>
           Bind DN
         </function-arg-description>
         <function-arg-property name="type" value="DN"/>
-      </function-arg-def> 
-		
+      </function-arg-def>
       <function-arg-def name="dsInstancePswd" type="required">
         <function-arg-description>
           Bind password
         </function-arg-description>
         <function-arg-property name="type" value="string"/>
-      </function-arg-def>          
-		
-	   <function-arg-def name="DNToModify" type="required">
+      </function-arg-def>
+	    <function-arg-def name="DNToModify" type="required">
         <function-arg-description>
           DN to modify
         </function-arg-description>
         <function-arg-property name="type" value="DN"/>
       </function-arg-def>
-			
       <function-arg-def name="newRDN" type="optional">
         <function-arg-description>
           new rdn name : ie uid=jdoe_bis
         </function-arg-description>
         <function-arg-property name="type" value="string"/>
       </function-arg-def>
-		
 	    <function-arg-def name="deleteOldRDN" type="optional">
         <function-arg-description>
           1 : delete old rdn, 0 do not delete old rdn, default value is 1
         </function-arg-description>
         <function-arg-property name="type" value="integer"/>
       </function-arg-def>
-  
       <function-arg-def name="expectedRC" type="optional" default="0">
         <function-arg-description>
           Expected return code value. Default value is 0
         </function-arg-description>
-        <function-arg-property name="type" value="integer"/>		  
-      </function-arg-def>		
-	
+        <function-arg-property name="type" value="integer"/>
+      </function-arg-def>
     </function-map-args>
     <sequence>
     
       <!-- Local variables -->
       <script>
         mylocation=location
-      
-		
-      <!-- Build the Command -->
-      
+        #Build the Command
         STAFCmdParamsList=[]
-        STAFCmdParams=''	
-        STAFCmd=''			  	
-		</script>
+        STAFCmdParams=''
+        STAFCmd=''
+      </script>
 		  
-     <!-- Set common ldap arguments -->      
-      <call function="'_ldapCommonArgs'"/>
-
+      <!-- Set common ldap arguments -->      
+      <call function="'_ldapCommonArgs'" />
       <script>
- 
         if DNToModify:
           STAFCmdParamsList.append('-d "%s"' % DNToModify)
-
+        
         if newRDN:
           STAFCmdParamsList.append('-e "%s"' % newRDN)
-
+        
         if deleteOldRDN:
           STAFCmdParamsList.append('-f "%s"' % deleteOldRDN)		  		  		  		  
-		  		  
+        
         STAFCmdParams=' '.join(STAFCmdParamsList)
-		  		 
+        
         STAFCmd='modifyDn' 
-   
-    </script>
-      <process name="'Modify DN'">
-        <location>'%s' % location</location>
-        <command>'java'</command>
-        <workdir>'%s' % TESTS_JAVA_DIR</workdir>
-		  <parms>'%s %s' % (STAFCmd,STAFCmdParams)</parms>
-        <envs>
-          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s' % TESTS_JAVA_DIR]
-        </envs>
-        <console use="'same'"/>
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      </script>
+      <call function="'runCommand'" >
+        { 'name'      : 'Modify DN',
+          'command'   : 'java',
+          'arguments' : '%s %s' % (STAFCmd,STAFCmdParams),
+          'location'  : location,
+          'env'       : ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s' % TESTS_JAVA_DIR],
+          'path'      : TESTS_JAVA_DIR
+        }
+      </call>
       <script>
         STAXCode=RC
         STAXReason=STAXResult
@@ -3115,9 +2998,4 @@
       </return>
     </sequence>
   </function>
-
-          
-  
-    
-  
 </stax>
diff --git a/opends/tests/functional-tests/shared/functions/security.xml b/opends/tests/functional-tests/shared/functions/security.xml
index ed8fa3e..4211f34 100755
--- a/opends/tests/functional-tests/shared/functions/security.xml
+++ b/opends/tests/functional-tests/shared/functions/security.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE stax SYSTEM "../../stax.dtd">
+<!DOCTYPE stax SYSTEM "../../shared/stax.dtd">
 <!--
  ! CDDL HEADER START
  !
@@ -26,13 +26,10 @@
  !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  ! -->
 <stax>
-	
-
 	<!-- **************************************************** -->
-	<!--                       generate a certificate                            -->
-	<!-- **************************************************** -->	
-
- <function name="genCertificate">
+	<!--                       generate a certificate         -->
+	<!-- **************************************************** -->
+  <function name="genCertificate">
     <function-prolog>
       This function generates a server certificate
     </function-prolog>
@@ -41,16 +38,16 @@
         <function-arg-description>
           Location of target host
         </function-arg-description>
-      </function-arg-def>		
+      </function-arg-def>
       <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
         <function-arg-description>
           Pathname to installation root
         </function-arg-description>
-      </function-arg-def>	 		
+      </function-arg-def>
       <function-arg-def name="certAlias" type="optional" default="'server-cert'">
         <function-arg-description>
           Alias certificate
-	</function-arg-description>
+        </function-arg-description>
       </function-arg-def>
       <function-arg-def name="dname" type="optional" default="'cn=server,O=Sun Microsystems,C=US'">	 
         <function-arg-description>
@@ -59,234 +56,295 @@
       </function-arg-def>
       <function-arg-def name="keystore" type="optional" default="'keystore'">
         <function-arg-description>
-	Path for the key store file
+          Path for the key store file
         </function-arg-description>
       </function-arg-def>
       <function-arg-def name="storepass" type="optional" default="'servercert'">
         <function-arg-description>
-         Password to protect the contents of the key store
+           Password to protect the contents of the key store
         </function-arg-description>
       </function-arg-def>
       <function-arg-def name="keypass" type="optional" default="'servercert'">
         <function-arg-description>
-	   Password to protect the private key on the key store: keypass
+          Password to protect the private key on the key store: keypass
         </function-arg-description>     
       </function-arg-def>
       <function-arg-def name="storetype" type="optional" default="'JKS'">
         <function-arg-description>
-           The storetype. can be JKS or PKCS12
+          The storetype. can be JKS or PKCS12
         </function-arg-description>
       </function-arg-def>
-     </function-map-args>
+    </function-map-args>
     <sequence>
-  <!-- Local variables -->
-    <script>
-      if dsPath:
-          dsConfigPath='%s/config' % (dsPath)
-          dsBinPath='%s/%s' % (dsPath,fileFolder) 	 
-    </script>
-	<message>'keytool -genkey -alias %s -keyalg rsa -dname "%s" -keystore %s -storepass %s -keypass %s -storetype %s ' % (certAlias,dname,keystore,storepass,keypass,storetype)</message>
-      <process name="'Generate a Certificate'">
-        <location>'%s' % location</location>	  
-        <command>'%s/bin/keytool' % JAVA_HOME</command>   
-        <parms>'-genkey -alias %s -keyalg rsa -dname "%s" -keystore %s -storepass %s -keypass %s -storetype %s ' % (certAlias,dname,keystore,storepass,keypass,storetype)</parms>
-        <workdir>'%s' % dsConfigPath</workdir>	  
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>         	  
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
-     <script>
-         STAXCode=RC
-         STAXReason=STAXResult
-       </script>
-       <call function="'checktestRC'">
-         { 'returncode' : STAXCode ,
-           'result'     : STAXReason }
-       </call>
-       <return>STAXReason</return>
-    </sequence>
-  </function>
-
-
-<!-- **************************************************** -->
-<!--                       Self signed a certificate                            -->
-<!-- **************************************************** -->
-	
-  <function name="SelfSignCertificate">
-  <function-prolog>
-      This function self-signs a certificate
-  </function-prolog> 
-  <function-map-args>
-      <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
-        <function-arg-description>
-          Location of target host
-        </function-arg-description>
-      </function-arg-def>	
-      <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
-        <function-arg-description>
-          Pathname to installation root
-        </function-arg-description>
-      </function-arg-def>	 		
-      <function-arg-def name="certAlias" type="optional" default="'server-cert'">
-        <function-arg-description>
-	   Alias certificate
-        </function-arg-description>
-      </function-arg-def>
-      <function-arg-def name="keystore" type="optional" default="'keystore'">
-         <function-arg-description>
-		Path for the key store file
-         </function-arg-description>
-       </function-arg-def>
-       <function-arg-def name="storepass" type="optional" default="'servercert'">
-         <function-arg-description>
-	      Password to protect the contents of the key store
-         </function-arg-description>
-       </function-arg-def>
-       <function-arg-def name="keypass" type="optional" default="'servercert'">
-         <function-arg-description>
-	      Password to protect the private key on the key store: keypass
-         </function-arg-description>     
-       </function-arg-def>
-       <function-arg-def name="storetype" type="optional" default="'JKS'">
-         <function-arg-description>
-	     The storetype. can be JKS or PKCS12
-         </function-arg-description>
-       </function-arg-def>		
-     </function-map-args>
-    <sequence>
-  <!-- Local variables -->
-	<script>
-      if dsPath:
-          dsConfigPath='%s/config' % (dsPath)
-          dsBinPath='%s/%s' % (dsPath,fileFolder) 	 
-  </script>
-			
-  <message>'keytool -selfcert -alias %s -keystore "%s" -keypass "%s" -storepass "%s" -storetype "%s" ' % (certAlias,keystore,keypass,storepass,storetype)</message>
-      <process name="'Generate a Self-Signs Server Certificate'">
-        <location>'%s' % location</location>
-        <command>'%s/bin/keytool' % JAVA_HOME</command> 
-        <parms>'-selfcert -alias %s -keystore "%s"  -keypass "%s" -storepass "%s" -storetype "%s" ' % (certAlias,keystore,keypass,storepass,storetype)</parms>
-        <workdir>'%s' % dsConfigPath</workdir>	  
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>         	  		  
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <!-- Local variables -->
       <script>
-         STAXCode=RC
-         STAXReason=STAXResult
-       </script>
-       <call function="'checktestRC'">
-         { 'returncode' : STAXCode ,
-           'result'     : STAXReason }
-       </call>
-       <return>STAXReason</return>	
+        if dsPath:
+          dsConfigPath='%s/config' % (dsPath)
+          dsBinPath='%s/%s' % (dsPath,fileFolder) 	 
+      </script>
+      <call function="'runCommand'">
+        { 'name'      : 'Generate a Certificate',
+          'location'  : location,
+          'command'   : '%s/bin/keytool' % JAVA_HOME,
+          'arguments' : '-genkey -alias %s -keyalg rsa -dname "%s" -keystore %s -storepass %s -keypass %s -storetype %s ' % (certAlias,dname,keystore,storepass,keypass,storetype),
+          'path'      : dsConfigPath
+        }
+      </call>
+      <script>
+        STAXCode=RC
+        STAXReason=STAXResult
+      </script>
+      <call function="'checktestRC'">
+        { 'returncode' : STAXCode ,
+           'result'     : STAXReason
+        }
+      </call>
+      <return>STAXReason</return>
     </sequence>
   </function>
-
-<!-- **************************************************** -->
-<!--                       Export  a certificate                                 -->
-<!-- **************************************************** -->	
-
-<function name="ExportCertificate">
+  
+  
+  <!-- **************************************************** -->
+  <!--                       Self signed a certificate      -->
+  <!-- **************************************************** -->
+  <function name="SelfSignCertificate">
     <function-prolog>
-      This function exports a certificate
+      This function self-signs a certificate
     </function-prolog>
-<function-map-args>
-	
+    <function-map-args>
       <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
         <function-arg-description>
           Location of target host
         </function-arg-description>
-      </function-arg-def>	
+      </function-arg-def>
       <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
         <function-arg-description>
           Pathname to installation root
         </function-arg-description>
-      </function-arg-def>	 		
+      </function-arg-def>
       <function-arg-def name="certAlias" type="optional" default="'server-cert'">
         <function-arg-description>
-	    Alias certificate
+          Alias certificate
         </function-arg-description>
       </function-arg-def>
       <function-arg-def name="keystore" type="optional" default="'keystore'">
         <function-arg-description>
-		Path for the key store file
+          Path for the key store file
         </function-arg-description>
       </function-arg-def>
       <function-arg-def name="storepass" type="optional" default="'servercert'">
         <function-arg-description>
-	    Password to protect the contents of the key store
+	        Password to protect the contents of the key store
+        </function-arg-description>
+      </function-arg-def>
+      <function-arg-def name="keypass" type="optional" default="'servercert'">
+        <function-arg-description>
+	        Password to protect the private key on the key store: keypass
+        </function-arg-description>     
+      </function-arg-def>
+      <function-arg-def name="storetype" type="optional" default="'JKS'">
+        <function-arg-description>
+	        The storetype. can be JKS or PKCS12
+        </function-arg-description>
+      </function-arg-def>
+    </function-map-args>
+    <sequence>
+      <!-- Local variables -->
+      <script>
+        if dsPath:
+          dsConfigPath='%s/config' % (dsPath)
+          dsBinPath='%s/%s' % (dsPath,fileFolder)
+      </script>
+			
+      <call function="'runCommand'" >
+        { 'name'      : 'Generate a Self-Signs Server Certificate',
+          'location'  : location,
+          'command'   : '%s/bin/keytool' % JAVA_HOME,
+          'arguments' : '-selfcert -alias %s -keystore "%s"  -keypass "%s" -storepass "%s" -storetype "%s" ' % (certAlias,keystore,keypass,storepass,storetype),
+          'path'      : dsConfigPath
+        }
+      </call>
+      <script>
+        STAXCode=RC
+        STAXReason=STAXResult
+      </script>
+      <call function="'checktestRC'">
+        { 'returncode' : STAXCode  ,
+          'result'     : STAXReason
+        }
+      </call>
+      <return>STAXReason</return>
+    </sequence>
+  </function>
+  
+  
+  <!-- **************************************************** -->
+  <!--                       Export  a certificate                                 -->
+  <!-- **************************************************** -->	
+  <function name="ExportCertificate">
+    <function-prolog>
+      This function exports a certificate
+    </function-prolog>
+    <function-map-args>
+      <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
+        <function-arg-description>
+          Location of target host
+        </function-arg-description>
+      </function-arg-def>
+      <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
+        <function-arg-description>
+          Pathname to installation root
+        </function-arg-description>
+      </function-arg-def>
+      <function-arg-def name="certAlias" type="optional" default="'server-cert'">
+        <function-arg-description>
+          Alias certificate
+        </function-arg-description>
+      </function-arg-def>
+      <function-arg-def name="keystore" type="optional" default="'keystore'">
+        <function-arg-description>
+          Path for the key store file
+        </function-arg-description>
+      </function-arg-def>
+      <function-arg-def name="storepass" type="optional" default="'servercert'">
+        <function-arg-description>
+          Password to protect the contents of the key store
         </function-arg-description>
       </function-arg-def>
       <function-arg-def name="format" type="optional">
         <function-arg-description>
-	   Format of the certificate. By default, it's in binary encoding
-        </function-arg-description>     
+          Format of the certificate. By default, it's in binary encoding
+        </function-arg-description>
       </function-arg-def>
       <function-arg-def name="storetype" type="optional" default="'JKS'">
         <function-arg-description>
-	    The storetype. can be JKS or PKCS12
+          The storetype. can be JKS or PKCS12
         </function-arg-description>
-      </function-arg-def>				
-     <function-arg-def name="outputfile" type="required">
+      </function-arg-def>
+      <function-arg-def name="outputfile" type="required">
         <function-arg-description>
-		Output file to store certificate
+          Output file to store certificate
         </function-arg-description> 
-     </function-arg-def>			
+      </function-arg-def>
     </function-map-args>
-
+    
     <sequence>
-   
-  <!-- Local variables -->
-    <script>
-       if dsPath:
-          dsConfigPath='%s/config' % (dsPath)
-          dsBinPath='%s/%s' % (dsPath,fileFolder) 	 
-        
-       STAFCmdParams=''
-
-       if format:
-          STAFCmdParams='-%s' % (format)
-    </script>	
-	
-<message>'keytool -export -alias %s -file %s -keystore "%s"  -storepass "%s" -storetype %s %s' % (certAlias,outputfile,keystore,storepass,storetype,STAFCmdParams)</message>
-      <process name="'Export a Certificate'">
-        <location>'%s' % location</location>
-        <command>'%s/bin/keytool' % JAVA_HOME</command> 
-        <parms>'-export -alias %s -file %s -keystore "%s"  -storepass "%s" -storetype %s %s' % (certAlias,outputfile,keystore,storepass,storetype,STAFCmdParams)</parms>
-        <workdir>'%s' % dsConfigPath</workdir>	  
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>         	  		  
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <!-- Local variables -->
       <script>
-         STAXCode=RC
-         STAXReason=STAXResult
-       </script>
-       <call function="'checktestRC'">
-         { 'returncode' : STAXCode ,
-           'result'     : STAXReason }
-       </call>
-       <return>STAXReason</return>	
+        if dsPath:
+          dsConfigPath='%s/config' % (dsPath)
+          dsBinPath='%s/%s' % (dsPath,fileFolder)
+        
+        STAFCmdParams=''
+        
+        if format:
+          STAFCmdParams='-%s' % (format)
+      </script>
+      
+      <call function="'runCommand'">
+        { 'name'       : 'Export a Certificate',
+          'location'   : location,
+          'command'    : '%s/bin/keytool' % JAVA_HOME,
+          'arguments'  : '-export -alias %s -file %s -keystore "%s"  -storepass "%s" -storetype %s %s' % (certAlias,outputfile,keystore,storepass,storetype,STAFCmdParams),
+          'path'       : dsConfigPath
+        }
+      </call>
+      <script>
+        STAXCode=RC
+        STAXReason=STAXResult
+      </script>
+      <call function="'checktestRC'">
+        { 'returncode' : STAXCode ,
+          'result'     : STAXReason }
+      </call>
+      <return>STAXReason</return>	
     </sequence>
   </function>
-
-<!-- **************************************************** -->
-<!--                       Import  a certificate                                  -->
-<!-- **************************************************** -->
-
-<function name="ImportCertificate">
+  
+  
+  <!-- **************************************************** -->
+  <!--                       Import  a certificate          -->
+  <!-- **************************************************** -->
+  <function name="ImportCertificate">
     <function-prolog>
       This function imports a certificate
     </function-prolog>
-<function-map-args>
-	
+    <function-map-args>
+      <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
+        <function-arg-description>
+          Location of target host
+        </function-arg-description>
+      </function-arg-def>
+      <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
+        <function-arg-description>
+          Pathname to installation root
+        </function-arg-description>
+      </function-arg-def>
+      <function-arg-def name="certAlias" type="optional" default="'server-cert'">
+        <function-arg-description>
+          Alias certificate
+        </function-arg-description>
+      </function-arg-def>
+      <function-arg-def name="keystore" type="optional" default="'keystore'">
+        <function-arg-description>
+          Path for the key store file
+        </function-arg-description>
+      </function-arg-def>
+      <function-arg-def name="storepass" type="optional" default="'servercert'">
+        <function-arg-description>
+          Password to protect the contents of the key store
+       </function-arg-description>
+      </function-arg-def>
+      <function-arg-def name="storetype" type="optional" default="'JKS'">
+        <function-arg-description>
+          The storetype. can be JKS or PKCS12
+        </function-arg-description>
+      </function-arg-def>
+      <function-arg-def name="inputfile" type="required">
+        <function-arg-description>
+          Certificate to import
+        </function-arg-description>	
+      </function-arg-def>
+    </function-map-args>
+    <sequence>
+      
+      <!-- Local variables -->
+      <script>
+        if dsPath:
+          dsConfigPath='%s/config' % (dsPath)
+          dsBinPath='%s/%s' % (dsPath,fileFolder)
+      </script>
+		  
+      <call function="'runCommand'">
+        { 'name'        : 'Import a Certificate',
+          'location'    : location,
+          'command'     : '%s/bin/keytool' % JAVA_HOME,
+          'arguments'   : '-import  -alias %s -file %s -keystore "%s"  -storepass "%s" -storetype %s -noprompt' % (certAlias,inputfile,keystore,storepass,storetype),
+          'path'        : dsConfigPath
+        }
+      </call>
+      <script>
+        STAXCode=RC
+        STAXReason=STAXResult
+      </script>
+      <call function="'checktestRC'">
+        { 'returncode' : STAXCode ,
+          'result'     : STAXReason 
+        }
+      </call>
+      <return>STAXReason</return>	
+    </sequence>
+  </function>
+  
+  
+  <!-- **************************************************** -->
+  <!--                      get MD5 and SHA1 values         -->
+  <!-- **************************************************** -->	
+  <function name="getFingerprint">
+    <function-prolog>
+      This function returns the fingerprint MD5 or SHA1
+    </function-prolog>
+    <function-map-args>
       <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
         <function-arg-description>
           Location of target host
@@ -299,150 +357,63 @@
       </function-arg-def>	 		
       <function-arg-def name="certAlias" type="optional" default="'server-cert'">
         <function-arg-description>
-	   Alias certificate
+	        Alias certificate
         </function-arg-description>
       </function-arg-def>
       <function-arg-def name="keystore" type="optional" default="'keystore'">
         <function-arg-description>
-		Path for the key store file
+          Path for the key store file
         </function-arg-description>
       </function-arg-def>
       <function-arg-def name="storepass" type="optional" default="'servercert'">
         <function-arg-description>
-	    Password to protect the contents of the key store
-       </function-arg-description>
+          Password to protect the contents of the key store
+        </function-arg-description>
       </function-arg-def>
-      <function-arg-def name="storetype" type="optional" default="'JKS'">
+      <function-arg-def name="fingerprint" type="optional" default="'MD5'">
         <function-arg-description>
-	  The storetype. can be JKS or PKCS12
+          fingerprint. can be MD5 or SHA1
         </function-arg-description>
-      </function-arg-def>				
-      <function-arg-def name="inputfile" type="required">
-	    <function-arg-description>
-		Certificate to import
-        </function-arg-description>	
-      </function-arg-def>	
-     </function-map-args>
-    <sequence>
-
-  <!-- Local variables -->
-    <script>
-       if dsPath:
-          dsConfigPath='%s/config' % (dsPath)
-          dsBinPath='%s/%s' % (dsPath,fileFolder) 	 
-
-    </script>	
-			
-<message>'keytool -import -alias %s -file %s -keystore "%s"  -storepass "%s" -storetype %s -noprompt' % (certAlias,inputfile,keystore,storepass,storetype)</message>
-      <process name="'Import a Certificate'">
-        <location>'%s' % location</location>
-        <command>'%s/bin/keytool' % JAVA_HOME</command> 
-        <parms>'-import  -alias %s -file %s -keystore "%s"  -storepass "%s" -storetype %s -noprompt' % (certAlias,inputfile,keystore,storepass,storetype)</parms>
-        <workdir>'%s' % dsConfigPath</workdir>	  
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>  
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
-      <script>
-         STAXCode=RC
-         STAXReason=STAXResult
-       </script>
-       <call function="'checktestRC'">
-         { 'returncode' : STAXCode ,
-           'result'     : STAXReason }
-       </call>
-       <return>STAXReason</return>	
-    </sequence>
-  </function>
-
-<!-- **************************************************** -->
-<!--                      get MD5 and SHA1 values                          -->
-<!-- **************************************************** -->	
-
-<function name="getFingerprint">
-    <function-prolog>
-      This function returns the fingerprint MD5 or SHA1
-    </function-prolog>
-   <function-map-args>
-
-      <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
-        <function-arg-description>
-          Location of target host
-        </function-arg-description>
-      </function-arg-def>	
-      <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
-        <function-arg-description>
-          Pathname to installation root
-        </function-arg-description>
-     </function-arg-def>	 		
-     <function-arg-def name="certAlias" type="optional" default="'server-cert'">
-        <function-arg-description>
-	   Alias certificate
-        </function-arg-description>
-     </function-arg-def>
-     <function-arg-def name="keystore" type="optional" default="'keystore'">
-        <function-arg-description>
-		Path for the key store file
-        </function-arg-description>
-     </function-arg-def>
-     <function-arg-def name="storepass" type="optional" default="'servercert'">
-       <function-arg-description>
-	    Password to protect the contents of the key store
-       </function-arg-description>
-     </function-arg-def>		
-     <function-arg-def name="fingerprint" type="optional" default="'MD5'">
-        <function-arg-description>
-		 fingerprint. can be MD5 or SHA1
-	   </function-arg-description>
-     </function-arg-def>
+      </function-arg-def>
     </function-map-args>
     <sequence>
-
-  <!-- Local variables -->
-    <script>
-       if dsPath:
-          dsConfigPath='%s/config' % (dsPath)
-          dsBinPath='%s/%s' % (dsPath,fileFolder) 	 
-
-    </script>			
-      <message>' -keystore "%s"  -storepass "%s"  -alias "%s" -list -v' % (keystore,storepass,certAlias)</message>
-      <process name="'getFingerprint'">
-        <location>'%s' % location</location>
-        <command>'%s/bin/keytool' % JAVA_HOME</command> 
-        <parms>' -list -v -keystore "%s"  -storepass "%s"  -alias "%s"' % (keystore,storepass,certAlias)</parms>
-       <workdir>'%s' % dsConfigPath</workdir>	  
-        <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
-        </envs>  
-        <stderr mode="'stdout'"/>
-        <returnstdout/>
-      </process>
+      <!-- Local variables -->
       <script>
-         STAXCode=RC
-         STAXReason=STAXResult
-       </script>
-       <call function="'checktestRC'">
-         { 'returncode' : STAXCode ,
-           'result'     : STAXReason }
-       </call>
-       <return>STAXReason</return>    
+        if dsPath:
+          dsConfigPath='%s/config' % (dsPath)
+          dsBinPath='%s/%s' % (dsPath,fileFolder)
+      </script>
+      <call function="'runCommand'">
+        { 'name'      : 'getFingerprint',
+          'location'  : location,
+          'command'   : '%s/bin/keytool' % JAVA_HOME,
+          'arguments' : ' -list -v -keystore "%s"  -storepass "%s"  -alias "%s"' % (keystore,storepass,certAlias),
+          'path'      : dsConfigPath
+        }
+      </call>
+      <script>
+        STAXCode=RC
+        STAXReason=STAXResult
+      </script>
+      <call function="'checktestRC'">
+        { 'returncode' : STAXCode ,
+          'result'     : STAXReason
+        }
+      </call>
+      <return>STAXReason</return>
     </sequence>
   </function>
-
   
-<!-- ################################################## -->	
-<!--  configure SSL  -->
-<!-- ################################################## -->		
-
-	
+  
+  <!-- ################################################## -->	
+  <!--  configure SSL  -->
+  <!-- ################################################## -->		
   <function name="configureSSL">
     <function-prolog>
       This function makes the configuration changes for SSL
     </function-prolog>
     <function-map-args>
-     <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
+      <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
         <function-arg-description>
           Location of target host
         </function-arg-description>
@@ -459,7 +430,7 @@
           Directory server hostname or IP address
         </function-arg-description>
         <function-arg-property name="type" value="hostname"/>
-      </function-arg-def>      
+      </function-arg-def>
       <function-arg-def name="dsInstancePort" type="optional">
         <function-arg-description>
           Directory server port number
@@ -470,13 +441,13 @@
         <function-arg-description>
           Bind DN
         </function-arg-description>
-	  </function-arg-def>	  
-     <function-arg-def name="certAlias" type="optional" default="'server-cert'">
+      </function-arg-def>
+      <function-arg-def name="certAlias" type="optional" default="'server-cert'">
         <function-arg-description>
-	   Alias certificate
+          Alias certificate
         </function-arg-description>
         <function-arg-property name="type" value="DN"/>
-      </function-arg-def> 
+      </function-arg-def>
       <function-arg-def name="dsInstancePswd" type="optional">
         <function-arg-description>
           Bind password
@@ -484,103 +455,100 @@
         <function-arg-property name="type" value="string"/>
       </function-arg-def>
       <function-arg-def name="keystoreType" type="optional" default="'JKS'">
-	    <function-arg-description>
-	     Keystore type : JKS or PKCS12
+        <function-arg-description>
+          Keystore type : JKS or PKCS12
   	    </function-arg-description>
-	  <function-arg-property name="type" value="string"/>
-	 </function-arg-def>
-     <function-arg-def name="keystorePin" type="optional" default="'servercert'">
-	    <function-arg-description>
-	     Keystore pin
-  	    </function-arg-description>	 
-	  <function-arg-property name="type" value="string"/>
-	 </function-arg-def>		
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>
+      <function-arg-def name="keystorePin" type="optional" default="'servercert'">
+        <function-arg-description>
+          Keystore pin
+  	    </function-arg-description>
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>
       <function-arg-def name="extraParams" type="optional">
         <function-arg-description>
           Optional extra parameters for specific test cases
         </function-arg-description>
         <function-arg-property name="type" value="string"/>
-      </function-arg-def>                
+      </function-arg-def>
     </function-map-args>
     <sequence>
-   
       <!--- configure Key Manager Provider -->
       <message>
-       'Configure Key Manager Provider'
+        'Configure Key Manager Provider'
       </message>
-
-				
+      
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-key-manager-prop' ,
-        'objectType'        : 'manager-name' ,
-        'objectName'        :  keystoreType,
-        'optionsString'        :  '--set key-store-file:config/keystore --reset key-store-pin-file --set key-store-pin:%s --set enabled:true' % keystorePin,
-        'expectedRC'            : 0 }
-    </call>
-  
+        { 'location'       : location ,
+          'dsPath'         : dsPath ,
+          'dsInstanceHost' : dsInstanceHost ,
+          'dsInstancePort' : dsInstancePort ,
+          'dsInstanceDn'   :  dsInstanceDn ,
+          'dsInstancePswd' : dsInstancePswd ,
+          'subcommand'     :  'set-key-manager-prop' ,
+          'objectType'     : 'manager-name' ,
+          'objectName'     :  keystoreType,
+          'optionsString'  :  '--set key-store-file:config/keystore --reset key-store-pin-file --set key-store-pin:%s --set enabled:true' % keystorePin,
+          'expectedRC'     : 0 
+        }
+      </call>
+      
       <!--- configure Trust Manager Provider -->
       <message>
          'Configure Trust Manager Provider'
       </message>
-
-				
+      
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-trust-manager-prop' ,
-        'objectType'        : 'manager-name' ,
-        'objectName'        : 'Blind Trust',
-        'optionsString'        : '--set enabled:true' ,
-        'expectedRC'            : 0 }
-    </call>		
-
-		
+        { 'location'       : location ,
+          'dsPath'         : dsPath ,
+          'dsInstanceHost' : dsInstanceHost ,
+          'dsInstancePort' : dsInstancePort ,
+          'dsInstanceDn'   : dsInstanceDn ,
+          'dsInstancePswd' : dsInstancePswd ,
+          'subcommand'     : 'set-trust-manager-prop' ,
+          'objectType'     : 'manager-name' ,
+          'objectName'     : 'Blind Trust',
+          'optionsString'  : '--set enabled:true' ,
+          'expectedRC'     : 0
+        }
+      </call>
+      
       <!--- Enable LDAPS Connection Handler -->
       <message>
        'Enabling LDAPS Connection Handler - Keystore type'
       </message>
-	
-     <script>
-		  option1='--set ssl-cert-nickname:%s' % certAlias
-		  option2='--set trust-manager-provider-dn:"cn=Blind Trust,cn=Trust Manager Providers,cn=config"' 
-		  option3='--set key-manager-provider-dn:"cn=%s,cn=Key Manager Providers,cn=config"' % (keystoreType)
-		  option4='--set listen-port:%s' % DIRECTORY_INSTANCE_SSL_PORT
-		  option5='--set enabled:true' 
-		  optionsString='%s %s %s %s %s' % (option1,option2,option3,option4,option5) 	  
-	  </script>			
-		
+      
+      <script>
+        option1='--set ssl-cert-nickname:%s' % certAlias
+        option2='--set trust-manager-provider-dn:"cn=Blind Trust,cn=Trust Manager Providers,cn=config"' 
+        option3='--set key-manager-provider-dn:"cn=%s,cn=Key Manager Providers,cn=config"' % (keystoreType)
+        option4='--set listen-port:%s' % DIRECTORY_INSTANCE_SSL_PORT
+        option5='--set enabled:true' 
+        optionsString='%s %s %s %s %s' % (option1,option2,option3,option4,option5) 	  
+      </script>
+      
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-connection-handler-prop' ,
-        'objectType'             : 'handler-name' ,
-        'objectName'            : 'LDAPS Connection Handler',
-        'optionsString'        :  optionsString,
-        'expectedRC'            : 0 }
-    </call>				
-		
-		
+        { 'location'       : location ,
+          'dsPath'         : dsPath ,
+          'dsInstanceHost' : dsInstanceHost ,
+          'dsInstancePort' : dsInstancePort ,
+          'dsInstanceDn'   : dsInstanceDn ,
+          'dsInstancePswd' : dsInstancePswd ,
+          'subcommand'     : 'set-connection-handler-prop',
+          'objectType'     : 'handler-name' ,
+          'objectName'     : 'LDAPS Connection Handler',
+          'optionsString'  : optionsString,
+          'expectedRC'     : 0 
+        }
+      </call>
     </sequence>
   </function>
-
-<!-- ################################################## -->	
-<!--  configureTLS -->
-<!-- ################################################## -->		
-	
+  
+  
+  <!-- ################################################## -->	
+  <!--  configureTLS -->
+  <!-- ################################################## -->		
   <function name="configureTLS">
     <function-prolog>
       This function makes the configuration changes for startTLS
@@ -603,7 +571,7 @@
           Directory server hostname or IP address
         </function-arg-description>
         <function-arg-property name="type" value="hostname"/>
-      </function-arg-def>      
+      </function-arg-def>
       <function-arg-def name="dsInstancePort" type="optional">
         <function-arg-description>
           Directory server port number
@@ -615,30 +583,30 @@
           Bind DN
         </function-arg-description>
         <function-arg-property name="type" value="DN"/>
-      </function-arg-def> 
+      </function-arg-def>
       <function-arg-def name="dsInstancePswd" type="optional">
         <function-arg-description>
           Bind password
         </function-arg-description>
         <function-arg-property name="type" value="string"/>
       </function-arg-def>
-     <function-arg-def name="keystorePin" type="optional" default="'servercert'">
-	    <function-arg-description>
-	     Keystore pin
+      <function-arg-def name="keystorePin" type="optional" default="'servercert'">
+	      <function-arg-description>
+          Keystore pin
   	    </function-arg-description>
-	  <function-arg-property name="type" value="string"/>
-	 </function-arg-def>				
-     <function-arg-def name="certAlias" type="optional" default="'server-cert'">
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>
+      <function-arg-def name="certAlias" type="optional" default="'server-cert'">
         <function-arg-description>
-	   Alias certificate
+          Alias certificate
         </function-arg-description>
-     </function-arg-def>		
+      </function-arg-def>
       <function-arg-def name="keystoreType" type="optional" default="'JKS'">
-	    <function-arg-description>
-	     Keystore type : JKS or PKCS12
+        <function-arg-description>
+          Keystore type : JKS or PKCS12
   	    </function-arg-description>
-	  <function-arg-property name="type" value="string"/>
-	 </function-arg-def>		
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>
       <function-arg-def name="extraParams" type="optional">
         <function-arg-description>
           Optional extra parameters for specific test cases
@@ -646,29 +614,27 @@
         <function-arg-property name="type" value="string"/>
       </function-arg-def>
     </function-map-args>
-      <sequence>
-      
-       
+    <sequence>
       <!--- configure Key Manager Provider -->
       <message>
        'Configure Key Manager Provider'
       </message>
-
-				
+      
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-key-manager-prop' ,
-        'objectType'        : 'manager-name' ,
-        'objectName'        : keystoreType,
-        'optionsString'        :  '--set key-store-file:config/keystore --reset key-store-pin-file --set key-store-pin:%s --set enabled:true' % keystorePin,
-        'expectedRC'            : 0 }
-    </call>
-  
+        { 'location'        : location,
+          'dsPath'          : dsPath,
+          'dsInstanceHost'  : dsInstanceHost,
+          'dsInstancePort'  : dsInstancePort,
+          'dsInstanceDn'    : dsInstanceDn,
+          'dsInstancePswd'  : dsInstancePswd,
+          'subcommand'      : 'set-key-manager-prop',
+          'objectType'      : 'manager-name',
+          'objectName'      : keystoreType,
+          'optionsString'   : '--set key-store-file:config/keystore --reset key-store-pin-file --set key-store-pin:%s --set enabled:true' % keystorePin,
+          'expectedRC'      : 0
+        }
+      </call>
+      
       <!--- configure Trust Manager Provider -->
       <message>
          'Configure Trust Manager Provider'
@@ -676,64 +642,60 @@
 
 				
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-trust-manager-prop' ,
-        'objectType'        : 'manager-name' ,
-        'objectName'        : 'Blind Trust',
-        'optionsString'        : '--set enabled:true' ,
-        'expectedRC'            : 0 }
-      </call>		
-
-        <!--- Enable StartTLS -->
-        <message>
-         'Enabling StartTLS'
-        </message>
-
-     <script>
-		  option1='--set ssl-cert-nickname:%s' % certAlias
-		  option2='--set trust-manager-provider-dn:"cn=Blind Trust,cn=Trust Manager Providers,cn=config" '
-		  option3='--set key-manager-provider-dn:"cn=%s,cn=Key Manager Providers,cn=config"' % (keystoreType)
-		  option4='--set allow-start-tls:true' 
-		  optionsString='%s %s %s %s' % (option1,option2,option3,option4) 	 
-	  </script>			
-		   
-	
+        { 'location'       : location,
+          'dsPath'         : dsPath,
+          'dsInstanceHost' : dsInstanceHost,
+          'dsInstancePort' : dsInstancePort,
+          'dsInstanceDn'   : dsInstanceDn,
+          'dsInstancePswd' : dsInstancePswd,
+          'subcommand'     : 'set-trust-manager-prop',
+          'objectType'     : 'manager-name',
+          'objectName'     : 'Blind Trust',
+          'optionsString'  : '--set enabled:true',
+          'expectedRC'     : 0
+        }
+      </call>
+      
+      <!--- Enable StartTLS -->
+      <message>
+        'Enabling StartTLS'
+      </message>
+      
+      <script>
+        option1='--set ssl-cert-nickname:%s' % certAlias
+        option2='--set trust-manager-provider-dn:"cn=Blind Trust,cn=Trust Manager Providers,cn=config" '
+        option3='--set key-manager-provider-dn:"cn=%s,cn=Key Manager Providers,cn=config"' % (keystoreType)
+        option4='--set allow-start-tls:true' 
+        optionsString='%s %s %s %s' % (option1,option2,option3,option4) 	 
+      </script>
+      
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-connection-handler-prop' ,
-        'objectType'        : 'handler-name' ,
-        'objectName'        : 'LDAP Connection Handler',
-        'optionsString'        :  optionsString,
-        'expectedRC'            : 0 }
-    </call>				
-			
-	
+      { 'location'       : location,
+        'dsPath'         : dsPath,
+        'dsInstanceHost' : dsInstanceHost,
+        'dsInstancePort' : dsInstancePort,
+        'dsInstanceDn'   : dsInstanceDn,
+        'dsInstancePswd' : dsInstancePswd,
+        'subcommand'     : 'set-connection-handler-prop',
+        'objectType'     : 'handler-name',
+        'objectName'     : 'LDAP Connection Handler',
+        'optionsString'  : optionsString,
+        'expectedRC'     : 0 
+      }
+    </call>
     </sequence>
   </function>
-
-
   
-<!-- ################################################## -->	
-<!--  configure SSL  and TLS -->
-<!-- ################################################## -->		
-
-	
+  
+  <!-- ################################################## -->	
+  <!--  configure SSL  and TLS -->
+  <!-- ################################################## -->		
   <function name="configureSSL_TLS">
     <function-prolog>
       This function makes the configuration changes for SSL and TLS
     </function-prolog>
     <function-map-args>
-     <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
+      <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
         <function-arg-description>
           Location of target host
         </function-arg-description>
@@ -750,7 +712,7 @@
           Directory server hostname or IP address
         </function-arg-description>
         <function-arg-property name="type" value="hostname"/>
-      </function-arg-def>      
+      </function-arg-def>
       <function-arg-def name="dsInstancePort" type="optional">
         <function-arg-description>
           Directory server port number
@@ -770,22 +732,22 @@
         <function-arg-property name="type" value="string"/>
       </function-arg-def>
       <function-arg-def name="keystoreType" type="optional" default="'JKS'">
-	    <function-arg-description>
-	     Keystore type : JKS or PKCS12
-  	    </function-arg-description>
-	  <function-arg-property name="type" value="string"/>
-	 </function-arg-def>		
-     <function-arg-def name="certAlias" type="optional" default="'server-cert'">
         <function-arg-description>
-	   Alias certificate
-        </function-arg-description>
-     </function-arg-def>		
-     <function-arg-def name="keystorePin" type="optional" default="'servercert'">
-	    <function-arg-description>
-	     Keystore pin
+          Keystore type : JKS or PKCS12
   	    </function-arg-description>
-	  <function-arg-property name="type" value="string"/>
-	 </function-arg-def>				
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>
+      <function-arg-def name="certAlias" type="optional" default="'server-cert'">
+        <function-arg-description>
+          Alias certificate
+        </function-arg-description>
+      </function-arg-def>
+      <function-arg-def name="keystorePin" type="optional" default="'servercert'">
+	      <function-arg-description>
+          Keystore pin
+  	    </function-arg-description>
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>
       <function-arg-def name="extraParams" type="optional">
         <function-arg-description>
           Optional extra parameters for specific test cases
@@ -794,111 +756,110 @@
       </function-arg-def>                
     </function-map-args>
     <sequence>
-    
-      
       <!--- configure Key Manager Provider -->
       <message>
        'Configure Key Manager Provider'
       </message>
-				
+      
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-key-manager-prop' ,
-        'objectType'        : 'manager-name' ,
-        'objectName'        : keystoreType,
-        'optionsString'        :  '--set key-store-file:config/keystore --reset key-store-pin-file  --set key-store-pin:%s --set enabled:true' % keystorePin,
-        'expectedRC'            : 0 }
-    </call>
-  
+        { 'location'       : location,
+          'dsPath'         : dsPath,
+          'dsInstanceHost' : dsInstanceHost,
+          'dsInstancePort' : dsInstancePort ,
+          'dsInstanceDn'   :  dsInstanceDn ,
+          'dsInstancePswd' : dsInstancePswd ,
+          'subcommand'     :  'set-key-manager-prop' ,
+          'objectType'     : 'manager-name' ,
+          'objectName'     : keystoreType,
+          'optionsString'  :  '--set key-store-file:config/keystore --reset key-store-pin-file  --set key-store-pin:%s --set enabled:true' % keystorePin,
+          'expectedRC'     : 0
+        }
+      </call>
+      
       <!--- configure Trust Manager Provider -->
       <message>
-         'Configure Trust Manager Provider'
+        'Configure Trust Manager Provider'
       </message>
-
-				
+      
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-trust-manager-prop' ,
-        'objectType'        : 'manager-name' ,
-        'objectName'        : 'Blind Trust',
-        'optionsString'        : '--set enabled:true' ,
-        'expectedRC'            : 0 }
-    </call>		
-
-		
+        { 'location'       : location,
+          'dsPath'         : dsPath,
+          'dsInstanceHost' : dsInstanceHost ,
+          'dsInstancePort' : dsInstancePort ,
+          'dsInstanceDn'   :  dsInstanceDn ,
+          'dsInstancePswd' : dsInstancePswd ,
+          'subcommand'     :  'set-trust-manager-prop' ,
+          'objectType'     : 'manager-name' ,
+          'objectName'     : 'Blind Trust',
+          'optionsString'  : '--set enabled:true' ,
+          'expectedRC'     : 0 
+        }
+      </call>
+      
+      
       <!--- Enable LDAPS Connection Handler -->
       <message>
-       'Enabling LDAPS Connection Handler - Keystore type'
+        'Enabling LDAPS Connection Handler - Keystore type'
       </message>
-
+      
       <script>
-		  option1='--set ssl-cert-nickname:%s' % certAlias
-		  option2='--set trust-manager-provider-dn:"cn=Blind Trust,cn=Trust Manager Providers,cn=config"' 
-		  option3='--set key-manager-provider-dn:"cn=%s,cn=Key Manager Providers,cn=config"' % (keystoreType)
-		  option4='--set listen-port:%s' % DIRECTORY_INSTANCE_SSL_PORT
-		  option5='--set enabled:true' 
-		  optionsString='%s %s %s %s %s' % (option1,option2,option3,option4,option5) 	  
-	  </script>		
-				
+        option1='--set ssl-cert-nickname:%s' % certAlias
+        option2='--set trust-manager-provider-dn:"cn=Blind Trust,cn=Trust Manager Providers,cn=config"'
+        option3='--set key-manager-provider-dn:"cn=%s,cn=Key Manager Providers,cn=config"' % (keystoreType)
+        option4='--set listen-port:%s' % DIRECTORY_INSTANCE_SSL_PORT
+        option5='--set enabled:true'
+        optionsString='%s %s %s %s %s' % (option1,option2,option3,option4,option5)
+      </script>	
+      
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-connection-handler-prop' ,
-        'objectType'        : 'handler-name' ,
-        'objectName'        : 'LDAPS Connection Handler',
-        'optionsString'        :  optionsString,
-        'expectedRC'            : 0 }
-    </call>				
-	 
-    <!--- Enable StartTLS -->
-        <message>
-         'Enabling StartTLS'
-        </message>
-
-     <script>
-		  option1='--set ssl-cert-nickname:%s' % certAlias
-		  option2='--set trust-manager-provider-dn:"cn=Blind Trust,cn=Trust Manager Providers,cn=config" '
-		  option3='--set key-manager-provider-dn:"cn=%s,cn=Key Manager Providers,cn=config"' % (keystoreType)
-		  option4='--set allow-start-tls:true' 
-		  optionsString='%s %s %s %s' % (option1,option2,option3,option4) 	 
-	  </script>	
+        { 'location'       : location,
+          'dsPath'         : dsPath,
+          'dsInstanceHost' : dsInstanceHost,
+          'dsInstancePort' : dsInstancePort,
+          'dsInstanceDn'   :  dsInstanceDn,
+          'dsInstancePswd' : dsInstancePswd,
+          'subcommand'     :  'set-connection-handler-prop',
+          'objectType'     : 'handler-name',
+          'objectName'     : 'LDAPS Connection Handler',
+          'optionsString'  :  optionsString,
+          'expectedRC'     : 0 
+        }
+      </call>
+      
+      <!--- Enable StartTLS -->
+      <message>
+       'Enabling StartTLS'
+      </message>
+      
+      <script>
+        option1='--set ssl-cert-nickname:%s' % certAlias
+        option2='--set trust-manager-provider-dn:"cn=Blind Trust,cn=Trust Manager Providers,cn=config" '
+        option3='--set key-manager-provider-dn:"cn=%s,cn=Key Manager Providers,cn=config"' % (keystoreType)
+        option4='--set allow-start-tls:true' 
+        optionsString='%s %s %s %s' % (option1,option2,option3,option4) 	 
+      </script>
 			
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-connection-handler-prop' ,
-        'objectType'        : 'handler-name' ,
-        'objectName'        : 'LDAP Connection Handler',
-        'optionsString'        :  optionsString,
-        'expectedRC'            : 0 }
-    </call>						
-			
+        { 'location'       : location,
+          'dsPath'         : dsPath,
+          'dsInstanceHost' : dsInstanceHost,
+          'dsInstancePort' : dsInstancePort,
+          'dsInstanceDn'   : dsInstanceDn,
+          'dsInstancePswd' : dsInstancePswd,
+          'subcommand'     : 'set-connection-handler-prop',
+          'objectType'     : 'handler-name',
+          'objectName'     : 'LDAP Connection Handler',
+          'optionsString'  : optionsString,
+          'expectedRC'     : 0
+        }
+      </call>
     </sequence>
   </function>
 	
 	
-<!-- ################################################## -->	
-<!-- Unconfigure SSL -->
-<!-- ################################################## -->	
-	
+  <!-- ################################################## -->	
+  <!-- Unconfigure SSL -->
+  <!-- ################################################## -->	
   <function name="unconfigureSSL">
     <function-prolog>
       This function reverses the configuration changes for SSL
@@ -906,7 +867,7 @@
     <function-map-args>
       <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
         <function-arg-description>
-            Location of target host
+          Location of target host
         </function-arg-description>
         <function-arg-property name="type" value="hostname"/>
       </function-arg-def>
@@ -921,7 +882,7 @@
           Directory server hostname or IP address
         </function-arg-description>
         <function-arg-property name="type" value="hostname"/>
-      </function-arg-def>      
+      </function-arg-def>
       <function-arg-def name="dsInstancePort" type="optional">
         <function-arg-description>
           Directory server port number
@@ -933,7 +894,7 @@
           Bind DN
         </function-arg-description>
         <function-arg-property name="type" value="DN"/>
-      </function-arg-def> 
+      </function-arg-def>
       <function-arg-def name="dsInstancePswd" type="optional">
         <function-arg-description>
           Bind password
@@ -941,11 +902,11 @@
         <function-arg-property name="type" value="string"/>
       </function-arg-def>
       <function-arg-def name="keystoreType" type="optional" default="'JKS'">
-	    <function-arg-description>
-	     Keystore type : JKS or PKCS12
+	      <function-arg-description>
+          Keystore type : JKS or PKCS12
   	    </function-arg-description>
-	  <function-arg-property name="type" value="string"/>
-	 </function-arg-def>		
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>
       <function-arg-def name="extraParams" type="optional">
         <function-arg-description>
           Optional extra parameters for specific test cases
@@ -954,75 +915,70 @@
       </function-arg-def>
     </function-map-args>
     <sequence>
-
-		
-          
       <!--- Disable LDAPS Connection Handler -->
       <message>
-         'Disabling LDAPS Connection Handler'
+       'Disabling LDAPS Connection Handler'
       </message>
-
+      
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-connection-handler-prop' ,
-        'objectType'        : 'handler-name' ,
-        'objectName'        : 'LDAPS Connection Handler',
-        'optionsString'        :  '--set enabled:false',
-        'expectedRC'            : 0 }
-    </call>				
-		
+        { 'location'       : location,
+          'dsPath'         : dsPath ,
+          'dsInstanceHost' : dsInstanceHost,
+          'dsInstancePort' : dsInstancePort ,
+          'dsInstanceDn'   :  dsInstanceDn ,
+          'dsInstancePswd' : dsInstancePswd ,
+          'subcommand'     :  'set-connection-handler-prop' ,
+          'objectType'     : 'handler-name' ,
+          'objectName'     : 'LDAPS Connection Handler',
+          'optionsString'  :  '--set enabled:false',
+          'expectedRC'     : 0 
+        }
+      </call>
+      
       <!--- Disable SSL Trust Manager Provider -->
       <message>
-         'Disabling SSL Trust Manager Provider'
+        'Disabling SSL Trust Manager Provider'
       </message>
-
-
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-trust-manager-prop' ,
-        'objectType'        : 'manager-name' ,
-        'objectName'        : 'Blind Trust',
-        'optionsString'        : '--set enabled:false' ,
-        'expectedRC'            : 0 }
-      </call>		
-  		
-
+        { 'location'       : location,
+          'dsPath'         : dsPath,
+          'dsInstanceHost' : dsInstanceHost,
+          'dsInstancePort' : dsInstancePort,
+          'dsInstanceDn'   :  dsInstanceDn,
+          'dsInstancePswd' : dsInstancePswd,
+          'subcommand'     : 'set-trust-manager-prop',
+          'objectType'     : 'manager-name',
+          'objectName'     : 'Blind Trust',
+          'optionsString'  : '--set enabled:false',
+          'expectedRC'     : 0
+        }
+      </call>
       <!--- Disable Key Manager Provider -->
       <message>
-         'Disabling Key Manager Provider'
+        'Disabling Key Manager Provider'
       </message>
-
-     <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-key-manager-prop' ,
-        'objectType'        : 'manager-name' ,
-        'objectName'        : keystoreType,
-        'optionsString'        :  '--set enabled:false',
-        'expectedRC'            : 0 }
-    </call>
-  
+      
+      <call function="'dsconfig'">
+        { 'location'       : location,
+          'dsPath'         : dsPath,
+          'dsInstanceHost' : dsInstanceHost ,
+          'dsInstancePort' : dsInstancePort ,
+          'dsInstanceDn'   : dsInstanceDn ,
+          'dsInstancePswd' : dsInstancePswd ,
+          'subcommand'     : 'set-key-manager-prop' ,
+          'objectType'     : 'manager-name' ,
+          'objectName'     : keystoreType,
+          'optionsString'  : '--set enabled:false',
+          'expectedRC'     : 0 
+        }
+      </call>
     </sequence>
   </function>
 	
-<!-- ################################################## -->	
-<!--  unconfigureTLS -->
-<!-- ################################################## -->		
-	
+  
+  <!-- ################################################## -->	
+  <!--  unconfigureTLS -->
+  <!-- ################################################## -->		
   <function name="unconfigureTLS">
     <function-prolog>
       This function reverses the configuration changes for startTLS
@@ -1045,7 +1001,7 @@
           Directory server hostname or IP address
         </function-arg-description>
         <function-arg-property name="type" value="hostname"/>
-      </function-arg-def>      
+      </function-arg-def>
       <function-arg-def name="dsInstancePort" type="optional">
         <function-arg-description>
           Directory server port number
@@ -1065,11 +1021,11 @@
         <function-arg-property name="type" value="string"/>
       </function-arg-def>
       <function-arg-def name="keystoreType" type="optional" default="'JKS'">
-	    <function-arg-description>
-	     Keystore type : JKS or PKCS12
+        <function-arg-description>
+          Keystore type : JKS or PKCS12
   	    </function-arg-description>
-	  <function-arg-property name="type" value="string"/>
-	 </function-arg-def>		
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>
       <function-arg-def name="extraParams" type="optional">
         <function-arg-description>
           Optional extra parameters for specific test cases
@@ -1078,73 +1034,71 @@
       </function-arg-def>
     </function-map-args>
     <sequence>
-    
- 
       <!--- Disable StartTLS -->
       <message>
        'Disabling StartTLS'
       </message>
-		
-     <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-connection-handler-prop' ,
-        'objectType'        : 'handler-name' ,
-        'objectName'        : 'LDAP Connection Handler',
-        'optionsString'        :  ' --set allow-start-tls:false',
-        'expectedRC'            : 0 }
-    </call>				
-
+      
+      <call function="'dsconfig'">
+        { 'location'       : location,
+          'dsPath'         : dsPath,
+          'dsInstanceHost' : dsInstanceHost,
+          'dsInstancePort' : dsInstancePort,
+          'dsInstanceDn'   : dsInstanceDn,
+          'dsInstancePswd' : dsInstancePswd,
+          'subcommand'     : 'set-connection-handler-prop',
+          'objectType'     : 'handler-name',
+          'objectName'     : 'LDAP Connection Handler',
+          'optionsString'  : ' --set allow-start-tls:false',
+          'expectedRC'     : 0 
+        }
+      </call>
+      
       <!--- Disable SSL Trust Manager Provider -->
       <message>
-         'Disabling SSL Trust Manager Provider'
+        'Disabling SSL Trust Manager Provider'
       </message>
-
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-trust-manager-prop' ,
-        'objectType'        : 'manager-name' ,
-        'objectName'        : 'Blind Trust',
-        'optionsString'        : '--set enabled:false' ,
-        'expectedRC'            : 0 }
-      </call>		
+        { 'location'       : location,
+          'dsPath'         : dsPath,
+          'dsInstanceHost' : dsInstanceHost,
+          'dsInstancePort' : dsInstancePort,
+          'dsInstanceDn'   : dsInstanceDn,
+          'dsInstancePswd' : dsInstancePswd,
+          'subcommand'     : 'set-trust-manager-prop',
+          'objectType'     : 'manager-name',
+          'objectName'     : 'Blind Trust',
+          'optionsString'  : '--set enabled:false',
+          'expectedRC'     : 0 
+        }
+      </call>
   		
-
       <!--- Disable Key Manager Provider -->
       <message>
-         'Disabling Key Manager Provider'
+        'Disabling Key Manager Provider'
       </message>
-
-     <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-key-manager-prop' ,
-        'objectType'        : 'manager-name' ,
-        'objectName'        : keystoreType,
-        'optionsString'        :  '--set enabled:false',
-        'expectedRC'            : 0 }
-    </call>
-		
-      </sequence>
-    </function>
-
-<!-- ################################################## -->	
-<!-- Unconfigure SSL and TLS -->
-<!-- ################################################## -->	
-	
+      
+      <call function="'dsconfig'">
+        { 'location'       : location,
+          'dsPath'         : dsPath,
+          'dsInstanceHost' : dsInstanceHost,
+          'dsInstancePort' : dsInstancePort,
+          'dsInstanceDn'   :  dsInstanceDn,
+          'dsInstancePswd' : dsInstancePswd,
+          'subcommand'     :  'set-key-manager-prop',
+          'objectType'     : 'manager-name',
+          'objectName'     : keystoreType,
+          'optionsString'  :  '--set enabled:false',
+          'expectedRC'     : 0 
+        }
+      </call>
+    </sequence>
+  </function>
+  
+  
+  <!-- ################################################## -->	
+  <!-- Unconfigure SSL and TLS -->
+  <!-- ################################################## -->	
   <function name="unconfigureSSL_TLS">
     <function-prolog>
       This function reverses the configuration changes for SSL and TLS
@@ -1167,7 +1121,7 @@
           Directory server hostname or IP address
         </function-arg-description>
         <function-arg-property name="type" value="hostname"/>
-      </function-arg-def>      
+      </function-arg-def>
       <function-arg-def name="dsInstancePort" type="optional">
         <function-arg-description>
           Directory server port number
@@ -1179,7 +1133,7 @@
           Bind DN
         </function-arg-description>
         <function-arg-property name="type" value="DN"/>
-      </function-arg-def> 
+      </function-arg-def>
       <function-arg-def name="dsInstancePswd" type="optional">
         <function-arg-description>
           Bind password
@@ -1187,11 +1141,11 @@
         <function-arg-property name="type" value="string"/>
       </function-arg-def>
       <function-arg-def name="keystoreType" type="optional" default="'JKS'">
-	    <function-arg-description>
-	     Keystore type : JKS or PKCS12
+        <function-arg-description>
+          Keystore type : JKS or PKCS12
   	    </function-arg-description>
-	  <function-arg-property name="type" value="string"/>
-	 </function-arg-def>				
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>
       <function-arg-def name="extraParams" type="optional">
         <function-arg-description>
           Optional extra parameters for specific test cases
@@ -1200,89 +1154,84 @@
       </function-arg-def>
     </function-map-args>
     <sequence>
-
-		
-          
       <!--- Disable LDAPS Connection Handler -->
       <message>
-         'Disabling LDAPS Connection Handler'
+        'Disabling LDAPS Connection Handler'
       </message>
 
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-connection-handler-prop' ,
-        'objectType'        : 'handler-name' ,
-        'objectName'        : 'LDAPS Connection Handler',
-        'optionsString'        :  '--set enabled:false',
-        'expectedRC'            : 0 }
-    </call>				
-		
-
+        { 'location'       : location,
+          'dsPath'         : dsPath,
+          'dsInstanceHost' : dsInstanceHost,
+          'dsInstancePort' : dsInstancePort,
+          'dsInstanceDn'   : dsInstanceDn,
+          'dsInstancePswd' : dsInstancePswd,
+          'subcommand'     : 'set-connection-handler-prop',
+          'objectType'     : 'handler-name',
+          'objectName'     : 'LDAPS Connection Handler',
+          'optionsString'  : '--set enabled:false',
+          'expectedRC'     : 0
+        }
+      </call>
+      
       <!--- Disable StartTLS -->
       <message>
-       'Disabling StartTLS'
+        'Disabling StartTLS'
       </message>
-		
-     <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-connection-handler-prop' ,
-        'objectType'        : 'handler-name' ,
-        'objectName'        : 'LDAP Connection Handler',
-        'optionsString'        :  ' --set allow-start-tls:false',
-        'expectedRC'            : 0 }
-    </call>				
-				
+      <call function="'dsconfig'">
+        { 'location'       : location ,
+          'dsPath'         : dsPath ,
+          'dsInstanceHost' : dsInstanceHost ,
+          'dsInstancePort' : dsInstancePort ,
+          'dsInstanceDn'   :  dsInstanceDn ,
+          'dsInstancePswd' : dsInstancePswd ,
+          'subcommand'     :  'set-connection-handler-prop' ,
+          'objectType'     : 'handler-name' ,
+          'objectName'     : 'LDAP Connection Handler',
+          'optionsString'  :  ' --set allow-start-tls:false',
+          'expectedRC'     : 0 
+        }
+      </call>
+      
       <!--- Disable SSL Trust Manager Provider -->
       <message>
-         'Disabling SSL Trust Manager Provider'
+        'Disabling SSL Trust Manager Provider'
       </message>
 
-
       <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-trust-manager-prop' ,
-        'objectType'        : 'manager-name' ,
-        'objectName'        : 'Blind Trust',
-        'optionsString'        : '--set enabled:false' ,
-        'expectedRC'            : 0 }
-      </call>		
+        { 'location'       : location,
+          'dsPath'         : dsPath,
+          'dsInstanceHost' : dsInstanceHost,
+          'dsInstancePort' : dsInstancePort,
+          'dsInstanceDn'   : dsInstanceDn,
+          'dsInstancePswd' : dsInstancePswd ,
+          'subcommand'     : 'set-trust-manager-prop' ,
+          'objectType'     : 'manager-name' ,
+          'objectName'     : 'Blind Trust',
+          'optionsString'  : '--set enabled:false' ,
+          'expectedRC'     : 0
+        }
+      </call>
   		
-
       <!--- Disable Key Manager Provider -->
       <message>
-         'Disabling Key Manager Provider'
+        'Disabling Key Manager Provider'
       </message>
-
-     <call function="'dsconfig'">
-      { 'location'                   : location ,
-        'dsPath'                     : dsPath ,
-        'dsInstanceHost'        : dsInstanceHost ,
-        'dsInstancePort'         : dsInstancePort ,
-        'dsInstanceDn'          :  dsInstanceDn ,
-        'dsInstancePswd'       : dsInstancePswd ,
-        'subcommand'          :  'set-key-manager-prop' ,
-        'objectType'        : 'manager-name' ,
-        'objectName'        : keystoreType,
-        'optionsString'        :  '--set enabled:false',
-        'expectedRC'            : 0 }
-    </call>
-  
+      
+      <call function="'dsconfig'">
+        { 'location'       : location,
+          'dsPath'         : dsPath,
+          'dsInstanceHost' : dsInstanceHost,
+          'dsInstancePort' : dsInstancePort,
+          'dsInstanceDn'   : dsInstanceDn,
+          'dsInstancePswd' : dsInstancePswd,
+          'subcommand'     : 'set-key-manager-prop',
+          'objectType'     : 'manager-name',
+          'objectName'     : keystoreType,
+          'optionsString'  : '--set enabled:false',
+          'expectedRC'     : 0 
+        }
+      </call>
     </sequence>
   </function>
-		
 </stax>
diff --git a/opends/tests/functional-tests/shared/functions/topology.xml b/opends/tests/functional-tests/shared/functions/topology.xml
index 8689dd9..4a2ed45 100755
--- a/opends/tests/functional-tests/shared/functions/topology.xml
+++ b/opends/tests/functional-tests/shared/functions/topology.xml
@@ -399,23 +399,23 @@
       
       <!-- configure the coverage dump file -->
       <script>
-        mylog='::coverage: begin\n'
-        emmaprops = '%s/%s/classes/emma.properties' % (dsDir,OPENDSNAME)
-        group='emma'
-        if CurrentTestPath['group']:
-          group=CurrentTestPath['group'].strip()
-          
-        if os.path.exists('%s' % emmaprops):
-          mylog+='::coverage: setting %s/%s.coverage to file %s\n' % (TMPDIR,group,emmaprops)
-          coveragefh = open(emmaprops,'w')
-          coveragefh.write('coverage.out.file=%s/%s.coverage\n' % (TMPDIR,group) )
+        mylog="::coverage - checking for %s/lib/emma.jar\n" % dsPath
+        if os.path.exists('%s/lib/emma.jar' % dsPath):
+          mylog+="  ::coverage on\n"
+          if not os.path.exists('%s/coverage' % TMPDIR):
+            os.mkdir('%s/coverage' % TMPDIR)
+            mylog+="    ::mkdir %s/coverage on\n" % TMPDIR
+          if not os.path.exists('%s/coverage/%s' % (TMPDIR,CurrentTestPath['group'])):
+            os.mkdir('%s/coverage/%s' % (TMPDIR,CurrentTestPath['group']))
+            mylog+="    ::mkdir %s/coverage/%s on\n" % (TMPDIR,CurrentTestPath['group'])
+          mylog+="  ::writing to %s/classes/emma.properties" % dsPath
+          coveragefh = open( '%s/classes/emma.properties' % dsPath, 'w' )
+          coveragefh.write( 'coverage.out.file=%s/coverage/%s/coverage.ec\n' % (TMPDIR,CurrentTestPath['group']) )
           coveragefh.close()
           
       </script>
-      <message>
-        '%s' % mylog
-      </message>
 
+      <message>mylog</message>
       <!--- Set up DS -->
       <message>
         'Set up DS on %s : %s/%s' % (dsHost,dsDir,OPENDSNAME)
diff --git a/opends/tests/functional-tests/shared/functions/utils.xml b/opends/tests/functional-tests/shared/functions/utils.xml
index dd96717..30fb608 100755
--- a/opends/tests/functional-tests/shared/functions/utils.xml
+++ b/opends/tests/functional-tests/shared/functions/utils.xml
@@ -434,13 +434,6 @@
     </function-prolog>
     <function-no-args />
     <sequence>
-      <script>
-        testcaseStartTime=strftime("%Y%m%d@%H:%M:%S",localtime())
-        myLog = open('%s/my.log' % TMPDIR, 'a')
-        myLog.seek(0,2)
-        myLog.write('%s - starting testcase: %s\n' % (testcaseStartTime, STAXCurrentTestcase ) )
-        myLog.close()
-      </script>
       <message level="'start'">'testcase: %s' % STAXCurrentTestcase</message>
       <message>'****************************************************'</message>
       <message>'*** STARTING TEST CASE %s.' % STAXCurrentTestcase</message>
@@ -467,6 +460,9 @@
     </function-prolog>
     <function-no-args />
       <sequence>
+        <script>
+          testcaseStartTime=strftime("%Y%m%d@%H:%M:%S",localtime())
+        </script>
         <call function="'testCase_StartBanner'" />
     </sequence>
   </function>
@@ -506,7 +502,7 @@
           numFail=int(STAFResult['numFails'])
         else:
           numFail=int(0)
-
+          
       </script>
              
       <if expr="numFail &gt; 0">
@@ -528,7 +524,7 @@
       </call>
       <script>
         class Test:
-          def __init__(self, group, suite, fullname, start, stop, failures):
+          def __init__(self, group, suite, fullname, start, stop, failures, successes):
             self.log=''
             self.group=group
             self.suite=suite
@@ -540,7 +536,10 @@
             self.name=''.join(tmp)
             self.duration = 0
             if failures == 0:
-              self.result='pass'
+              if successes == 0:
+                self.result='inconclusive'
+              else:
+                self.result='pass'
             else:
               self.result='fail'
             
@@ -560,15 +559,17 @@
             return xml
             
           def appendLog(self, log):
-            self.log +='          %s&lt;br /&gt;\n' % log
+            log=log.replace('&lt;','')
+            log=log.replace('&gt;','')
+            self.log +='          %s\n' % log
             
           def getName(self):
             return self.name
          
-        thisTest = Test(CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentTestcase, testcaseStartTime,testcaseEndTime,numFail)
+        thisTest = Test(CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentTestcase, testcaseStartTime,testcaseEndTime,numFail,numPass)
             
         doLog = False
-        testlog=open('%s/test.log' % TMPDIR,'a')
+        testlog=open('%s/tests-log.xml' % TMPDIR,'a')
         testlog.seek(0,2)
 
         # loop through the log lines
@@ -618,20 +619,8 @@
           
         ThisGroupName=CurrentTestPath['group']  
         ThisSuiteName=CurrentTestPath['suite']
-        
-        mylog='::coverage: begin\n'
-        if os.path.exists('%s/classes' % dsPath):
-          mylog+='::coverage: setting %s/%s.coverage to file %s/classes/emma.properties\n' % (TMPDIR,CurrentTestPath['group'],dsPath)
-          coveragefh = open( '%s/classes/emma.properties' % dsPath, 'w' )
-          coveragefh.write( 'coverage.out.file=%s/%s.coverage\n' % (TMPDIR,CurrentTestPath['group']) )
-          coveragefh.close()
-          coveragefh = open( '%s/classes/emma.properties' % dsPath, 'r' )
-          mylog+='::coverage:contents: %s' % coveragefh.read()
-          coveragefh.close()
-          
-
       </script>
-
+      
       <!-- Start time of test suite -->      
       <script>
         TestSuiteStartTime=strftime("%Y%m%d@%H:%M:%S",localtime())
@@ -703,17 +692,35 @@
     </function-prolog>
     <function-no-args />
     <sequence>
-    
-      <!-- Take the values from the current test path -->     
+      <!-- Take the values from the current test path -->
       <script>
         if not CurrentTestPath.has_key('group'):
           CurrentTestPath['group']='unknown-group'
         
         ThisGroupName=CurrentTestPath['group']
+        
+        # NOTE: the same code lives in topology.xml
+        #       the reason for that is that the topology is created AFTER the
+        #       first test group has started (as part of the first setup)
+        #       the following groups are going to use the same topology
+        mylog="::coverage - checking for %s/lib/emma.jar\n" % dsPath
+        if os.path.exists('%s/lib/emma.jar' % dsPath):
+          mylog+="  ::coverage on\n"
+          if not os.path.exists('%s/coverage' % TMPDIR):
+            os.mkdir('%s/coverage' % TMPDIR)
+            mylog+="    ::mkdir %s/coverage on\n" % TMPDIR
+          if not os.path.exists('%s/coverage/%s' % (TMPDIR,CurrentTestPath['group'])):
+            os.mkdir('%s/coverage/%s' % (TMPDIR,CurrentTestPath['group']))
+            mylog+="    ::mkdir %s/coverage/%s on\n" % (TMPDIR,CurrentTestPath['group'])
+          mylog+="  ::writing to %s/classes/emma.properties" % dsPath
+          coveragefh = open( '%s/classes/emma.properties' % dsPath, 'w' )
+          coveragefh.write( 'coverage.out.file=%s/coverage/%s/coverage.ec\n' % (TMPDIR,CurrentTestPath['group']) )
+          coveragefh.close()
       </script>
-      
+      <message>
+        mylog
+      </message>
       <message>'##### %s group preamble #####' % ThisGroupName</message>
-      
     </sequence>
   </function>
 
@@ -729,15 +736,76 @@
           ThisGroupName=CurrentTestPath['group']
         else:
           ThisGroupName='unknown-group'
+        
+        coverage='N/A'
       </script>
       
       <message>'##### %s group postamble #####' % ThisGroupName</message>
       
+      <if expr="os.path.exists('%s/lib/emma.jar' % dsPath)">
+        <sequence>
+          <call function="'runCommand'">
+            { 'name'      : 'Generate coverage xml report for test group %s' % CurrentTestPath['group'],
+              'command'   : 'java',
+              'arguments' : ' -Xms64M -Xmx512M -cp %s/lib/emma.jar emma report -r xml,html -in %s/coverage.em,%s/coverage/%s/coverage.ec -Dreport.xml.out.file=%s/coverage/%s/coverage.xml -Dreport.html.out.file=%s/coverage/%s/coverage.html -sp %s/../../../src' % (dsPath,dsPath,TMPDIR,CurrentTestPath['group'],TMPDIR,CurrentTestPath['group'],TMPDIR,CurrentTestPath['group'],TMPDIR),
+              'path'      : TMPDIR
+            }
+          </call>
+          <script>
+            from java.io import FileInputStream
+            from javax.xml.transform.stream import StreamSource
+            from javax.xml.transform.stream import StreamResult
+            from javax.xml.parsers import DocumentBuilderFactory
+            from org.w3c.dom import *
+            
+            factory = DocumentBuilderFactory.newInstance() 
+            builder = factory.newDocumentBuilder()
+            
+            input = FileInputStream("%s/coverage/%s/coverage.xml" % (TMPDIR,CurrentTestPath['group']))
+            document = builder.parse(input)
+            dom = document.getDocumentElement()
+            coverageNodes = dom.getElementsByTagName("all").item(0).getChildNodes()
+            for coverageNodeIndex in range(coverageNodes.getLength()):
+              thisNode = coverageNodes.item(coverageNodeIndex)
+              if thisNode.getNodeName() == 'coverage':
+                thisNodeAttributes = thisNode.getAttributes()
+                if thisNodeAttributes.getNamedItem("type").getNodeValue() == 'block, %':
+                  rawCoverage = thisNodeAttributes.getNamedItem("value").getNodeValue()
+                  coverage = rawCoverage.split('%')[0]
+            testlog=open('%s/tests-log.xml' % TMPDIR,'a')
+            testlog.seek(0,2)
+            testlog.write("      &lt;group&gt;\n")
+            testlog.write("        &lt;name&gt;\n")
+            testlog.write("          %s\n" % CurrentTestPath['group'])
+            testlog.write("        &lt;/name&gt;\n")
+            testlog.write("        &lt;coverage&gt;\n")
+            testlog.write("          %s\n" % coverage)
+            testlog.write("        &lt;/coverage&gt;\n")
+            testlog.write("      &lt;/group&gt;\n")
+            testlog.close()
+          </script>
+        </sequence>
+        <else>
+          <script>
+            testlog=open('%s/tests-log.xml' % TMPDIR,'a')
+            testlog.seek(0,2)
+            testlog.write("      &lt;group&gt;\n")
+            testlog.write("        &lt;name&gt;\n")
+            testlog.write("          %s\n" % CurrentTestPath['group'])
+            testlog.write("        &lt;/name&gt;\n")
+            testlog.write("        &lt;coverage&gt;\n")
+            testlog.write("          N/A\n")
+            testlog.write("        &lt;/coverage&gt;\n")
+            testlog.write("      &lt;/group&gt;\n")
+            testlog.close()
+          </script>
+        </else>
+      </if>
+      
       <script>
         if CurrentTestPath.has_key('group'):
           del CurrentTestPath['group']
       </script>
-      
     </sequence>
   </function>
   
@@ -1068,12 +1136,12 @@
           the command to run
         </function-arg-description>
       </function-arg-def>
-      <function-arg-def name="path" type="optional" default="'%s' % dsPath">
+      <function-arg-def name="path" type="optional" default="'%s' % dsBinPath">
         <function-arg-description>
           the path where the command is to be run from
         </function-arg-description>
       </function-arg-def>
-      <function-arg-def name="argmunents" type="optional" default="''">
+      <function-arg-def name="arguments" type="optional" default="''">
         <function-arg-description>
           the path where the command is to be found
         </function-arg-description>
@@ -1093,29 +1161,67 @@
           Which machine should the command be executed on
         </function-arg-description>
       </function-arg-def>
+      <function-arg-def name="name" 
+                        default="'Run a system command'" 
+                        type="optional">
+        <function-arg-description>
+          The name to give the process (only matters in the STAX Monitor really)
+        </function-arg-description>
+      </function-arg-def>
+      <function-arg-def name="stripOutput" default="True" type="optional">
+        <function-arg-description>
+          A boolean (use True or False here, case matters) to enable disable
+          stripping the output of a command
+          TODO: consider allowing passing a function name to enable custom
+                output manipulation (overkill?)
+        </function-arg-description>
+        <function-arg-property name="type" value="enum">
+          <function-arg-property-description>
+            This argument can only have boolean values
+          </function-arg-property-description>
+          <function-arg-property-data type="choice" value="True"/>
+          <function-arg-property-data type="choice" value="False"/>
+        </function-arg-property>
+      </function-arg-def>
     </function-map-args>
     <sequence>
       <message>
-        '%s' % command
+        'Running command:\n %s %s\nenv: %s\nworkdir: %s' % (command,arguments,env,path)
       </message>
             
-      <process name="'run a system command'">
-        <location>'%s' % location</location>
-        <command>'%s' % command</command>
-        <parms>'%s' % arguments</parms>
-        <workdir>'%s' % path</workdir>
-        <envs>
-          '%s' % env
-        </envs>
+      <process name="name">
+        <location>location</location>
+        <command>command</command>
+        <parms>arguments</parms>
+        <workdir>path</workdir>
+        <envs>env</envs>
         <console use="'same'"/>
         <stderr mode="'stdout'"/>
         <returnstdout/>
       </process>
+      <message level="'info'">
+        'Command returned:\n%s' % STAXResult[0][1]
+      </message>
       <script>
-        STAXResult.replace('EMMA: collecting runtime coverage data ...\n','')
+        def dig(var):
+          try:
+            if var.__class__==[].__class__:
+              for i in range(len(var)):
+                var[i]=dig(var[i])
+              return var
+            else:
+              if var.__class__==''.__class__:
+                return re.compile(r'EMMA:.*\n').sub('',var)
+              else:
+                return var
+          except TypeError:
+            return 'could not evaluate the following component: %s' % var
+        
+        if stripOutput == True:
+          STAXResult=dig(STAXResult)
       </script>
       <return>
-        [ RC , STAXResult ]
+        STAXResult
       </return>
     </sequence>
   </function>
diff --git a/opends/tests/functional-tests/staf-installer.xml b/opends/tests/functional-tests/staf-installer.xml
index b2b66d8..12a2ba8 100644
--- a/opends/tests/functional-tests/staf-installer.xml
+++ b/opends/tests/functional-tests/staf-installer.xml
@@ -682,7 +682,7 @@
       </then>
     </if>
   </target>
-  <target name="run-my-tests-default-plan" depends="run-my-tests-define">
+  <target name="run-my-tests-default-plan" depends="run-my-tests-define" unless="custom-suites.on">
     <delete file="${test.plan.default}"/>
     <foreach list="${test.plan.list}" param="test" target="run-my-tests-default-plan-add"/>
   </target>
@@ -826,11 +826,11 @@
   </target>
   
   <target name="coverage-report" if="coverage.on">
-    <delete dir="${staf.tmp.dir}/coverage" />
-    <mkdir dir="${staf.tmp.dir}/coverage" />
+    <delete dir="${staf.tmp.dir}/coverage/all" />
+    <mkdir dir="${staf.tmp.dir}/coverage/all" />
     <emma enabled="${coverage.on}" >
       <report >
-        <infileset dir="${staf.tmp.dir}" includes="**/*.em,**/*.coverage" />
+        <infileset dir="${staf.tmp.dir}" includes="**/*.em,**/*.ec" />
 
         <sourcepath>
           <dirset dir="${project.home}" >
@@ -838,7 +838,7 @@
           </dirset>
         </sourcepath>
 
-        <html outfile="${staf.tmp.dir}/coverage/index.html"
+        <html outfile="${staf.tmp.dir}/coverage/all/index.html"
               columns="name, method, line"
               sort="+line, +name"
               metrics="line:80"
@@ -1024,7 +1024,7 @@
         </and>
       </condition>
       <available file="${daily.package}" property="daily.package.downloaded"/>
-      
+      <available file="testcases/run-custom-suites.dat" property="custom-suites.on" />
       <available file="${staf.install.dir}" 
                 type="dir" 
                 property="staf.installed" />
@@ -1170,14 +1170,11 @@
   </target>
   
   <target name="generate-report">
-    <tstamp>
-      <format property="tstamp.today" pattern="yyyyMMdd"/>
-    </tstamp>
-    <fileset id="resultxml" file="${tstamp.today}-*/**/reports/results.xml" />
+    <delete file="${staf.tmp.dir}/my-report.html"/>
     <xslt processor="trax"
-          in="C:\Users\arnaud\.hudson\jobs\opends-vista-functional-tests\workspace\opends\tests\functional-run\tmp\20070726-234928\Windows-x86-jvm1.5\reports\results.xml" 
-          out="${staf.tmp.dir}/results.html"
-          style="shared/xsl/gen-alltests-report.xsl">
+          in="${staf.tmp.dir}/tests-log.xml" 
+          out="${staf.tmp.dir}/my-report.html"
+          style="shared/xsl/my-report.xsl">
     </xslt>
   </target>
 </project>
diff --git a/opends/tests/functional-tests/testcases/aci/aci.xml b/opends/tests/functional-tests/testcases/aci/aci.xml
index 8c8ea59..ecf6e92 100755
--- a/opends/tests/functional-tests/testcases/aci/aci.xml
+++ b/opends/tests/functional-tests/testcases/aci/aci.xml
@@ -45,7 +45,7 @@
           <call function="'testGroup_Preamble'"/>
 			        											
    
-          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+<!--          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
             file="'%s/testcases/aci/global_acis.xml' % (TESTS_DIR)"/>
           <call function="'global_acis'" />
   
@@ -112,7 +112,7 @@
           <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
             file="'%s/testcases/aci/aci_effective_rights.xml' % (TESTS_DIR)"/>
           <call function="'aci_effective_rights'" />
-  
+  -->
           <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
             file="'%s/testcases/aci/aci_import.xml' % (TESTS_DIR)"/>
           <call function="'aci_import'" />
diff --git a/opends/tests/functional-tests/testcases/indexes/indexes.xml b/opends/tests/functional-tests/testcases/indexes/indexes.xml
index 9ef1f31..29c315d 100644
--- a/opends/tests/functional-tests/testcases/indexes/indexes.xml
+++ b/opends/tests/functional-tests/testcases/indexes/indexes.xml
@@ -34,7 +34,7 @@
           CurrentTestPath={'group':'indexes','suite':'indexes'}
           envAlreadyLoaded='true'
           _setupSteps=['testGroup_Preamble','testSuite_Preamble','indexes_setup']
-          _testSteps=['indexes_search','indexes_modify','indexes_add','indexes_remove']
+          _testSteps=['indexes_search','indexes_add','indexes_remove']
           _cleanupSteps=['indexes_cleanup','testSuite_Postamble','testGroup_Postamble']
         </script>
         <!---
@@ -334,6 +334,52 @@
     </block>
   </function>
 
+  <function name="indexes_vlv_add">
+    <!--
+      This test does a bunch of searches on the 
+      and then verifies that it worked
+      #@TestMarker                indexes
+      #@TestName                  indexes_remove
+      #@TestIssue                 TODO: look up the issue in issue tracker
+      #@TestPurpose               Check if the user can remove indexes
+      #@TestPreamble              none
+      #@TestStep                  iterate through filters prior to removing index
+      #@TestStep                  remove index
+      #@TestStep                  iterate through filters after to removing index
+      #@TestPostamble             none
+      #@TestResult                Success if entry are indexed as expected
+    -->
+    <block name="'Entry_Limit'">
+      <sequence>
+        <try>
+          <sequence>
+            <call function="'loopThroughFilters'">
+              { 'filters' : 'before-entry-limit' }
+            </call>
+            <call function="'runFunction'">
+              { 'functionName'      : 'modifyIndex'                                ,
+                'functionException' : 'LDAP.ModifyIndexException'                  ,
+                'functionFailureTC' : '%s: %s: %s' % (CurrentTestPath['group'], CurrentTestPath['suite'], STAXCurrentBlock),
+                'functionMessage'   : 'Modify index entry limit on attribute uid'  ,
+                'functionArguments' : { 'operation'          : 'set'               ,
+                                        'indexAttribute'     : 'uid'               ,
+                                        'indexProperty'      : 'index-entry-limit' ,
+                                        'indexPropertyValue' : '3'
+                                      }
+              }
+            </call>
+            <call function="'loopThroughFilters'">
+              { 'filters' : 'after-entry-limit' }
+            </call>
+          </sequence>
+          <catch exception="'STAXException.LDAP.RemoveIndexException'">
+            <message log="1" level="'fatal'">'Fatal Error: Failed to remove index for attribute l'</message>
+          </catch>
+        </try>
+      </sequence>
+    </block>
+  </function>
+
   
   <function name="loopThroughFilters" scope="local">
     <function-map-args>
diff --git a/opends/tests/functional-tests/testcases/quickstart/quickstart.xml b/opends/tests/functional-tests/testcases/quickstart/quickstart.xml
index 47471fb..3fc25ef 100755
--- a/opends/tests/functional-tests/testcases/quickstart/quickstart.xml
+++ b/opends/tests/functional-tests/testcases/quickstart/quickstart.xml
@@ -26,78 +26,57 @@
  !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  ! -->
 <stax>
-
   <defaultcall function="main_quickstart"/>
-
   <function name="main_quickstart">
-
-    <sequence>
-
-      <block name="'quickstart'">
-      
-        <sequence>
+    <block name="'quickstart'">
+      <sequence>
+        <!--- Start DS -->
+        <call function="'StartDsWithScript'">
+         { 'location'  : STAF_REMOTE_HOSTNAME }
+        </call>
+        <call function="'checkRC'">
+           { 'returncode' : RC ,
+             'result'     : STAXResult }
+        </call>
         
-          <!--- Start DS -->
-          <message>
-            'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
-          </message>
-          
-          <call function="'StartDsWithScript'">
-           { 'location'  : STAF_REMOTE_HOSTNAME }
-          </call>
-          
-          <call function="'checkRC'">
-             { 'returncode' : RC ,
-               'result'     : STAXResult }
-          </call>
-          
-          <!--- Check that DS started -->
-          <call function="'isAlive'">
-            { 'noOfLoops'        : 5 ,
-              'noOfMilliSeconds' : 2000 }
-          </call>
-          
-          <message>
-             'Quickstart: Adding quickstart entries'
-          </message>
-          
-          <call function="'addEntry'">
-            { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
-              'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
-              'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
-              'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
-              'entryToBeAdded'   : '%s/quickstart/quickstart.ldif' % logsRemoteDataDir }
-          </call>
-          
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-          
-          <!--- Stop DS -->
-          <message>
-             'Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
-          </message>
-          
-          <call function="'StopDsWithScript'">
-              { 'location'  : STAF_REMOTE_HOSTNAME,
-                'dsHost'    : DIRECTORY_INSTANCE_HOST,
-                'dsPort'    : DIRECTORY_INSTANCE_PORT,
-                'dsBindDN'  : DIRECTORY_INSTANCE_DN,
-                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
-          </call>
-          
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-      
-        </sequence>
-    
-      </block>
-    
-    </sequence>
-
+        <!--- Check that DS started -->
+        <call function="'isAlive'">
+          { 'noOfLoops'        : 5 ,
+            'noOfMilliSeconds' : 2000 }
+        </call>
+        
+        <message>
+           'Quickstart: Adding quickstart entries'
+        </message>
+        <call function="'addEntry'">
+          { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+            'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+            'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+            'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+            'entryToBeAdded'   : '%s/quickstart/quickstart.ldif' % logsRemoteDataDir 
+          }
+        </call>
+        <call function="'checkRC'">
+            { 'returncode' : RC ,
+              'result'     : STAXResult }
+        </call>
+        
+        <!--- Stop DS -->
+        <call function="'StopDsWithScript'">
+          { 'location'  : STAF_REMOTE_HOSTNAME,
+            'dsHost'    : DIRECTORY_INSTANCE_HOST,
+            'dsPort'    : DIRECTORY_INSTANCE_PORT,
+            'dsBindDN'  : DIRECTORY_INSTANCE_DN,
+            'dsBindPwd' : DIRECTORY_INSTANCE_PSWD 
+          }
+        </call>
+        
+        <call function="'checkRC'">
+          { 'returncode' : RC ,
+            'result'     : STAXResult 
+          }
+        </call>
+      </sequence>
+    </block>
   </function>
-
 </stax>
diff --git a/opends/tests/functional-tests/testcases/runFuncTests.xml b/opends/tests/functional-tests/testcases/runFuncTests.xml
index efccf64..5701c05 100755
--- a/opends/tests/functional-tests/testcases/runFuncTests.xml
+++ b/opends/tests/functional-tests/testcases/runFuncTests.xml
@@ -26,81 +26,77 @@
  !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  ! -->
 <stax>
-
   <defaultcall function="main" />
-
   <function name="main">
-
     <sequence>
-		
       <!--- Load the environment for the test suite execution -->
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/environment.xml' % (TESTS_FUNCTIONS_DIR)" />
-      <call function="'loadEnvironment'" />  
+      <import machine="STAF_LOCAL_HOSTNAME"
+              file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR" />
+      <call function="'loadEnvironment'" />
 
       <!-- The Functional Tests -->
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/testcases/security/security.xml' % (TESTS_DIR)" />
+      <import machine="STAF_LOCAL_HOSTNAME"
+              file="'%s/testcases/security/security.xml' % TESTS_DIR" />
       <!--
       <call function="'main_security'" />
       -->
 
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/testcases/aci/aci.xml' % (TESTS_DIR)" />
+      <import machine="STAF_LOCAL_HOSTNAME"
+              file="'%s/testcases/aci/aci.xml' % TESTS_DIR" />
       <!--
       <call function="'main_aci'" />
       -->
 
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/testcases/privileges/privileges.xml' % (TESTS_DIR)" />
+      <import machine="STAF_LOCAL_HOSTNAME"
+              file="'%s/testcases/privileges/privileges.xml' % TESTS_DIR" />
       <!--
       <call function="'main_privileges'" />
       -->
 
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/testcases/backends/backends.xml' % (TESTS_DIR)" />
+      <import machine="STAF_LOCAL_HOSTNAME"
+              file="'%s/testcases/backends/backends.xml' % TESTS_DIR" />
       <!--
       <call function="'main_backends'" />
       --> 
       
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/testcases/clu/commands.xml' % (TESTS_DIR)" />
+      <import machine="STAF_LOCAL_HOSTNAME"
+              file="'%s/testcases/clu/commands.xml' % TESTS_DIR" />
       <!--
       <call function="'main_commands'" />
       -->
 
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/testcases/core/core.xml' % (TESTS_DIR)" />
+      <import machine="STAF_LOCAL_HOSTNAME"
+              file="'%s/testcases/core/core.xml' % TESTS_DIR" />
       <!--
       <call function="'main_core'" />
       -->
 
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/testcases/schema/schema.xml' % (TESTS_DIR)" />
+      <import machine="STAF_LOCAL_HOSTNAME"
+              file="'%s/testcases/schema/schema.xml' % TESTS_DIR" />
       <!--
       <call function="'main_schema'" />
       -->
 
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/testcases/replication/replication.xml' % (TESTS_DIR)" />
+      <import machine="STAF_LOCAL_HOSTNAME"
+              file="'%s/testcases/replication/replication.xml' % TESTS_DIR" />
       <!--
       <call function="'main_replication'" />					
       -->
 
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/testcases/indexes/indexes.xml' % (TESTS_DIR)" />
+      <import machine="STAF_LOCAL_HOSTNAME"
+              file="'%s/testcases/indexes/indexes.xml' % TESTS_DIR" />
       <!--
       <call function="'indexes'" />
       -->
 
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/testcases/groups/groups.xml' % (TESTS_DIR)" />
+      <import machine="STAF_LOCAL_HOSTNAME"
+              file="'%s/testcases/groups/groups.xml' % TESTS_DIR" />
       <!--
       <call function="'main_groups'" />
       -->
 
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/testcases/sample/sample.xml' % (TESTS_DIR)" />
+      <import machine="STAF_LOCAL_HOSTNAME"
+              file="'%s/testcases/sample/sample.xml' % TESTS_DIR" />
       <script>
         class functionToRun:
           def __init__(self, name):
@@ -109,6 +105,11 @@
           def getName(self):
             return self.name
           
+        testlog=open('%s/tests-log.xml' % TMPDIR,'w')
+        testlog.write('&lt;qa&gt;\n')
+        testlog.write('  &lt;functional-tests&gt;\n')
+        testlog.write('    &lt;results&gt;\n')
+        testlog.close()
           
         suitesFileName='%s/testcases/run-custom-suites.dat' % TESTS_DIR
         
@@ -124,11 +125,171 @@
       <iterate var="function" in="functionsToRun">
         <sequence>
           <message>'calling function [%s]' % function.getName()</message>
-          <call function="'%s' % function.getName()" />
+          <call function="function.getName()" />
         </sequence>
       </iterate>
+      
+      <!-- in this section we'll compute the coverage for all the tests
+           if coverage is turned on
+           so far I could only get through this on either machines with a lot
+           of memory or small sets of tests
+      -->
+      <if expr="os.path.exists('%s/lib/emma.jar' % dsPath)">
+        <sequence>
+          <script>
+            coverageFiles=''
+            for group in os.listdir('%s/coverage/' % TMPDIR):
+              coverageFiles+='%s/coverage/%s/coverage.ec' % (TMPDIR,group)
+          </script>
+          <call function="'runCommand'">
+              { 'name'      : 'Generate global coverage xml report',
+                'command'   : 'java',
+                'arguments' : ' -Xms64M -Xmx1024M -cp %s/lib/emma.jar emma report -r xml,html -in %s/coverage.em,%s -Dreport.xml.out.file=%s/coverage/coverage.xml -Dreport.html.out.file=%s/coverage/coverage.html -sp %s/../../../src' % (dsPath,dsPath,coverageFiles,TMPDIR,TMPDIR,TMPDIR),
+                'path'      : TMPDIR
+              }
+          </call>
+          <script>
+            from java.io import FileInputStream
+            from javax.xml.transform.stream import StreamSource
+            from javax.xml.transform.stream import StreamResult
+            from javax.xml.parsers import DocumentBuilderFactory
+            from org.w3c.dom import *
+            
+            factory = DocumentBuilderFactory.newInstance() 
+            builder = factory.newDocumentBuilder()
+            
+            input = FileInputStream("%s/coverage/coverage.xml" % TMPDIR)
+            document = builder.parse(input)
+            dom = document.getDocumentElement()
+            coverageNodes = dom.getElementsByTagName("all").item(0).getChildNodes()
+            for coverageNodeIndex in range(coverageNodes.getLength()):
+              thisNode = coverageNodes.item(coverageNodeIndex)
+              if thisNode.getNodeName() == 'coverage':
+                thisNodeAttributes = thisNode.getAttributes()
+                if thisNodeAttributes.getNamedItem("type").getNodeValue() == 'block, %':
+                  rawCoverage = thisNodeAttributes.getNamedItem("value").getNodeValue()
+                  coverage = rawCoverage.split('%')[0]
+            testlog=open('%s/tests-log.xml' % TMPDIR,'a')
+            testlog.seek(0,2)
+            testlog.write("      &lt;all&gt;\n")
+            testlog.write("        &lt;coverage&gt;\n")
+            testlog.write("          %s\n" % coverage)
+            testlog.write("        &lt;/coverage&gt;\n")
+            testlog.write("      &lt;/all&gt;\n")
+            testlog.close()
+          </script>
+        </sequence>
+        <else>
+          <script>
+            testlog=open('%s/tests-log.xml' % TMPDIR,'a')
+            testlog.seek(0,2)
+            testlog.write("      &lt;all&gt;\n")
+            testlog.write("        &lt;coverage&gt;\n")
+            testlog.write("          N/A\n")
+            testlog.write("        &lt;/coverage&gt;\n")
+            testlog.write("      &lt;/all&gt;\n")
+            testlog.close()
+          </script>
+        </else>
+      </if>
 
+      <!-- here goes the section where we get the product's info -->
+      <call function="'GetVar'">
+        { 'location'  : STAF_REMOTE_HOSTNAME,
+          'type'      : 'shared',
+          'variable'  : 'Job%s_ServerInfo' % STAXJobID
+        }
+      </call>
+
+      <if expr="RC != 0">
+        <script>
+          STAFResult='{}'
+        </script>
+      </if>
+            
+      <!-- Build the Servers Information Dictionary -->
+      <script> 
+        ServersInfoDict=eval(STAFResult)
+
+        ServerVersion='unknown'
+        ServerBuildId='unknown'
+        ServerJavaVersion='unknown'
+        ServerJavaVendor='unknown'
+        ServerJVMVersion='unknown'
+        ServerJVMVendor='unknown'
+        ServerSystemOS='unknown'
+        ServerSystemName='unknown'
+        ServerSvnRevision='unknown'
+        
+        if ServersInfoDict.has_key('%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)):
+          ServerInfoDict=ServersInfoDict['%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)]
+          
+          ServerInfoKey='server version'
+          if ServerInfoDict.has_key(ServerInfoKey):
+            ServerVersion=ServerInfoDict[ServerInfoKey]
+          
+          ServerInfoKey='server buildid'
+          if ServerInfoDict.has_key(ServerInfoKey):
+            ServerBuildId=ServerInfoDict[ServerInfoKey]
+          
+          ServerInfoKey='java version'
+          if ServerInfoDict.has_key(ServerInfoKey):
+            ServerJavaVersion=ServerInfoDict[ServerInfoKey]
+          
+          ServerInfoKey='java vendor'
+          if ServerInfoDict.has_key(ServerInfoKey):
+            ServerJavaVendor=ServerInfoDict[ServerInfoKey]
+
+          ServerInfoKey='jvm version'
+          if ServerInfoDict.has_key(ServerInfoKey):
+            ServerJVMVersion=ServerInfoDict[ServerInfoKey]
+
+          ServerInfoKey='jvm vendor'
+          if ServerInfoDict.has_key(ServerInfoKey):
+            ServerJVMVendor=ServerInfoDict[ServerInfoKey]
+
+          ServerInfoKey='system os'
+          if ServerInfoDict.has_key(ServerInfoKey):
+            ServerSystemOS=ServerInfoDict[ServerInfoKey]
+
+          ServerInfoKey='system name'
+          if ServerInfoDict.has_key(ServerInfoKey):
+            ServerSystemName=ServerInfoDict[ServerInfoKey]
+
+          ServerInfoKey='svn revision'
+          if ServerInfoDict.has_key(ServerInfoKey):
+            ServerSvnRevision=ServerInfoDict[ServerInfoKey]
+          
+        else:
+          ServerInfoDict='No key found (%s/%s)' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)
+        
+        testlog=open('%s/tests-log.xml' % TMPDIR,'a')
+        testlog.seek(0,2)
+        testlog.write('    &lt;/results&gt;\n')
+        testlog.write('    &lt;identification&gt;\n')
+        testlog.write('      &lt;version&gt;\n')
+        testlog.write('        %s\n' % ServerVersion)
+        testlog.write('      &lt;/version&gt;\n')    
+        testlog.write('      &lt;buildid&gt;\n')
+        testlog.write('        %s\n' % ServerBuildId)
+        testlog.write('      &lt;/buildid&gt;\n')
+        testlog.write('      &lt;revision&gt;\n')
+        testlog.write('        %s\n' % ServerSvnRevision)
+        testlog.write('      &lt;/revision&gt;\n')                 
+        testlog.write('      &lt;platform&gt;\n')
+        testlog.write('        %s\n' % ServerSystemOS)
+        testlog.write('      &lt;/platform&gt;\n')
+        testlog.write('      &lt;jvm-version&gt;\n')
+        testlog.write('        %s\n' % ServerJVMVersion)
+        testlog.write('      &lt;/jvm-version&gt;\n')
+        testlog.write('      &lt;jvm-vendor&gt;\n')
+        testlog.write('        %s\n' % ServerJVMVendor)
+        testlog.write('      &lt;/jvm-vendor&gt;\n')        
+        testlog.write('    &lt;/identification&gt;\n')
+        testlog.write('  &lt;/functional-tests&gt;\n')
+        testlog.write('&lt;/qa&gt;\n')
+        testlog.close()
+      </script>
     </sequence>
   </function>
 </stax>
-
diff --git a/opends/tests/functional-tests/testcases/runTestJob.xml b/opends/tests/functional-tests/testcases/runTestJob.xml
index debc6bc..42dd6f5 100644
--- a/opends/tests/functional-tests/testcases/runTestJob.xml
+++ b/opends/tests/functional-tests/testcases/runTestJob.xml
@@ -27,13 +27,9 @@
  ! -->
 
 <stax>
-
   <defaultcall function="start_job"/>
-
   <function name="start_job">
-
     <sequence>
-
       <script>
         STAXLogMessage = 1
       </script>
@@ -45,23 +41,23 @@
           <log>'Started sub-job %s on %s' % (STAXSubJobID,STAF_REMOTE_HOSTNAME)</log>
         </job-action>
       </job>
-
+      
       <if expr="RC == 0">
         <message>
           'Sub-job %s completed. Result: %s' % (STAXSubJobID, STAXResult)
         </message>
-      <else>
-        <sequence>
-          <message log="1" level="'Error'">'Sub-job %s could not be started. RC: %s Result: %s' % (STAXSubJobID,RC,STAFResult)</message>
-          <return>1</return>
-        </sequence>
-      </else>
+        <else>
+          <sequence>
+            <message log="1" level="'Error'">'Sub-job %s could not be started. RC: %s Result: %s' % (STAXSubJobID,RC,STAFResult)</message>
+            <return>1</return>
+          </sequence>
+        </else>
       </if>
-
+      
       <!--- Import required shared xml libraries -->
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/stafcmd.xml' % (TESTS_FUNCTIONS_DIR)" />
-        
+      <import machine="STAF_LOCAL_HOSTNAME"
+              file="'%s/stafcmd.xml' % TESTS_FUNCTIONS_DIR" />
+      
       <!--
         dirty workaround because utils.xml now depends on environment.xml
         to avoid loading environment.xml I'll just set the required vars here
@@ -72,26 +68,27 @@
         NO_CHECK = 'noCheck'
       </script>
       <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/utils.xml' % (TESTS_FUNCTIONS_DIR)" />        
-        
+        file="'%s/utils.xml' % (TESTS_FUNCTIONS_DIR)" />
+      
       <!-- Get Directory Server Variables -->
       <call function="'GetVar'">
         { 'location'  : STAF_REMOTE_HOSTNAME,
           'type'      : 'shared',
-          'variable'  : 'Job%s_ServerInfo' % STAXSubJobID }
+          'variable'  : 'Job%s_ServerInfo' % STAXSubJobID
+        }
       </call>
-
+      
       <if expr="RC != 0">
         <script>
           STAFResult='{}'
         </script>
       </if>
-            
+      
       <!-- Build the Servers Information Dictionary -->
       <script> 
-                    
+        
         ServersInfoDict=eval(STAFResult)
-
+        
         ServerVersion='unknown'
         ServerBuildId='unknown'
         ServerJavaVersion='unknown'
@@ -101,49 +98,49 @@
         ServerSystemOS='unknown'
         ServerSystemName='unknown'
         ServerSvnRevision='unknown'
-                  
+        
         if ServersInfoDict.has_key('%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)):       
           ServerInfoDict=ServersInfoDict['%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)]
           
           ServerInfoKey='server version'
           if ServerInfoDict.has_key(ServerInfoKey):
-            ServerVersion=ServerInfoDict[ServerInfoKey]  
-    
-          ServerInfoKey='server buildid'        
+            ServerVersion=ServerInfoDict[ServerInfoKey]
+          
+          ServerInfoKey='server buildid'
           if ServerInfoDict.has_key(ServerInfoKey):
-            ServerBuildId=ServerInfoDict[ServerInfoKey]  
-
-          ServerInfoKey='java version'    
+            ServerBuildId=ServerInfoDict[ServerInfoKey]
+          
+          ServerInfoKey='java version'
           if ServerInfoDict.has_key(ServerInfoKey):
-            ServerJavaVersion=ServerInfoDict[ServerInfoKey]  
-
-          ServerInfoKey='java vendor'    
+            ServerJavaVersion=ServerInfoDict[ServerInfoKey]
+          
+          ServerInfoKey='java vendor'
           if ServerInfoDict.has_key(ServerInfoKey):
-            ServerJavaVendor=ServerInfoDict[ServerInfoKey]  
-
-          ServerInfoKey='jvm version'    
+            ServerJavaVendor=ServerInfoDict[ServerInfoKey]
+          
+          ServerInfoKey='jvm version'
           if ServerInfoDict.has_key(ServerInfoKey):
-            ServerJVMVersion=ServerInfoDict[ServerInfoKey]  
-
-          ServerInfoKey='jvm vendor'    
+            ServerJVMVersion=ServerInfoDict[ServerInfoKey]
+          
+          ServerInfoKey='jvm vendor'
           if ServerInfoDict.has_key(ServerInfoKey):
-            ServerJVMVendor=ServerInfoDict[ServerInfoKey]  
-
-          ServerInfoKey='system os'    
+            ServerJVMVendor=ServerInfoDict[ServerInfoKey]
+          
+          ServerInfoKey='system os'
           if ServerInfoDict.has_key(ServerInfoKey):
-            ServerSystemOS=ServerInfoDict[ServerInfoKey]  
-
-          ServerInfoKey='system name'    
+            ServerSystemOS=ServerInfoDict[ServerInfoKey]
+          
+          ServerInfoKey='system name'
           if ServerInfoDict.has_key(ServerInfoKey):
-            ServerSystemName=ServerInfoDict[ServerInfoKey]  
-
-          ServerInfoKey='svn revision'    
+            ServerSystemName=ServerInfoDict[ServerInfoKey]
+          
+          ServerInfoKey='svn revision'
           if ServerInfoDict.has_key(ServerInfoKey):
-            ServerSvnRevision=ServerInfoDict[ServerInfoKey]  
+            ServerSvnRevision=ServerInfoDict[ServerInfoKey]
                                                                                                 
         else:
           ServerInfoDict='No key found (%s/%s)' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)
-                    
+        
       </script>
       
       <message>'Server= %s' % ServerInfoDict </message>     
@@ -155,7 +152,7 @@
           'QUERY ALL MACHINE %s LOGNAME STAX_Job_%s' % (STAXServiceMachine,STAXSubJobID)
         </request>
       </stafcmd>
-
+      
       <if expr="RC == 0">
         <sequence>
           <script>
@@ -165,23 +162,24 @@
             'Log Query on STAX_Job_%s Completed. RC=%s' % (STAXSubJobID,RC)
           </message>
         </sequence>
-      <else>
-        <sequence>
-          <message log="1" level="'Error'">
-            'Unable to perform log query on STAX_Job_%s. RC: %s Result: %s' % (STAXSubJobID,RC,STAFResult)
-          </message>
-          <return>1</return>
-        </sequence>
-      </else>
+        <else>
+          <sequence>
+            <message log="1" level="'Error'">
+              'Unable to perform log query on STAX_Job_%s. RC: %s Result: %s' % (STAXSubJobID,RC,STAFResult)
+            </message>
+            <return>1</return>
+          </sequence>
+        </else>
       </if>
-
+      
       <!-- Get logsDir Variable -->
       <call function="'GetVar'">
         { 'location'  : STAF_REMOTE_HOSTNAME,
           'type'      : 'shared',
-          'variable'  : 'Job%s_LogsDir' % STAXSubJobID }
+          'variable'  : 'Job%s_LogsDir' % STAXSubJobID 
+        }
       </call>
-
+      
       <if expr="RC == 0">
         <script>
           logsDir=STAFResult
@@ -197,38 +195,38 @@
         </sequence>
       </else>
       </if>
-
+      
       <script>
         logsReportDir='%s/reports' % logsDir
       </script>
-
+      
       <call function="'createFolder'">
         { 'location'   : STAF_LOCAL_HOSTNAME, 
           'foldername' : logsReportDir }
       </call>
-                   
+     
       <!-- Write Text File for results -->
       <script>
           textfile= '%s/results.txt' % logsReportDir
           txtfh=open(textfile,'w')
       </script>
       
-      <iterate var="line" in="resultQuery"> 
-
-        <script> 
-          txtfh.write('%s\n' % line) 
+      <iterate var="line" in="resultQuery">
+        
+        <script>
+          txtfh.write('%s\n' % line)
         </script>
       
       </iterate> 
- 
+      
       <script> 
         txtfh.close() 
-      </script> 
-
+      </script>
+      
       <message>
         'TEXT Report Written to %s.' % textfile
       </message>
-
+      
       <!-- Write XML File for results -->
       <script>
         import re
@@ -237,74 +235,68 @@
         errorfile= '%s/results.errors' % logsReportDir
         errorfh=open(errorfile,'w')
       </script>
-
+      
       <!-- Build the test case dictionary object -->
       <script>
         testDict={}
         testCaseList=[]
       </script>
-
+      
       <iterate var="element" in="resultQuery">
         <script>
           level=element['level']
           message=element['message']
           timestamp=element['timestamp']
-
+          
           startValueDict={}
           stopValueDict={}
           statusValueDict={}
-
+          
           if level == 'Start':
-
             tcpattern=re.compile("(Testcase): (.*)")
             tcmatch = tcpattern.search(message)
-
             if tcmatch:
               tctype=tcmatch.group(1)
               tcname=tcmatch.group(2)
-
               if testDict.has_key(tcname):
-
                 for key in testDict[tcname].keys():
                   value=testDict[tcname][key]
                   startValueDict[key]=value
-
+              
               startValueDict['start']=timestamp
               testDict[tcname]=startValueDict
-
+              
               testCaseList.append(tcname)
-
+            
             else:
               errorfh.write('Warning: No match Start element %s.\n' % element)
-
+          
           elif level == 'Stop':
-
+            
             tcpattern=re.compile("(Testcase): (.*), ElapsedTime: (.*)")
             tcmatch = tcpattern.search(message)
-
+            
             if tcmatch:
               tctype=tcmatch.group(1)
               tcname=tcmatch.group(2)
               tctime=tcmatch.group(3)
-
               if testDict.has_key(tcname):
-
                 for key in testDict[tcname].keys():
                   value=testDict[tcname][key]
                   stopValueDict[key]=value
-
+              
               stopValueDict['stop']=timestamp
               stopValueDict['duration']=tctime
               testDict[tcname]=stopValueDict
-
+            
             else:
               errorfh.write('Warning: No match Stop element %s.\n' % element)
-
+          
           elif level == 'Status':
-
+            
             tcpattern=re.compile("(Testcase): (.*), Pass: (.*), Fail: (.*), ElapsedTime: (.*), NumStarts: (.*)")
             tcmatch = tcpattern.search(message)
-
+            
             if tcmatch:
               tctype=tcmatch.group(1)
               tcname=tcmatch.group(2)
@@ -312,26 +304,26 @@
               tcfail=tcmatch.group(4)
               tctime=tcmatch.group(5)
               tcnums=tcmatch.group(6)
-
+              
               if testDict.has_key(tcname):
-
+                
                 for key in testDict[tcname].keys():
                   value=testDict[tcname][key]
                   statusValueDict[key]=value
-
+              
               statusValueDict['pass']=tcpass
               statusValueDict['fail']=tcfail
               testDict[tcname]=statusValueDict
-
+            
             else:
               errorfh.write('Warning: No match Status element %s.\n' % element)
           
           elif level == 'Info':
             errorfh.write('Warning: Info element %s.\n' % element)
-              
+          
           else:
             errorfh.write('Error: Unknown element %s.\n' % element)
-
+          
         </script>
       </iterate>
 
@@ -365,7 +357,7 @@
       <!-- XML Report Results -->
       <script>
         for tcname in testCaseList:
-
+          
           if testDict.has_key(tcname):
             tcnamesplit=tcname.split(":")
             if tcnamesplit[0]:
@@ -382,60 +374,60 @@
               tcpass=testDict[tcname]['pass']
             else:
               tcpass='0'
-
+            
             if testDict[tcname].has_key('fail'):
               tcfail=testDict[tcname]['fail']
             else:
               tcfail='0'
-
+            
             if testDict[tcname].has_key('start'):
               tcstart=testDict[tcname]['start']
             else:
               tcstart='unknown'
-
+            
             if testDict[tcname].has_key('stop'):
               tcstop=testDict[tcname]['stop']
             else:
               tcstop='unknown'
-
+            
             if testDict[tcname].has_key('duration'):
               tcduration=testDict[tcname]['duration']
             else:
               duration='unknown'
-
+          
           else:
             errorfh.write('No key for testcase %s.\n' % tcname)
-
+          
           if int(tcfail) == 0 and int(tcpass) > 0:
             tcresult='pass'
           elif int(tcfail) == 0 and int(tcpass) == 0: 
             tcresult='unknown'
           else:
             tcresult='fail'
-
+          
           xmlfh.write('      &lt;testgroup name="%s"&gt;\n' % testgroup)
           xmlfh.write('        &lt;testsuite name="%s"&gt;\n' % testsuite)
           xmlfh.write('          &lt;testcase name="%s" result="%s" start="%s" stop="%s" duration="%s"/&gt;\n' % (tcname,tcresult,tcstart,tcstop,tcduration))
           xmlfh.write('        &lt;/testsuite&gt;\n')
           xmlfh.write('      &lt;/testgroup&gt;\n')
-      </script> 
- 
+      </script>
+      
       <!-- XML Report Post -->
       <script>
         xmlfh.write('    &lt;/results&gt;\n')
         xmlfh.write('  &lt;/functional-tests&gt;\n')
         xmlfh.write('&lt;/qa&gt;\n')
       </script>
-
-      <script> 
+      
+      <script>
         xmlfh.close() 
         errorfh.close() 
-      </script> 
-
+      </script>
+      
       <message>
         'XML Report Written to %s.' % xmlfile
       </message>
-
+      
       <!-- Transform Report XML into HTML -->
       <script>
         xslfile= '%s/xsl/gen-alltests-report.xsl' % TESTS_SHARED_DIR
@@ -450,35 +442,36 @@
         from java.io import FileInputStream
         from java.io import FileOutputStream
         from java.io import ByteArrayOutputStream
-      
+        
         from javax.xml.transform import TransformerFactory
         from javax.xml.transform.stream import StreamSource
         from javax.xml.transform.stream import StreamResult
-  
+        
         xslSource = StreamSource(FileInputStream("%s" % xslfile))
         xslTemplate = TransformerFactory.newInstance().newTemplates(xslSource)
         transformer = xslTemplate.newTransformer()
-  
+        
         source = StreamSource(FileInputStream("%s" % xmlfile))
         result = StreamResult(FileOutputStream("%s" % htmlfile))
+        # the original report
+        transformer.transform(source, result)
         
-        transformer.transform(source, result)      
+        #the new report transformation
+        TransformerFactory.newInstance().newTemplates(StreamSource(FileInputStream("%s/xsl/my-report.xsl" % TESTS_SHARED_DIR))).newTransformer().transform(StreamSource(FileInputStream("%s/tests-log.xml" % TMPDIR)), StreamResult(FileOutputStream("%s/my-report.html" % TMPDIR)))
       </script>
-
+      
       <if expr="SEND_MAIL_AFTER_TEST_RUN == 'TRUE'">
-
         <sequence>
-
           <message>
             'Sending Email Test Report to %s.' % SEND_MAIL_TO
           </message>
-
+          
           <script>
             MailToList= SEND_MAIL_TO.split(",")
             MailSubject= 'OpenDS Test Report for %s' % STAF_REMOTE_HOSTNAME
             MailSendTo= ' '
           </script>
-
+          
           <iterate var="Recipient" in="MailToList">
             <script>
              MailSendTo='to %s %s' % (Recipient,MailSendTo)
@@ -492,30 +485,26 @@
               'send %s contenttype "text/html" file %s subject "%s" noheader' % (MailSendTo,htmlfile,MailSubject)
             </request>
           </stafcmd>
-
+          
           <if expr="RC != 0">
             <message log="1" level="'Error'">
               'Send test report failed. RC: %s STAFResult: %s' % (RC,STAFResult)
             </message>
-          <else>
-            <message>
-              'Send test report successful. RC: %s' % (RC)
-            </message>
-          </else>
+            <else>
+              <message>
+                'Send test report successful. RC: %s' % (RC)
+              </message>
+            </else>
           </if>
-
         </sequence>
-
       </if>
-
+      
       <!-- fixMe: Copy the html results file to TMPDIR for Hudson -->
       <call function="'copyFile'">
         { 'srcfile'    : htmlfile,
-          'destfile'   : '%s/results.html' % (TMPDIR) }
+          'destfile'   : '%s/results.html' % TMPDIR
+        }
       </call>
-
     </sequence>
-
   </function>
-
 </stax>
diff --git a/opends/tests/functional-tests/testcases/sample/sample.xml b/opends/tests/functional-tests/testcases/sample/sample.xml
index aadeb89..eac9c17 100644
--- a/opends/tests/functional-tests/testcases/sample/sample.xml
+++ b/opends/tests/functional-tests/testcases/sample/sample.xml
@@ -30,7 +30,7 @@
   <function name="sample">
     <sequence>
       <script>
-        CurrentTestPath={ 'group' : 'sample', 'suite' : 'sample' }
+        CurrentTestPath['group']= 'sample'
         envAlreadyLoaded='true'
       </script>
       
@@ -48,12 +48,20 @@
         <!-- this is an example of how to loop through a list of functions to 
              run instead of duplicating calls 
          -->
-        <iterate in="['testGroup_Preamble','testSuite_Preamble','sample_setup','sample_test']" var="testStep">
-          <!-- the sequence tag is superfluous here since there is only a 
-               single instruction to execute within the iterate block 
-           -->
-          <call function="'%s' % testStep" />
-        </iterate>
+         <sequence>
+          <iterate in="['testGroup_Preamble','testSuite_Preamble','sample_setup']" var="setupStep">
+            <!-- the sequence tag is superfluous here since there is only a 
+                 single instruction to execute within the iterate block 
+             -->
+            <call function="'%s' % setupStep" />
+          </iterate>
+          <iterate in="['passing_test']" var="testStep">
+            <!-- the sequence tag is superfluous here since there is only a 
+                 single instruction to execute within the iterate block 
+             -->
+            <call function="'%s' % testStep" />
+          </iterate>
+        </sequence>
         <catch exception="'STAFException.Topology.CreationException'">
           <!-- it is a good idea to make sure that the messages getting
                sent to the gui also make their way in the logs for easier 
@@ -96,20 +104,87 @@
       #@TestPostamble             none
       #@TestResult                Success if OpenDS returns 0
     -->
-    <testcase name="'%s: %s: %s' % (CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentFunction)">
+    <block name="'sample_test'">
       <sequence>
-        <call function="'testCase_Preamble'" />
-        <call function="'SearchObject'">
-        { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
-          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
-          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN   ,
-          'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
-          'dsBaseDN'         : DIRECTORY_INSTANCE_SFX  ,
-          'dsFilter'         : 'objectclass=*'         }
-        </call>
-        <call function="'testCase_Postamble'" />
+        <script>
+          CurrentTestPath['suite']= 'search'
+        </script>
+        <testcase name="'%s: %s: %s' % (CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentBlock)">
+          <sequence>
+            <call function="'testCase_Preamble'" />
+            <call function="'SearchObject'">
+            { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+              'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+              'dsInstanceDn'     : DIRECTORY_INSTANCE_DN   ,
+              'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+              'dsBaseDN'         : DIRECTORY_INSTANCE_SFX  ,
+              'dsFilter'         : 'objectclass=*'         }
+            </call>
+            <call function="'testCase_Postamble'" />
+          </sequence>
+        </testcase>
       </sequence>
-    </testcase>
+    </block>
+  </function>
+  
+  <!-- the dummy failing test -->
+  <function name="failing_test">
+    <!---
+      Place test-specific test information here.
+      The tag, TestMarker, must be the same as the tag, TestSuiteName.
+      #@TestMarker                Sample
+      #@TestName                  failing_test
+      #@TestIssue                 xyz
+      #@TestPurpose               Illustrate how to issue a query on OpenDS
+      #@TestPreamble              none
+      #@TestStep                  Fetch all the entries in the server
+      #@TestPostamble             none
+      #@TestResult                Success if OpenDS returns 0
+    -->
+    <block name="'failing_test'">
+      <sequence>
+        <script>
+          CurrentTestPath['suite']= 'dummy'
+        </script>
+        <testcase name="'%s: %s: %s' % (CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentBlock)">
+          <sequence>
+            <call function="'testCase_Preamble'" />
+            <tcstatus result="'fail'" />
+            <call function="'testCase_Postamble'" />
+          </sequence>
+        </testcase>
+      </sequence>
+    </block>
+  </function>
+
+  <!-- the dummy passing test -->
+  <function name="passing_test">
+    <!---
+      Place test-specific test information here.
+      The tag, TestMarker, must be the same as the tag, TestSuiteName.
+      #@TestMarker                Sample
+      #@TestName                  passing_test
+      #@TestIssue                 xyz
+      #@TestPurpose               Illustrate how to issue a query on OpenDS
+      #@TestPreamble              none
+      #@TestStep                  Fetch all the entries in the server
+      #@TestPostamble             none
+      #@TestResult                Success if OpenDS returns 0
+    -->
+    <block name="'passing_test'">
+      <sequence>
+        <script>
+          CurrentTestPath['suite']= 'dummy'
+        </script>
+        <testcase name="'%s: %s: %s' % (CurrentTestPath['group'],CurrentTestPath['suite'],STAXCurrentBlock)">
+          <sequence>
+            <call function="'testCase_Preamble'" />
+            <tcstatus result="'pass'" />
+            <call function="'testCase_Postamble'" />
+          </sequence>
+        </testcase>
+      </sequence>
+    </block>
   </function>
   
   <!-- Setup the instance for sample test -->
diff --git a/opends/tests/functional-tests/testcases/security/client_auth/client_auth_setup.xml b/opends/tests/functional-tests/testcases/security/client_auth/client_auth_setup.xml
index 6483351..5eaf2d9 100755
--- a/opends/tests/functional-tests/testcases/security/client_auth/client_auth_setup.xml
+++ b/opends/tests/functional-tests/testcases/security/client_auth/client_auth_setup.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE stax SYSTEM "../../shared/stax.dtd">
+<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
 <!--
  ! CDDL HEADER START
  !
diff --git a/opends/tests/functional-tests/testcases/security/security.xml b/opends/tests/functional-tests/testcases/security/security.xml
index 9a579c9..1b5e4f4 100755
--- a/opends/tests/functional-tests/testcases/security/security.xml
+++ b/opends/tests/functional-tests/testcases/security/security.xml
@@ -26,79 +26,67 @@
  !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  ! -->
 <stax>
-
   <defaultcall function="main_security"/>
-
   <function name="main_security">
-
-    <sequence>
-
-      <block name="'security'">
-      
-        <sequence>
-  
-          <script>
-            CurrentTestPath['group']='security'
-          </script>
+    <block name="'security'">
+      <sequence>
+        <script>
+          CurrentTestPath['group']='security'
+        </script>
         
-          <call function="'testGroup_Preamble'"/>
-	 
-          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-            file="'%s/testcases/security/client_auth/client_auth.xml' % (TESTS_DIR)"/>
-          <call function="'client_auth'" />			
-				
-          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-            file="'%s/testcases/security/jks/security_jks.xml' % (TESTS_DIR)"/>
-          <call function="'security_jks'" />
-		 
-            <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-            file="'%s/testcases/security/pkcs12/security_pkcs12.xml' % (TESTS_DIR)"/>
-          <call function="'security_pkcs12'" />
-          
-          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-            file="'%s/testcases/security/startTLS/security_startTLS.xml' % (TESTS_DIR)"/>
-          <call function="'security_startTLS'" />
- 
-          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-            file="'%s/testcases/security/sasl/security_sasl.xml' % (TESTS_DIR)"/>
-          <call function="'security_sasl'" />
-  
-          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-            file="'%s/testcases/security/pwd_policy/security_pwd_policy.xml' % (TESTS_DIR)"/>
-          <call function="'security_pwd_policy'" />
-  
-          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-            file="'%s/testcases/security/pwd_policy_root/security_pwd_policy_root.xml' % (TESTS_DIR)"/>
-          <call function="'security_pwd_policy_root'" />
-  
-          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-            file="'%s/testcases/security/auth_pwd_syntax/security_auth_pwd_syntax.xml' % (TESTS_DIR)"/>
-          <call function="'security_auth_pwd_syntax'" />
-  
-          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-            file="'%s/testcases/security/pwd_validator/security_pwd_validator.xml' % (TESTS_DIR)"/>
-          <call function="'security_pwd_validator'" />
-  
-          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-            file="'%s/testcases/security/pwd_storage/security_pwd_storage.xml' % (TESTS_DIR)"/>
-          <call function="'security_pwd_storage'" />
-  
-          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-            file="'%s/testcases/security/bind_no_pwd/security_bind_no_pwd.xml' % (TESTS_DIR)"/>
-          <call function="'security_bind_no_pwd'" />
-  
-          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-            file="'%s/testcases/security/account_activation/security_account_activation.xml' % (TESTS_DIR)"/>
-          <call function="'security_account_activation'" />
-
-          <call function="'testGroup_Postamble'"/>
+        <call function="'testGroup_Preamble'"/>
         
-        </sequence>
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/client_auth/client_auth.xml' % (TESTS_DIR)"/>
+        <call function="'client_auth'" />
+        
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/jks/security_jks.xml' % (TESTS_DIR)"/>
+        <call function="'security_jks'" />
+        
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/pkcs12/security_pkcs12.xml' % (TESTS_DIR)"/>
+        <call function="'security_pkcs12'" />
+        
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/startTLS/security_startTLS.xml' % (TESTS_DIR)"/>
+        <call function="'security_startTLS'" />
+        
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/sasl/security_sasl.xml' % (TESTS_DIR)"/>
+        <call function="'security_sasl'" />
+        
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/pwd_policy/security_pwd_policy.xml' % (TESTS_DIR)"/>
+        <call function="'security_pwd_policy'" />
+        
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/pwd_policy_root/security_pwd_policy_root.xml' % (TESTS_DIR)"/>
+        <call function="'security_pwd_policy_root'" />
+        
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/auth_pwd_syntax/security_auth_pwd_syntax.xml' % (TESTS_DIR)"/>
+        <call function="'security_auth_pwd_syntax'" />
+        
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/pwd_validator/security_pwd_validator.xml' % (TESTS_DIR)"/>
+        <call function="'security_pwd_validator'" />
+        
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/pwd_storage/security_pwd_storage.xml' % (TESTS_DIR)"/>
+        <call function="'security_pwd_storage'" />
+        
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/bind_no_pwd/security_bind_no_pwd.xml' % (TESTS_DIR)"/>
+        <call function="'security_bind_no_pwd'" />
+        
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/account_activation/security_account_activation.xml' % (TESTS_DIR)"/>
+        <call function="'security_account_activation'" />
+        
+        <call function="'testGroup_Postamble'"/>
       
-      </block>
-      
-    </sequence>
-
+      </sequence>
+    </block>
   </function>
-
 </stax>

--
Gitblit v1.10.0