From f0783b7179474a080e15bdbc3ddbf63ae36ffa90 Mon Sep 17 00:00:00 2001
From: Gary Williams <gary.williams@forgerock.com>
Date: Sun, 15 Jul 2012 11:11:56 +0000
Subject: [PATCH] Functional tests function to create remotely multiple folders from list

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

diff --git a/opends/tests/staf-tests/shared/functions/stafcmd.xml b/opends/tests/staf-tests/shared/functions/stafcmd.xml
index 1ff6df1..03efe61 100755
--- a/opends/tests/staf-tests/shared/functions/stafcmd.xml
+++ b/opends/tests/staf-tests/shared/functions/stafcmd.xml
@@ -507,6 +507,63 @@
 
   </function>  
 
+    <function name="createMultiFolders" scope="local">
+
+    <function-prolog>
+        This function creates multiple folders
+    </function-prolog>
+
+    <function-map-args>
+      <function-arg-def name="location" type="optional" default="STAXServiceMachine">
+        <function-arg-description>
+          Location of target host
+        </function-arg-description>
+        <function-arg-property name="type" value="hostname"/>
+      </function-arg-def>
+      <function-arg-def name="folderslist" type="required">
+        <function-arg-description>
+          Name of folder to be created
+        </function-arg-description>
+        <function-arg-property name="type" value="filepath"/>
+      </function-arg-def>      
+    </function-map-args>
+
+    <sequence>
+
+      <iterate var="folderToCreate" in="folderslist">
+      
+        <sequence>
+          <message>'Check if folder exists already.'</message>
+
+          <call function="'GetEntry'">
+            {
+            'location'  : location,
+            'entry'     : folderToCreate,
+            'attribute' : 'TYPE'
+            }
+          </call>
+
+          <if expr="RC == 48">
+            <sequence>
+     
+              <message>
+                'Folder %s does not exists, create folder' % folderToCreate
+              </message>
+    
+              <call function="'createFolder'">
+                { 'location'   : location,
+                  'foldername' : folderToCreate
+                }
+              </call>
+            </sequence>
+          </if>
+        </sequence>
+      </iterate>
+      
+    </sequence>
+
+  </function>
+
   <function name="queryLogs">
 
     <function-prolog>

--
Gitblit v1.10.0