mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

ugaston
04.42.2007 895140b9e4f027e73ef892fba5cafb72cf47f68b
Set of changes introducing the Synchronization Test Group + Basic Test
6 files added
14 files modified
5591 ■■■■ changed files
opendj-sdk/opends/tests/functional-tests/config/synchronization/basic_topology.txt 23 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/functions/dsadm.xml 2427 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/functions/ldap.xml 788 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/functions/security.xml 612 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/functions/stafcmd.xml 2 ●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/functions/topology.xml 564 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/functions/utils.xml 328 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/backends/backends.xml 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/backends/import-tasks.xml 40 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/backends/import.xml 17 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/backends/restore.xml 72 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/core/core_search_sizelimit.xml 25 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/core/core_search_timelimit.xml 21 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/runFuncTests.xml 19 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/runTestJob.xml 2 ●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/setup/setup.xml 2 ●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic.xml 201 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic_bob.xml 222 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic_setup.xml 159 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/synchronization/synchronization.xml 63 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/config/synchronization/basic_topology.txt
New file
@@ -0,0 +1,23 @@
Hostname: localhost
Directory: /tmp/opends-synchro-tests/server1
Port: 11389
Sslport: 11636
RootDn: cn=directory manager
RootPwd: secret12
BaseDn: o=example
Changelogport: 11111
SynchronizedSuffix: o=example
ChangelogServer: localhost:11111
ChangelogServer: localhost:22222
Hostname: localhost
Directory: /tmp/opends-synchro-tests/server2
Port: 22389
Sslport: 22636
RootDn: cn=directory manager
RootPwd: secret12
BaseDn: o=example
Changelogport: 22222
SynchronizedSuffix: o=example
ChangelogServer: localhost:11111
ChangelogServer: localhost:22222
opendj-sdk/opends/tests/functional-tests/shared/functions/dsadm.xml
@@ -31,56 +31,55 @@
  <function name="ConfigureDsWithScript">
    <function-prolog>
      This function configures a Directory Server using a script
    </function-prolog>
    </function-prolog>
    <function-map-args>
      <function-arg-def name="location" type="optional" default="'%s' % STAXServiceMachine">
        <function-arg-description>
          Location of target host
        </function-arg-description>
        <function-arg-property name="type" value="filepath"/>
        <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="hostname"/>
        <function-arg-property name="type" value="filepath"/>
      </function-arg-def>
      <function-arg-def name="dsPort" type="optional" default="''">
      <function-arg-def name="dsPort" type="optional">
        <function-arg-description>
          Directory server port number
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
        <function-arg-property name="type" value="Port number"/>
      </function-arg-def>
      <function-arg-def name="dsBaseDN" type="optional" default="''">
      <function-arg-def name="dsBaseDN" type="optional">
        <function-arg-description>
          Base DN (only single base DN supported).
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsBindDN" type="optional" default="''">
      <function-arg-def name="dsBindDN" type="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def> 
      <function-arg-def name="dsBindPwd" type="optional" default="''">
      <function-arg-def name="dsBindPwd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>          
      <function-arg-def name="dsBindPwdFile" type="optional" default="''">
      <function-arg-def name="dsBindPwdFile" type="optional">
        <function-arg-description>
          Bind password file
        </function-arg-description>
        <function-arg-property name="type" value="filename"/>
      </function-arg-def>
      <function-arg-def name="dsHelp" type="optional" default="''">
      <function-arg-def name="dsHelp" type="optional">
        <function-arg-description>
          Help option
        </function-arg-description>
        <function-arg-property name="type" value="filename"/>
        <function-arg-property name="help" value="option"/>
      </function-arg-def>    
    </function-map-args>
    
@@ -89,6 +88,7 @@
      <!-- Build the Command -->
      <script>
        STAFCmdParamsList=[]
        STAFCmdParams=''
        if dsPath:
          STAFCmd='%s/bin/configure-ds%s' % (dsPath,fileExt)
@@ -142,7 +142,6 @@
    <function-prolog>
      This function starts a Directory Server
    </function-prolog>
    <function-map-args>
      <function-arg-def name="location" type="optional" default="'%s' % STAXServiceMachine">
        <function-arg-description>
@@ -156,31 +155,25 @@
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsPort" type="optional" default="''">
        <function-arg-description>
          Directory server port number
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsVersion" type="optional" default="''">
      <function-arg-def name="dsVersion" type="optional">
        <function-arg-description>
          Directory server version
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>      
      <function-arg-def name="dsSystemInfo" type="optional" default="''">
      <function-arg-def name="dsSystemInfo" type="optional">
        <function-arg-description>
          Directory server system info
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="dsNoDetach" type="optional" default="''">
      <function-arg-def name="dsNoDetach" type="optional">
        <function-arg-description>
          Do not detach directory server from process
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="dsHelp" type="optional" default="''">
      <function-arg-def name="dsHelp" type="optional">
        <function-arg-description>
          Help option
        </function-arg-description>
@@ -193,6 +186,7 @@
      <!-- Build the Command -->
      <script>
        STAFCmdParamsList=[]
        STAFCmdParams=''
        if dsPath:
          STAFCmd='%s/bin/start-ds%s' % (dsPath,fileExt)
@@ -242,10 +236,8 @@
  <function name="StopDsWithScript">
    <function-prolog>
      This function starts a Directory Server using the script
    </function-prolog>
    <function-map-args>
    </function-prolog>
    <function-map-args>
      <function-arg-def name="location" type="optional" default="'%s' % STAXServiceMachine">
        <function-arg-description>
          Location of target host
@@ -258,121 +250,121 @@
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsHost" type="optional" default="''">
      <function-arg-def name="dsHost" type="optional">
        <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="dsPort" type="optional" default="''">
      <function-arg-def name="dsPort" type="optional">
        <function-arg-description>
          Directory server port number
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsUseSSL" type="optional" default="''">
      <function-arg-def name="dsUseSSL" type="optional">
        <function-arg-description>
          Use SSL for secure communication with the server
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>      
      <function-arg-def name="dsUseStartTLS" type="optional" default="''">
      <function-arg-def name="dsUseStartTLS" type="optional">
        <function-arg-description>
          Use StartTLS for secure communication with the server
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="dsBindDN" type="optional" default="''">
      <function-arg-def name="dsBindDN" type="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsBindPwd" type="optional" default="''">
      <function-arg-def name="dsBindPwd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="dsBindPwdFile" type="optional" default="''">
      <function-arg-def name="dsBindPwdFile" type="optional">
        <function-arg-description>
          Bind password file
        </function-arg-description>
        <function-arg-property name="type" value="filepath"/>
      </function-arg-def>
      <function-arg-def name="dsSaslOption" type="optional" default="''">
      <function-arg-def name="dsSaslOption" type="optional">
        <function-arg-description>
          SASL bind options
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="dsProxyAuthZID" type="optional" default="''">
      <function-arg-def name="dsProxyAuthZID" type="optional">
        <function-arg-description>
          Use the proxied authorization control with the given authorization ID
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>     
      <function-arg-def name="dsStopReason" type="optional" default="''">
      <function-arg-def name="dsStopReason" type="optional">
        <function-arg-description>
          Reason the server is being stopped or restarted
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def> 
      <function-arg-def name="dsRestart" type="optional" default="''">
      <function-arg-def name="dsRestart" type="optional">
        <function-arg-description>
          Attempt to automatically restart the server once it has stopped
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def> 
      <function-arg-def name="dsStopTime" type="optional" default="''">
      <function-arg-def name="dsStopTime" type="optional">
        <function-arg-description>
          Time to begin the shutdown in YYYYMMDDhhmmss format (local time)
        </function-arg-description>
        <function-arg-property name="type" value="timestamp"/>
      </function-arg-def>
      <function-arg-def name="dsTrustAll" type="optional" default="''">
      <function-arg-def name="dsTrustAll" type="optional">
        <function-arg-description>
          Trust all server SSL certificates
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="dsKeyStoreFile" type="optional" default="''">
      <function-arg-def name="dsKeyStoreFile" type="optional">
        <function-arg-description>
          Certificate keystore path
        </function-arg-description>
        <function-arg-property name="type" value="filename"/>
      </function-arg-def>
      <function-arg-def name="dsKeyStorePwd" type="optional" default="''">
      <function-arg-def name="dsKeyStorePwd" type="optional">
        <function-arg-description>
          Certificate keystore PIN
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>      
      <function-arg-def name="dsKeyStorePwdFile" type="optional" default="''">
      <function-arg-def name="dsKeyStorePwdFile" type="optional">
        <function-arg-description>
          Certificate keystore PIN file
        </function-arg-description>
        <function-arg-property name="type" value="filename"/>
      </function-arg-def>
      <function-arg-def name="dsTrustStoreFile" type="optional" default="''">
      <function-arg-def name="dsTrustStoreFile" type="optional">
        <function-arg-description>
          Certificate trust store path
        </function-arg-description>
        <function-arg-property name="type" value="filename"/>
      </function-arg-def>
      <function-arg-def name="dsTrustStorePwd" type="optional" default="''">
      <function-arg-def name="dsTrustStorePwd" type="optional">
        <function-arg-description>
          Certificate trust store PIN
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>      
      <function-arg-def name="dsTrustStorePwdFile" type="optional" default="''">
      <function-arg-def name="dsTrustStorePwdFile" type="optional">
        <function-arg-description>
          Certificate trust store PIN file
        </function-arg-description>
        <function-arg-property name="type" value="filename"/>
      </function-arg-def>
      <function-arg-def name="dsHelp" type="optional" default="''">
      <function-arg-def name="dsHelp" type="optional">
        <function-arg-description>
          Help option
        </function-arg-description>
@@ -385,6 +377,7 @@
      <!-- Build the Command -->
      <script>
        STAFCmdParamsList=[]
        STAFCmdParams=''
        if dsPath:
          STAFCmd='%s/bin/stop-ds%s' % (dsPath,fileExt)
@@ -566,34 +559,56 @@
      </call>
    </sequence>
  </function>
  <!-- Import Function -->
  <!-- Import LDIF file Function -->
  <function name="importLdif">
  <function-prolog>
    This function performs an offline import of an ldif file
  </function-prolog>
    <function-prolog>
      This function performs an offline import of an ldif file
    </function-prolog>
    <function-map-args>
      <function-required-arg name="ldifFile">
        The name of the ldif file
      </function-required-arg>
      <function-optional-arg name="backEnd" default="'%s' % DIRECTORY_INSTANCE_BE">
        The name of the database backend
      </function-optional-arg>
      <function-optional-arg name="extraParams" default="' '">
        Optional extra parameters for specific test cases
      </function-optional-arg>
      <function-arg-def name="location" type="optional" default="'%s' % 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="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="hostname"/>
      </function-arg-def>
      <function-arg-def name="ldifFile" type="required">
        <function-arg-description>
          Path to the LDIF file to be imported
        </function-arg-description>
        <function-arg-property name="type" value="filename"/>
      </function-arg-def>
      <function-arg-def name="backEnd" type="optional" default="'%s' % DIRECTORY_INSTANCE_BE">
        <function-arg-description>
          Backend ID for the backend to import
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional" default="''">
        <function-arg-description>
          Optional extra parameters for specific test cases
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <message>
        'import-ldif%s -l %s -n %s %s' % (fileExt,ldifFile,backEnd,extraParams)
      </message>
      <process name="'Offline Import'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/import-ldif%s' % (OPENDS_BINPATH,fileExt)</command>
        <location>'%s' % location </location>
        <command>'%s/bin/import-ldif%s' % (dsPath,fileExt)</command>
        <parms>'-l %s -n %s %s' % (ldifFile,backEnd,extraParams)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
        <workdir>'%s/bin' % dsPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
@@ -609,76 +624,387 @@
      <return>importRC</return>
    </sequence>
  </function>
  <!-- Import Function With Script-->
  <function name="ImportLdifWithScript">
    <function-prolog>
      This function performs an offline import of an ldif file using the script
    </function-prolog>
    <function-map-args>
      <function-arg-def name="location" type="optional" default="'%s' % 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="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="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsLdifFile" type="required">
        <function-arg-description>
          Path to the LDIF file to be imported
        </function-arg-description>
        <function-arg-property name="type" value="filename"/>
      </function-arg-def>
      <function-arg-def name="dsTemplateFile" type="optional">
        <function-arg-description>
          Path to a MakeLDIF template to use to generate the import data
        </function-arg-description>
        <function-arg-property name="type" value="filename"/>
      </function-arg-def>
      <function-arg-def name="dsAppend" type="optional">
        <function-arg-description>
          Append to an existing database rather than overwriting it
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="dsReplaceExisting" type="optional">
        <function-arg-description>
          Replace existing entries when appending to the database
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="dsBackEnd" type="optional" default="'%s' % DIRECTORY_INSTANCE_BE">
        <function-arg-description>
          Backend ID for the backend to import
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="dsBranchDN" type="optional">
        <function-arg-description>
          Base DN of a branch to include in the LDIF import
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsIncludeBranch" type="optional">
        <function-arg-description>
          Base DN of a branch to include in the LDIF import
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsExcludeBranch" type="optional">
        <function-arg-description>
          Base DN of a branch to exclude from the LDIF import
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsIncludeAttribute" type="optional">
        <function-arg-description>
          Attribute to include in the LDIF import
        </function-arg-description>
        <function-arg-property name="type" value="attribute"/>
      </function-arg-def>
      <function-arg-def name="dsExcludeAttribute" type="optional">
        <function-arg-description>
          Attribute to exclude in the LDIF import
        </function-arg-description>
        <function-arg-property name="type" value="attribute"/>
      </function-arg-def>
      <function-arg-def name="dsIncludeFilter" type="optional">
        <function-arg-description>
          Filter to identify entries to include in the LDIF import
        </function-arg-description>
        <function-arg-property name="type" value="filter"/>
      </function-arg-def>
      <function-arg-def name="dsExcludeFilter" type="optional">
        <function-arg-description>
          Filter to identify entries to exclude from the LDIF import
        </function-arg-description>
        <function-arg-property name="type" value="filter"/>
      </function-arg-def>
      <function-arg-def name="dsRejectFile" type="optional">
        <function-arg-description>
          Write rejected entries to the specified file
        </function-arg-description>
        <function-arg-property name="type" value="filename"/>
      </function-arg-def>
      <function-arg-def name="dsOverWriteRejects" type="optional">
        <function-arg-description>
          Overwrite an existing rejects file rather than appending to it
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="dsRandomSeed" type="optional">
        <function-arg-description>
          Seed for the MakeLDIF random number generator
        </function-arg-description>
        <function-arg-property name="type" value="seed"/>
      </function-arg-def>
      <function-arg-def name="dsSkipSchemaValidation" type="optional">
        <function-arg-description>
          Skip schema validation during the LDIF import
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="dsIsCompressed" type="optional">
        <function-arg-description>
          LDIF file is compressed
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="dsIsEncrypted" type="optional">
        <function-arg-description>
          LDIF file is encrypted
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="dsQuiet" type="optional">
        <function-arg-description>
          Use quiet mode (no output)
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="dsHelp" type="optional">
        <function-arg-description>
          Display usage information
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Build the Command -->
      <script>
        STAFCmdParamsList=[]
        STAFCmdParams=''
        if dsPath:
          STAFCmd='%s/bin/import-ldif%s' % (dsPath,fileExt)
        if dsLdifFile:
          STAFCmdParamsList.append('-l %s' % dsLdifFile)
        if dsTemplateFile:
          STAFCmdParamsList.append('-t %s' % dsTemplateFile)
        if dsAppend:
          STAFCmdParamsList.append('-a')
        if dsReplaceExisting:
          STAFCmdParamsList.append('-r')
        if dsBackEnd:
          STAFCmdParamsList.append('-n %s' % dsBackEnd)
        if dsIncludeBranch:
          STAFCmdParamsList.append('-b %s' % dsIncludeBranch)
        if dsExcludeBranch:
          STAFCmdParamsList.append('-B %s' % dsExcludeBranch)
        if dsIncludeAttribute:
          STAFCmdParamsList.append('-i %s' % dsIncludeAttribute)
        if dsExcludeAttribute:
          STAFCmdParamsList.append('-e %s' % dsExcludeAttribute)
        if dsIncludeFilter:
          STAFCmdParamsList.append('-I %s' % dsIncludeFilter)
        if dsExcludeFilter:
          STAFCmdParamsList.append('-E %s' % dsExcludeFilter)
        if dsRejectFile:
          STAFCmdParamsList.append('-R %s' % dsRejectFile)
        if dsOverWriteRejects:
          STAFCmdParamsList.append('-O')
        if dsRandomSeed:
          STAFCmdParamsList.append('-S %s' % dsRandomSeed)
        if dsSkipSchemaValidation:
          STAFCmdParamsList.append('-s')
        if dsIsCompressed:
          STAFCmdParamsList.append('-c')
        if dsIsEncrypted:
          STAFCmdParamsList.append('-y')
        if dsQuiet:
          STAFCmdParamsList.append('-q')
        if dsHelp:
          STAFCmdParamsList.append('-H')
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      <message>
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'Offline Import Script'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s/bin' % dsPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
      </call>
    </sequence>
  </function>
  <!-- Import Task Function -->
  <function name="importLdifTask">
    <function-prolog>
        This function performs an on line import task of an ldif file
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
        Directory Server host name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
        Directory Server port number
      </function-required-arg>
      <function-required-arg name="dsInstanceDn">
        Directory Server Manager DN
      </function-required-arg>
      <function-required-arg name="dsInstancePswd">
        Directory Server Manager Password
      </function-required-arg>
      <function-required-arg name="taskID">
        The identifier for the task
      </function-required-arg>
      <function-required-arg name="ldifFile">
        The name of the ldif file
      </function-required-arg>
      <function-optional-arg name="backEnd" default="'%s' % DIRECTORY_INSTANCE_BE">
        Optional the name of the database backend
      </function-optional-arg>
      <function-optional-arg name="isCompressed" default="'FALSE'">
        Optional imported ldif data file compressed
      </function-optional-arg>
      <function-optional-arg name="isEncrypted" default="'FALSE'">
        Optional imported ldif data file encrypted
      </function-optional-arg>
      <function-optional-arg name="rejectsFile" default="' '">
        Optional name of rejects file
      </function-optional-arg>
      <function-optional-arg name="overwriteRejectsFile" default="'FALSE'">
        Optional name of rejects file
      </function-optional-arg>
      <function-optional-arg name="append" default="'FALSE'">
        Optional append imported ldif data
      </function-optional-arg>
      <function-optional-arg name="skipSchemaValidation" default="'FALSE'">
        Optional don't do schema validation on import
      </function-optional-arg>
      <function-optional-arg name="replaceExisting" default="'TRUE'">
        Optional replace existing data
      </function-optional-arg>
      <function-optional-arg name="excludeBranches" default="' '">
        Optional exclude branches
      </function-optional-arg>
      <function-optional-arg name="includeBranches" default="' '">
        Optional include branches
      </function-optional-arg>
      <function-optional-arg name="excludeAttributes" default="' '">
        Optional exclude attributes
      </function-optional-arg>
      <function-optional-arg name="includeAttributes" default="' '">
        Optional include attributes
      </function-optional-arg>
      <function-optional-arg name="excludeFilters" default="' '">
        Optional exclude filters
      </function-optional-arg>
      <function-optional-arg name="includeFilters" default="' '">
        Optional include filters
      </function-optional-arg>
    <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="pathname"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceHost" type="optional">
        <function-arg-description>
          Directory server host name
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePort" type="optional">
        <function-arg-description>
          Directory server port number
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceDn" type="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="taskID" type="optional">
        <function-arg-description>
          The identifier for the task
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="ldifFile" type="optional">
        <function-arg-description>
          The name of the ldif file
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="backEnd" type="optional" default="'%s' % DIRECTORY_INSTANCE_BE">
        <function-arg-description>
          Optional the name of the database backend
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="isCompressed" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional imported ldif data file compressed
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
      <function-arg-def name="isEncrypted" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional imported ldif data file encrypted
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
      <function-arg-def name="rejectsFile" type="optional">
        <function-arg-description>
          Optional name of rejects file
        </function-arg-description>
        <function-arg-property name="type" value="filename"/>
      </function-arg-def>
      <function-arg-def name="overwriteRejectsFile" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional name of rejects file
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
      <function-arg-def name="append" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional append imported ldif data
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
      <function-arg-def name="skipSchemaValidation" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional don't do schema validation on import
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
      <function-arg-def name="replaceExisting" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional replace existing data
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
      <function-arg-def name="excludeBranches" type="optional" default="''">
        <function-arg-description>
          Optional exclude branches
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="includeBranches" type="optional" default="''">
        <function-arg-description>
          Optional include branches
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="excludeAttributes" type="optional" default="''">
        <function-arg-description>
          Optional exclude attributes
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="includeAttributes" type="optional" default="''">
        <function-arg-description>
          Optional include attributes
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="excludeFilters" type="optional" default="''">
        <function-arg-description>
          Optional exclude filters
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="includeFilters" type="optional" default="''">
        <function-arg-description>
          Optional exclude filters
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
        taskLdif='%s/../functional-tests/shared/data/import-task.ldif' % dsPath
        tmpTaskLdif='%s/import-task.ldif' % TMP_DATA_DIR
        taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
      </script>
      
@@ -690,200 +1016,83 @@
        ldifLines.append('objectclass: ds-task')
        ldifLines.append('objectclass: ds-task-import')
        ldifLines.append('ds-task-class-name: org.opends.server.tasks.ImportTask')
      </script>
      <script>
        ldifLines.append('ds-task-import-backend-id: %s' % backEnd )
        ldifLines.append('ds-task-import-ldif-file: %s' % ldifFile )
        ldifLines.append('ds-task-import-is-compressed: %s' % isCompressed )
        ldifLines.append('ds-task-import-is-encrypted: %s' % isEncrypted )
      </script>
      <if expr="rejectsFile != ' '">
        <script>
        if rejectsFile:
          ldifLines.append('ds-task-import-reject-file: %s' % rejectsFile )
        </script>
      </if>
      <script>
        ldifLines.append('ds-task-import-overwrite-rejects: %s' % overwriteRejectsFile )
        ldifLines.append('ds-task-import-append: %s' % append )
        ldifLines.append('ds-task-import-skip-schema-validation: %s' % skipSchemaValidation )
        ldifLines.append('ds-task-import-replace-existing: %s' % replaceExisting )
      </script>
  
      <iterate var="branch" in="excludeBranches">
        <sequence>
          <if expr="branch == ' '">
            <break/>
          </if>
          <script>
            ldifLines.append('ds-task-import-exclude-branch: %s' % branch )
          </script>
        </sequence>
      </iterate>
      <iterate var="branch" in="includeBranches">
        <sequence>
          <if expr="branch == ' '">
            <break/>
          </if>
          <script>
      <script>
          for branch in excludeBranches:
            ldifLines.append('ds-task-import-exclude-branch: %s' % branch )
          for branch in includeBranches:
            ldifLines.append('ds-task-import-include-branch: %s' % branch )
          </script>
        </sequence>
      </iterate>
      <iterate var="attribute" in="excludeAttributes">
        <sequence>
          <if expr="attribute == ' '">
            <break/>
          </if>
          <script>
            ldifLines.append('ds-task-import-exclude-attribute: %s' % attribute )
          </script>
        </sequence>
      </iterate>
      <iterate var="attribute" in="includeAttributes">
        <sequence>
          <if expr="attribute == ' '">
            <break/>
          </if>
          <script>
          for attribute in excludeAttributes:
            ldifLines.append('ds-task-import-exclude-attribute: %s' % attribute )
          for attribute in includeAttributes:
            ldifLines.append('ds-task-import-include-attribute: %s' % attribute )
          </script>
        </sequence>
      </iterate>
      <iterate var="filter" in="excludeFilters">
        <sequence>
          <if expr="filter == ' '">
            <break/>
          </if>
          <script>
          for filter in excludeFilters:
            ldifLines.append('ds-task-import-exclude-filter: %s' % filter)
          </script>
        </sequence>
      </iterate>
      <iterate var="filter" in="includeFilters">
        <sequence>
          <if expr="filter == ' '">
            <break/>
          </if>
          <script>
            ldifLines.append('ds-task-import-include-filter: %s' % filter)
          </script>
        </sequence>
      </iterate>
          for filter in includeFilters:
             ldifLines.append('ds-task-import-include-filter: %s' % filter)
      </script>
      <!-- Write out the import-task ldif -->
      <script>
        outfile = open('%s/import-task.ldif' % TMP_DATA_DIR,"w")
        outfile = open(tmpTaskLdif,"w")
          
        for line in ldifLines:
          outfile.write("%s\n" % line)
          
        outfile.close()
      </script>
      
      <!-- Copy the import-task ldif to remote host -->
      <message>'Copy import task ldif (import-task.ldif) file from %s to %s' % (TMP_DATA_DIR,STAGED_DATA_DIR)</message>
      <message>'Copy import task ldif (%s) to %s' % (tmpTaskLdif,taskLdif)</message>
      <call function="'copyFile'">
        { 'location'   : STAXServiceMachine,
          'srcfile'    : '%s/import-task.ldif' % TMP_DATA_DIR,
          'destfile'   : '%s/import-task.ldif' % STAGED_DATA_DIR,
          'remotehost' : STAF_REMOTE_HOSTNAME }
          'srcfile'    : tmpTaskLdif,
          'destfile'   : taskLdif,
          'remotehost' : mylocation }
      </call>
      <!-- Online Import Task with ldapmodify -->
      <message>
        'ldapmodify%s -a -h %s -p %s -D "%s" -w %s' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd)
      </message>
      <process name="'Online Import Task'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/ldapmodify%s' % (OPENDS_BINPATH,fileExt)</command>
        <parms>'-a -h %s -p %s -D "%s" -w %s' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
        </envs>
        <stdin>'%s/import-task.ldif' % STAGED_DATA_DIR</stdin>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <script>
        importTaskRC=RC
        importTaskResult=STAXResult
      </script>
      <call function="'checkRC'">
        { 'returncode' : importTaskRC ,
          'result'     : importTaskResult }
      <!-- Start the task using ldap task interface -->
      <call function="'StartLdapTask'">
        { 'location'   : mylocation,
          'taskLabel'  : 'Online Import Task',
          'dsHost'     : dsInstanceHost,
          'dsPort'     : dsInstancePort,
          'dsBindDn'   : dsInstanceDn,
          'dsBindPswd' : dsInstancePswd,
          'dsTaskLdif' : taskLdif }
      </call>
      <!-- Check that the task is completed -->
      <script>
        loopRC=1
      </script>
      <script>
        searchre = re.compile('ds-task-state: COMPLETED_SUCCESSFULLY')
      </script>
      <!-- Wait for the task to be COMPLETED_SUCCESSFULLY -->
      <loop from="1" to="5" while="loopRC != 0">
        <sequence>
          <message>
            'ldapsearch%s -h %s -p %s -D "%s" -w %s -s base -b "%s" "objectclass=*" ds-task-state' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,taskDN)
          </message>
          <process name="'Search On line Import Task'">
            <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
            <command>'%s/ldapsearch%s' % (OPENDS_BINPATH,fileExt)</command>
            <parms>'-h %s -p %s -D "%s" -w %s -s base -b "%s" "objectclass=*" ds-task-state' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,taskDN)</parms>
            <workdir>'%s' % (OPENDS_BINPATH)</workdir>
            <envs>
                  ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
            </envs>
            <stderr mode="'stdout'"/>
            <returnstdout/>
          </process>
          <script>
            searchRC=RC
            searchResult=STAXResult
          </script>
          <script>
            result = STAXResult[0][1]
          </script>
          <if expr='re.search(searchre, result) != None'>
            <sequence>
              <script>loopRC=0</script>
            </sequence>
          <else>
            <message log="1" level="'Warning'">
              'No match on ds-task-state.'
            </message>
          </else>
          </if>
          <call function="'checkRC'">
              { 'returncode' : searchRC ,
                'result'     : searchResult }
          </call>
          <call function="'Sleep'">
            { 'sleepForMilliSeconds' : '2000' }
          </call>
        </sequence>
      </loop>
      <return>loopRC</return>
      <!-- Check that the ldap task is completed -->
      <call function="'CheckLdapTask'">
        { 'location'   : mylocation,
          'dsTaskDn'   : taskDN,
          'dsHost'     : dsInstanceHost,
          'dsPort'     : dsInstancePort,
          'dsBindDn'   : dsInstanceDn,
          'dsBindPswd' : dsInstancePswd }
      </call>
    </sequence>
  </function>
  <!-- Check Import Function -->
@@ -892,41 +1101,114 @@
      This function verifies an import of an ldif file 
    </function-prolog>
    <function-map-args>
      <function-required-arg name="expectedEntries">
        Entries expected to be present after import
      </function-required-arg>
      <function-optional-arg name="missingEntries" default="'NULL'">
        Optional entries expected to be present after import
      </function-optional-arg>
      <function-optional-arg name="expectedAttributes" default="'NULL'">
        Optional attributes expected to be present after import
      </function-optional-arg>
      <function-optional-arg name="missingAttributes" default="'NULL'">
        Optional attributes expected to be present after import
      </function-optional-arg>
      <function-optional-arg name="suffix" default="'%s' % DIRECTORY_INSTANCE_SFX">
        Optional main suffix for the import
      </function-optional-arg>
      <function-optional-arg name="startDS" default="'yes'">
        Optional start the Directory Server after import
      </function-optional-arg>
      <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="pathname"/>
      </function-arg-def>
      <function-arg-def name="dsHost" type="optional" default="'%s' % DIRECTORY_INSTANCE_HOST">
        <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="dsPort" type="optional" default="'%s' % DIRECTORY_INSTANCE_PORT">
        <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="dsDn" type="optional" default="'%s' % DIRECTORY_INSTANCE_DN">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsPswd" type="optional" default="'%s' % DIRECTORY_INSTANCE_PSWD">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="expectedEntries" type="required">
        <function-arg-description>
          Entries expected to be present after import
        </function-arg-description>
        <function-arg-property name="type" value="list"/>
      </function-arg-def>
      <function-arg-def name="missingEntries" type="optional" default="'NULL'">
        <function-arg-description>
          Optional entries expected to be missing after import
        </function-arg-description>
        <function-arg-property name="type" value="list"/>
      </function-arg-def>
      <function-arg-def name="expectedAttributes" type="optional" default="'NULL'">
        <function-arg-description>
          Optional attributes expected to be present after import
        </function-arg-description>
        <function-arg-property name="type" value="list"/>
      </function-arg-def>
      <function-arg-def name="missingAttributes" type="optional" default="'NULL'">
        <function-arg-description>
          Optional attributes expected to be missing after import
        </function-arg-description>
        <function-arg-property name="type" value="list"/>
      </function-arg-def>
      <function-arg-def name="suffix" type="optional" default="'%s' % DIRECTORY_INSTANCE_SFX">
        <function-arg-description>
          Optional main suffix for the import
        </function-arg-description>
        <function-arg-property name="type" value="list"/>
      </function-arg-def>
      <function-arg-def name="startDS" type="optional" default="'yes'">
        <function-arg-description>
          Optional start the Directory Server after import
        </function-arg-description>
        <function-arg-property name="type" value="list"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- If we don't want to start DS then we don't need to stop it -->
      <script>stopDS=startDS</script>
      <!-- Local variables -->
      <script>
        mylocation=location
        myhost=dsHost
        myport=dsPort
        mydn=dsDn
        mypswd=dsPswd
      </script>
      <!-- Assume that if DS is not started then there is no need to stop it -->
      <script>
        if startDS == 'yes':
          stopDS='yes'
        else:
          stopDS='no'
      </script>
      <!-- Do we need to start the DS -->
      <if expr="startDS == 'yes'">
        <sequence>
          <!-- StartDS -->
          <call function="'StartDsWithScript'">
           { 'location'  : STAF_REMOTE_HOSTNAME }
           { 'location'  : mylocation }
          </call>
          
          <!-- Wait for DS to start -->
          <call function="'isAlive'">
            { 'noOfLoops'        : 5 ,
            { 'location'         : mylocation,
              'noOfLoops'        : 5 ,
              'noOfMilliSeconds' : 2000 }
          </call>
        </sequence>
      </if>
    
@@ -934,10 +1216,11 @@
      <iterate var="expectedEntry" in="expectedEntries">
        <sequence>
          <call function="'SearchObject'">
            { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
              'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
              'dsInstanceDn'   : DIRECTORY_INSTANCE_DN ,
              'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
            { 'location'       : mylocation ,
              'dsInstanceHost' : myhost ,
              'dsInstancePort' : myport ,
              'dsInstanceDn'   : mydn ,
              'dsInstancePswd' : mypswd ,
              'dsBaseDN'       : '%s' % expectedEntry ,
              'dsFilter'       : 'objectclass=*' 
            }
@@ -956,12 +1239,13 @@
            <break/>
          </if>
          <call function="'SearchObject'">
            { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
              'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
              'dsInstanceDn'   : DIRECTORY_INSTANCE_DN ,
              'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
              'dsBaseDN'       : '%s' % missingEntry ,
              'dsFilter'       : 'objectclass=*'
           { 'location'       : mylocation ,
             'dsInstanceHost' : myhost ,
             'dsInstancePort' : myport ,
             'dsInstanceDn'   : mydn ,
             'dsInstancePswd' : mypswd ,
             'dsBaseDN'       : '%s' % missingEntry ,
             'dsFilter'       : 'objectclass=*'
            }
          </call>
          <call function="'checktestRC'">
@@ -976,33 +1260,53 @@
      <if expr="stopDS == 'yes'">
        <!-- StopDS -->
        <call function="'StopDsWithScript'">
            { 'location'  : STAF_REMOTE_HOSTNAME,
              'dsHost'    : DIRECTORY_INSTANCE_HOST,
              'dsPort'    : DIRECTORY_INSTANCE_PORT,
              'dsBindDN'  : DIRECTORY_INSTANCE_DN,
              'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
           { 'location'       : mylocation ,
             'dsHost' : myhost ,
             'dsPort' : myport ,
             'dsBindDN'   : mydn ,
             'dsBindPwd' : mypswd }
        </call>  
      </if>
    </sequence>
  </function>
    
  <!-- Export Function -->
  <!-- Export LDIF Function -->
  <function name="exportLdif">
    <function-prolog>
      This function performs an export to an ldif file on or off line
    </function-prolog>
    <function-map-args>
      <function-required-arg name="ldifFile">
        The name of the ldif file to be written
      </function-required-arg>
      <function-optional-arg name="backEnd" default="'%s' % DIRECTORY_INSTANCE_BE">
        The name of the database backend
      </function-optional-arg>
      <function-optional-arg name="extraParams" default="' '">
        Optional extra parameters for specific test cases
      </function-optional-arg>
      <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="pathname"/>
      </function-arg-def>
      <function-arg-def name="ldifFile" type="required">
        <function-arg-description>
          The name of the ldif file to be written
        </function-arg-description>
        <function-arg-property name="type" value="filename"/>
      </function-arg-def>
      <function-arg-def name="backEnd" type="optional" default="'%s' % DIRECTORY_INSTANCE_BE">
        <function-arg-description>
          The name of the database backend
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional" default="''">
        <function-arg-description>
          Optional extra parameters for specific test cases
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
@@ -1010,12 +1314,12 @@
        'export-ldif%s -l %s -n %s %s' % (fileExt,ldifFile,backEnd,extraParams)
      </message>
      <process name="'Ldif Export'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/export-ldif%s' % (OPENDS_BINPATH,fileExt)</command>
        <location>'%s' % location </location>
        <command>'%s/bin/export-ldif%s' % (dsPath,fileExt)</command>
        <parms>'-l %s -n %s %s' % (ldifFile,backEnd,extraParams)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
        <workdir>'%s/bin' % dsPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
@@ -1038,63 +1342,132 @@
      This function performs an on line export task of an ldif file
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
        Directory Server host name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
        Directory Server port number
      </function-required-arg>
      <function-required-arg name="dsInstanceDn">
        Directory Server Manager DN
      </function-required-arg>
      <function-required-arg name="dsInstancePswd">
        Directory Server Manager Password
      </function-required-arg>
      <function-required-arg name="taskID">
        The identifier for the task
      </function-required-arg>
      <function-required-arg name="ldifFile">
        The name of the ldif file
      </function-required-arg>
      <function-optional-arg name="backEnd" default="'%s' % DIRECTORY_INSTANCE_BE">
        Optional the name of the database backend
      </function-optional-arg>
      <function-optional-arg name="Compress" default="'FALSE'">
        Optional exported ldif data file compressed
      </function-optional-arg>
      <function-optional-arg name="Encrypt" default="'FALSE'">
        Optional exported ldif data file encrypted
      </function-optional-arg>
      <function-optional-arg name="append" default="'FALSE'">
        Optional append exported ldif data
      </function-optional-arg>
      <function-optional-arg name="excludeBranches" default="' '">
        Optional exclude branches
      </function-optional-arg>
      <function-optional-arg name="includeBranches" default="' '">
        Optional include branches
      </function-optional-arg>
      <function-optional-arg name="excludeAttributes" default="' '">
        Optional exclude attributes
      </function-optional-arg>
      <function-optional-arg name="includeAttributes" default="' '">
        Optional include attributes
      </function-optional-arg>
      <function-optional-arg name="excludeFilters" default="' '">
        Optional exclude filters
      </function-optional-arg>
      <function-optional-arg name="includeFilters" default="' '">
        Optional include filters
      </function-optional-arg>
      <function-optional-arg name="signHash" default="'FALSE'">
        Optional generate a signed hash of the export data
      </function-optional-arg>
      <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="pathname"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceHost" type="optional">
        <function-arg-description>
          Directory server host name
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePort" type="optional">
        <function-arg-description>
          Directory server port number
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceDn" type="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="taskID" type="optional">
        <function-arg-description>
          The identifier for the task
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="ldifFile" type="optional">
        <function-arg-description>
          The name of the ldif file
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="backEnd" type="optional" default="'%s' % DIRECTORY_INSTANCE_BE">
        <function-arg-description>
          Optional the name of the database backend
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="isCompressed" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional exported ldif data file compressed
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
      <function-arg-def name="isEncrypted" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional exported ldif data file encrypted
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
      <function-arg-def name="append" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional append exported ldif data
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
      <function-arg-def name="excludeBranches" type="optional" default="''">
        <function-arg-description>
          Optional exclude branches
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="includeBranches" type="optional" default="''">
        <function-arg-description>
          Optional include branches
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="excludeAttributes" type="optional" default="''">
        <function-arg-description>
          Optional exclude attributes
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="includeAttributes" type="optional" default="''">
        <function-arg-description>
          Optional include attributes
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="excludeFilters" type="optional" default="''">
        <function-arg-description>
          Optional exclude filters
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="includeFilters" type="optional" default="''">
        <function-arg-description>
          Optional exclude filters
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
      <function-arg-def name="isSignedHash" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional generate a signed hash of the export data
        </function-arg-description>
        <function-arg-property name="type" value="option"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
        taskLdif='%s/../functional-tests/shared/data/export-task.ldif' % dsPath
        tmpTaskLdif='%s/export-task.ldif' % TMP_DATA_DIR
        taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
      </script>
      <!-- Build the export task configuration object -->
      <script>
        ldifLines=[]
@@ -1104,84 +1477,37 @@
        ldifLines.append('objectclass: ds-task-export')
        ldifLines.append('ds-task-class-name: org.opends.server.tasks.ExportTask')
        ldifLines.append('ds-task-id: %s' % taskID)
      </script>
      <script>
        ldifLines.append('ds-task-export-backend-id: %s' % backEnd )
        ldifLines.append('ds-task-export-ldif-file: %s' % ldifFile )
        ldifLines.append('ds-task-export-compress-ldif: %s' % Compress )
        ldifLines.append('ds-task-export-encrypt-ldif: %s' % Encrypt )
        ldifLines.append('ds-task-export-sign-hash: %s' % signHash )
        ldifLines.append('ds-task-export-compress-ldif: %s' % isCompressed )
        ldifLines.append('ds-task-export-encrypt-ldif: %s' % isEncrypted )
        ldifLines.append('ds-task-export-sign-hash: %s' % isSignedHash )
      </script>
      <iterate var="branch" in="excludeBranches">
        <sequence>
          <if expr="branch == ' '">
            <break/>
          </if>
          <script>
      <script>
          for branch in excludeBranches:
            ldifLines.append('ds-task-export-exclude-branch: %s' % branch )
          </script>
        </sequence>
      </iterate>
      <iterate var="branch" in="includeBranches">
        <sequence>
          <if expr="branch == ' '">
            <break/>
          </if>
          <script>
          for branch in includeBranches:
            ldifLines.append('ds-task-export-include-branch: %s' % branch )
          </script>
        </sequence>
      </iterate>
      <iterate var="attribute" in="excludeAttributes">
        <sequence>
          <if expr="attribute == ' '">
            <break/>
          </if>
          <script>
          for attribute in excludeAttributes:
            ldifLines.append('ds-task-export-exclude-attribute: %s' % attribute )
          </script>
        </sequence>
      </iterate>
      <iterate var="attribute" in="includeAttributes">
        <sequence>
          <if expr="attribute == ' '">
            <break/>
          </if>
          <script>
          for attribute in includeAttributes:
            ldifLines.append('ds-task-export-include-attribute: %s' % attribute )
          </script>
        </sequence>
      </iterate>
      <iterate var="filter" in="excludeFilters">
        <sequence>
          <if expr="filter == ' '">
            <break/>
          </if>
          <script>
          for filter in excludeFilters:
            ldifLines.append('ds-task-export-exclude-filter: %s' % filter)
          </script>
        </sequence>
      </iterate>
      <iterate var="filter" in="includeFilters">
        <sequence>
          <if expr="filter == ' '">
            <break/>
          </if>
          <script>
            ldifLines.append('ds-task-export-include-filter: %s' % filter)
          </script>
        </sequence>
      </iterate>
          for filter in includeFilters:
             ldifLines.append('ds-task-export-include-filter: %s' % filter)
      </script>
      
      <!-- Write out the export-task ldif -->
      <script>
        outfile = open('%s/export-task.ldif' % TMP_DATA_DIR,"w")
        outfile = open(tmpTaskLdif,"w")
          
        for line in ldifLines:
          outfile.write("%s\n" % line)
@@ -1190,130 +1516,92 @@
      </script>
      
      <!-- Copy the export-task ldif to remote host -->
      <message>'Copy export task ldif file.'</message>
      <message>'Copy export task ldif (%s) to %s' % (tmpTaskLdif,taskLdif)</message>
      <call function="'copyFile'">
        { 'location'   : STAXServiceMachine,
          'srcfile'    : '%s/export-task.ldif' % TMP_DATA_DIR,
          'destfile'   : '%s/export-task.ldif' % STAGED_DATA_DIR,
          'remotehost' : STAF_REMOTE_HOSTNAME }
          'srcfile'    : tmpTaskLdif,
          'destfile'   : taskLdif,
          'remotehost' : mylocation }
      </call>
      <!-- On line Export Task with ldapmodify -->
      <message>
        'ldapmodify%s -a -h %s -p %s -D "%s" -w %s' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd)
      </message>
      <process name="'On line Export Task'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/ldapmodify%s' % (OPENDS_BINPATH,fileExt)</command>
        <parms>'-a -h %s -p %s -D "%s" -w %s' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
        </envs>
        <stdin>'%s/export-task.ldif' % STAGED_DATA_DIR</stdin>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <script>
        exportTaskRC=RC
        exportTaskResult=STAXResult
      </script>
      <call function="'checkRC'">
        { 'returncode' : exportTaskRC ,
          'result'     : exportTaskResult }
      <!-- Start the task using ldap task interface -->
      <call function="'StartLdapTask'">
        { 'location'   : mylocation,
          'taskLabel'  : 'Online Export Task',
          'dsHost'     : dsInstanceHost,
          'dsPort'     : dsInstancePort,
          'dsBindDn'   : dsInstanceDn,
          'dsBindPswd' : dsInstancePswd,
          'dsTaskLdif' : taskLdif }
      </call>
      
      <!-- Check that the task is completed -->
      <script>
        loopRC=1
      </script>
      <script>
        import re
        searchre = re.compile('ds-task-state: COMPLETED_SUCCESSFULLY')
      </script>
      <!-- Wait for the task to be COMPLETED_SUCCESSFULLY -->
      <loop from="1" to="5" while="loopRC != 0">
        <sequence>
          <message>
            'ldapsearch%s -h %s -p %s -D "%s" -w %s -s base -b "%s" "objectclass=*" ds-task-state' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,taskDN)
          </message>
          <process name="'Search On line Export Task'">
            <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
            <command>'%s/ldapsearch%s' % (OPENDS_BINPATH,fileExt)</command>
            <parms>'-h %s -p %s -D "%s" -w %s -s base -b "%s" "objectclass=*" ds-task-state' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,taskDN)</parms>
            <workdir>'%s' % (OPENDS_BINPATH)</workdir>
            <envs>
              ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
            </envs>
            <stderr mode="'stdout'"/>
            <returnstdout/>
          </process>
          <script>
            searchRC=RC
            searchResult=STAXResult
          </script>
          <script>
            result = STAXResult[0][1]
          </script>
          <if expr='re.search(searchre, result) != None'>
            <sequence>
              <script>loopRC=0</script>
            </sequence>
          <else>
            <message log="1" level="'Warning'">
              'No match on ds-task-state.'
            </message>
          </else>
          </if>
          <call function="'checkRC'">
              { 'returncode' : searchRC ,
                'result'     : searchResult }
          </call>
          <call function="'Sleep'">
            { 'sleepForMilliSeconds' : '2000' }
          </call>
        </sequence>
      </loop>
      <return>loopRC</return>
      <call function="'CheckLdapTask'">
        { 'location'   : mylocation,
          'dsTaskDn'   : taskDN,
          'dsHost'     : dsInstanceHost,
          'dsPort'     : dsInstancePort,
          'dsBindDn'   : dsInstanceDn,
          'dsBindPswd' : dsInstancePswd }
      </call>
    </sequence>
  </function>
  
  <!-- Backup Function -->
  <function name="backup">
    <function-prolog>
        This function performs an on line backup
        This function performs an off line backup
    </function-prolog>
    <function-map-args>
      <function-required-arg name="backupDir">
        The directory where the backup files will be placed
      </function-required-arg>
      <function-optional-arg name="backEnd" default="'%s' % DIRECTORY_INSTANCE_BE">
        The name of the database backend
      </function-optional-arg>
      <function-optional-arg name="extraParams" default="' '">
        Optional extra parameters for specific test cases
      </function-optional-arg>
      <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="pathname"/>
      </function-arg-def>
      <function-arg-def name="backEnd" type="optional" default="'%s' % DIRECTORY_INSTANCE_BE">
        <function-arg-description>
          Optional the name of the database backend
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="backupDir" type="required">
        <function-arg-description>
          The directory where the backup files will be placed
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional" default="''">
        <function-arg-description>
          Optional extra parameters for specific test cases
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
      </script>
      <message>
        'backup%s -n %s -d %s %s' % (fileExt,backEnd,backupDir,extraParams)
      </message>
      <process name="'Offline Backup'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/backup%s' % (OPENDS_BINPATH,fileExt)</command>
        <location>'%s' % mylocation </location>
        <command>'%s/bin/backup%s' % (dsPath,fileExt)</command>
        <parms>'-d %s -n %s %s' % (backupDir,backEnd,extraParams)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
        <workdir>'%s/bin' % dsPath</workdir>
        <envs>
              ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
              ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
@@ -1336,51 +1624,109 @@
        This function performs an on line backup task 
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
        Directory Server host name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
        Directory Server port number
      </function-required-arg>
      <function-required-arg name="dsInstanceDn">
        Directory Server Manager DN
      </function-required-arg>
      <function-required-arg name="dsInstancePswd">
        Directory Server Manager Password
      </function-required-arg>
      <function-required-arg name="taskID">
        The identifier for the task
      </function-required-arg>
      <function-required-arg name="backupDir">
        Path to the target directory for the backup file(s)
      </function-required-arg>
      <function-optional-arg name="backEnd" default="'%s' % DIRECTORY_INSTANCE_BE">
        Optional the name of the database backend
      </function-optional-arg>
      <function-optional-arg name="backupAll" default="'FALSE'">
        Optional back up all backends in the server
      </function-optional-arg>
      <function-optional-arg name="backupIncremental" default="' '">
        Optional perform an incremental backup rather than a full backup
      </function-optional-arg>
      <function-optional-arg name="backupIncrementalId" default="' '">
        Optional use the provided identifier for the backup
      </function-optional-arg>
      <function-optional-arg name="Compress" default="'FALSE'">
        Optional backup contents compressed
      </function-optional-arg>
      <function-optional-arg name="Encrypt" default="'FALSE'">
        Optional backup contents encrypted
      </function-optional-arg>
      <function-optional-arg name="signHash" default="'FALSE'">
        Optional generate a signed hash of the backup data
      </function-optional-arg>
      <function-optional-arg name="hash" default="'FALSE'">
        Optional generate a hash of the backup data
      </function-optional-arg>
      <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="pathname"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceHost" type="optional">
        <function-arg-description>
          Directory server host name
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePort" type="optional">
        <function-arg-description>
          Directory server port number
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceDn" type="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="taskID" type="optional">
        <function-arg-description>
          The identifier for the task
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="backupDir" type="required">
        <function-arg-description>
          Path to the target directory for the backup file(s)
        </function-arg-description>
        <function-arg-property name="type" value="filepath"/>
      </function-arg-def>
      <function-arg-def name="backEnd" type="optional" default="'%s' % DIRECTORY_INSTANCE_BE">
        <function-arg-description>
          Optional the name of the database backend
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="backupAll" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional back up all backends in the server
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
      <function-arg-def name="backupIncremental" type="optional">
        <function-arg-description>
          Optional perform an incremental backup rather than a full backup
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="backupIncrementalId" type="optional">
        <function-arg-description>
          Optional use the provided identifier for the backup
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="Compress" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional backup contents compressed
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
      <function-arg-def name="Encrypt" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional backup contents encrypted
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
      <function-arg-def name="signHash" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional generate a signed hash of the backup data
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
      <function-arg-def name="hash" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional generate a hash of the backup data
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <script>
       <script>
        mylocation=location
        taskLdif='%s/../functional-tests/shared/data/backup-task.ldif' % dsPath
        tmpTaskLdif='%s/backup-task.ldif' % TMP_DATA_DIR
        taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
      </script>
      
@@ -1393,9 +1739,7 @@
        ldifLines.append('objectclass: ds-task-backup')
        ldifLines.append('ds-task-class-name: org.opends.server.tasks.BackupTask')
        ldifLines.append('ds-backup-id: %s' % taskID)
      </script>
      <script>
        ldifLines.append('ds-task-backup-backend-id: %s' % backEnd )
        ldifLines.append('ds-backup-directory-path: %s' % backupDir )
        ldifLines.append('ds-task-backup-all: %s' % backupAll )
@@ -1403,18 +1747,17 @@
        ldifLines.append('ds-task-backup-encrypt: %s' % Encrypt )
        ldifLines.append('ds-task-backup-sign-hash: %s' % signHash )
        ldifLines.append('ds-task-backup-hash: %s' % hash )
      </script>
      <if expr="backupIncremental != ' '">
        <script>
        if backupIncremental:
          ldifLines.append('ds-task-backup-incremental: %s' % backupIncremental )
          ldifLines.append('ds-task-backup-incremental-base-id: %s' % backupIncrementalId )
        </script>
      </if>
        if backupIncrementalId:
          ldifLines.append('ds-task-backup-incremental-base-id: %s' % backupIncrementalId )
      </script>
      
      <!-- Write out the backup-task ldif -->
      <script>
        outfile = open('%s/backup-task.ldif' % TMP_DATA_DIR,"w")
        outfile = open(tmpTaskLdif,"w")
          
        for line in ldifLines:
          outfile.write("%s\n" % line)
@@ -1426,95 +1769,34 @@
      <message>'Copy backup task ldif file.'</message>
      <call function="'copyFile'">
        { 'location'   : STAXServiceMachine,
          'srcfile'    : '%s/backup-task.ldif' % TMP_DATA_DIR,
          'destfile'   : '%s/backup-task.ldif' % STAGED_DATA_DIR,
          'remotehost' : STAF_REMOTE_HOSTNAME }
          'srcfile'    : tmpTaskLdif,
          'destfile'   : taskLdif,
          'remotehost' : mylocation }
      </call>
      <!-- On line Backup Task with ldapmodify -->
      <message>
        'ldapmodify%s -a -h %s -p %s -D "%s" -w %s' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd)
      </message>
      <process name="'On line Backup Task'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/ldapmodify%s' % (OPENDS_BINPATH,fileExt)</command>
        <parms>'-a -h %s -p %s -D "%s" -w %s' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
        <envs>
              ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
        </envs>
        <stdin>'%s/backup-task.ldif' % STAGED_DATA_DIR</stdin>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <script>
        backupTaskRC=RC
        backupTaskResult=STAXResult
      </script>
      <call function="'checkRC'">
        { 'returncode' : backupTaskRC ,
          'result'     : backupTaskResult }
      <!-- Start the task using ldap task interface -->
      <call function="'StartLdapTask'">
        { 'location'   : mylocation,
          'taskLabel'  : 'Online Backup Task',
          'dsHost'     : dsInstanceHost,
          'dsPort'     : dsInstancePort,
          'dsBindDn'   : dsInstanceDn,
          'dsBindPswd' : dsInstancePswd,
          'dsTaskLdif' : taskLdif }
      </call>
      <!-- Check that the task is completed -->
      <script>
        loopRC=1
      </script>
      <script>
        searchre = re.compile('ds-task-state: COMPLETED_SUCCESSFULLY')
      </script>
      <!-- Wait for the task to be COMPLETED_SUCCESSFULLY -->
      <loop from="1" to="5" while="loopRC != 0">
        <sequence>
          <message>
            'ldapsearch%s -h %s -p %s -D "%s" -w %s -s base -b "%s" "objectclass=*" ds-task-state' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,taskDN)
          </message>
          <process name="'Search On line Backup Task'">
            <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
            <command>'%s/ldapsearch%s' % (OPENDS_BINPATH,fileExt)</command>
            <parms>'-h %s -p %s -D "%s" -w %s -s base -b "%s" "objectclass=*" ds-task-state' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,taskDN)</parms>
            <workdir>'%s' % (OPENDS_BINPATH)</workdir>
            <envs>
                  ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
            </envs>
            <stderr mode="'stdout'"/>
            <returnstdout/>
          </process>
          <script>
            searchRC=RC
            searchResult=STAXResult
          </script>
          <script>
            result = STAXResult[0][1]
          </script>
          <if expr='re.search(searchre, result) != None'>
            <sequence>
              <script>loopRC=0</script>
            </sequence>
          <else>
            <message log="1" level="'Warning'">
              'No match on ds-task-state.'
            </message>
          </else>
          </if>
          <call function="'checkRC'">
            { 'returncode' : searchRC ,
              'result'     : searchResult }
          </call>
          <call function="'Sleep'">
            { 'sleepForMilliSeconds' : '2000' }
          </call>
        </sequence>
      </loop>
      <return>loopRC</return>
      <!-- Check that the ldap task is completed -->
      <call function="'CheckLdapTask'">
        { 'location'   : mylocation,
          'dsTaskDn'   : taskDN,
          'dsHost'     : dsInstanceHost,
          'dsPort'     : dsInstancePort,
          'dsBindDn'   : dsInstanceDn,
          'dsBindPswd' : dsInstancePswd }
      </call>
    </sequence>
  </function>
  <!-- Restore Function -->
@@ -1523,38 +1805,48 @@
      This function performs an off line restore
    </function-prolog>
    <function-map-args>
      <function-required-arg name="backupDir">
        Path to the directory containing the backup file(s)
      </function-required-arg>
      <function-optional-arg name="extraParams" default="' '">
        Optional extra parameters for specific test cases
      </function-optional-arg>
      <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="pathname"/>
      </function-arg-def>
      <function-arg-def name="backupDir" type="required">
        <function-arg-description>
          The directory where the backup files will be placed
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional" default="''">
        <function-arg-description>
          Optional extra parameters for specific test cases
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <message>
         'Stopping OpenDS'
      </message>
      <call function="'StopDsWithScript'">
          { 'location'  : STAF_REMOTE_HOSTNAME,
            'dsHost'    : DIRECTORY_INSTANCE_HOST,
            'dsPort'    : DIRECTORY_INSTANCE_PORT,
            'dsBindDN'  : DIRECTORY_INSTANCE_DN,
            'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
      </call>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
      </call>
      <!-- Local variables -->
      <script>
        mylocation=location
      </script>
      <message>
        'restore%s -d %s %s' % (fileExt,backupDir,extraParams)
      </message>
      <process name="'Offline restore'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/restore%s' % (OPENDS_BINPATH,fileExt)</command>
        <location>'%s' % mylocation </location>
        <command>'%s/bin/restore%s' % (dsPath,fileExt)</command>
        <parms>'-d %s %s' % (backupDir,extraParams)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
        <workdir>'%s/bin' % dsPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
@@ -1567,16 +1859,7 @@
        { 'returncode' : restoreRC ,
          'result'     : restoreResult }
      </call>
      <message>
        'Starting DS'
      </message>
      <call function="'StartDsWithScript'">
       { 'location'  : STAF_REMOTE_HOSTNAME }
      </call>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
      </call>
      <return>restoreRC</return>
    </sequence>
  </function>
@@ -1587,35 +1870,76 @@
        This function performs an on line restore task of a backup file
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
        Directory Server host name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
        Directory Server port number
      </function-required-arg>
      <function-required-arg name="dsInstanceDn">
        Directory Server Manager DN
      </function-required-arg>
      <function-required-arg name="dsInstancePswd">
        Directory Server Manager Password
      </function-required-arg>
      <function-required-arg name="taskID">
        The identifier for the task
      </function-required-arg>
      <function-required-arg name="backupDir">
        The name of the backup directory
      </function-required-arg>
      <function-optional-arg name="backupId" default="' '">
        Optional the name of the backupId
      </function-optional-arg>
      <function-optional-arg name="verify" default="'FALSE'">
        Optional verify the contents of the backup but do not restore it
      </function-optional-arg>
      <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="pathname"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceHost" type="optional">
        <function-arg-description>
          Directory server host name
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePort" type="optional">
        <function-arg-description>
          Directory server port number
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceDn" type="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="taskID" type="optional">
        <function-arg-description>
          The identifier for the task
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="backupDir" type="required">
        <function-arg-description>
          The name of the backup directory
        </function-arg-description>
        <function-arg-property name="type" value="pathname"/>
      </function-arg-def>
      <function-arg-def name="backupId" type="optional">
        <function-arg-description>
          Optional the name of the backupId
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="verify" type="optional" default="'FALSE'">
        <function-arg-description>
          Optional verify the contents of the backup but do not restore it
        </function-arg-description>
        <function-arg-property name="type" value="boolean"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <script>
       <script>
        mylocation=location
        taskLdif='%s/../functional-tests/shared/data/restore-task.ldif' % dsPath
        tmpTaskLdif='%s/restore-task.ldif' % TMP_DATA_DIR
        taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
      </script>
      </script>
      <!-- Build the restore task configuration object -->
      <script>
        ldifLines=[]
@@ -1625,19 +1949,17 @@
        ldifLines.append('objectclass: ds-task-restore')
        ldifLines.append('ds-task-class-name: org.opends.server.tasks.RestoreTask')
        ldifLines.append('ds-task-id: %s' % taskID)
      </script>
      <script>
        ldifLines.append('ds-backup-directory-path: %s' % backupDir )
        ldifLines.append('ds-task-restore-verify-only: %s' % verify )
        if backupId:
          ldifLines.append('ds-backup-id: %s' % backupId )
      </script>
      <if expr="backupId != ' '">
        <script>
          ldifLines.append('ds-backup-id: %s' % backupId )
        </script>
      </if>
      <!-- Write out the restore-task ldif -->
      <script>
        outfile = open('%s/restore-task.ldif' % TMP_DATA_DIR,"w")
        outfile = open(tmpTaskLdif,"w")
          
        for line in ldifLines:
          outfile.write("%s\n" % line)
@@ -1649,125 +1971,99 @@
      <message>'Copy restore task ldif file.'</message>
      <call function="'copyFile'">
        { 'location'   : STAXServiceMachine,
          'srcfile'    : '%s/restore-task.ldif' % TMP_DATA_DIR,
          'destfile'   : '%s/restore-task.ldif' % STAGED_DATA_DIR,
          'remotehost' : STAF_REMOTE_HOSTNAME }
          'srcfile'    : tmpTaskLdif,
          'destfile'   : taskLdif,
          'remotehost' : mylocation }
      </call>
      <!-- On line Restore Task with ldapmodify -->
      <message>
        'ldapmodify%s -a -h %s -p %s -D "%s" -w %s' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd)
      </message>
      <process name="'On line Restore Task'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/ldapmodify%s' % (OPENDS_BINPATH,fileExt)</command>
        <parms>'-a -h %s -p %s -D "%s" -w %s' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
        </envs>
        <stdin>'%s/restore-task.ldif' % STAGED_DATA_DIR</stdin>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <script>
        restoreTaskRC=RC
        restoreTaskResult=STAXResult
      </script>
      <call function="'checkRC'">
        { 'returncode' : restoreTaskRC ,
          'result'     : restoreTaskResult }
      <!-- Start the task using ldap task interface -->
      <call function="'StartLdapTask'">
        { 'location'   : mylocation,
          'taskLabel'  : 'Online Restore Task',
          'dsHost'     : dsInstanceHost,
          'dsPort'     : dsInstancePort,
          'dsBindDn'   : dsInstanceDn,
          'dsBindPswd' : dsInstancePswd,
          'dsTaskLdif' : taskLdif }
      </call>
      <!-- Check that the task is completed -->
      <script>
        loopRC=1
      </script>
      <script>
        searchre = re.compile('ds-task-state: COMPLETED_SUCCESSFULLY')
      </script>
      <!-- Wait for the task to be COMPLETED_SUCCESSFULLY -->
      <loop from="1" to="5" while="loopRC != 0">
        <sequence>
          <message>
            'ldapsearch%s -h %s -p %s -D "%s" -w %s -s base -b "%s" "objectclass=*" ds-task-state' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,taskDN)
          </message>
          <process name="'Search On line Restore Task'">
            <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
            <command>'%s/ldapsearch%s' % (OPENDS_BINPATH,fileExt)</command>
            <parms>'-h %s -p %s -D "%s" -w %s -s base -b "%s" "objectclass=*" ds-task-state' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,taskDN)</parms>
            <workdir>'%s' % (OPENDS_BINPATH)</workdir>
            <envs>
              ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
            </envs>
            <stderr mode="'stdout'"/>
            <returnstdout/>
          </process>
          <script>
            searchRC=RC
            searchResult=STAXResult
          </script>
          <script>
            result = STAXResult[0][1]
          </script>
          <if expr='re.search(searchre, result) != None'>
            <sequence>
              <script>loopRC=0</script>
            </sequence>
          <else>
            <message log="1" level="'Warning'">
              'No match on ds-task-state.'
            </message>
          </else>
          </if>
          <call function="'checkRC'">
            { 'returncode' : searchRC ,
              'result'     : searchResult }
          </call>
          <call function="'Sleep'">
            { 'sleepForMilliSeconds' : '2000' }
          </call>
        </sequence>
      </loop>
      <return>loopRC</return>
      <!-- Check that the ldap task is completed -->
      <call function="'CheckLdapTask'">
        { 'location'   : mylocation,
          'dsTaskDn'   : taskDN,
          'dsHost'     : dsInstanceHost,
          'dsPort'     : dsInstancePort,
          'dsBindDn'   : dsInstanceDn,
          'dsBindPswd' : dsInstancePswd }
      </call>
    </sequence>
  </function>
 
    <!-- Add Schema Task Function -->
    <function name="addSchemaTask">
  <!-- Add Schema Task Function -->
  <function name="addSchemaTask">
    <function-prolog>
        This function performs a dynamic schema add task 
    </function-prolog>
    <function-map-args>
        <function-required-arg name="dsInstanceHost">
            Directory Server host name
        </function-required-arg>
        <function-required-arg name="dsInstancePort">
            Directory Server port number
        </function-required-arg>
        <function-required-arg name="dsInstanceDn">
            Directory Server Manager DN
        </function-required-arg>
        <function-required-arg name="dsInstancePswd">
            Directory Server Manager Password
        </function-required-arg>
        <function-required-arg name="taskID">
            The identifier for the task
        </function-required-arg>
        <function-required-arg name="ldifFile">
            The name of the ldif file that contains the schema updates
        </function-required-arg>
      <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="pathname"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceHost" type="optional">
        <function-arg-description>
          Directory server host name
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePort" type="optional">
        <function-arg-description>
          Directory server port number
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceDn" type="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="taskID" type="optional">
        <function-arg-description>
          The identifier for the task
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="ldifFile" type="required">
        <function-arg-description>
          The name of the ldif file that contains the schema updates
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
      <sequence>
        <script>
         <script>
          mylocation=location
          taskLdif='%s/../functional-tests/shared/data/schema-task.ldif' % dsPath
          tmpTaskLdif='%s/schema-task.ldif' % TMP_DATA_DIR
          taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
        </script>
        
@@ -1780,134 +2076,329 @@
          ldifLines.append('objectclass: ds-task-add-schema-file')
          ldifLines.append('ds-task-class-name: org.opends.server.tasks.AddSchemaFileTask')
          ldifLines.append('ds-task-id: %s' % taskID)
        </script>
        <script>
          ldifLines.append('ds-task-schema-file-name: %s' % ldifFile )
        </script>
               
                   
        <!-- Write out the schema-task ldif -->
        <script>
          outfile = open('%s/schema-task.ldif' % TMP_DATA_DIR,"w")
          outfile = open(tmpTaskLdif,"w")
            
          for line in ldifLines:
            outfile.write("%s\n" % line)
            
          outfile.close()
        </script>
        
        <!-- Copy the schema-task ldif to remote host -->
        <message>'Copy schema task ldif file.'</message>
        <call function="'copyFile'">
          { 'location'   : STAXServiceMachine,
            'srcfile'    : '%s/schema-task.ldif' % TMP_DATA_DIR,
            'destfile'   : '%s/schema-task.ldif' % STAGED_DATA_DIR,
            'remotehost' : STAF_REMOTE_HOSTNAME }
            'srcfile'    : tmpTaskLdif,
            'destfile'   : taskLdif,
            'remotehost' : mylocation }
        </call>
        
        <!-- Copy the schema update ldif to remote host's config/schema directory -->
        <message>'Copy schema update ldif file.'</message>
        <call function="'copyFile'">
          { 'location'   : STAF_REMOTE_HOSTNAME,
          { 'location'   : mylocation,
            'srcfile'    : '%s/schema/ldifs/%s' % (STAGED_DATA_DIR,ldifFile),
            'destfile'   : '%s/%s/config/schema/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME,ldifFile),
            'remotehost' : STAF_REMOTE_HOSTNAME }
            'remotehost' : mylocation }
        </call>
        <!-- On line Schema Task with ldapmodify -->
        <message>
          'ldapmodify%s -a -h %s -p %s -D "%s" -w %s' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd)
        </message>
        <process name="'On line Schema Task'">
          <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
          <command>'%s/ldapmodify%s' % (OPENDS_BINPATH,fileExt)</command>
          <parms>'-a -h %s -p %s -D "%s" -w %s' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd)</parms>
          <workdir>'%s' % (OPENDS_BINPATH)</workdir>
          <envs>
                ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
          </envs>
          <stdin>'%s/schema-task.ldif' % STAGED_DATA_DIR</stdin>
          <stderr mode="'stdout'"/>
          <returnstdout/>
        </process>
      <!-- Start the task using ldap task interface -->
      <call function="'StartLdapTask'">
        { 'location'   : mylocation,
          'taskLabel'  : 'Online Schema Task',
          'dsHost'     : dsInstanceHost,
          'dsPort'     : dsInstancePort,
          'dsBindDn'   : dsInstanceDn,
          'dsBindPswd' : dsInstancePswd,
          'dsTaskLdif' : taskLdif }
      </call>
      <!-- Check that the ldap task is completed -->
      <call function="'CheckLdapTask'">
        { 'location'   : mylocation,
          'dsTaskDn'   : taskDN,
          'dsHost'     : dsInstanceHost,
          'dsPort'     : dsInstancePort,
          'dsBindDn'   : dsInstanceDn,
          'dsBindPswd' : dsInstancePswd }
      </call>
        <script>
          schemaTaskRC=RC
          schemaTaskResult=STAXResult
        </script>
    </sequence>
  </function>
        <call function="'checkRC'">
          { 'returncode' : schemaTaskRC ,
            'result'     : schemaTaskResult }
        </call>
        <!-- Check that the task is completed -->
        <script>
          loopRC=1
        </script>
  <function name="StartLdapTask">
    <function-prolog>
      This function starts a task using the ldap task interface
    </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="taskLabel" type="required">
        <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="pathname"/>
      </function-arg-def>
      <function-arg-def name="dsHost" type="optional">
        <function-arg-description>
          Directory server host name
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsPort" type="optional">
        <function-arg-description>
          Directory server port number
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsBindDn" type="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsBindPswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="dsTaskLdif" type="required">
        <function-arg-description>
          Ldif file for task
        </function-arg-description>
        <function-arg-property name="type" value="filename"/>
      </function-arg-def>
    </function-map-args>
        <script>
          searchre = re.compile('ds-task-state: COMPLETED_SUCCESSFULLY')
        </script>
        <!-- Wait for the task to be COMPLETED_SUCCESSFULLY -->
        <loop from="1" to="5" while="loopRC != 0">
          <sequence>
            <message>
              'ldapsearch%s -h %s -p %s -D "%s" -w %s -s base -b "%s" "objectclass=*" ds-task-state' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,taskDN)
            </message>
            <process name="'Search On line Restore Task'">
              <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
              <command>'%s/ldapsearch%s' % (OPENDS_BINPATH,fileExt)</command>
              <parms>'-h %s -p %s -D "%s" -w %s -s base -b "%s" "objectclass=*" ds-task-state' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,taskDN)</parms>
              <workdir>'%s' % (OPENDS_BINPATH)</workdir>
              <envs>
                    ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
              </envs>
              <stderr mode="'stdout'"/>
              <returnstdout/>
            </process>
            <script>
              searchRC=RC
              searchResult=STAXResult
            </script>
    <sequence>
    
            <script>
              result = STAXResult[0][1]
            </script>
      <!-- Local variables -->
      <script>
        mylocation=location
      </script>
      <!-- Build the Modify Command -->
      <script>
        STAFCmdParamsList=[]
        STAFCmdParams=''
        if dsPath:
          STAFCmd='%s/bin/ldapmodify%s' % (dsPath,fileExt)
        STAFCmdParamsList.append('-a')
        if dsHost:
          STAFCmdParamsList.append('-h %s' % dsHost)
        if dsPort:
          STAFCmdParamsList.append('-p %s' % dsPort)
        if dsBindDn:
          STAFCmdParamsList.append('-D "%s"' % dsBindDn)
        if dsBindPswd:
          STAFCmdParamsList.append('-w "%s"' % dsBindPswd)
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      <message>
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <!-- Perform Task with ldapmodify -->
      <process name="'%s' % taskLabel">
        <location>'%s' % mylocation</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s/bin' % dsPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stdin>'%s' % dsTaskLdif</stdin>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
      </call>
    </sequence>
    
            <if expr='re.search(searchre, result) != None'>
              <sequence>
                <script>loopRC=0</script>
              </sequence>
            <else>
              <message log="1" level="'Warning'">
                'No match on ds-task-state.'
  </function>
  <function name="CheckLdapTask">
    <function-prolog>
      This function checks a task using the ldap task interface
    </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="dsTaskDn" type="required">
        <function-arg-description>
          Dn of the task to be performed
        </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="pathname"/>
      </function-arg-def>
      <function-arg-def name="dsHost" type="optional">
        <function-arg-description>
          Directory server host name
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsPort" type="optional">
        <function-arg-description>
          Directory server port number
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsBindDn" type="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsBindPswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
      </script>
      <script>
        STAFCmdParamsList=[]
        STAFCmdParams=''
        if dsPath:
          STAFCmd='%s/bin/ldapsearch%s' % (dsPath,fileExt)
        if dsHost:
          STAFCmdParamsList.append('-h %s' % dsHost)
        if dsPort:
          STAFCmdParamsList.append('-p %s' % dsPort)
        if dsBindDn:
          STAFCmdParamsList.append('-D "%s"' % dsBindDn)
        if dsBindPswd:
          STAFCmdParamsList.append('-w "%s"' % dsBindPswd)
        if dsTaskDn:
          STAFCmdParamsList.append('-b "%s"' % dsTaskDn)
        dsScope='base'
        STAFCmdParamsList.append('-s %s' % dsScope)
        dsFilter='"objectclass=*"'
        STAFCmdParamsList.append('%s' % dsFilter)
        dsAttribute='ds-task-state'
        STAFCmdParamsList.append('%s' % dsAttribute)
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      <script>
        searchre = re.compile('ds-task-state: COMPLETED_SUCCESSFULLY')
      </script>
      <!-- Wait for the task to be COMPLETED_SUCCESSFULLY -->
      <script>RC=1</script>
      <loop from="1" to="5" while="RC != 0">
        <sequence>
          <message>
            '%s %s' % (STAFCmd, STAFCmdParams)
          </message>
          <!-- Search for task status -->
          <process name="'Search On line Import Task'">
            <location>'%s' % mylocation</location>
            <command>'%s' % STAFCmd</command>
            <parms>'%s' % STAFCmdParams</parms>
            <workdir>'%s/bin' % dsPath</workdir>
            <envs>
              ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
            </envs>
            <stderr mode="'stdout'"/>
            <returnstdout/>
          </process>
          <script>
            searchRC=RC
            searchResult=STAXResult
          </script>
          <script>
            result = STAXResult[0][1]
          </script>
          <if expr='re.search(searchre, result) != None'>
            <sequence>
              <script>RC=0</script>
              <message>
                '%s' % searchResult
              </message>
            </else>
            </if>
            <call function="'checkRC'">
                { 'returncode' : searchRC ,
                  'result'     : searchResult }
            </call>
            </sequence>
          <else>
            <message level="'Warning'">
              '%s' % searchResult
            </message>
          </else>
          </if>
          
            <call function="'Sleep'">
              { 'sleepForMilliSeconds' : '2000' }
            </call>
          </sequence>
        </loop>
        <return>loopRC</return>
      </sequence>
    </function>
          <call function="'checkRC'">
              { 'returncode' : searchRC ,
                'result'     : searchResult }
          </call>
          <call function="'Sleep'">
            { 'sleepForMilliSeconds' : '2000' }
          </call>
        </sequence>
      </loop>
    </sequence>
    
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/shared/functions/ldap.xml
@@ -28,48 +28,113 @@
<stax>
  <function name="addEntry">
    <function-prolog>
      This function adds an entry to the Directory Server
      This function adds an entry to the Directory Server from an ldif file
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
        Directory Server Host Name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
        Directory Server Port Number
      </function-required-arg>
      <function-required-arg name="dsInstanceDn">
        Directory Server Manager DN
      </function-required-arg>
      <function-required-arg name="dsInstancePswd">
        Directory Server Manager Password
      </function-required-arg>
      <function-required-arg name="entryToBeAdded">
        Entry to be added to Directory Server in ldif format
      </function-required-arg>
      <function-optional-arg name="extraParams" default="' '">
        Optional extra parameters for specific test cases
      </function-optional-arg>
      <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">
        <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="optional">
        <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="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="entryToBeAdded" type="required">
        <function-arg-description>
          Entry to be added to Directory Server in ldif format
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional">
        <function-arg-description>
          Optional extra parameters for specific test cases
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
      </script>
      <!-- Build the Command -->
      <script>
        STAFCmdParamsList=[]
        STAFCmdParams=''
        if dsPath:
          STAFCmd='%s/bin/ldapmodify%s' % (dsPath,fileExt)
        STAFCmdParamsList.append('-a')
      </script>
      <!-- Set common ldap arguments -->
      <call function="'_ldapCommonArgs'"/>
      <script>
        if extraParams:
          STAFCmdParamsList.append('%s' % extraParams)
        if entryToBeAdded:
          STAFCmdParamsList.append('-f "%s"' % entryToBeAdded)
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      <message>
        'ldapmodify%s -a -h %s -p %s -D "%s" -w %s %s -f "%s"' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,extraParams,entryToBeAdded)
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'Add Entry'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/ldapmodify%s' % (OPENDS_BINPATH,fileExt)</command>
        <parms>'-a -h %s -p %s -D "%s" -w %s %s -f "%s"' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,extraParams,entryToBeAdded)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
      <process name="'Add Entry from ldif file'">
        <location>'%s' % mylocation</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s/bin' % dsPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
      </call>
    </sequence>
  </function>
  <function name="modifyEntry">
@@ -77,45 +142,109 @@
      This function modifies an entry in the Directory Server
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
        Directory Server Host Name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
        Directory Server Port Number
      </function-required-arg>
      <function-required-arg name="dsInstanceDn">
        Directory Server Manager DN
      </function-required-arg>
      <function-required-arg name="dsInstancePswd">
        Directory Server Manager Password
      </function-required-arg>
      <function-required-arg name="entryToBeModified">
        Entry to be modified in the Directory Server in ldif format
      </function-required-arg>
      <function-optional-arg name="extraParams" default="' '">
        Optional extra parameters for specific test cases
      </function-optional-arg>
      <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">
        <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="optional">
        <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="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="entryToBeModified" type="required">
        <function-arg-description>
          Entry to be modified in the Directory Server in ldif format
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional">
        <function-arg-description>
          Optional extra parameters for specific test cases
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
      </script>
      <!-- Build the Command -->
      <script>
        STAFCmdParamsList=[]
        STAFCmdParams=''
        if dsPath:
          STAFCmd='%s/bin/ldapmodify%s' % (dsPath,fileExt)
      </script>
      <!-- Set common ldap arguments -->
      <call function="'_ldapCommonArgs'"/>
      <script>
        if extraParams:
          STAFCmdParamsList.append('%s' % extraParams)
        if entryToBeModified:
          STAFCmdParamsList.append('-f "%s"' % entryToBeModified)
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      <message>
        'ldapmodify%s -h %s -p %s -D "%s" -w %s %s -f "%s"' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,extraParams,entryToBeModified)
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'Modify Entry'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/ldapmodify%s' % (OPENDS_BINPATH,fileExt)</command>
        <parms>'-h %s -p %s -D "%s" -w %s %s -f "%s"' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,extraParams,entryToBeModified)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
      <process name="'Modify Entry from ldif file'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s/bin' % dsPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
      </call>
    </sequence>
  </function>
  <function name="SearchObject">
@@ -123,48 +252,143 @@
      This function searches the Directory Server with optional arguments possible
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
        Directory Server Host Name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
        Directory Server Port Number
      </function-required-arg>
      <function-required-arg name="dsInstanceDn">
        Directory Server Manager DN
      </function-required-arg>
      <function-required-arg name="dsInstancePswd">
        Directory Server Manager Password
      </function-required-arg>
      <function-required-arg name="dsBaseDN">
        The baseDN for the search operation
      </function-required-arg>
      <function-required-arg name="dsFilter">
        The filter for the search operation
      </function-required-arg>
      <function-optional-arg name="extraParams" default="' '">
        Optional extra parameters for specific test cases
      </function-optional-arg>
      <function-optional-arg name="attributes" default="' '">
        Attributes to return
      </function-optional-arg>
      <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="pathname"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceHost" type="optional">
        <function-arg-description>
          Directory Server Host Name
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePort" type="optional">
        <function-arg-description>
          Directory Server Port Number
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceDn" type="optional">
        <function-arg-description>
          Directory Server Manager DN
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional">
        <function-arg-description>
          Directory Server Manager Password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="dsScope" type="optional">
        <function-arg-description>
          The scope of the search operation
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsBaseDN" type="optional">
        <function-arg-description>
          The baseDN for the search operation
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsFilter" type="optional">
        <function-arg-description>
          The filter for the search operation
        </function-arg-description>
        <function-arg-property name="type" value="filter"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional">
        <function-arg-description>
          Optional extra parameters for specific test cases
        </function-arg-description>
        <function-arg-property name="type" value="filter"/>
      </function-arg-def>
      <function-arg-def name="attributes" type="optional">
        <function-arg-description>
          Optional Attributes to return
        </function-arg-description>
        <function-arg-property name="type" value="attributes"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
      </script>
      <!-- Build the Command -->
      <script>
        STAFCmdParamsList=[]
        STAFCmdParams=''
        if dsPath:
          STAFCmd='%s/bin/ldapsearch%s' % (dsPath,fileExt)
      </script>
      <!-- Set common ldap arguments -->
      <call function="'_ldapCommonArgs'"/>
      <script>
        if dsScope:
          STAFCmdParamsList.append('-s %s' % dsScope)
        if extraParams:
          STAFCmdParamsList.append('%s' % extraParams)
        if dsBaseDN:
          STAFCmdParamsList.append('-b "%s"' % dsBaseDN)
        if dsFilter:
          STAFCmdParamsList.append('"%s"' % dsFilter)
        if attributes:
          STAFCmdParamsList.append('%s' % attributes)
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      <message>
        'ldapsearch%s -h %s -p %s -D "%s" -w %s %s -b "%s" "%s" "%s"' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,extraParams,dsBaseDN,dsFilter,attributes)
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'Search Base Object'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/ldapsearch%s' % (OPENDS_BINPATH,fileExt)</command>
        <parms>'-h %s -p %s -D "%s" -w %s %s -b "%s" "%s" %s' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,extraParams,dsBaseDN,dsFilter,attributes)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s/bin' % dsPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <return>STAXResult</return>
      <script>
        SearchRC=RC
        SearchResult=STAXResult
      </script>
      <call function="'checkRC'">
        { 'returncode' : SearchRC ,
          'result'     : SearchResult }
      </call>
      <return>SearchResult</return>
    </sequence>
  </function>
  <function name="SearchObjectNoPwd">
@@ -172,126 +396,248 @@
      This function searches the Directory Server with optional arguments possible
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
        Directory Server Host Name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
        Directory Server Port Number
      </function-required-arg>
      <function-required-arg name="dsInstanceDn">
        Directory Server Manager DN
      </function-required-arg>
      <function-required-arg name="dsBaseDN">
        The baseDN for the search operation
      </function-required-arg>
      <function-required-arg name="dsFilter">
        The filter for the search operation
      </function-required-arg>
      <function-optional-arg name="extraParams" default="' '">
        Optional extra parameters for specific test cases
      </function-optional-arg>
      <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="pathname"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceHost" type="optional">
        <function-arg-description>
          Directory Server Host Name
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePort" type="optional">
        <function-arg-description>
          Directory Server Port Number
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceDn" type="optional">
        <function-arg-description>
          Directory Server Manager DN
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsBaseDN" type="optional">
        <function-arg-description>
          The baseDN for the search operation
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsFilter" type="optional">
        <function-arg-description>
          The filter for the search operation
        </function-arg-description>
        <function-arg-property name="type" value="filter"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional">
        <function-arg-description>
          Optional extra parameters for specific test cases
        </function-arg-description>
        <function-arg-property name="type" value="filter"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <message>
          'ldapsearch%s -h %s -p %s -D "%s" %s -b "%s" "%s"' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,extraParams,dsBaseDN,dsFilter)
      </message>
      <process name="'Search Base Object'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/ldapsearch%s' % (OPENDS_BINPATH,fileExt)</command>
      <process name="'Search Base Object No Password'">
        <location>'%s' % location </location>
        <command>'%s/bin/ldapsearch%s' % (dsPath,fileExt)</command>
        <parms>'-h %s -p %s -D "%s" %s -b "%s" "%s"' % (dsInstanceHost,dsInstancePort,dsInstanceDn,extraParams,dsBaseDN,dsFilter)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
        <workdir>'%s/bin' % dsPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
    </sequence>
  </function>
  <function name="AnonSearchObject">
    <function-prolog>
      This function searches the Directory Server anonymously with optional arguments possible
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
      <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="pathname"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceHost" type="optional">
        <function-arg-description>
          Directory Server Host Name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePort" type="optional">
        <function-arg-description>
          Directory Server Port Number
      </function-required-arg>
      <function-required-arg name="dsBaseDN">
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="dsBaseDN" type="optional">
        <function-arg-description>
          The baseDN for the search operation
      </function-required-arg>
      <function-required-arg name="dsFilter">
        </function-arg-description>
        <function-arg-property name="type" value="dn"/>
      </function-arg-def>
      <function-arg-def name="dsFilter" type="optional">
        <function-arg-description>
          The filter for the search operation
      </function-required-arg>
      <function-optional-arg name="extraParams" default="' '">
        </function-arg-description>
        <function-arg-property name="type" value="filter"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional">
        <function-arg-description>
          Optional extra parameters for specific test cases
      </function-optional-arg>
        </function-arg-description>
        <function-arg-property name="type" value="filter"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <message>
        'ldapsearch%s -h %s -p %s %s -b "%s" "%s"' % (fileExt,dsInstanceHost,dsInstancePort,extraParams,dsBaseDN,dsFilter)
      </message>
      <process name="'Anonymous Search Base Object'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/ldapsearch%s' % (OPENDS_BINPATH,fileExt)</command>
        <location>'%s' % location </location>
        <command>'%s/bin/ldapsearch%s' % (dsPath,fileExt)</command>
        <parms>'-h %s -p %s %s -b "%s" "%s"' % (dsInstanceHost,dsInstancePort,extraParams,dsBaseDN,dsFilter)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
        <workdir>'%s/bin' % dsPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
    </sequence>
  </function>
  <function name="DeleteEntry">
    <function-prolog>
      This function an entry in the Directory Server
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
        Directory Server Host Name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
        Directory Server Port Number
      </function-required-arg>
      <function-required-arg name="dsInstanceDn">
        Directory Server Manager DN
      </function-required-arg>
      <function-required-arg name="dsInstancePswd">
        Directory Server Manager Password
      </function-required-arg>
      <function-required-arg name="dsBaseDN">
        The entry to be deleted
      </function-required-arg>
      <function-optional-arg name="extraParams" default="' '">
        Optional extra parameters for specific test cases
      </function-optional-arg>
      <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">
        <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="optional">
        <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="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="dsBaseDN" type="required">
        <function-arg-description>
          Entry to be deleted in the Directory Server
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional">
        <function-arg-description>
          Optional extra parameters for specific test cases
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
      </script>
      <!-- Build the Command -->
      <script>
        STAFCmdParamsList=[]
        STAFCmdParams=''
        if dsPath:
          STAFCmd='%s/bin/ldapdelete%s' % (dsPath,fileExt)
      </script>
      <!-- Set common ldap arguments -->
      <call function="'_ldapCommonArgs'"/>
      <script>
        if extraParams:
          STAFCmdParamsList.append('%s' % extraParams)
        if dsBaseDN:
          STAFCmdParamsList.append('"%s"' % dsBaseDN)
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      <message>
        'ldapdelete%s -h %s -p %s -D "%s" -w %s %s "%s"' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,extraParams,dsBaseDN)
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'Delete Object'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/ldapdelete%s' % (OPENDS_BINPATH,fileExt)</command>
        <parms>'-h %s -p %s -D "%s" -w %s %s "%s"' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,extraParams,dsBaseDN)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s/bin' % dsPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
      </call>
    </sequence>
  </function>
  <function name="compareEntry">
@@ -299,43 +645,139 @@
      This function compares the attribute and value an entry to the Directory Server
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
        Directory Server Host Name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
        Directory Server Port Number
      </function-required-arg>
      <function-required-arg name="dsInstanceDn">
        Directory Server Manager DN
      </function-required-arg>
      <function-required-arg name="dsInstancePswd">
        Directory Server Manager Password
      </function-required-arg>
      <function-required-arg name="attrToBeCompared">
        Attribute to be compared in Directory Server
      </function-required-arg>
      <function-required-arg name="entryToBeCompared">
        Entry to be compared in Directory Server
      </function-required-arg>
      <function-optional-arg name="extraParams" default="' '">
        Optional extra parameters for specific test cases
      </function-optional-arg>
      <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">
        <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="optional">
        <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="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="attrToBeCompared" type="required">
        <function-arg-description>
          Attribute to be compared in Directory Server
        </function-arg-description>
        <function-arg-property name="type" value="attribute"/>
      </function-arg-def>
      <function-arg-def name="entryToBeCompared" type="required">
        <function-arg-description>
          Entry to be compared in Directory Server
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional">
        <function-arg-description>
          Optional extra parameters for specific test cases
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
      </script>
      <!-- Build the Command -->
      <script>
        STAFCmdParamsList=[]
        STAFCmdParams=''
        if dsPath:
          STAFCmd='%s/bin/ldapcompare%s' % (dsPath,fileExt)
      </script>
      <!-- Set common ldap arguments -->
      <call function="'_ldapCommonArgs'"/>
      <script>
        if extraParams:
          STAFCmdParamsList.append('%s' % extraParams)
        if attrToBeCompared:
          STAFCmdParamsList.append('"%s"' % attrToBeCompared)
        if entryToBeCompared:
          STAFCmdParamsList.append('"%s"' % entryToBeCompared)
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      <message>
        'ldapcompare%s -h %s -p %s -D "%s" -w %s %s  "%s" "%s"' % (fileExt,dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,extraParams,attrToBeCompared,entryToBeCompared)
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'Compare Entry'">
        <location>'%s' % (STAF_REMOTE_HOSTNAME) </location>
        <command>'%s/ldapcompare%s' % (OPENDS_BINPATH,fileExt)</command>
        <parms>'-h %s -p %s -D "%s" -w %s %s  "%s" "%s"' % (dsInstanceHost,dsInstancePort,dsInstanceDn,dsInstancePswd,extraParams,attrToBeCompared,entryToBeCompared)</parms>
        <workdir>'%s' % (OPENDS_BINPATH)</workdir>
      <process name="'Compare Object'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s/bin' % dsPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % (OPENDS_BINPATH), 'JAVA_HOME=%s' % (JAVA_HOME)]
          ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
      </call>
    </sequence>
  </function>
  <function name="_ldapCommonArgs">
    <function-prolog>
      This function resolves common ldap arguments
    </function-prolog>
    <function-no-args/>
    <script>
        if dsInstanceHost:
          STAFCmdParamsList.append('-h %s' % dsInstanceHost)
        if dsInstancePort:
          STAFCmdParamsList.append('-p %s' % dsInstancePort)
        if dsInstanceDn:
          STAFCmdParamsList.append('-D "%s"' % dsInstanceDn)
        if dsInstancePswd:
          STAFCmdParamsList.append('-w "%s"' % dsInstancePswd)
    </script>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/shared/functions/security.xml
@@ -31,36 +31,77 @@
      This function makes the configuration changes for SSL
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
        Directory Server Host Name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
        Directory Server Port Number
      </function-required-arg>
      <function-required-arg name="dsInstanceDn">
        Directory Server Manager DN
      </function-required-arg>
      <function-required-arg name="dsInstancePswd">
        Directory Server Manager Password
      </function-required-arg>
      <function-required-arg name="keystoreType">
        Keystore type
      </function-required-arg>
      <function-optional-arg name="extraParams" default="' '">
        Optional extra parameters for specific test cases
      </function-optional-arg>
     <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">
        <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="optional">
        <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="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="keystoreType" type="required">
        <function-arg-description>
          Keystore type
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional">
        <function-arg-description>
          Optional extra parameters for specific test cases
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
        myhost=dsInstanceHost
        myport=dsInstancePort
        mydn=dsInstanceDn
        mypswd=dsInstancePswd
      </script>
      <!--- Enable Key Manager Provider -->
      <message>
       'Enabling Key Manager Provider'
      </message>
      <call function="'modifyEntry'">
        { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
          'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
          'entryToBeModified'   : '%s/security/%s/setup/enable_key_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
        { 'location'          : mylocation ,
          'dsInstanceHost'    : myhost ,
          'dsInstancePort'    : myport ,
          'dsInstanceDn'      : mydn ,
          'dsInstancePswd'    : mypswd ,
          'entryToBeModified' : '%s/security/%s/setup/enable_key_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
      </call>
      <call function="'checkRC'">
      { 'returncode' : RC ,
@@ -73,11 +114,12 @@
      </message>
      <call function="'modifyEntry'">
        { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
          'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
          'entryToBeModified'   : '%s/security/%s/setup/enable_trust_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
        { 'location'          : mylocation ,
          'dsInstanceHost'    : myhost ,
          'dsInstancePort'    : myport ,
          'dsInstanceDn'      : mydn ,
          'dsInstancePswd'    : mypswd ,
          'entryToBeModified' : '%s/security/%s/setup/enable_trust_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
      </call>
      <call function="'checkRC'">
@@ -91,11 +133,12 @@
      </message>
      <call function="'modifyEntry'">
        { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
          'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
          'entryToBeModified'   : '%s/ldaps_port.ldif' % (STAGED_DATA_DIR) }
        { 'location'          : mylocation ,
          'dsInstanceHost'    : myhost ,
          'dsInstancePort'    : myport ,
          'dsInstanceDn'      : mydn ,
          'dsInstancePswd'    : mypswd ,
          'entryToBeModified' : '%s/ldaps_port.ldif' % (STAGED_DATA_DIR) }
      </call>
      <call function="'checkRC'">
@@ -108,18 +151,19 @@
      </message>
      <call function="'modifyEntry'">
        { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
          'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
          'entryToBeModified'   : '%s/security/%s/setup/enable_ldaps_conn_handler.ldif' % (STAGED_DATA_DIR,keystoreType) }
        { 'location'          : mylocation ,
          'dsInstanceHost'    : myhost ,
          'dsInstancePort'    : myport ,
          'dsInstanceDn'      : mydn ,
          'dsInstancePswd'    : mypswd ,
          'entryToBeModified' : '%s/security/%s/setup/enable_ldaps_conn_handler.ldif' % (STAGED_DATA_DIR,keystoreType) }
      </call>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
      </call>
</sequence>
    </sequence>
  </function>
  <function name="configureTLS">
@@ -127,33 +171,74 @@
      This function makes the configuration changes for startTLS
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
          Directory Server Host Name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
          Directory Server Port Number
      </function-required-arg>
      <function-required-arg name="dsInstanceDn">
          Directory Server Manager DN
      </function-required-arg>
      <function-required-arg name="dsInstancePswd">
          Directory Server Manager Password
      </function-required-arg>
      <function-required-arg name="keystoreType">
      <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">
        <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="optional">
        <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="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="keystoreType" type="required">
        <function-arg-description>
          Keystore type
      </function-required-arg>
      <function-optional-arg name="extraParams" default="' '">
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional">
        <function-arg-description>
          Optional extra parameters for specific test cases
      </function-optional-arg>
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
      <sequence>
        <!--- Enable Key Manager Provider -->
      <!-- Local variables -->
      <script>
        mylocation=location
        myhost=dsInstanceHost
        myport=dsInstancePort
        mydn=dsInstanceDn
        mypswd=dsInstancePswd
      </script>
      <!--- Enable Key Manager Provider -->
      <call function="'modifyEntry'">
        { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
          'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
          'entryToBeModified'   : '%s/security/%s/setup/enable_key_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
        { 'location'          : mylocation ,
          'dsInstanceHost'    : myhost ,
          'dsInstancePort'    : myport ,
          'dsInstanceDn'      : mydn ,
          'dsInstancePswd'    : mypswd ,
          'entryToBeModified' : '%s/security/%s/setup/enable_key_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
      </call>
      <call function="'checkRC'">
      { 'returncode' : RC ,
@@ -166,11 +251,12 @@
      </message>
      <call function="'modifyEntry'">
        { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
          'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
          'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
          'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
          'entryToBeModified'   : '%s/security/%s/setup/enable_trust_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
        { 'location'          : mylocation ,
          'dsInstanceHost'    : myhost ,
          'dsInstancePort'    : myport ,
          'dsInstanceDn'      : mydn ,
          'dsInstancePswd'    : mypswd ,
          'entryToBeModified' : '%s/security/%s/setup/enable_trust_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
      </call>
      <call function="'checkRC'">
@@ -183,18 +269,19 @@
         'Enabling StartTLS'
        </message>
        <call function="'addEntry'">
          { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
            'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
            'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
            'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
            'entryToBeAdded'   : '%s/security/%s/setup/enable_startTLS.ldif' % (STAGED_DATA_DIR,keystoreType) }
        </call>
      <call function="'addEntry'">
        { 'location'        : mylocation ,
          'dsInstanceHost'  : myhost ,
          'dsInstancePort'  : myport ,
          'dsInstanceDn'    : mydn ,
          'dsInstancePswd'  : mypswd ,
          'entryToBeAdded'  : '%s/security/%s/setup/enable_startTLS.ldif' % (STAGED_DATA_DIR,keystoreType) }
      </call>
        <call function="'checkRC'">
          { 'returncode' : RC ,
            'result'     : STAXResult }
        </call>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
      </call>
    </sequence>
  </function>
@@ -203,160 +290,245 @@
      This function reverses the configuration changes for SSL
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
        Directory Server Host Name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
        Directory Server Port Number
      </function-required-arg>
      <function-required-arg name="dsInstanceDn">
        Directory Server Manager DN
      </function-required-arg>
      <function-required-arg name="dsInstancePswd">
        Directory Server Manager Password
      </function-required-arg>
      <function-required-arg name="keystoreType">
        Keystore type
      </function-required-arg>
      <function-optional-arg name="extraParams" default="' '">
        Optional extra parameters for specific test cases
      </function-optional-arg>
      <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">
        <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="optional">
        <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="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="keystoreType" type="required">
        <function-arg-description>
          Keystore type
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional">
        <function-arg-description>
          Optional extra parameters for specific test cases
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
        <!--- Disable LDAPS Connection Handler -->
        <message>
           'Disabling LDAPS Connection Handler'
        </message>
        <call function="'modifyEntry'">
          { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
            'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
            'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
            'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
            'entryToBeModified'   : '%s/security/%s/teardown/disable_ldaps_conn_handler.ldif' % (STAGED_DATA_DIR,keystoreType) }
        </call>
        <call function="'checkRC'">
            { 'returncode' : RC ,
              'result'     : STAXResult }
        </call>
        <!--- Disable SSL Trust Manager Provider -->
        <message>
           'Disabling SSL Trust Manager Provider'
        </message>
        <call function="'modifyEntry'">
          { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
            'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
            'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
            'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
            'entryToBeModified'   : '%s/security/%s/teardown/disable_trust_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
        </call>
        <call function="'checkRC'">
            { 'returncode' : RC ,
              'result'     : STAXResult }
        </call>
        <!--- Disable Key Manager Provider -->
        <message>
           'Disabling Key Manager Provider'
        </message>
        <call function="'modifyEntry'">
          { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
            'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
            'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
            'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
            'entryToBeModified'   : '%s/security/%s/teardown/disable_key_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
        </call>
        <call function="'checkRC'">
            { 'returncode' : RC ,
              'result'     : STAXResult }
        </call>
      </sequence>
    </function>
      <!-- Local variables -->
      <script>
        mylocation=location
        myhost=dsInstanceHost
        myport=dsInstancePort
        mydn=dsInstanceDn
        mypswd=dsInstancePswd
      </script>
      <!--- Disable LDAPS Connection Handler -->
      <message>
         'Disabling LDAPS Connection Handler'
      </message>
      <call function="'modifyEntry'">
        { 'location'          : mylocation ,
          'dsInstanceHost'    : myhost ,
          'dsInstancePort'    : myport ,
          'dsInstanceDn'      : mydn ,
          'dsInstancePswd'    : mypswd ,
          'entryToBeModified' : '%s/security/%s/teardown/disable_ldaps_conn_handler.ldif' % (STAGED_DATA_DIR,keystoreType) }
      </call>
      <call function="'checkRC'">
          { 'returncode' : RC ,
            'result'     : STAXResult }
      </call>
      <!--- Disable SSL Trust Manager Provider -->
      <message>
         'Disabling SSL Trust Manager Provider'
      </message>
      <call function="'modifyEntry'">
        { 'location'          : mylocation ,
          'dsInstanceHost'    : myhost ,
          'dsInstancePort'    : myport ,
          'dsInstanceDn'      : mydn ,
          'dsInstancePswd'    : mypswd ,
          'entryToBeModified' : '%s/security/%s/teardown/disable_trust_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
      </call>
      <call function="'checkRC'">
          { 'returncode' : RC ,
            'result'     : STAXResult }
      </call>
      <!--- Disable Key Manager Provider -->
      <message>
         'Disabling Key Manager Provider'
      </message>
      <call function="'modifyEntry'">
        { 'location'          : mylocation ,
          'dsInstanceHost'    : myhost ,
          'dsInstancePort'    : myport ,
          'dsInstanceDn'      : mydn ,
          'dsInstancePswd'    : mypswd ,
          'entryToBeModified' : '%s/security/%s/teardown/disable_key_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
      </call>
      <call function="'checkRC'">
          { 'returncode' : RC ,
            'result'     : STAXResult }
      </call>
    </sequence>
  </function>
  <function name="unconfigureTLS">
    <function-prolog>
      This function reverses the configuration changes for startTLS
    </function-prolog>
    <function-map-args>
      <function-required-arg name="dsInstanceHost">
        Directory Server Host Name
      </function-required-arg>
      <function-required-arg name="dsInstancePort">
        Directory Server Port Number
      </function-required-arg>
      <function-required-arg name="dsInstanceDn">
        Directory Server Manager DN
      </function-required-arg>
      <function-required-arg name="dsInstancePswd">
        Directory Server Manager Password
      </function-required-arg>
      <function-required-arg name="keystoreType">
        Keystore type
      </function-required-arg>
      <function-optional-arg name="extraParams" default="' '">
        Optional extra parameters for specific test cases
      </function-optional-arg>
      <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">
        <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="optional">
        <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="optional">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="keystoreType" type="required">
        <function-arg-description>
          Keystore type
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional">
        <function-arg-description>
          Optional extra parameters for specific test cases
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
        myhost=dsInstanceHost
        myport=dsInstancePort
        mydn=dsInstanceDn
        mypswd=dsInstancePswd
      </script>
      <!--- Disable StartTLS -->
        <message>
         'Disabling StartTLS'
        </message>
        <call function="'modifyEntry'">
          { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
            'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
            'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
            'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
            'entryToBeModified'   : '%s/security/%s/teardown/disable_startTLS.ldif' % (STAGED_DATA_DIR,keystoreType) }
        </call>
        <call function="'checkRC'">
            { 'returncode' : RC ,
              'result'     : STAXResult }
        </call>
        <!--- Disable SSL Trust Manager Provider -->
        <message>
           'Disabling SSL Trust Manager Provider'
        </message>
        <call function="'modifyEntry'">
          { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
            'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
            'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
            'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
            'entryToBeModified'   : '%s/security/%s/teardown/disable_trust_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
        </call>
        <call function="'checkRC'">
            { 'returncode' : RC ,
              'result'     : STAXResult }
        </call>
        <!--- Disable Key Manager Provider -->
        <message>
           'Disabling Key Manager Provider'
        </message>
        <call function="'modifyEntry'">
          { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
            'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
            'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
            'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
            'entryToBeModified'   : '%s/security/%s/teardown/disable_key_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
        </call>
        <call function="'checkRC'">
            { 'returncode' : RC ,
              'result'     : STAXResult }
        </call>
      <message>
       'Disabling StartTLS'
      </message>
      <call function="'modifyEntry'">
        { 'location'          : mylocation ,
          'dsInstanceHost'    : myhost ,
          'dsInstancePort'    : myport ,
          'dsInstanceDn'      : mydn ,
          'dsInstancePswd'    : mypswd ,
          'entryToBeModified' : '%s/security/%s/teardown/disable_startTLS.ldif' % (STAGED_DATA_DIR,keystoreType) }
      </call>
      <call function="'checkRC'">
          { 'returncode' : RC ,
            'result'     : STAXResult }
      </call>
      <!--- Disable SSL Trust Manager Provider -->
      <message>
         'Disabling SSL Trust Manager Provider'
      </message>
      <call function="'modifyEntry'">
        { 'location'          : mylocation ,
          'dsInstanceHost'    : myhost ,
          'dsInstancePort'    : myport ,
          'dsInstanceDn'      : mydn ,
          'dsInstancePswd'    : mypswd ,
          'entryToBeModified' : '%s/security/%s/teardown/disable_trust_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
      </call>
      <call function="'checkRC'">
          { 'returncode' : RC ,
            'result'     : STAXResult }
      </call>
      <!--- Disable Key Manager Provider -->
      <message>
         'Disabling Key Manager Provider'
      </message>
      <call function="'modifyEntry'">
        { 'location'          : mylocation ,
          'dsInstanceHost'    : myhost ,
          'dsInstancePort'    : myport ,
          'dsInstanceDn'      : mydn ,
          'dsInstancePswd'    : mypswd ,
          'entryToBeModified' : '%s/security/%s/teardown/disable_key_mgr_provider.ldif' % (STAGED_DATA_DIR,keystoreType) }
      </call>
      <call function="'checkRC'">
          { 'returncode' : RC ,
            'result'     : STAXResult }
      </call>
      </sequence>
    </function>
</stax>
opendj-sdk/opends/tests/functional-tests/shared/functions/stafcmd.xml
@@ -93,7 +93,7 @@
      </function-arg-def>
      <function-arg-def name="destfolder" type="required">
        <function-arg-description>
          The name of the destination fule
          The name of the destination file
        </function-arg-description>
        <function-arg-property name="type" value="foldername"/>
      </function-arg-def>
opendj-sdk/opends/tests/functional-tests/shared/functions/topology.xml
New file
@@ -0,0 +1,564 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <function name="createTopology">
    <function-prolog>
        This function creates the topology required by the Test Group/Suite.
    </function-prolog>
    <function-map-args>
      <function-arg-def name="topologyDescFile" type="optional" default="None">
        <function-arg-description>
          Topology Description file
        </function-arg-description>
        <function-arg-property name="type" value="filePath"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <if expr="topologyDescFile == None">
          <!-- SINGLE instance deployment: read parameters from config.py (done by default) -->
          <sequence>
            <message>
              'SINGLE instance deployment: read parameters from config.py'
            </message>
            <call function="'createInstance'"></call>
          </sequence>
      <else>
          <!-- MULTIPLE instance deployment: read parameters from topologyDescFile -->
          <sequence>
            <message>
              'MULTIPLE instance deployment: read parameters from %s' % topologyDescFile
            </message>
            <!-- Parse the topology description file and set _topologyServerList -->
            <call function="'readTopology'">
              { 'file' : topologyDescFile }
            </call>
            <message>
              'Number of server instances required by the deployment: %s' % len(_topologyServerList)
            </message>
            <iterate var="server" in="_topologyServerList">
              <sequence>
                <!-- Create the instance-->
                <call function="'createInstance'">
                  { 'dsHost' : server.getHostname(),
                    'dsDir' : server.getDir(),
                    'dsPort' : server.getPort(),
                    'dsSslPort' : server.getSslPort(),
                    'dsBindDN' : server.getRootDn(),
                    'dsBindPwd' : server.getRootPwd(),
                    'dsBaseDN' : server.getBaseDn() }
                </call>
                <!-- Configure synchronization if required so by the server
                  !  (i.e. server is a changelog server and/or has synchronized suffixes) -->
                <if expr="server.requiresSynchronization()">
                  <sequence>
                    <message> 'Instance requires SYNCHRONIZATION configuration.' </message>
                    <script>
                      serverMap = {}
                      serverMap['instance'] = server
                    </script>
                    <call function="'configureSynchronization'">
                      [serverMap]
                    </call>
                  </sequence>
                </if>
              </sequence>
            </iterate>
          </sequence>
      </else>
      </if>
    </sequence>
  </function>
  <function name="createInstance">
    <function-prolog>
        This function creates an instance on a given host.
        It copies both data and OpenDS zip files onto the host,
        unzips them, and configures OpenDS.
    </function-prolog>
    <function-map-args>
      <function-arg-def name="dsHost" type="optional" default="DIRECTORY_INSTANCE_HOST">
        <function-arg-description>
          Hostname where the instance is to be created
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsDir" type="optional" default="DIRECTORY_INSTANCE_DIR">
        <function-arg-description>
          Directory where OpenDS will be installed
        </function-arg-description>
        <function-arg-property name="type" value="filepath"/>
      </function-arg-def>
      <function-arg-def name="dsPort" type="optional" default="DIRECTORY_INSTANCE_PORT">
        <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="dsSslPort" type="optional" default="DIRECTORY_INSTANCE_SSL_PORT">
        <function-arg-description>
          Directory Server SSL port number
        </function-arg-description>
        <function-arg-property name="type" value="Port number"/>
      </function-arg-def>
      <function-arg-def name="dsBindDN" type="optional" default="DIRECTORY_INSTANCE_DN">
        <function-arg-description>
          Directory Manager DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsBindPwd" type="optional" default="DIRECTORY_INSTANCE_PSWD">
        <function-arg-description>
          Directory Server SSL port number
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="dsBaseDN" type="optional" default="DIRECTORY_INSTANCE_SFX">
        <function-arg-description>
          Directory Server base suffix dn
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <message>
        'Create instance in host %s at directory %s' % (dsHost,dsDir)
      </message>
      <!--- Delete folder if it exists on remote host-->
      <message>
        'Delete folder %s/%s on host %s' % (dsDir,OPENDSNAME,dsHost)
      </message>
      <call function="'deleteFolder'">
        { 'location' : dsHost,
          'foldername' : '%s/%s' % (dsDir,OPENDSNAME) }
      </call>
      <!--- Create folder on remote host-->
      <message>
        'Create folder %s on host %s' % (dsDir,dsHost)
      </message>
      <call function="'createFolder'">
        { 'location' : dsHost,
          'foldername' : '%s' % dsDir }
      </call>
      <!---   Copy staging data to remote host -->
      <message>
        'Copy tests to %s on %s' % (dsDir,dsHost)
      </message>
      <call function="'copyFile'">
        { 'srcfile'    : '%s/ldifdata.zip' % TMPDIR,
          'destfile'   : '%s/ldifdata.zip' % dsDir,
          'remotehost' : dsHost }
      </call>
      <!---   Unzip contents of staging data on remote host -->
      <message>
        'Extract contents of test data %s on %s' % (dsDir,dsHost)
      </message>
      <call function="'unZipFile'">
        { 'location' : dsHost,
          'zipfile'  : '%s/ldifdata.zip' % dsDir,
          'unzipdir' : dsDir }
      </call>
      <!--- Install DS Copy zip file -->
      <message>
        'Copy DS zip archive to %s on %s' % (DSTFILE,dsHost)
      </message>
      <call function="'copyFile'">
        { 'srcfile'    : SRCFILE,
          'destfile'   : DSTFILE,
          'remotehost' : dsHost }
      </call>
       <!--- Install DS Extract zip file -->
      <message>
        'Extract DS zip archive to %s on %s' % (dsDir,dsHost)
      </message>
      <call function="'unZipFile'">
        { 'location' : dsHost,
          'zipfile'  : DSTFILE,
          'unzipdir' : dsDir }
      </call>
      <!--- Configure DS -->
      <message>
        'Configure DS on %s : %s/%s' % (dsHost,dsDir,OPENDSNAME)
      </message>
      <call function="'ConfigureDsWithScript'">
        { 'location' : dsHost,
          'dsPath' : '%s/%s' % (dsDir, OPENDSNAME),
          'dsPort'   : dsPort ,
          'dsBindDN' : dsBindDN,
          'dsBindPwd' : dsBindPwd,
          'dsBaseDN' : dsBaseDN }
      </call>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
      </call>
      <if expr="returncode == 0">
        <message>
          'Instance created.'
        </message>
        <else>
          <message>
              'Failed to create instance.'
          </message>
        </else>
      </if>
    </sequence>
  </function>
  <function name="configureSynchronization">
    <function-prolog>
      This function configures synchronization in a given server.
    </function-prolog>
    <function-list-args>
      <function-arg-def name="syncserverMap" type="required">
        <function-arg-description>
          Map containing a Server class instance representing the server to configure.
        </function-arg-description>
        <function-arg-property name="type" value="map"/>
      </function-arg-def>
    </function-list-args>
    <sequence>
      <script>
        syncserver = syncserverMap['instance']
        filename = 'synchronization_conf.ldif'
        filePath = '%s/%s' % (TMP_DATA_DIR,filename)
        dataDir = '%s/functional-tests/shared/data' % syncserver.getDir()
        write_synchronization_conf_ldif_file(filePath, syncserver)
      </script>
      <message>
        'Configure synchronization on server on host %s at directory %s' % (syncserver.getHostname(),syncserver.getDir())
      </message>
      <!-- Copy the synchronization_conf ldif to remote host -->
      <message>
        'Copy %s file from %s to %s' % (filename,TMP_DATA_DIR,dataDir)
      </message>
      <call function="'copyFile'">
        { 'srcfile'    : filePath,
          'destfile'   : '%s/%s' % (dataDir,filename),
          'remotehost' : syncserver.getHostname() }
      </call>
      <!--- Add synchronization configuration entries to config.ldif in server -->
      <script>
        remoteFilePath = '%s/%s' % (dataDir, filename)
        configPath = '%s/%s/config/config.ldif' % (syncserver.getDir(),OPENDSNAME)
      </script>
      <stafcmd>
        <location> syncserver.getHostname() </location>
        <service> 'FS' </service>
        <request> 'GET ENTRY %s SIZE' % configPath </request>
      </stafcmd>
      <script>
        if RC == STAFRC.Ok:
          configFileSize = STAFResult['lowerSize']
        cmd = '/bin/dd'
        cmdParamsList = []
        cmdParamsList.append('if=%s' % remoteFilePath)
        cmdParamsList.append('of=%s' % configPath)
        cmdParamsList.append('conv=notrunc bs=1 seek=%s' % configFileSize)
        cmdParams = ' '.join(cmdParamsList)
      </script>
      <message>
        'Append %s to %s' % (remoteFilePath,configPath)
      </message>
      <message>
         '%s %s' % (cmd,cmdParams)
      </message>
      <process name="'Append Synchronization Entries to config.ldif'">
        <location> syncserver.getHostname() </location>
        <command> '%s' % cmd </command>
        <parms>'%s' % cmdParams </parms>
        <workdir> '/bin' </workdir>
        <envs>
          ['PATH=/bin:/usr/bin', 'JAVA_HOME=%s' % (JAVA_HOME)]
        </envs>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <call function="'checkRC'">
        { 'returncode' : RC ,
          'result'     : STAXResult }
      </call>
    </sequence>
  </function>
  <function name="readTopology">
    <function-prolog>
      This function reads the topology from a given file.
      It parses the topology description file and sets _topologyServerList, a list of the servers
      that form the topology.
    </function-prolog>
    <function-map-args>
      <function-arg-def name="file" type="required">
        <function-arg-description>
          File containing the topology description.
        </function-arg-description>
        <function-arg-property name="type" value="filePath"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <message>
        'Parse file %s for topology parameters' % file
      </message>
      <script>
        _topologyServerList = []
        f = open(file, 'r')
        hostname = None
        dir = None
        port = None
        sslport = None
        rootDn = None
        rootPwd = None
        baseDn = None
        changelogport = None
        suffixList = []
        changelogList = []
        serverId = 1
        fileLines = f.readlines()
        for line in fileLines:
          if line.startswith('#'):
            continue
          elif line.find('Hostname') != -1:
            hostname = line[line.find('Hostname') + 9:].strip()
          elif line.find('Directory') !=-1:
            dir = line[line.find('Directory') + 10:].strip()
          elif line.find('Port') != -1:
            port = line[line.find('Port') + 5:].strip()
          elif line.find('Sslport') != -1:
            sslport = line[line.find('Sslport') + 8:].strip()
          elif line.find('RootDn') != -1:
            rootDn = line[line.find('RootDn') + 7:].strip()
          elif line.find('RootPwd') != -1:
            rootPwd = line[line.find('RootPwd') + 8:].strip()
          elif line.find('BaseDn') != -1:
            baseDn = line[line.find('BaseDn') + 7:].strip()
          elif line.find('Changelogport') != -1:
            changelogport = line[line.find('Changelogport') + 14:].strip()
          elif line.find('SynchronizedSuffix') != -1:
            suffixList.append( line[line.find('SynchronizedSuffix') + 19:].strip() )
          elif line.find('ChangelogServer') != -1:
            changelogList.append( line[line.find('ChangelogServer') + 16:].strip() )
          elif (line.isspace()) or (len(line) == 0):
            server = Server(hostname, dir, port, sslport, rootDn, rootPwd, baseDn)
            if changelogport != None:
              changelogServer = ChangelogServer(changelogport, serverId)
              for item in changelogList:
                srv = item[:item.find(':')]
                prt = item[item.find(':') + 1:]
                changelogServer.addChangelogServer(srv, prt)
              server.addChangelogServer(changelogServer)
            for suffix in suffixList:
              synchroSuffix = SynchronizedSuffix(suffix, serverId)
              for item in changelogList:
                srv = item[:item.find(':')]
                prt = item[item.find(':') + 1:]
                synchroSuffix.addChangelogServer(srv, prt)
              server.addSynchronizedSuffix(synchroSuffix)
            _topologyServerList.append(server)
            hostname = None
            dir = None
            port = None
            sslport = None
            rootDn = None
            rootPwd = None
            baseDn = None
            changelogport = None
            suffixList = []
            changelogList = []
            serverId += 1
        if hostname != None:
          server = Server(hostname, dir, port, sslport, rootDn, rootPwd, baseDn)
          if changelogport != None:
            changelogServer = ChangelogServer(changelogport, serverId)
            for item in changelogList:
              srv = item[:item.find(':')]
              prt = item[item.find(':') + 1:]
              changelogServer.addChangelogServer(srv, prt)
            server.addChangelogServer(changelogServer)
          for suffix in suffixList:
            synchroSuffix = SynchronizedSuffix(suffix, serverId)
            for item in changelogList:
              srv = item[:item.find(':')]
              prt = item[item.find(':') + 1:]
              synchroSuffix.addChangelogServer(srv, prt)
            server.addSynchronizedSuffix(synchroSuffix)
          _topologyServerList.append(server)
        f.close()
      </script>
    </sequence>
  </function>
  <function name="removeTopology">
    <function-prolog>
        This function removes the topology created for the Test Group/Suite.
    </function-prolog>
    <sequence>
      <message>
        'Number of server instances deployed: %s' % len(_topologyServerList)
      </message>
      <iterate var="server" in="_topologyServerList">
        <sequence>
          <message>
            'Cleaning up %s/%s instance on host %s' % (server.getDir(),OPENDSNAME,server.getHostname())
          </message>
          <!--- Delete staging data file on remote host-->
          <message>
            'Delete stagingn data file %s/ldifdata.zip' % server.getDir()
          </message>
          <call function="'deleteFile'">
            { 'location' : server.getHostname(),
              'filename' : '%s/ldifdata.zip' % server.getDir() }
          </call>
          <!--- Delete staging data folder on remote host -->
          <message>
            'Delete staging data folder %s/functional-tests' % server.getDir()
          </message>
          <call function="'deleteFolder'">
            { 'location'   : server.getHostname(),
              'foldername' : '%s/functional-tests' % server.getDir() }
          </call>
          <!--- Delete OPENDS folder on remote host-->
          <message>
            'Delete OPENDS folder %s/%s' % (server.getDir(),OPENDSNAME)
          </message>
          <call function="'deleteFolder'">
            { 'location' : server.getHostname(),
              'foldername' : '%s/%s' % (server.getDir(),OPENDSNAME) }
          </call>
          <!--- Delete OPENDS zip file on remote host-->
          <message>
            'Delete OPENDS zip file %s' % DSTFILE
          </message>
          <call function="'deleteFile'">
            { 'location' : server.getHostname(),
              'filename' : '%s' % DSTFILE }
          </call>
          <message>
            'Instance cleaned up.'
          </message>
        </sequence>
      </iterate>
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/shared/functions/utils.xml
@@ -30,17 +30,26 @@
    <function-prolog>
      This function checks a return code against an expected return code
    </function-prolog>
    <function-map-args>
      <function-required-arg name="returncode">
        return code received from command
      </function-required-arg>
      <function-required-arg name="result">
        the output of the result
      </function-required-arg>
      <function-optional-arg name="expected" default="0">
        the expected return code
      </function-optional-arg>
      <function-arg-def name="returncode" type="required">
        <function-arg-description>
          return code received from command
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="result" type="required">
        <function-arg-description>
          the output of the result
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="expected" type="optional" default="0">
        <function-arg-description>
          the expected return code
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
@@ -48,11 +57,11 @@
        <sequence>
          <if expr="result == ''">
            <message log="1">
              'Success: RC=%s, Result=Ok' % (returncode)
              'RC=%s, Result=Ok' % (returncode)
            </message>
          <else>
            <message log="1">
              'Success: RC=%s, Result=%s' % (returncode,result)
              'RC=%s, Result=%s' % (returncode,result)
            </message>
          </else>
          </if>
@@ -60,7 +69,7 @@
        <else>
          <sequence>
            <message log="1" level="'Error'">
              'Error: RC=%s, Expected %s, Result=%s' % (returncode,expected,result)
              'RC=%s, Expected %s, Result=%s' % (returncode,expected,result)
            </message>
          </sequence>
        </else>
@@ -73,29 +82,38 @@
      This function checks the return code against an expected return code for a testcase
    </function-prolog>
    <function-map-args>
      <function-required-arg name="returncode">
        return code received from command
      </function-required-arg>
      <function-required-arg name="result">
        the output of the result
      </function-required-arg>
      <function-optional-arg name="expected" default="0">
        the expected return code
      </function-optional-arg>
    </function-map-args>
      <function-arg-def name="returncode" type="required">
        <function-arg-description>
          return code received from command
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="result" type="required">
        <function-arg-description>
          the output of the result
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="expected" type="optional" default="0">
        <function-arg-description>
          the expected return code
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <if expr="returncode == expected">
        <sequence>
          <tcstatus result="'pass'"/>
          <message log="1">
            'Success: RC=%s, Result=%s' % (returncode,result)
            'RC=%s, Result=%s' % (returncode,result)
          </message>
        </sequence>
        <else>
          <sequence>
            <tcstatus result="'fail'"/>
            <message log="1" level="'Error'">
              'Error: RC=%s, Expected %s, Result=%s' % (returncode,expected,result)
              'RC=%s, Expected %s, Result=%s' % (returncode,expected,result)
            </message>
          </sequence>
        </else>
@@ -107,14 +125,22 @@
    <function-prolog>
      This function checks the return string against an expected return substring for a testcase
    </function-prolog>
    <function-map-args>
      <function-required-arg name="expectedString">
        the substring expected from the command
      </function-required-arg>
      <function-required-arg name="returnString">
        the return string received from command
      </function-required-arg>
      <function-arg-def name="expectedString" type="required">
        <function-arg-description>
          the substring expected from the command
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="returnString" type="required">
        <function-arg-description>
          the return string received from command
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <script> 
        searchre = re.compile('%s' % expectedString)
@@ -124,14 +150,14 @@
        <sequence>
          <tcstatus result="'pass'"/>
          <message log="1">
            'Success: Found substring, %s, in the return string' % (expectedString)
            'Found substring, %s, in the return string' % (expectedString)
          </message>
        </sequence>
        <else>
          <sequence>
            <tcstatus result="'fail'"/>
            <message log="1" level="'Error'">
              'Error: Did not find substring, %s, in the return string, %s' % (expectedString, returnString)
              'Did not find substring, %s, in the return string, %s' % (expectedString, returnString)
            </message>
          </sequence>
        </else>
@@ -144,12 +170,18 @@
      This function checks the return string against an expected return substring that should not be present for a testcase
    </function-prolog>
    <function-map-args>
      <function-required-arg name="testString">
        the substring being tested from the command
      </function-required-arg>
      <function-required-arg name="returnString">
        the return string received from command
      </function-required-arg>
      <function-arg-def name="testString" type="required">
        <function-arg-description>
          the substring being tested from the command
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="returnString" type="required">
        <function-arg-description>
          the return string received from command
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
@@ -160,14 +192,14 @@
        <sequence>
          <tcstatus result="'pass'"/>
          <message log="1">
            'Success: Did Not Find substring, %s, in the return string' % (testString)
            'Did Not Find substring, %s, in the return string' % (testString)
          </message>
        </sequence>
        <else>
          <sequence>
            <tcstatus result="'fail'"/>
            <message log="1" level="'Error'">
              'Error: Found substring, %s, in the return string, %s' % (testString, returnString)
              'Found substring, %s, in the return string, %s' % (testString, returnString)
            </message>
          </sequence>
        </else>
@@ -179,13 +211,20 @@
    <function-prolog>
      This function simply searches a string for a substring
    </function-prolog>
    <function-map-args>
      <function-required-arg name="testString">
        the substring being tested from the command
      </function-required-arg>
      <function-required-arg name="returnString">
        the return string received from command
      </function-required-arg>
      <function-arg-def name="testString" type="required">
        <function-arg-description>
          the substring being tested from the command
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="returnString" type="required">
        <function-arg-description>
          the return string received from command
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
@@ -196,14 +235,14 @@
        <sequence>
          <script>returnCode='0'</script>
          <message log="1">
            'Result: Did Not Find substring, %s, in the return string' % (testString)
            'Did Not Find substring, %s, in the return string' % (testString)
          </message>
        </sequence>
        <else>
          <sequence>
            <script>returnCode='1'</script>
            <message log="1">
              'Result: Found substring, %s, in the return string' % (testString)
              'Found substring, %s, in the return string' % (testString)
            </message>
          </sequence>
        </else>
@@ -212,43 +251,97 @@
    </sequence>
  </function>
  
  <function name="isAlive">
  <function name="isAlive" scope="local">
    <function-prolog>
      Checks that the ldap server is running
    </function-prolog>
    <function-map-args>
      <function-required-arg name="noOfLoops">
        Number of loops
      </function-required-arg>
      <function-required-arg name="noOfMilliSeconds">
        Number of seconds
      </function-required-arg>
      <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="pathname"/>
      </function-arg-def>
      <function-arg-def name="noOfLoops" type="required">
        <function-arg-description>
          Number of iterations
        </function-arg-description>
        <function-arg-property name="type" value="integer"/>
      </function-arg-def>
      <function-arg-def name="noOfMilliSeconds" type="required">
        <function-arg-description>
          Number of seconds to wait between iterations
        </function-arg-description>
        <function-arg-property name="type" value="seconds"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceHost" type="optional" default="'%s' % DIRECTORY_INSTANCE_HOST">
        <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="optional" default="'%s' % DIRECTORY_INSTANCE_PORT">
        <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="optional" default="'%s' % DIRECTORY_INSTANCE_DN">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="optional" default="'%s' % DIRECTORY_INSTANCE_PSWD">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
        myhost=dsInstanceHost
        myport=dsInstancePort
        mydn=dsInstanceDn
        mypswd=dsInstancePswd
      </script>
      <script>ldapRC=9999</script>
      <loop from="1" to="noOfLoops" while="ldapRC != 0">
        <sequence>
          <call function="'SearchObject'">
            { 'location'       : mylocation,
              'dsInstanceHost' : myhost ,
              'dsInstancePort' : myport ,
              'dsInstanceDn'   : mydn ,
              'dsInstancePswd' : mypswd ,
              'dsScope'        : 'base' ,
              'dsBaseDN'       : 'cn=config' ,
              'dsFilter'       : 'objectclass=*' }
          </call>
      <sequence>
        <script>ldapRC=9999</script>
        <loop from="1" to="noOfLoops" while="ldapRC != 0">
          <sequence>
            <call function="'SearchObject'">
              { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'   : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
                'dsBaseDN'       : 'cn=config' ,
                'dsFilter'       : 'objectclass=*' ,
                'extraParams'    : '-s "base"' }
            </call>
          <script>
            ldapRC=RC
          </script>
            <script>
              ldapRC=RC
            </script>
            <call function="'Sleep'">
              { 'sleepForMilliSeconds'  : noOfMilliSeconds }
            </call>
          </sequence>
        </loop>
      </sequence>
          <call function="'Sleep'">
            { 'sleepForMilliSeconds'  : noOfMilliSeconds }
          </call>
        </sequence>
      </loop>
    </sequence>
  </function>
  <function name="Sleep">
@@ -256,14 +349,23 @@
      Sleep for number of milliseconds
    </function-prolog>
    <function-map-args>
      <function-required-arg name="sleepForMilliSeconds">
        Number of milliseconds to sleep
      </function-required-arg>
      <function-arg-def name="location" type="optional" default="'%s' % 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="sleepForMilliSeconds" type="required">
        <function-arg-description>
          Number of milliseconds to sleep
        </function-arg-description>
        <function-arg-property name="type" value="seconds"/>
      </function-arg-def>
    </function-map-args>
    
    <sequence>
      <stafcmd name="'STAF Command: Delay'">
        <location>'%s' % (hostname)</location>
        <location>'%s' % location</location>
        <service>'delay'</service>
        <request>
          'delay %i' % sleepForMilliSeconds
@@ -282,13 +384,16 @@
      Set OS related variables
    </function-prolog>
    <function-map-args>
      <function-required-arg name="hostname">
        Name of host
      </function-required-arg>
      <function-arg-def name="hostname" type="required">
        <function-arg-description>
          Name of host on which to retrieve variables
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <stafcmd name="'STAF Command: Get OS Name'">
        <location>'%s' % (hostname)</location>
        <location>'%s' % hostname</location>
        <service>'var'</service>
        <request>
          'get system var STAF/Config/OS/Name'
@@ -499,17 +604,25 @@
    <function-prolog>
      Queries the staf logs for the test case and write to file as text
    </function-prolog>
    <function-map-args>
      <function-required-arg name="starttime">
        timestamp to start logging from
      </function-required-arg>
      <function-required-arg name="endtime">
        timestamp to start logging from
      </function-required-arg>
      <function-required-arg name="tofile">
        timestamp to start logging from
      </function-required-arg>
      <function-arg-def name="starttime" type="required">
        <function-arg-description>
          timestamp to start logging from
        </function-arg-description>
        <function-arg-property name="type" value="timestamp"/>
      </function-arg-def>
      <function-arg-def name="endtime" type="required">
        <function-arg-description>
          timestamp to start logging to
        </function-arg-description>
        <function-arg-property name="type" value="timestamp"/>
      </function-arg-def>
      <function-arg-def name="tofile" type="required">
        <function-arg-description>
          name of file to write the logs
        </function-arg-description>
        <function-arg-property name="type" value="filepath"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
@@ -535,16 +648,21 @@
    <function-prolog>
      Process staf log query results and write them to a file
    </function-prolog>
    <function-map-args>
      <function-required-arg name="queryresult">
        result of the staf log query
      </function-required-arg>
      <function-required-arg name="logfile">
        name of the log file to where results are written
      </function-required-arg>
      <function-arg-def name="queryresult" type="required">
        <function-arg-description>
          result of the staf log query
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="logfile" type="required">
        <function-arg-description>
          name of the log file to where results are written
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <message>'Creating test log %s' % logfile</message>
opendj-sdk/opends/tests/functional-tests/testcases/backends/backends.xml
@@ -46,7 +46,7 @@
          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
            file="'%s/testcases/backends/import.xml' % (TESTS_DIR)"/>
          <call function="'main_import'" />
          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
            file="'%s/testcases/backends/import-tasks.xml' % (TESTS_DIR)"/>
          <call function="'main_import-tasks'" />
@@ -74,7 +74,7 @@
          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
            file="'%s/testcases/backends/export-tasks.xml' % (TESTS_DIR)"/>
          <call function="'main_export-tasks'" />
          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
            file="'%s/testcases/backends/export.xml' % (TESTS_DIR)"/>
          <call function="'main_export'" />
opendj-sdk/opends/tests/functional-tests/testcases/backends/import-tasks.xml
@@ -155,7 +155,7 @@
                  'dsInstancePswd'  : DIRECTORY_INSTANCE_PSWD,
                  'taskID'          : STAXCurrentTestcase,
                  'ldifFile'        : '%s/backends/Include.ldif' % STAGED_DATA_DIR,
                  'includeBranches' : 'dc=com',
                  'includeBranches' : ['dc=com'],
                }
              </call>
@@ -249,7 +249,7 @@
                  'dsInstancePswd'  : DIRECTORY_INSTANCE_PSWD,
                  'taskID'          : STAXCurrentTestcase,
                  'ldifFile'        : '%s/backends/Exclude.ldif' % STAGED_DATA_DIR,
                  'excludeBranches' : 'ou=Departed,ou=People,dc=example,dc=com',
                  'excludeBranches' : ['ou=Departed,ou=People,dc=example,dc=com'],
                }
              </call>
@@ -349,8 +349,8 @@
                  'dsInstancePswd'  : DIRECTORY_INSTANCE_PSWD,
                  'taskID'          : STAXCurrentTestcase,
                  'ldifFile'        : '%s/backends/Exclude.ldif' % STAGED_DATA_DIR,
                  'includeBranches' : 'dc=com',
                  'excludeBranches' : 'ou=Departed,ou=People,dc=example,dc=com',
                  'includeBranches' : ['dc=com'],
                  'excludeBranches' : ['ou=Departed,ou=People,dc=example,dc=com'],
                }
              </call>
@@ -393,13 +393,13 @@
              <call function="'testCase_Preamble'"/>
              <call function="'importLdifTask'">
                { 'dsInstanceHost'  : DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort'  : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'    : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd'  : DIRECTORY_INSTANCE_PSWD,
                  'taskID'          : STAXCurrentTestcase,
                  'ldifFile'        : '%s/backends/Include.ldif' % STAGED_DATA_DIR,
                  'includeAttributes' : 'dc',
                { 'dsInstanceHost'    : DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort'    : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'      : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD,
                  'taskID'            : STAXCurrentTestcase,
                  'ldifFile'          : '%s/backends/Include.ldif' % STAGED_DATA_DIR,
                  'includeAttributes' : ['dc'],
                }
              </call>
@@ -492,7 +492,7 @@
                  'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD,
                  'taskID'            : STAXCurrentTestcase,
                  'ldifFile'          : '%s/backends/Exclude.ldif' % STAGED_DATA_DIR,
                  'excludeAttributes' : 'userpassword'
                  'excludeAttributes' : ['userpassword']
                }
              </call>
@@ -585,7 +585,7 @@
                  'taskID'            : STAXCurrentTestcase,
                  'ldifFile'          : '%s/backends/Exclude.ldif' % STAGED_DATA_DIR,
                  'includeBranches'   : ['dc=com','dc=example,dc=com','ou=People,dc=example,dc=com'],
                  'excludeBranches'   : 'ou=Departed,ou=People,dc=example,dc=com',
                  'excludeBranches'   : ['ou=Departed,ou=People,dc=example,dc=com'],
                  'includeAttributes' : ['dc','cn','ou','sn'],
                }
              </call>
@@ -635,7 +635,7 @@
                  'dsInstancePswd'  : DIRECTORY_INSTANCE_PSWD,
                  'taskID'          : STAXCurrentTestcase,
                  'ldifFile'        : '%s/backends/Include.ldif' % STAGED_DATA_DIR,
                  'includeFilters'  : 'objectclass=*',
                  'includeFilters'  : ['objectclass=*'],
                }
              </call>
@@ -682,7 +682,7 @@
                  'dsInstancePswd'  : DIRECTORY_INSTANCE_PSWD,
                  'taskID'          : STAXCurrentTestcase,
                  'ldifFile'        : '%s/backends/Exclude.ldif' % STAGED_DATA_DIR,
                  'excludeFilters'  : 'objectclass=person',
                  'excludeFilters'  : ['objectclass=person'],
                }
              </call>
@@ -826,7 +826,7 @@
                  'dsInstancePswd'  : DIRECTORY_INSTANCE_PSWD,
                  'taskID'          : STAXCurrentTestcase,
                  'ldifFile'        : '%s/backends/Include.ldif' % STAGED_DATA_DIR,
                  'includeFilters'  : '|(objectclass=person)(objectclass=domain)(objectclass=organizationalunit)',
                  'includeFilters'  : ['|(objectclass=person)(objectclass=domain)(objectclass=organizationalunit)'],
                }
              </call>
@@ -873,7 +873,7 @@
                  'dsInstancePswd'  : DIRECTORY_INSTANCE_PSWD,
                  'taskID'          : STAXCurrentTestcase,
                  'ldifFile'        : '%s/backends/Exclude.ldif' % STAGED_DATA_DIR,
                  'excludeFilters'  : '&amp;(objectclass=person)(ou=Departed)',
                  'excludeFilters'  : ['&amp;(objectclass=person)(ou=Departed)'],
                }
              </call>
@@ -919,9 +919,9 @@
                  'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD,
                  'taskID'            : STAXCurrentTestcase,
                  'ldifFile'          : '%s/backends/Exclude.ldif' % STAGED_DATA_DIR,
                  'excludeFilters'    : '&amp;(objectclass=person)(ou=Departed)',
                  'includeBranches'   : 'dc=com',
                  'excludeAttributes' : 'userpassword'
                  'excludeFilters'    : ['&amp;(objectclass=person)(ou=Departed)'],
                  'includeBranches'   : ['dc=com'],
                  'excludeAttributes' : ['userpassword']
                }
              </call>
opendj-sdk/opends/tests/functional-tests/testcases/backends/import.xml
@@ -71,8 +71,9 @@
    
              <call function="'testCase_Preamble'"/>
    
              <call function="'importLdif'">
                { 'ldifFile'    : '%s/backends/Example.ldif' % STAGED_DATA_DIR }
              <call function="'ImportLdifWithScript'">
                { 'location'    : STAF_REMOTE_HOSTNAME ,
                  'dsLdifFile'  : '%s/backends/Example.ldif' % STAGED_DATA_DIR }
              </call>
    
              <call function="'checktestRC'">
@@ -147,11 +148,11 @@
            <sequence>
    
              <call function="'testCase_Preamble'"/>
              <call function="'importLdif'">
                { 'ldifFile'    : '%s/backends/Include.ldif' % STAGED_DATA_DIR,
                  'extraParams' : '-b dc=com'
                }
              <call function="'ImportLdifWithScript'">
                { 'location'        : STAF_REMOTE_HOSTNAME,
                  'dsLdifFile'      : '%s/backends/Include.ldif' % STAGED_DATA_DIR,
                  'dsIncludeBranch' : 'dc=com' }
              </call>
    
              <call function="'checktestRC'">
@@ -187,7 +188,7 @@
            <sequence>
    
              <call function="'testCase_Preamble'"/>
              <call function="'importLdif'">
                { 'ldifFile'    : '%s/backends/Include.ldif' % STAGED_DATA_DIR,
                  'extraParams' : '-b "dc=com" -b "dc=example,dc=com"'
opendj-sdk/opends/tests/functional-tests/testcases/backends/restore.xml
@@ -75,7 +75,20 @@
                  'Backend Restore1: Restore data to OpenDS'
                </message>
                <!-- Stop DS -->
                <call function="'StopDsWithScript'">
                    { 'location'  : STAF_REMOTE_HOSTNAME,
                      'dsHost'    : DIRECTORY_INSTANCE_HOST,
                      'dsPort'    : DIRECTORY_INSTANCE_PORT,
                      'dsBindDN'  : DIRECTORY_INSTANCE_DN,
                      'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
                </call>
                
                <call function="'checkRC'">
                   { 'returncode' : RC ,
                     'result'     : STAXResult }
                </call>
                <call function="'restore'">
                  { 
                    'backupDir'       : '%s/backends/backup1' % STAGED_DATA_DIR
@@ -86,7 +99,27 @@
                  { 'returncode' : RC ,
                    'result'     : STAXResult }
                </call>
                <!-- Start DS -->
                <message>
                  'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
                </message>
                <call function="'StartDsWithScript'">
                 { 'location'  : STAF_REMOTE_HOSTNAME }
                </call>
                <call function="'checkRC'">
                   { 'returncode' : RC ,
                     'result'     : STAXResult }
                </call>
                <!--- Check that DS started -->
                <call function="'isAlive'">
                  { 'noOfLoops'        : 5 ,
                    'noOfMilliSeconds' : 2000 }
                </call>
                <call function="'testCase_Postamble'"/>
                      
              </sequence>
@@ -114,6 +147,21 @@
                <message>
                  'Backend Restore2: Restore compressed data to OpenDS'
                </message>
                <!-- Stop DS -->
                <call function="'StopDsWithScript'">
                    { 'location'  : STAF_REMOTE_HOSTNAME,
                      'dsHost'    : DIRECTORY_INSTANCE_HOST,
                      'dsPort'    : DIRECTORY_INSTANCE_PORT,
                      'dsBindDN'  : DIRECTORY_INSTANCE_DN,
                      'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
                </call>
                <call function="'checkRC'">
                   { 'returncode' : RC ,
                     'result'     : STAXResult }
                </call>
                <call function="'backup'">
                  { 
                    'backupDir'       : '%s/restore.compressed' % STAGED_DATA_DIR
@@ -124,7 +172,27 @@
                  { 'returncode' : RC ,
                    'result'     : STAXResult }
                </call>
                <!-- Start DS -->
                <message>
                  'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
                </message>
                <call function="'StartDsWithScript'">
                 { 'location'  : STAF_REMOTE_HOSTNAME }
                </call>
                <call function="'checkRC'">
                   { 'returncode' : RC ,
                     'result'     : STAXResult }
                </call>
                <!--- Check that DS started -->
                <call function="'isAlive'">
                  { 'noOfLoops'        : 5 ,
                    'noOfMilliSeconds' : 2000 }
                </call>
                <call function="'testCase_Postamble'"/>
      
              </sequence>
opendj-sdk/opends/tests/functional-tests/testcases/core/core_search_sizelimit.xml
@@ -64,7 +64,7 @@
                  'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                  'dsBaseDN'         : 'ou=People,o=core tests,dc=example,dc=com' ,
                  'dsFilter'         : 'objectclass=*' ,
                  'extraParams'    : '-z 150' }
                  'extraParams'      : '-z 150' }
                  
              </call>
    
@@ -92,7 +92,7 @@
                  'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                  'dsBaseDN'         : 'ou=People,o=core tests,dc=example,dc=com' ,
                  'dsFilter'         : 'objectclass=*' ,
                  'extraParams'    : '-z 151' }
                  'extraParams'      : '-z 151' }
                  
              </call>
    
@@ -136,12 +136,11 @@
                 'Core SSzL4: Check the response of OpenDS when an ldap search request is conducted with a search size limit defined by the server-wide parameter, ds-cfg-size-limit, and the search size limit is exceeded'
              </message>
    
              <call function="'AnonSearchObject'">
              <call function="'SearchObject'">
                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                  'dsBaseDN'         : 'ou=People,o=core tests,dc=example,dc=com' ,
                  'dsFilter'         : 'objectclass=*' ,
                  'extraParams'    : '' }
                  'dsFilter'         : 'objectclass=*' }
                  
              </call>
    
@@ -186,12 +185,11 @@
                 'Core SSzL6: Check the response of OpenDS when an ldap search request is conducted with a search size limit defined by the server-wide parameter, ds-cfg-size-limit, and the search size limit is not exceeded'
              </message>
    
              <call function="'AnonSearchObject'">
              <call function="'SearchObject'">
                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                  'dsBaseDN'         : 'ou=People,o=core tests,dc=example,dc=com' ,
                  'dsFilter'         : 'objectclass=*' ,
                  'extraParams'    : '' }
                  'dsFilter'         : 'objectclass=*' }
                  
              </call>
    
@@ -241,8 +239,7 @@
                  'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                  'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                  'dsBaseDN'         : 'ou=People,o=core tests,dc=example,dc=com' ,
                  'dsFilter'         : 'objectclass=*' ,
                  'extraParams'    : '' }
                  'dsFilter'         : 'objectclass=*' }
                  
              </call>
    
@@ -263,12 +260,11 @@
                 'Core SSzL9: Check the response of OpenDS when an ldap search request is conducted with a user search size limit defined by the user-specific parameter, ds-rlim-size-limit, and the search is conducted as a bind to a different user'
              </message>
    
              <call function="'AnonSearchObject'">
              <call function="'SearchObject'">
                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                  'dsBaseDN'         : 'ou=People,o=core tests,dc=example,dc=com' ,
                  'dsFilter'         : 'objectclass=*' ,
                  'extraParams'    : '' }
                  'dsFilter'         : 'objectclass=*' }
                  
              </call>
    
@@ -318,8 +314,7 @@
                  'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                  'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                  'dsBaseDN'         : 'ou=People,o=core tests,dc=example,dc=com' ,
                  'dsFilter'         : 'objectclass=*' ,
                  'extraParams'      : '' }
                  'dsFilter'         : 'objectclass=*' }
                  
              </call>
    
opendj-sdk/opends/tests/functional-tests/testcases/core/core_search_timelimit.xml
@@ -136,12 +136,11 @@
                 'Core STmL4: Check the response of OpenDS when an ldap search request is conducted with a search time limit defined by the server-wide parameter, ds-cfg-time-limit, and the search time limit is exceeded'
              </message>
    
              <call function="'AnonSearchObject'">
              <call function="'SearchObject'">
                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                  'dsBaseDN'         : 'o=core tests,dc=example,dc=com' ,
                  'dsFilter'         : 'objectclass=*' ,
                  'extraParams'    : '' }
                  'dsFilter'         : 'objectclass=*' }
                  
              </call>
    
@@ -186,12 +185,11 @@
                 'Core STmL6: Check the response of OpenDS when an ldap search request is conducted with a search time limit defined by the server-wide parameter, ds-cfg-time-limit, and the search time limit is not exceeded'
              </message>
    
              <call function="'AnonSearchObject'">
              <call function="'SearchObject'">
                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                  'dsBaseDN'         : 'o=core tests,dc=example,dc=com' ,
                  'dsFilter'         : 'objectclass=*' ,
                  'extraParams'    : '' }
                  'dsFilter'         : 'objectclass=*' }
                  
              </call>
    
@@ -241,8 +239,7 @@
                  'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                  'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                  'dsBaseDN'         : 'o=core tests,dc=example,dc=com' ,
                  'dsFilter'         : 'objectclass=*' ,
                  'extraParams'    : '' }
                  'dsFilter'         : 'objectclass=*' }
                  
              </call>
    
@@ -263,12 +260,11 @@
                 'Core STmL9: Check the response of OpenDS when an ldap search request is conducted with a user search time limit defined by the user-specific parameter, ds-rlim-time-limit, and the search is conducted as a bind to a different user'
              </message>
    
              <call function="'AnonSearchObject'">
              <call function="'SearchObject'">
                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                  'dsBaseDN'         : 'o=core tests,dc=example,dc=com' ,
                  'dsFilter'         : 'objectclass=*' ,
                  'extraParams'    : '' }
                  'dsFilter'         : 'objectclass=*' }
                  
              </call>
    
@@ -318,8 +314,7 @@
                  'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                  'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                  'dsBaseDN'         : 'o=core tests,dc=example,dc=com' ,
                  'dsFilter'         : 'objectclass=*' ,
                  'extraParams'    : '' }
                  'dsFilter'         : 'objectclass=*' }
                  
              </call>
    
opendj-sdk/opends/tests/functional-tests/testcases/runFuncTests.xml
@@ -51,6 +51,9 @@
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/security.xml' % (TESTS_FUNCTIONS_DIR)" />
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/topology.xml' % (TESTS_FUNCTIONS_DIR)" />
      <!-- Load in any standard python libraries -->
      <script>
@@ -96,11 +99,11 @@
        CurrentTestPath={}
      </script>
        
      <!--- The Functional Tests -->
      <!--- The Functional Tests -->
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/setup/setup.xml' % (TESTS_DIR)" />
      <call function="'main_setup'" />
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/quickstart/quickstart.xml' % (TESTS_DIR)" />
      <call function="'main_quickstart'" />
@@ -124,11 +127,21 @@
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/schema/schema.xml' % (TESTS_DIR)" />
      <call function="'main_schema'" />
      <if expr="not isWindows">
      <!-- Do not execute Synchronization Test Suite as long as dynamic configuration
          is not supported. ('dd' not supported in Windows.  see 'configureSynchronization' -->
      <sequence>
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/synchronization/synchronization.xml' % (TESTS_DIR)" />
      <call function="'main_synchronization'" />
      </sequence>
      </if>
      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
        file="'%s/testcases/cleanup/cleanup.xml' % (TESTS_DIR)" />
      <call function="'main_cleanup'" />
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/runTestJob.xml
@@ -41,7 +41,7 @@
      
      <job name="'Job: %s %s' % (STAF_REMOTE_HOSTNAME,TEST_OS_STRING) " monitor="1" clearlogs="'Enabled'" logtcstartstop="'Enabled'">
        <job-file>'%s/testcases/runFuncTests.xml' % TESTS_DIR</job-file>
        <job-scriptfiles machine="'%s' % STAF_LOCAL_HOSTNAME">['%s/config/config.py' % TESTS_DIR,'%s/python/security.py' % TESTS_SHARED_DIR]</job-scriptfiles>
        <job-scriptfiles machine="'%s' % STAF_LOCAL_HOSTNAME">['%s/config/config.py' % TESTS_DIR,'%s/python/security.py' % TESTS_SHARED_DIR,'%s/python/synchronization.py' % TESTS_SHARED_DIR ]</job-scriptfiles>
        <job-action>
          <log>'Started sub-job %s on %s' % (STAXSubJobID,STAF_REMOTE_HOSTNAME)</log>
        </job-action>
opendj-sdk/opends/tests/functional-tests/testcases/setup/setup.xml
@@ -36,7 +36,7 @@
      <block name="'setup'">
      
        <sequence>
          <!-- Locally delete any existing files from staging area -->
          <message>'Delete the temporary staging area'</message>
          <call function="'deleteFolder'">
opendj-sdk/opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic.xml
New file
@@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="synchronization_basic"/>
  <function name="synchronization_basic">
    <sequence>
      <block name="'basic'">
      <!-- Test Suite Block: Synchronization Basic -->
        <sequence>
          <script>
            CurrentTestPath['suite']='basic'
          </script>
          <call function="'testSuite_Preamble'"/>
          <!--- Test Suite information
          #@TestSuiteName       Synchronization Basic Tests
          #@TestSuitePurpose    Verify that the basic operations are synchronized correctly between two serrvers.
          #@TestSuiteID         Basic Tests
          #@TestSuiteGroup      Basic
          #@TestGroup           Synchronization
          #@TestScript          synchronization_basic.xml
          #@TestHTMLLink        http://opends.dev.java.net/
          -->
          <block name="'Block Create DS Topology'">
          <!-- Create the topology necessary to the test suite -->
            <sequence>
              <script>
                basicTopologyFile = '%s/config/synchronization/basic_topology.txt' % TESTS_DIR
              </script>
              <message>
                 'Create DS topology as described in %s' % basicTopologyFile
              </message>
              <call function="'createTopology'">
                { 'topologyDescFile' : basicTopologyFile }
              </call>
              <call function="'checkRC'">
                  { 'returncode' : RC ,
                    'result'     : STAXResult }
              </call>
            </sequence>
          <!--- End Block Create DS Topology -->
          </block>
          <block name="'Block DS Process Active'">
          <!-- Start the servers in the topology -->
            <iterate var="server" in="_topologyServerList">
              <sequence>
                <message>
                  'Start DS on host  %s to run on port %s' % (server.getHostname(),server.getPort())
                </message>
                <!--- Start DS -->
                <call function="'StartDsWithScript'">
                  { 'location'  : server.getHostname(),
                    'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME) }
                </call>
                <call function="'checkRC'">
                  { 'returncode' : RC ,
                    'result'     : STAXResult }
                </call>
              </sequence>
            </iterate>
          <!--- End Block DS Process Active -->
          </block>
          <block name="'Block Clients'">
          <!-- Execute the tests -->
            <sequence>
              <!-- Check that the servers in the topology started -->
              <iterate var="server" in="_topologyServerList">
                <!--- Check that DS started -->
                <call function="'isAlive'">
                  { 'location' : server.getHostname(),
                    'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME),
                    'dsInstanceHost' : server.getHostname(),
                    'dsInstancePort' : server.getPort(),
                    'dsInstanceDn' : server.getRootDn(),
                    'dsInstancePswd' : server.getRootPwd(),
                    'noOfLoops' : 5 ,
                    'noOfMilliSeconds' : 2000 }
                </call>
              </iterate>
              <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
                file="'%s/testcases/synchronization/basic/synchronization_basic_setup.xml' % (TESTS_DIR)"/>
              <call function="'synchronization_basic_setup'" />
              <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
                file="'%s/testcases/synchronization/basic/synchronization_basic_bob.xml' % (TESTS_DIR)"/>
              <call function="'synchronization_basic_bob'" />
            </sequence>
          <!--- End Block Clients -->
          </block>
          <block name="'Block DS Process Stop'">
          <!-- Stop the servers in the topology -->
            <iterate var="server" in="_topologyServerList">
              <sequence>
                <message>
                   'Stop DS on host %s running on port %s' % (server.getHostname(),server.getPort())
                </message>
                <!--- Stop DS -->
                <call function="'StopDsWithScript'">
                  { 'location'  : server.getHostname(),
                    'dsHost' : server.getHostname(),
                    'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME),
                    'dsPort'    : server.getPort(),
                    'dsBindDN'  : server.getRootDn(),
                    'dsBindPwd' : server.getRootPwd() }
                </call>
                <call function="'checkRC'">
                  { 'returncode' : RC ,
                    'result'     : STAXResult }
                </call>
              </sequence>
            </iterate>
          <!--- End Block DS Process Stop -->
          </block>
          <block name="'Block Remove DS Topology'">
          <!-- Remove  the topology created for the test suite -->
            <sequence>
              <message>
                 '(NOT IMPLEMENTED YET) Remove DS topology created for the Synchronization Basic Test Suite'
              </message>
              <call function="'removeTopology'"/>
              <call function="'checkRC'">
                  { 'returncode' : RC ,
                    'result'     : STAXResult }
              </call>
            </sequence>
          <!-- End Block Remove DS Topology-->
          </block>
          <call function="'testSuite_Postamble'"/>
        </sequence>
      <!-- End Test Suite Block: Synchronization Basic -->
      </block>
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic_bob.xml
New file
@@ -0,0 +1,222 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="synchronization_basic_bob"/>
  <function name="synchronization_basic_bob">
    <sequence>
          <!--- Test Case information
          #@TestMarker          Synchronization Basic Tests
          #@TestName            Synchronization: Basic: Add Entry
          #@TestID                  Add Entry
          #@TestPurpose         Check that an entry add is well propagated by synchronization.
          #@TestPreamble
          #@TestSteps
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="'Synchronization: Basic: Add Entry'">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                 'Synchronization: Basic: Add Entry. Check that an added entry is well propagated by synchronization.'
              </message>
              <call function="'addEntry'">
                { 'location' : clientHost,
                  'dsPath' : clientPath,
                  'dsInstanceHost'    : server1.getHostname(),
                  'dsInstancePort'   : server1.getPort(),
                  'dsInstanceDn'    : server1.getRootDn(),
                  'dsInstancePswd'  : server1.getRootPwd(),
                  'entryToBeAdded'   : '%s/synchronization_add_root_suffix.ldif' % clientDataDir }
              </call>
              <call function="'checktestRC'">
                  { 'returncode' : RC,
                    'result'     : STAXResult }
              </call>
              <call function="'SearchObject'">
                { 'location' : clientHost,
                  'dsPath' : clientPath,
                  'dsInstanceHost'   : server2.getHostname() ,
                  'dsInstancePort'   : server2.getPort() ,
                  'dsInstanceDn'     : server2.getRootDn() ,
                  'dsInstancePswd'   : server2.getRootPwd() ,
                  'dsBaseDN'         : synchroSuffix ,
                  'dsFilter'         : 'objectclass=*' }
              </call>
              <call function="'checktestRC'">
                  { 'returncode' : RC,
                    'result'     : STAXResult,
                    'expected'   : 0 }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
          #@TestMarker          Synchronization Basic Tests
          #@TestName            Synchronization: Basic: Modify Entry
          #@TestID                  Modify Entry
          #@TestPurpose         Check that an entry modify is well propagated by synchronization.
          #@TestPreamble
          #@TestSteps
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="'Synchronization: Basic: Modify Entry'">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                 'Synchronization: Basic: Modify Entry. Check that an entry modify is well propagated by synchronization.'
              </message>
              <call function="'addEntry'">
                { 'location' : clientHost,
                  'dsPath' : clientPath,
                  'dsInstanceHost'   : server1.getHostname(),
                  'dsInstancePort'   : server1.getPort() ,
                  'dsInstanceDn'     : server1.getRootDn() ,
                  'dsInstancePswd'   : server1.getRootPwd() ,
                  'entryToBeAdded'   : '%s/synchronization_add_single.ldif' % clientDataDir }
              </call>
              <call function="'checktestRC'">
                  { 'returncode' : RC ,
                    'result'     : STAXResult }
              </call>
              <call function="'modifyEntry'">
                { 'location' : clientHost,
                  'dsPath' : clientPath,
                  'dsInstanceHost'   : server1.getHostname() ,
                  'dsInstancePort'   : server1.getPort() ,
                  'dsInstanceDn'     : server1.getRootDn() ,
                  'dsInstancePswd'   : server1.getRootPwd() ,
                  'entryToBeModified'   : '%s/synchronization_mod.ldif' % clientDataDir }
              </call>
              <call function="'checktestRC'">
                  { 'returncode' : RC ,
                    'result'     : STAXResult }
              </call>
              <call function="'SearchObject'">
                { 'location' : clientHost,
                  'dsPath' : clientPath,
                  'dsInstanceHost'   : server2.getHostname() ,
                  'dsInstancePort'   : server2.getPort() ,
                  'dsInstanceDn'     : server2.getRootDn() ,
                  'dsInstancePswd'   : server2.getRootPwd() ,
                  'dsBaseDN'         : entryDn,
                  'dsFilter'         : '%s=%s' % (attr_type,attr_value) }
              </call>
              <call function="'checktestRC'">
                  { 'returncode' : RC ,
                    'result'     : STAXResult ,
                    'expected'   : 0 }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
          #@TestMarker          Synchronization Basic Tests
          #@TestName            Synchronization: Basic: Delete Entry
          #@TestID                  Delete Entry
          #@TestPurpose         Check that an entry delete is well propagated by synchronization.
          #@TestPreamble
          #@TestSteps
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="'Synchronization: Basic: Delete Entry'">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                 'Synchronization: Basic: Delete Entry. Check that an entry delete is well propagated by synchronization.'
              </message>
              <call function="'DeleteEntry'">
                { 'location' : clientHost,
                  'dsPath' : clientPath,
                  'dsInstanceHost'   : server1.getHostname() ,
                  'dsInstancePort'   : server1.getPort() ,
                  'dsInstanceDn'     : server1.getRootDn() ,
                  'dsInstancePswd'   : server1.getRootPwd() ,
                  'dsBaseDN'   : entryDn }
              </call>
              <call function="'checktestRC'">
                  { 'returncode' : RC ,
                    'result'     : STAXResult }
              </call>
              <call function="'SearchObject'">
                { 'location' : clientHost,
                  'dsPath' : clientPath,
                  'dsInstanceHost'   : server2.getHostname() ,
                  'dsInstancePort'   : server2.getPort() ,
                  'dsInstanceDn'     : server2.getRootDn() ,
                  'dsInstancePswd'   : server2.getRootPwd() ,
                  'dsBaseDN'         : entryDn,
                  'dsFilter'         : 'objectclass=*' }
              </call>
              <call function="'checktestRC'">
                  { 'returncode' : RC ,
                    'result'     : STAXResult ,
                    'expected'   : 32 }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <call function="'testSuite_Postamble'"/>
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic_setup.xml
New file
@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="synchronization_basic_setup"/>
  <function name="synchronization_basic_setup">
    <sequence>
      <!--- Test Case information
      #@TestMarker          Synchronization Basic Tests
      #@TestName            Synchronization: Basic: Setup
      #@TestID                  Setup
      #@TestPurpose         Setup the client for the test suite.
      #@TestPreamble
      #@TestSteps
      #@TestPostamble
      #@TestResult
      -->
      <testcase name="'Synchronization: Basic: Setup'">
        <sequence>
          <call function="'testCase_Preamble'"/>
          <!--- Setup the client for the Basic test suite -->
          <message>
            'Synchronization: Basic: Setup. Get client ready for Basic tests.'
          </message>
          <script>
            client = _topologyServerList[0]
            clientHost = client.getHostname()
            clientPath = '%s/%s' % (client.getDir(),OPENDSNAME)
            clientDataDir = '%s/functional-tests/shared/data' % client.getDir()
            server1 = _topologyServerList[0]
            server2 = _topologyServerList[1]
            synchroSuffix = server1.getSynchronizedSuffixList()[0].getSuffixDn()
            entryDn = 'uid=scarter,%s' % synchroSuffix
            mod_type = 'replace'
            attr_type = 'roomnumber'
            attr_value = '1111'
          </script>
          <script>
            filename = 'synchronization_add_root_suffix.ldif'
            filePath = '%s/%s' % (TMP_DATA_DIR,filename)
            write_synchronization_add_root_suffix_ldif_file(filePath, synchroSuffix)
          </script>
          <!-- Copy the synchronization_add_root_suffix ldif to client host -->
          <message>
            'Copy %s file from %s to %s' % (filename,TMP_DATA_DIR,clientDataDir)
          </message>
          <call function="'copyFile'">
            { 'srcfile'    : filePath,
              'destfile'   : '%s/%s' % (clientDataDir,filename),
              'remotehost' : client.getHostname() }
          </call>
          <script>
            filename = 'synchronization_add_single.ldif'
            filePath = '%s/%s' % (TMP_DATA_DIR,filename)
            write_synchronization_add_single_ldif_file(filePath, synchroSuffix)
          </script>
          <!-- Copy the synchronization_add_single ldif to client host -->
          <message>
            'Copy %s file from %s to %s' % (filename,TMP_DATA_DIR,clientDataDir)
          </message>
          <call function="'copyFile'">
            { 'srcfile'    : filePath,
              'destfile'   : '%s/%s' % (clientDataDir,filename),
              'remotehost' : client.getHostname() }
          </call>
          <script>
            filename = 'synchronization_add_multiple.ldif'
            filePath = '%s/%s' % (TMP_DATA_DIR,filename)
            write_synchronization_add_multiple_ldif_file(filePath, synchroSuffix)
          </script>
          <!-- Copy the synchronization_add_multiple ldif to client host -->
          <message>
            'Copy %s file from %s to %s' % (filename,TMP_DATA_DIR,clientDataDir)
          </message>
          <call function="'copyFile'">
            { 'srcfile'    : filePath,
              'destfile'   : '%s/%s' % (clientDataDir,filename),
              'remotehost' : client.getHostname() }
          </call>
          <script>
            filename = 'synchronization_mod.ldif'
            filePath = '%s/%s' % (TMP_DATA_DIR,filename)
            write_synchronization_mod_ldif_file(filePath, entryDn, mod_type, attr_type, attr_value)
          </script>
          <!-- Copy the synchronization_mod ldif to client host -->
          <message>
            'Copy %s file from %s to %s' % (filename,TMP_DATA_DIR,clientDataDir)
          </message>
          <call function="'copyFile'">
            { 'srcfile'    : filePath,
              'destfile'   : '%s/%s' % (clientDataDir,filename),
              'remotehost' : client.getHostname() }
          </call>
          <call function="'checktestRC'">
            { 'returncode' : RC ,
              'result'     : STAXResult }
          </call>
          <call function="'testCase_Postamble'"/>
        </sequence>
      </testcase>
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/synchronization/synchronization.xml
New file
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="main_synchronization"/>
  <function name="main_synchronization">
    <sequence>
      <block name="'synchronization'">
        <sequence>
          <script>
            CurrentTestPath['group']='synchronization'
          </script>
          <call function="'testGroup_Preamble'"/>
          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
            file="'%s/testcases/synchronization/basic/synchronization_basic.xml' % (TESTS_DIR)"/>
          <call function="'synchronization_basic'" />
          <call function="'testGroup_Postamble'"/>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>