From 110dba555c0c81e7f9754c84445051ea7125c67b Mon Sep 17 00:00:00 2001
From: Gary Williams <gary.williams@forgerock.com>
Date: Sun, 15 Jul 2012 11:57:36 +0000
Subject: [PATCH] Functional tests folders should be created on remote hosts
---
opendj-sdk/opends/tests/staf-tests/shared/functions/dsadm.xml | 53 +++++++++++++++++++-------
opendj-sdk/opends/tests/staf-tests/shared/functions/utils.xml | 12 ++++-
2 files changed, 47 insertions(+), 18 deletions(-)
diff --git a/opendj-sdk/opends/tests/staf-tests/shared/functions/dsadm.xml b/opendj-sdk/opends/tests/staf-tests/shared/functions/dsadm.xml
index e20df96..912ccef 100755
--- a/opendj-sdk/opends/tests/staf-tests/shared/functions/dsadm.xml
+++ b/opendj-sdk/opends/tests/staf-tests/shared/functions/dsadm.xml
@@ -720,7 +720,7 @@
</function>
<!-- Import-ldif Function -->
- <function name="ImportLdifWithScript">
+ <function name="ImportLdifWithScript" scope="local">
<function-prolog>
This function performs an import of an ldif file
</function-prolog>
@@ -952,6 +952,8 @@
<call function="'_adminCommonArgs'" />
<script>
+ foldersToCreate = []
+
if dsPath:
dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%s/import-ldif%s' % (dsBinPath,fileExt)
@@ -975,15 +977,11 @@
STAFCmdParamsList.append('-S')
if skipFile:
- if not os.path.exists(os.path.dirname(skipFile)):
- os.makedirs(os.path.dirname(skipFile))
-
+ foldersToCreate.append(os.path.dirname(skipFile))
STAFCmdParamsList.append('--skipFile %s' % skipFile)
if rejectFile:
- if not os.path.exists(os.path.dirname(rejectFile)):
- os.makedirs(os.path.dirname(rejectFile))
-
+ foldersToCreate.append(os.path.dirname(rejectFile))
STAFCmdParamsList.append('-R %s' % rejectFile)
if overwriteFile:
@@ -1038,9 +1036,16 @@
</script>
+ <call function="'createMultiFolders'">
+ { 'location' : location,
+ 'folderslist' : foldersToCreate
+ }
+ </call>
+
<message>
'%s %s' % (STAFCmd, STAFCmdParams)
</message>
+
<message>
'Start import-ldif'
</message>
@@ -1346,7 +1351,7 @@
</function>
<!-- Export-ldif Function -->
- <function name="exportLdifWithScript">
+ <function name="exportLdifWithScript" scope="local">
<function-prolog>
This function performs an on line export task of an ldif file
</function-prolog>
@@ -1519,6 +1524,8 @@
<call function="'_adminCommonArgs'" />
<script>
+ foldersToCreate = []
+
if dsPath:
dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%s/export-ldif%s' % (dsBinPath,fileExt)
@@ -1527,9 +1534,7 @@
STAFCmdParamsList.append('-p %s' % dsInstancePort)
if ldifFile:
- if not os.path.exists(os.path.dirname(ldifFile)):
- os.makedirs(os.path.dirname(ldifFile))
-
+ foldersToCreate.append(os.path.dirname(ldifFile))
STAFCmdParamsList.append('-l %s' % ldifFile)
if startTask:
@@ -1584,9 +1589,16 @@
</script>
+ <call function="'createMultiFolders'">
+ { 'location' : location,
+ 'folderslist' : foldersToCreate
+ }
+ </call>
+
<message>
'%s %s' % (STAFCmd, STAFCmdParams)
</message>
+
<message>
'Start export-ldif'
</message>
@@ -1633,7 +1645,7 @@
</function>
<!-- Backup Function -->
- <function name="backup">
+ <function name="backup" scope="local">
<function-prolog>
This function performs an off line backup
</function-prolog>
@@ -1741,14 +1753,14 @@
<call function="'_adminCommonArgs'" />
<script>
+ foldersToCreate = []
+
if dsPath:
dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%s/backup%s' % (dsBinPath,fileExt)
if backupDir:
- if not os.path.exists(os.path.dirname(backupDir)):
- os.makedirs(os.path.dirname(backupDir))
-
+ foldersToCreate.append(os.path.dirname(backupDir))
STAFCmdParamsList.append('-d %s' % backupDir)
if backEnd:
@@ -1769,10 +1781,21 @@
STAFCmdParams=' '.join(STAFCmdParamsList)
</script>
+
+ <call function="'createMultiFolders'">
+ { 'location' : location,
+ 'folderslist' : foldersToCreate
+ }
+ </call>
+
<message>
'%s %s' % (STAFCmd, STAFCmdParams)
</message>
+ <message>
+ 'Start backup'
+ </message>
+
<call function="'runCommand'">
{ 'location' : location,
'name' : 'Backup Script',
diff --git a/opendj-sdk/opends/tests/staf-tests/shared/functions/utils.xml b/opendj-sdk/opends/tests/staf-tests/shared/functions/utils.xml
index e65dadb..72686fc 100755
--- a/opendj-sdk/opends/tests/staf-tests/shared/functions/utils.xml
+++ b/opendj-sdk/opends/tests/staf-tests/shared/functions/utils.xml
@@ -4119,6 +4119,8 @@
<!-- Build the command -->
<script>
+ foldersToCreate = []
+
STAFCmdParamsList=[]
STAFCmdParams=''
@@ -4144,9 +4146,7 @@
STAFCmdParamsList.append('-l')
if outputFile:
- if not os.path.exists(os.path.dirname(outputFile)):
- os.makedirs(os.path.dirname(outputFile))
-
+ foldersToCreate.append(os.path.dirname(outputFile))
STAFCmdParamsList.append('-f %s' % outputFile)
if nbrOfThread:
@@ -4173,6 +4173,12 @@
</script>
+ <call function="'createMultiFolders'">
+ { 'location' : location,
+ 'folderslist' : foldersToCreate
+ }
+ </call>
+
<message>
'%s %s' % (STAFCmd, STAFCmdParams)
</message>
--
Gitblit v1.10.0