From 33374178f0c27aca1316d311d93301fa16a45fb2 Mon Sep 17 00:00:00 2001
From: Gary Williams <gary.williams@forgerock.com>
Date: Wed, 24 Oct 2012 13:59:43 +0000
Subject: [PATCH] Fix scoping issue introduced in previous commit for file copy in functional tests

---
 opends/tests/staf-tests/shared/functions/stafcmd.xml |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/opends/tests/staf-tests/shared/functions/stafcmd.xml b/opends/tests/staf-tests/shared/functions/stafcmd.xml
index 9329102..ccaaac9 100755
--- a/opends/tests/staf-tests/shared/functions/stafcmd.xml
+++ b/opends/tests/staf-tests/shared/functions/stafcmd.xml
@@ -27,7 +27,7 @@
  !      Portions Copyright 2011-2012 ForgeRock AS.
  ! -->
 <stax>
-  <function name="copyFile">
+  <function name="copyFile" scope="local">
     <function-prolog>
       This function copies a source file to destination file to host
     </function-prolog>
@@ -46,21 +46,24 @@
       </function-arg-def>
       <function-arg-def name="srcfile" type="required">
         <function-arg-description>
-          The name of the source fule
+          The name of the source file
         </function-arg-description>
         <function-arg-property name="type" value="filename"/>
       </function-arg-def>
       <function-arg-def name="destfile" type="required">
         <function-arg-description>
-          The name of the destination fule
+          The name of the destination file
         </function-arg-description>
         <function-arg-property name="type" value="filename"/>
       </function-arg-def>
     </function-map-args>
     <sequence>
+      <script>
+        myLocation=location
+      </script>
       <message>
         'Copy file %s:%s to %s:%s.' \
-        % (location,srcfile,remotehost,destfile)
+          % (myLocation,srcfile,remotehost,destfile)
       </message>
 
       <script>
@@ -68,19 +71,21 @@
       </script>
 
       <message>
-        'Checking for folder %s.' % destfolder
+        'Checking for parent folder %s on host %s.' % (destfolder,remotehost)
       </message>
 
       <call function="'createFolder'">
         { 'location'   : remotehost,
           'foldername' : '%s' % destfolder
         }
-      </call>      
+      </call>
 
       <stafcmd name="'STAF Command: Copy File'">
-        <location>'%s' % location</location>
+        <location>'%s' % myLocation</location>
         <service>'fs'</service>
-        <request>'COPY FILE %s TOFILE %s TOMACHINE %s' % (srcfile,destfile,remotehost) </request>
+        <request>
+          'COPY FILE %s TOFILE %s TOMACHINE %s' % (srcfile,destfile,remotehost)
+        </request>
       </stafcmd>
       <script>
         cmdRC=RC
@@ -428,14 +433,14 @@
       <if expr="RC == 48">
         <sequence>
           <message log="1">
-            'Folder does not exist, do not delete it.'
+            'Folder %s does not exist, do not delete it.' % foldername
           </message>
           <return>0</return>
         </sequence>
         <else>
           <sequence>
             <message log="1">
-              'Folder exists, will delete it'
+              'Folder %s exists, will delete it and all contents.' % foldername
             </message>
           </sequence>
         </else>
@@ -488,7 +493,7 @@
     <sequence>
 
       <message>
-        'Creating folder %s. on %s' % (foldername,location)
+        'Creating folder %s on %s' % (foldername,location)
       </message>
 
       <stafcmd name="'STAF Command: Create Folder'">

--
Gitblit v1.10.0