From eca873be9127fb6d7014bc5062fad74c2ff9ae11 Mon Sep 17 00:00:00 2001
From: Gary Williams <gary.williams@forgerock.com>
Date: Sun, 21 Oct 2012 16:07:47 +0000
Subject: [PATCH] Fix clu make-ldif, modifyldif, ldif-diffs tools functional tests

---
 opends/tests/staf-tests/shared/functions/topology.xml                                   |   18 +----
 opends/tests/staf-tests/functional-tests/testcases/clu/clu_make-ldif_checkbehavior.xml  |   36 ++++++------
 opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldif-diff_checkbehavior.xml  |   12 ++--
 opends/tests/staf-tests/shared/functions/environment.xml                                |    3 +
 opends/tests/staf-tests/shared/functions/tools.xml                                      |   49 +++++++++++++++
 opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldifmodify_checkbehavior.xml |   10 +-
 6 files changed, 83 insertions(+), 45 deletions(-)

diff --git a/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldif-diff_checkbehavior.xml b/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldif-diff_checkbehavior.xml
index d39b4d9..534e16b 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldif-diff_checkbehavior.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldif-diff_checkbehavior.xml
@@ -99,7 +99,7 @@
                   {
                   'sourceLdif' : sourceldif ,
                   'targetLdif' : sourceldif ,
-                  'outputLdif' : '%s/ldif-diff_nodiffs.out' % remote.temp
+                  'outputLdif' : '%s/clu/ldif-diff_nodiffs.out' % remote.temp
                   }
                 </call>
                 
@@ -136,7 +136,7 @@
                   {
                   'sourceLdif' : sourceldif ,
                   'targetLdif' : targetldif ,
-                  'outputLdif' : '%s/ldif-diff_withdiffs.out' % remote.temp ,
+                  'outputLdif' : '%s/clu/ldif-diff_withdiffs.out' % remote.temp ,
                   'expectedRC' : 1 ,
                   'knownIssue' : '2641'
                   }
@@ -174,7 +174,7 @@
                   {
                   'sourceLdif' : sourceldif ,
                   'targetLdif' : targetldif ,
-                  'outputLdif' : '%s/ldif-diff.out' % remote.temp ,
+                  'outputLdif' : '%s/clu/ldif-diff.out' % remote.temp ,
                   'expectedRC' : 'noCheck'
                   }
                 </call>
@@ -182,7 +182,7 @@
                 <call function="'compareFile'">
                   {
                   'outputFile' : 'ldif-diff.out' ,
-                  'outputPath' : remote.temp ,
+                  'outputPath' : '%s/clu' % remote.temp ,
                   'refFile'    : 'ldif-diff.ref',
                   'knownIssue' : '3111'
                   }
@@ -221,7 +221,7 @@
                   {
                   'sourceLdif'         : sourceldif ,
                   'targetLdif'         : targetldif ,
-                  'outputLdif'         : '%s/ldif-diff_singlevalue.out' \
+                  'outputLdif'         : '%s/clu/ldif-diff_singlevalue.out' \
                                          % remote.temp ,
                   'singleValueChanges' : 'True' ,           
                   'expectedRC'         : 'noCheck'
@@ -231,7 +231,7 @@
                 <call function="'compareFile'">
                   { 
                   'outputFile' : 'ldif-diff_singlevalue.out' ,
-                  'outputPath' : remote.temp ,
+                  'outputPath' : '%s/clu' % remote.temp ,
                   'refFile'    : 'ldif-diff_singlevalue.ref' ,
                   'knownIssue' : '3111'
                   }
diff --git a/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldifmodify_checkbehavior.xml b/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldifmodify_checkbehavior.xml
index 74ac5ea..3b8b3aa 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldifmodify_checkbehavior.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldifmodify_checkbehavior.xml
@@ -100,15 +100,15 @@
                   'sourceLdif'  : sourceldif ,
                   'changesLdif' : '%s/clu/ldifmodify_checkbehavior.ldif' \
                                   % remote.data ,
-                  'targetLdif'  : '%s/ldifmodify.out' % remote.temp
+                  'targetLdif'  : '%s/clu/ldifmodify.out' % remote.temp
                   }
                 </call>              
   
                 <call function="'LdifDiffWithScript'">
                   { 
-                  'sourceLdif' : '%s/ldifmodify.out' % remote.temp ,
+                  'sourceLdif' : '%s/clu/ldifmodify.out' % remote.temp ,
                   'targetLdif' : '%s/clu/ldifmodify.ref' % remote.data ,
-                  'outputLdif' : '%s/ldifmodify.diff' % remote.temp
+                  'outputLdif' : '%s/clu/ldifmodify.diff' % remote.temp
                   }
                 </call>
   
@@ -150,7 +150,7 @@
                   {
                   'sourceLdif'  : sourceldif ,
                   'changesLdif' : '%s/clu/ldifmodify_moddn.ldif' % remote.data ,
-                  'targetLdif'  : '%s/ldifmodify_moddn.out' % remote.temp ,
+                  'targetLdif'  : '%s/clu/ldifmodify_moddn.out' % remote.temp ,
                   'expectedRC'  : 1
                   }
                 </call>
@@ -205,7 +205,7 @@
                   'sourceLdif'  : sourceldif ,
                   'changesLdif' : '%s/clu/ldifmodify_concurrente.ldif' \
                                   % remote.data ,
-                  'targetLdif'  : '%s/ldifmodify_concurrente.out' % remote.temp ,
+                  'targetLdif'  : '%s/clu/ldifmodify_concurrente.out' % remote.temp ,
                   'expectedRC'  : 1
                   }
                 </call>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/clu/clu_make-ldif_checkbehavior.xml b/opends/tests/staf-tests/functional-tests/testcases/clu/clu_make-ldif_checkbehavior.xml
index a483821..5130d46 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/clu/clu_make-ldif_checkbehavior.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/clu/clu_make-ldif_checkbehavior.xml
@@ -96,7 +96,7 @@
                 <call function="'MakeLdifWithScript'">
                   {
                   'templateFile'   : template ,
-                  'ldifFile'       : '%s/make-ldif_seed0_1.ldif' % remote.temp ,
+                  'ldifFile'       : '%s/clu/make-ldif_seed0_1.ldif' % remote.temp ,
                   'randomSeed'     : 0
                   }
                 </call>
@@ -149,7 +149,7 @@
                 <call function="'MakeLdifWithScript'">
                   {
                   'templateFile'   : template ,
-                  'ldifFile'       : '%s/make-ldif_seed0_2.ldif' % remote.temp ,
+                  'ldifFile'       : '%s/clu/make-ldif_seed0_2.ldif' % remote.temp ,
                   'randomSeed'     : 0
                   }
                 </call>
@@ -164,7 +164,7 @@
                   'dsInstancePort'    : DIRECTORY_INSTANCE_PORT,
                   'dsInstanceDn'      : DIRECTORY_INSTANCE_DN,
                   'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD,
-                  'dsFilename'        : '%s/make-ldif_seed0_2.ldif' % remote.temp,
+                  'dsFilename'        : '%s/clu/make-ldif_seed0_2.ldif' % remote.temp,
                   'dsContinueOnError' : 'true',
                   'expectedRC'        : 0
                 }
@@ -239,7 +239,7 @@
                 <call function="'MakeLdifWithScript'">
                   {
                   'templateFile'   : template ,
-                  'ldifFile'       : '%s/make-ldif_noseed_1.ldif' % remote.temp
+                  'ldifFile'       : '%s/clu/make-ldif_noseed_1.ldif' % remote.temp
                   }
                 </call>
   
@@ -250,7 +250,7 @@
                 <call function="'MakeLdifWithScript'">
                   {
                   'templateFile'   : template ,
-                  'ldifFile'       : '%s/make-ldif_noseed_2.ldif' % remote.temp
+                  'ldifFile'       : '%s/clu/make-ldif_noseed_2.ldif' % remote.temp
                   }
                 </call>
   
@@ -261,7 +261,7 @@
                 <call function="'MakeLdifWithScript'">
                   {
                   'templateFile'   : template ,
-                  'ldifFile'       : '%s/make-ldif_seed5.ldif' % remote.temp ,
+                  'ldifFile'       : '%s/clu/make-ldif_seed5.ldif' % remote.temp ,
                   'randomSeed'     : 5
                   }
                 </call>              
@@ -272,9 +272,9 @@
                 
                 <call function="'LdifDiffWithScript'">
                   { 
-                  'sourceLdif' : '%s/make-ldif_seed0_1.ldif' % remote.temp ,
-                  'targetLdif' : '%s/make-ldif_seed0_2.ldif' % remote.temp ,
-                  'outputLdif' : '%s/make-ldif_seed0.diff' % remote.temp
+                  'sourceLdif' : '%s/clu/make-ldif_seed0_1.ldif' % remote.temp ,
+                  'targetLdif' : '%s/clu/make-ldif_seed0_2.ldif' % remote.temp ,
+                  'outputLdif' : '%s/clu/make-ldif_seed0.diff' % remote.temp
                   }
                 </call>              
   
@@ -285,9 +285,9 @@
                 
                 <call function="'LdifDiffWithScript'">
                   { 
-                  'sourceLdif' : '%s/make-ldif_seed0_1.ldif' % remote.temp ,
-                  'targetLdif' : '%s/make-ldif_noseed_1.ldif' % remote.temp ,
-                  'outputLdif' : '%s/make-ldif_noseed_1.diff' % remote.temp
+                  'sourceLdif' : '%s/clu/make-ldif_seed0_1.ldif' % remote.temp ,
+                  'targetLdif' : '%s/clu/make-ldif_noseed_1.ldif' % remote.temp ,
+                  'outputLdif' : '%s/clu/make-ldif_noseed_1.diff' % remote.temp
                   }
                 </call>           
                 
@@ -297,9 +297,9 @@
                 
                 <call function="'LdifDiffWithScript'">
                   { 
-                  'sourceLdif' : '%s/make-ldif_noseed_1.ldif' % remote.temp ,
-                  'targetLdif' : '%s/make-ldif_noseed_2.ldif' % remote.temp ,
-                  'outputLdif' : '%s/make-ldif_noseed_2.diff' % remote.temp
+                  'sourceLdif' : '%s/clu/make-ldif_noseed_1.ldif' % remote.temp ,
+                  'targetLdif' : '%s/clu/make-ldif_noseed_2.ldif' % remote.temp ,
+                  'outputLdif' : '%s/clu/make-ldif_noseed_2.diff' % remote.temp
                   }
                 </call>
                 
@@ -310,9 +310,9 @@
                 
                 <call function="'LdifDiffWithScript'">
                   { 
-                  'sourceLdif' : '%s/make-ldif_seed0_1.ldif' % remote.temp ,
-                  'targetLdif' : '%s/make-ldif_seed5.ldif' % remote.temp ,
-                  'outputLdif' : '%s/make-ldif_seed5.diff' % remote.temp
+                  'sourceLdif' : '%s/clu/make-ldif_seed0_1.ldif' % remote.temp ,
+                  'targetLdif' : '%s/clu/make-ldif_seed5.ldif' % remote.temp ,
+                  'outputLdif' : '%s/clu/make-ldif_seed5.diff' % remote.temp
                   }
                 </call>
   
diff --git a/opends/tests/staf-tests/shared/functions/environment.xml b/opends/tests/staf-tests/shared/functions/environment.xml
index 84b10e7..dea95c1 100755
--- a/opends/tests/staf-tests/shared/functions/environment.xml
+++ b/opends/tests/staf-tests/shared/functions/environment.xml
@@ -178,6 +178,7 @@
         MultimasterSync = 'Multimaster Synchronization'
         MultimasterType = 'multimaster'
 
+        # TODO: this test flow for replication tests needs moving out to configuration
         # Replication execution mode variables: if not defined, set "random"
         # values:
         #   (day of the month % 4) == 0 --> (split servers, eclmode n/a)
@@ -395,6 +396,8 @@
       <message>'source.data      = %s' % source.data</message>
       <message>'local.data       = %s' % local.data</message>
       <message>'remote.data      = %s' % remote.data</message>
+      <message>'local.temp       = %s' % local.temp</message>
+      <message>'remote.temp      = %s' % remote.temp</message>
                         
       <return>
         local.directory
diff --git a/opends/tests/staf-tests/shared/functions/tools.xml b/opends/tests/staf-tests/shared/functions/tools.xml
index 353dccc..c41256a 100755
--- a/opends/tests/staf-tests/shared/functions/tools.xml
+++ b/opends/tests/staf-tests/shared/functions/tools.xml
@@ -103,6 +103,7 @@
     <sequence>
       <!-- Build the Command -->
       <script>
+        foldersToCreate = []
         STAFCmdParamsList=[]
         STAFCmdParams=''
         
@@ -117,6 +118,7 @@
           STAFCmdParamsList.append('-t %s' % templateFile)
         
         if ldifFile:
+          foldersToCreate.append(os.path.dirname(ldifFile))
           STAFCmdParamsList.append('-o %s' % ldifFile)
         
         if randomSeed:
@@ -127,6 +129,17 @@
         
         STAFCmdParams=' '.join(STAFCmdParamsList)
       </script>
+
+      <call function="'createMultiFolders'">
+        { 'location'    : location,
+          'folderslist' : foldersToCreate
+        }
+      </call>
+
+      <message>
+        '%s %s' % (STAFCmd, STAFCmdParams)
+      </message>
+
       <call function="'runCommand'">
         { 'name'      : 'Make Ldif Script',
           'location'  : location,
@@ -381,6 +394,7 @@
     <sequence>
       <!-- Build the Command -->
       <script>
+        foldersToCreate = []
         STAFCmdParamsList=[]
         STAFCmdParams=''
         
@@ -398,6 +412,7 @@
           STAFCmdParamsList.append('-t %s' % targetLdif)
         
         if outputLdif:
+          foldersToCreate.append(os.path.dirname(outputLdif))
           STAFCmdParamsList.append('-o %s' % outputLdif)
         
         if ignoreAttrsFile:
@@ -415,9 +430,14 @@
         STAFCmdParams=' '.join(STAFCmdParamsList)
       </script>
       
+      <call function="'createMultiFolders'">
+        { 'location'    : location,
+          'folderslist' : foldersToCreate
+        }
+      </call>
+
       <message>
-        'Running command:\n %s %s\nlocation: %s\nworkdir: %s' \
-        % (STAFCmd,STAFCmdParams,location,dsBinPath)
+        '%s %s' % (STAFCmd, STAFCmdParams)
       </message>
     
       <process name="'LDIF Diff Script'">
@@ -590,6 +610,7 @@
     <sequence>
       <!-- Build the Command -->
       <script>
+        foldersToCreate = []
         STAFCmdParamsList=[]
         STAFCmdParams=''
         
@@ -604,6 +625,7 @@
           STAFCmdParamsList.append('-s %s' % sourceLdif)
         
         if targetLdif:
+          foldersToCreate.append(os.path.dirname(targetLdif))
           STAFCmdParamsList.append('-t %s' % targetLdif)
         
         if changesLdif:
@@ -614,6 +636,17 @@
         
         STAFCmdParams=' '.join(STAFCmdParamsList)
       </script>
+
+      <call function="'createMultiFolders'">
+        { 'location'    : location,
+          'folderslist' : foldersToCreate
+        }
+      </call>
+
+      <message>
+        '%s %s' % (STAFCmd, STAFCmdParams)
+      </message>
+
       <call function="'runCommand'">
         { 'name'      : 'LDIF Modify Script',
           'location'  : location,
@@ -1727,6 +1760,7 @@
     <sequence>
       <!-- Build the Command -->
       <script>
+        foldersToCreate = []
         STAFCmdParamsList=[]
         STAFCmdParams=''
         
@@ -1744,6 +1778,7 @@
           STAFCmdParamsList.append('-t %s' % targetLdif)
         
         if outputLdif:
+          foldersToCreate.append(os.path.dirname(outputLdif))
           STAFCmdParamsList.append('-o %s' % outputLdif)
         
         if overwriteExisting:
@@ -1757,6 +1792,16 @@
         
         STAFCmdParams=' '.join(STAFCmdParamsList)
       </script>
+
+      <call function="'createMultiFolders'">
+        { 'location'    : location,
+          'folderslist' : foldersToCreate
+        }
+      </call>
+
+      <message>
+        '%s %s' % (STAFCmd, STAFCmdParams)
+      </message>
       
       <call function="'runCommand'">
         { 
diff --git a/opends/tests/staf-tests/shared/functions/topology.xml b/opends/tests/staf-tests/shared/functions/topology.xml
index 53b4b23..a7981a4 100755
--- a/opends/tests/staf-tests/shared/functions/topology.xml
+++ b/opends/tests/staf-tests/shared/functions/topology.xml
@@ -372,25 +372,15 @@
         }
       </call>
 
-      <!--- Delete temporary folder on remote host -->
+      <!--- Create folder on remote host -->
       <message>
-        'Delete temporary folder %s/temp on remote host' % dsDir
+        'Create new instance temp folder %s/temp on remote host %s' % (dsDir,dsHost)
       </message>
-      <call function="'deleteFolder'">
-        { 'location'   : dsHost,
+      <call function="'createFolder'">
+        { 'location'   : dsHost, 
           'foldername' : '%s/temp' % dsDir
         }
       </call>
-      
-      <!--- Delete staging data folder on remote host -->
-      <message>
-        'Delete staging data folder %s/testdata on remote host' % dsDir
-      </message>
-      <call function="'deleteFolder'">
-        { 'location'   : dsHost,
-          'foldername' : '%s/testdata' % dsDir
-        }
-      </call>
             
       <!---   Copy staging data to remote host -->
       <message>

--
Gitblit v1.10.0