From a35b2ccd6bcbbbd431d02a89f2bf247df1660159 Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Tue, 20 May 2008 09:51:57 +0000
Subject: [PATCH] Add 'create_property_table' function

---
 opends/tests/shared/functions/dsconfig.xml |  125 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 124 insertions(+), 1 deletions(-)

diff --git a/opends/tests/shared/functions/dsconfig.xml b/opends/tests/shared/functions/dsconfig.xml
index 94eb618..48a3dcf 100755
--- a/opends/tests/shared/functions/dsconfig.xml
+++ b/opends/tests/shared/functions/dsconfig.xml
@@ -2140,5 +2140,128 @@
         STAXResult
       </return>
     </sequence>
-  </function>  
+  </function>
+
+  <function name="GetDSConfigProperties">
+    <function-prolog>
+      This function get the value of the given server's attributes
+      It will call dsconfig, then extract the attributes value.
+    </function-prolog>
+    <function-map-args>
+      <function-arg-def name="location"
+                        type="optional"
+                        default="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="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
+          e.g. get-backend-prop
+        </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. --backend-name userRoot --property base-dn
+        </function-arg-description>
+        <function-arg-property name="type" value="string" />
+      </function-arg-def>
+      
+      <function-arg-def name="myVariableName" type="required">
+        <function-arg-description>
+          Variable containing the dsconfig properties
+        </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.
+          Wildcard 'noCheck' to not check the RC
+        </function-arg-description>
+        <function-arg-property name="type" value="string" />
+      </function-arg-def>      
+    </function-map-args>
+    <sequence>
+
+      <script>
+        if optionsString:
+          optionsString = '%s --script-friendly' % optionsString
+        else:
+          optionsString = '--script-friendly'
+      </script>
+      
+      <!-- Call dsconfig -->
+      <call function="'dsconfig'">
+        {
+        'location'       : location ,
+        'dsPath'         : dsPath ,
+        'dsInstanceHost' : dsInstanceHost ,
+        'dsInstancePort' : dsInstancePort ,
+        'dsInstanceDn'   : dsInstanceDn ,
+        'dsInstancePswd' : dsInstancePswd ,
+        'subcommand'     : subcommand ,
+        'optionsString'  : optionsString ,
+        'expectedRC'     : expectedRC
+        }
+      </call>
+  
+      <if expr='RC == 0'>
+        <script>
+          vars()[myVariableName] = create_property_table(STAXResult[0][1], '\t')
+        </script>
+      </if>
+
+      <return>
+        STAXResult
+      </return>
+      
+    </sequence>
+  </function>
+
 </stax>

--
Gitblit v1.10.0