From 3feaf770174b8b55d581a8e7c50f159ff57e5dbd Mon Sep 17 00:00:00 2001
From: smaguin <smaguin@localhost>
Date: Thu, 02 Aug 2007 14:43:10 +0000
Subject: [PATCH] add a robust wrapper on dsconfig
---
opendj-sdk/opends/tests/functional-tests/shared/functions/dsconfig.xml | 148 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 148 insertions(+), 0 deletions(-)
diff --git a/opendj-sdk/opends/tests/functional-tests/shared/functions/dsconfig.xml b/opendj-sdk/opends/tests/functional-tests/shared/functions/dsconfig.xml
index 7c34286..101c617 100755
--- a/opendj-sdk/opends/tests/functional-tests/shared/functions/dsconfig.xml
+++ b/opendj-sdk/opends/tests/functional-tests/shared/functions/dsconfig.xml
@@ -207,6 +207,154 @@
</function>
+ <!-- generic wrapper on dsconfig -->
+ <!-- can be used to list, get or set a list of attribues -->
+
+ <function name="dsconfig">
+ <function-prolog>
+ This function lists, get or set a list of attributes using dsconfig
+ </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-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="subcommand" type="required">
+ <function-arg-description>
+ dsconfig subcommand to execute
+ </function-arg-description>
+ <function-arg-property name="type" value="string"/>
+ </function-arg-def>
+
+ <function-arg-def name="propertyName" type="optional">
+ <function-arg-description>
+ Property type to modify, e.g. backend-name
+ </function-arg-description>
+ <function-arg-property name="type" value="string"/>
+ </function-arg-def>
+
+ <function-arg-def name="propertyValue" type="optional">
+ <function-arg-description>
+ Property to modify, e.g. enabled
+ </function-arg-description>
+ <function-arg-property name="type" value="string"/>
+ </function-arg-def>
+
+ <function-arg-def name="optionsString" type="optional">
+ <function-arg-description>
+ String containing the dsconfig options. e.g. --set enabled:true --set key-store-pin:servercert
+ </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 return code value. Default value is 0
+ </function-arg-description>
+ <function-arg-property name="type" value="string"/>
+ </function-arg-def>
+
+ </function-map-args>
+ <sequence>
+
+ <!-- Local variables -->
+ <script>
+ mylocation=location
+ STAFCmdParams=''
+ STAFCmd=''
+
+ if dsPath:
+ dsBinPath='%s/%s' % (dsPath,fileFolder)
+ STAFCmd='%s/%s%s' % (dsBinPath,DSCONFIG,fileExt)
+
+ STAFCmdParamsList=[]
+ STAFCmdParamsList.append('%s' % (subcommand))
+ if propertyName:
+ STAFCmdParamsList.append('--%s "%s" ' % (propertyName,propertyValue))
+ if optionsString:
+ STAFCmdParamsList.append(' %s' % (optionsString))
+ </script>
+
+ <call function="'_dsconfigCommonArgs'"/>
+
+ <script>
+ STAFCmdParams=' '.join(STAFCmdParamsList)
+ </script>
+
+ <message>
+ '%s %s' % (STAFCmd, STAFCmdParams)
+ </message>
+
+ <process name="'execute dsconfig subcommand'">
+ <location>'%s' % location</location>
+ <command>'%s' % STAFCmd</command>
+ <parms>'%s' % STAFCmdParams</parms>
+ <workdir>'%s' % dsBinPath</workdir>
+ <envs>
+ ['PATH=/bin:/usr/bin:%s' % dsBinPath]
+ </envs>
+ <console use="'same'"/>
+ <stderr mode="'stdout'"/>
+ <returnstdout/>
+ </process>
+
+ <script>
+ STAXCode=RC
+ STAXReason=STAXResult
+ </script>
+
+ <call function="'checktestRC'">
+ { 'returncode' : STAXCode ,
+ 'result' : STAXReason,
+ 'expected' : expectedRC }
+ </call>
+
+ <return>
+ STAXReason
+ </return>
+
+ </sequence>
+
+ </function>
+
<!-- Modify password policy using dsconfig -->
<function name="modifyPwdPolicy">
<function-prolog>
--
Gitblit v1.10.0