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

Christophe Sovant
24.14.2008 b017349867f2c33f0a671a3fefacd6774dcbace2
Fix for Issue 3025: results should be the same on all OS/platforms
31 files modified
1733 ■■■■ changed files
opends/tests/staf-tests/functional-tests/config/replication/3server_topology.txt 6 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/config/replication/basic_topology.txt 4 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/clu/clu.xml 10 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldapcompare_checkbehavior.xml 8 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldappasswordmodify_checkbehavior.xml 6 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldapsearch_checkbehavior.xml 8 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldif-diff_checkbehavior.xml 4 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldifmodify_checkbehavior.xml 6 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldifsearch_checkbehavior.xml 72 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/clu/clu_list-backends_checkbehavior.xml 8 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/clu/clu_make-ldif_checkbehavior.xml 14 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/clu/clu_rebuild-index_checkbehavior.xml 24 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/clu/clu_verify-index_checkbehavior.xml 8 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/dsml/dsml_test.xml 381 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/monitoring/monitoring_componant.xml 128 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/plugins/plugins_7bit.xml 32 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/sample/sample.xml 122 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/setup/directory_manager.xml 116 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/setup/import.xml 12 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/setup/ports.xml 249 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/setup/security.xml 93 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/snmp/snmp.xml 7 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_mibvalues.xml 41 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_status.xml 240 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/ant/build.xml 2 ●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/functions/dsadm.xml 15 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/functions/environment.xml 14 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/functions/ldap.xml 6 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/functions/snmp.xml 12 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/functions/utils.xml 81 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/functions/webcontainer.xml 4 ●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/config/replication/3server_topology.txt
@@ -26,7 +26,7 @@
Hostname: localhost
Directory: /var/tmp/opends-synchro-tests/server1
Port: 11389
Adminport: 14444
Adminport: 11444
Sslport: 11636
Jmxport: 11689
RootDn: cn=directory manager
@@ -41,7 +41,7 @@
Hostname: localhost
Directory: /var/tmp/opends-synchro-tests/server2
Port: 22389
Adminport: 24444
Adminport: 22444
Sslport: 22636
Jmxport: 22689
RootDn: cn=directory manager
@@ -56,7 +56,7 @@
Hostname: localhost
Directory: /var/tmp/opends-synchro-tests/server3
Port: 33389
Adminport: 34444
Adminport: 33444
Sslport: 33636
Jmxport: 33689
RootDn: cn=directory manager
opends/tests/staf-tests/functional-tests/config/replication/basic_topology.txt
@@ -26,7 +26,7 @@
Hostname: localhost
Directory: /var/tmp/opends-synchro-tests/server1
Port: 11389
Adminport: 14444
Adminport: 11444
Sslport: 11636
Jmxport: 11689
RootDn: cn=directory manager
@@ -40,7 +40,7 @@
Hostname: localhost
Directory: /var/tmp/opends-synchro-tests/server2
Port: 22389
Adminport: 24444
Adminport: 22444
Sslport: 22636
Jmxport: 22689
RootDn: cn=directory manager
opends/tests/staf-tests/functional-tests/testcases/clu/clu.xml
@@ -30,9 +30,11 @@
  <defaultcall function="main_clu"/>
  
  <function name="main_clu">
     <function-list-args>
    <function-list-args>
      <function-required-arg name="STAXParentID"/>
    </function-list-args>
    </function-list-args>
    <sequence>
      
      <block name="'clu'">
@@ -41,9 +43,9 @@
          <!--- Load the job environment for the test group execution -->
          <import machine="STAF_LOCAL_HOSTNAME"
                  file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR" />
                  file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR"/>
          <call function="'loadJobEnvironment'">
               { 'parent' : STAXParentID }
            { 'parent' : STAXParentID }
          </call>
          
          <!--- Test Group information
opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldapcompare_checkbehavior.xml
@@ -85,15 +85,15 @@
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsDn'             : ['postalCode=63792' ,
                'dsDn'             : ['postalCode:63792' ,
                                      '%s' % dsdn] ,
                'expectedRC'       : 6
                }
              </call>
              <script>
                knownIssue(2761)
              </script>
              </script>
              
              <call function="'testCase_Postamble'"/>
              
@@ -129,7 +129,7 @@
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsDn'             : ['postalCode=00000' ,
                'dsDn'             : ['postalCode:00000' ,
                                      '%s' % dsdn] ,
                'expectedRC'       : 5
                }
opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldappasswordmodify_checkbehavior.xml
@@ -151,7 +151,7 @@
            #@TestStep            Do an ldappasswordmodify to change user
                                  password.
            #@TestPostamble       none
            #@TestResult          Success if ldappasswordmodify returns 0.
            #@TestResult          Success if ldappasswordmodify returns 50.
          -->
          <testcase name="getTestCaseName
          ('ldappasswordmodify: user cannot modify pwd for another user')">
@@ -168,11 +168,11 @@
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'dn:uid=user.0,%s' % basedn ,
                'dsInstanceDn'     : 'uid=user.0,%s' % basedn ,
                'dsInstancePswd'   : 'newpassword' ,
                'dsAuthzID'        : 'dn:uid=user.1,%s' % basedn ,
                'dsNewPassword'    : 'newpassword' ,
                'expectedRC'       : 49
                'expectedRC'       : 50
                }
              </call>
              
opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldapsearch_checkbehavior.xml
@@ -106,7 +106,7 @@
                'expectedString'   : 'Total number of matching entries: 111' 
                }
              </call>
              <script>
                knownIssue(2764)
              </script>
@@ -575,7 +575,7 @@
            #@TestMarker          ldapsearch check behavior tests
            #@TestName            ldapsearch: check behavior with a filter file
                                  (containing one filter) and search attribute
            #@TestIssue           3041
            #@TestIssue           none
            #@TestPurpose         Verify the output of ldapsearch with
                                  filter option.
            #@TestPreamble        none
@@ -636,10 +636,6 @@
                }
              </call>
              
              <script>
                knownIssue(3041)
              </script>
              <call function="'testCase_Postamble'"/>
              
            </sequence>
opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldif-diff_checkbehavior.xml
@@ -182,7 +182,7 @@
                'refFile'    : 'ldif-diff.ref'
                }
              </call>
              <script>
                knownIssue(3111)
              </script>
@@ -233,7 +233,7 @@
                'refFile'    : 'ldif-diff_singlevalue.ref'
                }
              </call>
              <script>
                knownIssue(3111)
              </script>
opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldifmodify_checkbehavior.xml
@@ -60,7 +60,7 @@
          <!--- Test Case information
            #@TestMarker          ldifmodify check behavior tests
            #@TestName            ldifmodify: add, delete and modify operations
            #@TestIssue           3111
            #@TestIssue           none
            #@TestPurpose         Test ldifmodify with add, delete and modify 
                                  operations
            #@TestPreamble        none
@@ -106,10 +106,6 @@
                }
              </call>
              
              <script>
                knownIssue(3111)
              </script>
              <call function="'testCase_Postamble'"/>
              
            </sequence>
opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldifsearch_checkbehavior.xml
@@ -203,7 +203,7 @@
          <!--- Test Case information
            #@TestMarker          ldifsearch check behavior tests
            #@TestName            ldifsearch: check with sizeLimit option
            #@TestIssue           3041
            #@TestIssue           none
            #@TestPurpose         Verify that the entries returned by ldifseach
                                  are the same than the entries returned by
                                  ldapsearch
@@ -223,22 +223,6 @@
              <message>
                'ldifsearch: sizeLimit option'
              </message>
              <call function="'ldapSearchWithScript'">
                {
                'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'   : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
                'dsSizeLimit'    : '50' ,
                'dsBaseDN'       : basedn ,
                'dsFilter'       : 'uid=user.1*' ,
                'outputFile'     : 'size_ldapsearch.out' ,
                'outputPath'     : DIRECTORY_INSTANCE_DIR ,
                'expectedRC'     : 4 ,
                'logStderr'      : False
                }
              </call>
              <call function="'ldifSearchWithScript'">
                {
@@ -246,34 +230,22 @@
                'dsSizeLimit'  : '50' ,
                'dsBaseDN'     : basedn ,
                'dsFilter'     : 'uid=user.1*' ,
                'dsOutputFile' : '%s/size_ldifsearch.out' \
                                 % DIRECTORY_INSTANCE_DIR ,
                'expectedRC'   : 4
                }                
              </call>              
              
              <call function="'LdifDiffWithScript'">
                {
                'sourceLdif' : '%s/size_ldifsearch.out' \
                % DIRECTORY_INSTANCE_DIR ,
                'targetLdif' : '%s/size_ldapsearch.out' \
                % DIRECTORY_INSTANCE_DIR ,
                'outputLdif' : '%s/size_ldifsearch.diff' \
                % DIRECTORY_INSTANCE_DIR
                }
              </call>
              <call function="'checktestRC'">
                {
                'returncode' : STAXResult ,
                'result'     : STAXResult
                }
              </call>
              <script>
                knownIssue(3041)
                returnString = STAXResult[0][1]
              </script>
              
              <call function="'CheckMatches'">
                {
                'string2find' : 'dn: ' ,
                'mainString'  : returnString ,
                'nbExpected'  : 50
                }
              </call>
              <call function="'testCase_Postamble'"/>
              
            </sequence>
@@ -320,13 +292,23 @@
                }                
              </call>
              
              <call function="'compareFile'">
              <call function="'LdifDiffWithScript'">
                { 
                'outputFile' : 'ldifsearch_filterfile_and_attribute.out' ,
                'refFile'    : 'ldapsearch_filterfile_and_attribute.ref'
                'sourceLdif' : '%s/ldifsearch_filterfile_and_attribute.out' \
                               % DIRECTORY_INSTANCE_DIR ,
                'targetLdif' : '%s/clu/ldapsearch_filterfile_and_attribute.ref'\
                               % remote.data ,
                'outputLdif' : '%s/ldifmodify.diff' % DIRECTORY_INSTANCE_DIR
                }
              </call>
              <call function="'checktestRC'">
                {
                'returncode' : STAXResult ,
                'result'     : STAXResult
                }
              </call>
              <call function="'testCase_Postamble'"/>
              
            </sequence>
@@ -337,7 +319,7 @@
            #@TestMarker          ldifsearch check behavior tests
            #@TestName            ldifsearch: check behavior with a filter file 
                                  containing multiple filters
            #@TestIssue           3042
            #@TestIssue           none
            #@TestPurpose         Verify the output of ldifsearch with
                                  filter option.
            #@TestPreamble        none
@@ -378,10 +360,6 @@
                }
              </call> 
              
              <script>
                knownIssue(3042)
              </script>
              <call function="'testCase_Postamble'"/>
              
            </sequence>
opends/tests/staf-tests/functional-tests/testcases/clu/clu_list-backends_checkbehavior.xml
@@ -296,7 +296,7 @@
          <!--- Test Case information
            #@TestMarker          list-backends check behavior tests
            #@TestName            list-backends: invalid baseDN
            #@TestIssue           2594
            #@TestIssue           none
            #@TestPurpose         Test list-backends with an invalid baseDN
            #@TestPreamble        none
            #@TestStep            Do an list-backends with an invalid baseDN.
@@ -334,11 +334,7 @@
                'expectedString' : '%s %s' % (msg1, msg2)
                }
              </call>
              <script>
                knownIssue(2594)
              </script>
              <call function="'testCase_Postamble'"/>
              
            </sequence>
opends/tests/staf-tests/functional-tests/testcases/clu/clu_make-ldif_checkbehavior.xml
@@ -93,14 +93,14 @@
                returnString = STAXResult[0][1]
                msg = 'LDIF processing complete.  161 entries written'
              </script>
              <call function="'checktestString'">
                { 
                'returnString'   : returnString ,
                'expectedString' : msg
                }
              </call>
              <call function="'testCase_Postamble'"/>
              
            </sequence>
@@ -142,7 +142,7 @@
                'randomSeed'     : 0
                }
              </call>
              <message>
                'make-ldif: stop the server'
              </message>    
@@ -213,7 +213,7 @@
                'expectedString'   : 'Total number of matching entries: 161' 
                }
              </call>
              <call function="'testCase_Postamble'"/>
              
            </sequence>
@@ -260,7 +260,7 @@
                                   % DIRECTORY_INSTANCE_DIR
                }
              </call>
              <message>
                'make-ldif: generate a second ldif file without seed'
              </message>
@@ -346,8 +346,8 @@
                'outputLdif' : '%s/make-ldif_seed5.diff' \
                % DIRECTORY_INSTANCE_DIR
                }
              </call>
              </call>
              <call function="'testCase_Postamble'"/>
              
            </sequence>
opends/tests/staf-tests/functional-tests/testcases/clu/clu_rebuild-index_checkbehavior.xml
@@ -333,7 +333,7 @@
          <!--- Test Case information
            #@TestMarker          rebuild-index check behavior tests
            #@TestName            rebuild-index: after creation
            #@TestIssue           3102
            #@TestIssue           none
            #@TestPurpose         Verify that rebuild-index command is
                                  successfull on a newly created index
                                  and that the output is correct.
@@ -377,8 +377,8 @@
              
              <script>
                msg1 = 'Due to changes in the configuration, index'
                msg2 = 'dc_com_st.equality is currently operating in a'
                msg3 = 'degraded state and must be rebuilt before it can used'
                msg2 = 'dc_com_st is currently operating in a degraded'
                msg3 = 'state and must be rebuilt before it can be used'
              </script>                 
              <call function="'checktestString'">
                { 
@@ -426,8 +426,8 @@
              
              <script>
                msg1 = 'Due to changes in the configuration, index'
                msg2 = 'dc_com_st.equality is currently operating in a'
                msg3 = 'degraded state and must be rebuilt before it can used'
                msg2 = 'dc_com_st is currently operating in a degraded'
                msg3 = 'state and must be rebuilt before it can be used'
              </script>                 
              <call function="'checktestString'">
                { 
@@ -474,8 +474,8 @@
              
              <script>
                msg1 = 'Due to changes in the configuration, index'
                msg2 = 'dc_com_st.equality is currently operating in a'
                msg3 = 'degraded state and must be rebuilt before it can used'
                msg2 = 'dc_com_st is currently operating in a degraded'
                msg3 = 'state and must be rebuilt before it can be used'
              </script>                 
              <call function="'checktestStringNotPresent'">
                { 
@@ -511,8 +511,8 @@
              
              <script>
                msg1 = 'Due to changes in the configuration, index'
                msg2 = 'dc_com_st.equality is currently operating in a'
                msg3 = 'degraded state and must be rebuilt before it can used'
                msg2 = 'dc_com_st is currently operating in a degraded'
                msg3 = 'state and must be rebuilt before it can be used'
              </script>                 
              <call function="'checktestStringNotPresent'">
                { 
@@ -556,11 +556,7 @@
                'noOfLoops'        : 5 ,
                'noOfMilliSeconds' : 2000
                }
              </call>
              <script>
                knownIssue(3102)
              </script>
              </call>
                            
              <call function="'testCase_Postamble'"/>
              
opends/tests/staf-tests/functional-tests/testcases/clu/clu_verify-index_checkbehavior.xml
@@ -195,7 +195,7 @@
          <!--- Test Case information
            #@TestMarker          verify-index check behavior tests
            #@TestName            verify-index: check with clean option
            #@TestIssue           3102
            #@TestIssue           none
            #@TestPurpose         Verify that verify-index command is successful
                                  and the output is correct.
            #@TestPreamble        none
@@ -272,11 +272,7 @@
                'returnString'   : returnString ,
                'expectedString' : msg
                }
              </call>
              <script>
                knownIssue(3102)
              </script>
              </call>
              
              <call function="'testCase_Postamble'"/>
              
opends/tests/staf-tests/functional-tests/testcases/dsml/dsml_test.xml
@@ -42,226 +42,215 @@
          CurrentTestPath['suite'] = STAXCurrentBlock
        </script>
        <call function="'testSuite_Preamble'"/>
        <sequence>
          <message>'TESTS_DATA_DIR=%s ' % (local.data)
          </message>
          <!--- Test Case information
              #@TestMarker          test
              #@TestName            test: test webcontainer
              #@TestIssue           none
              #@TestPurpose         test webcontainer responding necessary to the
                                    test suite.
              #@TestPreamble        none
              #@TestSteps           get the list of DSML test family
              #@TestSteps           for each family get the list of DSML SOAP requests (testXYZ.dat)
              #@TestSteps           for each SOAP request, submit it and store the result (testXYZ.run)
              #@TestSteps           for each SOAP result, compare it with reference (testXYZ.run vs testXYZ.res)
              #@TestResult          Success if returns 0.
          -->
          <testcase name="getTestCaseName('dsml suites')">
            <sequence>
              <message>'List DSML suites families'</message>
        <message>'TESTS_DATA_DIR=%s ' % (local.data)</message>
        <!--- Test Case information
            #@TestMarker          test
            #@TestName            test: test webcontainer
            #@TestIssue           none
            #@TestPurpose         test webcontainer responding necessary to the
                                  test suite.
            #@TestPreamble        none
            #@TestSteps           get the list of DSML test family
            #@TestSteps           for each family get the list of DSML SOAP requests (testXYZ.dat)
            #@TestSteps           for each SOAP request, submit it and store the result (testXYZ.run)
            #@TestSteps           for each SOAP result, compare it with reference (testXYZ.run vs testXYZ.res)
            #@TestResult          Success if returns 0.
        -->
              <call function="'runSTAFCommand'">
                { 'name'      :  'list DSML suites families',
                  'location'  :  STAXServiceMachine,
                  'service'   :  'FS',
                  'request'   :  'LIST DIRECTORY',
                  'arguments' :  '%s/dsml/suites SORTBYNAME TYPE d' % local.data
                }
              </call>
        <message>'List DSML suites families'</message>
              <if expr="RC != 0">
        <call function="'runSTAFCommand'">
          { 'name'      :  'list DSML suites families',
            'location'  :  STAXServiceMachine,
            'service'   :  'FS',
            'request'   :  'LIST DIRECTORY',
            'arguments' :  '%s/dsml/suites SORTBYNAME TYPE d' % local.data
          }
        </call>
        <if expr="RC != 0">
          <sequence>
            <message>
              'Folder %d/dsml/suites does not exist.' % (local.data)
            </message>
            <return>0</return>
          </sequence>
        </if>
        <script>
          cmdRC=RC
          familyList=STAFResult
          # The subversion folder could be present, if so remove it
          if familyList.count != 0:
            try:
              familyList.remove('.svn')
            except ValueError:
              print "List element .svn does not exist"
          import re
          import base64
          runFileRE = re.compile( 'dat$')
          validAuthRE = re.compile ( '\%VALIDAUTH\%' )
          sslRE = re.compile( '_ssl' )
          urls = { \
            'noSSL' : 'http://%s:%s/dsml/DSMLServlet' % (WC_HOST,WC_PORT), \
            'SSL'   : 'https://%s:%s/dsml/DSMLServlet' % (WC_HOST,WC_SSL_PORT) \
          }
        </script>
        <message>'DSML familyList = %s' % familyList</message>
        <iterate var="family" in="familyList">
          <sequence>
            <message>'DSML family %s ' % family</message>
            <call function="'runSTAFCommand'">
              { 'name'      :  'List DSML suite %s input' % family,
                'location'  :  STAXServiceMachine,
                'service'   :  'FS',
                'request'   :  'LIST DIRECTORY',
                'arguments' :  '%s/dsml/suites/%s/data \
                                SORTBYNAME EXT dat TYPE f' % (local.data,family)
              }
            </call>
            <script>
              familyInput = STAFResult
            </script>
            <call function="'runSTAFCommand'">
              { 'name'      :  'List DSML suite %s expected results' % family,
                'location'  :  STAXServiceMachine,
                'service'   :  'FS',
                'request'   :  'LIST DIRECTORY',
                'arguments' :  '%s/dsml/suites/%s/data \
                                SORTBYNAME EXT res TYPE f' % (local.data,family)
              }
            </call>
            <script>
              familyExpected = STAFResult
            </script>
            <iterate var="test" in="familyInput">
              <testcase name="getTestCaseName('%s-%s' % (family,test))">
                <sequence>
                  <message>
                    'Folder %d/dsml/suites does not exist.' % (local.data)
                  </message>
                  <return>0</return>
                </sequence>
              </if>
              <script>
                cmdRC=RC
                familyList=STAFResult
                # The subversion folder could be present, if so remove it
                if familyList.count != 0:
                  try:
                    familyList.remove('.svn')
                  except ValueError:
                    print "List element .svn does not exist"
                import re
                import base64
                runFileRE = re.compile( 'dat$')
                validAuthRE = re.compile ( '\%VALIDAUTH\%' )
                sslRE = re.compile( '_ssl' )
                urls = { \
                  'noSSL' : 'http://%s:%s/dsml/DSMLServlet' % (WC_HOST,WC_PORT), \
                  'SSL'   : 'https://%s:%s/dsml/DSMLServlet' % (WC_HOST,WC_SSL_PORT) \
                }
              </script>
              <message>'DSML familyList = %s' % familyList</message>
              <iterate var="family" in="familyList">
                <sequence>
                  <message>'DSML family %s ' % family</message>
                  <call function="'testCase_Preamble'"/>
                  <script>
                    runFileName = runFileRE.sub('run',test)
                    runFilePath = '/tmp/%s_%s' % (family, runFileName)
                    requestFilePath = '%s/dsml/suites/%s/data/%s' % \
                      (local.data,family,test)
                    expectedFileName = runFileRE.sub('res',test)
                    expectedFilePath = '%s/dsml/suites/%s/data/%s' % \
                      (local.data,family,expectedFileName)
                    if (sslRE.search(test) != None):
                      url = urls['SSL']
                    else:
                      url = urls['noSSL']
                  </script>
                  <call function="'runSTAFCommand'">
                    { 'name'      :  'List DSML suite %s input' % family,
                    { 'name'      :  'List DSML suite %s file %s' % (family,test),
                      'location'  :  STAXServiceMachine,
                      'service'   :  'FS',
                      'request'   :  'LIST DIRECTORY',
                      'arguments' :  '%s/dsml/suites/%s/data \
                                      SORTBYNAME EXT dat TYPE f' % (local.data,family)
                      'request'   :  'GET FILE',
                      'arguments' :  requestFilePath
                    }
                  </call>
                  <script>
                    familyInput = STAFResult
                    from com.ibm.staf import STAFUtil
                    BODYSeparator = '\n\n'
                    BODYStart = STAFResult.index(BODYSeparator)
                    h = STAFResult[:BODYStart]
                    kvs=h.split("\n")
                    SOAPHeaders = "HEADER content-type=text/xml "
                    for e in kvs[1:]:
                      if (e.upper().startswith("CONTENT-LENGTH:")):
                        continue
                      if len(e.strip()) == 0:
                        continue
                      if (e.upper().startswith("AUTHORIZATION:")):
                        e = validAuthRE.sub( base64.encodestring('%s:%s' % \
                               (DIRECTORY_INSTANCE_DN,DIRECTORY_INSTANCE_PSWD)) , \
                             e )
                      s = e.split(':')
                      rs = re.compile(' ')
                      s[1]=s[1].strip()
                      if (rs.search(s[1]) != None):
                        s[1] = '"' + s[1] + '"'
                      SOAPHeaders = SOAPHeaders + 'HEADER ' + s[0] + '=' + s[1] + ' '
                    SOAPBody = STAFUtil.wrapData(STAFResult[BODYStart+len(BODYSeparator):])
                  </script>
                  <call function="'runSTAFCommand'">
                    { 'name'      :  'List DSML suite %s expected results' % family,
                    { 'name'      :  'Submit SOAPBody',
                      'location'  :  STAXServiceMachine,
                      'service'   :  'FS',
                      'request'   :  'LIST DIRECTORY',
                      'arguments' :  '%s/dsml/suites/%s/data \
                                      SORTBYNAME EXT res TYPE f' % (local.data,family)
                      'service'   :  'HTTP',
                      'request'   :  'REQUEST METHOD POST',
                      'arguments' :  'URL %s FOLLOWREDIRECT %s CONTENT %s RETURNHEADERS ' \
                                      % (url, SOAPHeaders, SOAPBody)
                    }
                  </call>
                  <script>
                    familyExpected = STAFResult
                  </script>
                  <call function="'checktestRC'">
                    {
                    'returncode' : RC ,
                    'result'     : STAFResult
                    }
                  </call>
                  <if expr="result['statusCode'] == '200'">
                    <sequence>
                      <script>
                        # writing the result file to compare with expected result
                        httpHeaders = result['headers']
                        httpContent = result['content']
                        resultContent = "HTTP1.1 "
                        resultContent += result['statusCode'] + ' '
                        resultContent += result['statusMessage'] + '\n'
                        resultContent += "\n".join(["%s: %s" % (k, v) for k, v in httpHeaders.items()])
                        resultContent += '\n\n' + httpContent
                        f=open(runFilePath,'w')
                        f.write(resultContent)
                        f.close()
                      </script>
                      <message>'Comparing result %s and expected result %s' %  (runFilePath, expectedFilePath)</message>
                  <iterate var="test" in="familyInput">
                    <testcase name="getTestCaseName('%s-%s' % (family,test))">
                      <sequence>
                        <call function="'testCase_Preamble'"/>
                        <script>
                          runFileName = runFileRE.sub('run',test)
                          runFilePath = '/tmp/%s_%s' % (family, runFileName)
                          requestFilePath = '%s/dsml/suites/%s/data/%s' % \
                            (local.data,family,test)
                          expectedFileName = runFileRE.sub('res',test)
                          expectedFilePath = '%s/dsml/suites/%s/data/%s' % \
                            (local.data,family,expectedFileName)
                          if (sslRE.search(test) != None):
                            url = urls['SSL']
                          else:
                            url = urls['noSSL']
                        </script>
                      <call function="'runSTAFCommand'">
                        { 'name'      :  'Compare SOAPResult with expected result',
                          'location'  :  STAXServiceMachine,
                          'service'   :  'DSML',
                          'request'   :  'COMPARE FILE',
                          'arguments' :  '%s EXP_FILE %s' %(runFilePath, expectedFilePath)
                        }
                      </call>
                        <call function="'runSTAFCommand'">
                          { 'name'      :  'List DSML suite %s file %s' % (family,test),
                            'location'  :  STAXServiceMachine,
                            'service'   :  'FS',
                            'request'   :  'GET FILE',
                            'arguments' :  requestFilePath
                          }
                        </call>
                      <call function="'checktestRC'">
                        {
                        'returncode' : RC ,
                        'result'     : STAXResult
                        }
                      </call>
                    </sequence>
                    <else>
                      <call function="'checktestRC'">
                        {
                        'returncode' : result['statusCode'] ,
                        'result'     : result['statusMessage']
                        }
                      </call>
                    </else>
                  </if>
                        <script>
                          from com.ibm.staf import STAFUtil
                          BODYSeparator = '\n\n'
                          BODYStart = STAFResult.index(BODYSeparator)
                          h = STAFResult[:BODYStart]
                          kvs=h.split("\n")
                          SOAPHeaders = "HEADER content-type=text/xml "
                          for e in kvs[1:]:
                            if (e.upper().startswith("CONTENT-LENGTH:")):
                              continue
                            if len(e.strip()) == 0:
                              continue
                            if (e.upper().startswith("AUTHORIZATION:")):
                              e = validAuthRE.sub( base64.encodestring('%s:%s' % \
                                     (DIRECTORY_INSTANCE_DN,DIRECTORY_INSTANCE_PSWD)) , \
                                   e )
                            s = e.split(':')
                            rs = re.compile(' ')
                            s[1]=s[1].strip()
                            if (rs.search(s[1]) != None):
                              s[1] = '"' + s[1] + '"'
                            SOAPHeaders = SOAPHeaders + 'HEADER ' + s[0] + '=' + s[1] + ' '
                          SOAPBody = STAFUtil.wrapData(STAFResult[BODYStart+len(BODYSeparator):])
                        </script>
                        <call function="'runSTAFCommand'">
                          { 'name'      :  'Submit SOAPBody',
                            'location'  :  STAXServiceMachine,
                            'service'   :  'HTTP',
                            'request'   :  'REQUEST METHOD POST',
                            'arguments' :  'URL %s FOLLOWREDIRECT %s CONTENT %s RETURNHEADERS ' \
                                            % (url, SOAPHeaders, SOAPBody)
                          }
                        </call>
                        <call function="'checktestRC'">
                          {
                          'returncode' : RC ,
                          'result'     : STAFResult
                          }
                        </call>
                        <if expr="result['statusCode'] == '200'">
                          <sequence>
                            <script>
                              # writing the result file to compare with expected result
                              httpHeaders = result['headers']
                              httpContent = result['content']
                              resultContent = "HTTP1.1 "
                              resultContent += result['statusCode'] + ' '
                              resultContent += result['statusMessage'] + '\n'
                              resultContent += "\n".join(["%s: %s" % (k, v) for k, v in httpHeaders.items()])
                              resultContent += '\n\n' + httpContent
                              f=open(runFilePath,'w')
                              f.write(resultContent)
                              f.close()
                            </script>
                            <message>'Comparing result %s and expected result %s' %  (runFilePath, expectedFilePath)</message>
                            <call function="'runSTAFCommand'">
                              { 'name'      :  'Compare SOAPResult with expected result',
                                'location'  :  STAXServiceMachine,
                                'service'   :  'DSML',
                                'request'   :  'COMPARE FILE',
                                'arguments' :  '%s EXP_FILE %s' %(runFilePath, expectedFilePath)
                              }
                            </call>
                            <call function="'checktestRC'">
                              {
                              'returncode' : RC ,
                              'result'     : STAXResult
                              }
                            </call>
                          </sequence>
                          <else>
                            <call function="'checktestRC'">
                              {
                              'returncode' : result['statusCode'] ,
                              'result'     : result['statusMessage']
                              }
                            </call>
                          </else>
                        </if>
                        <call function="'testCase_Postamble'"/>
                      </sequence>
                    </testcase>
                  </iterate>
                  <call function="'testCase_Postamble'"/>
                </sequence>
              </iterate>
              </testcase>
            </iterate>
          </sequence>
        </iterate>
              <call function="'checktestRC'">
                {
                'returncode' : RC ,
                'result'     : STAFResult
                }
              </call>
            </sequence>
          </testcase>
        </sequence>
        <call function="'testSuite_Postamble'"/>
      </sequence>
    </block>
opends/tests/staf-tests/functional-tests/testcases/monitoring/monitoring_componant.xml
@@ -45,134 +45,6 @@
#@TestScript          monitoring_componants.xml
#@TestHTMLLink        http://opends.dev.java.net/
-->
        <!---
#@TestMarker            monitoring componants
#@TestName              monitoring componants
#@TestIssue             Check the monitoring of the componant LDIF connection handler
#@TestPreamble          none
#@TestStep               Check the entry on cn=LDIF Connection Handler,cn=monitor is available
#@TestStep              Disable the LDIF connection handler componant
#@TestStep              Check the entry on cn=LDIF Connection Handler,cn=monitor is not more available
#@TestPostamble         none
-->
        <testcase name="getTestCaseName('LDIF connection handler monitoring')">
          <sequence>
            <call function="'testCase_Preamble'"/>
            <!-- Check the entry on cn=LDIF Connection Handler,cn=monitor is available -->
            <message>'######  Monitor the LDIF connection handler ###### '</message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
              'dsInstancePort'     : DIRECTORY_INSTANCE_PORT ,
              'dsInstanceDn'       : DIRECTORY_INSTANCE_DN,
              'dsInstancePswd'     : DIRECTORY_INSTANCE_PSWD ,
              'dsBaseDN'           : 'cn=LDIF Connection Handler,cn=monitor',
              'dsFilter'           : 'objectclass=*',
              'expectedRC'     :  0 }
            </call>
            <message>'-- Disable the LDIF Connection Handler --'</message>
            <call function="'dsconfig'">
              { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST,
              'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
              'dsInstancePswd'       : DIRECTORY_INSTANCE_PSWD ,
              'subcommand'           : 'set-connection-handler-prop' ,
              'objectType'           : 'handler-name',
              'objectName'           : 'LDIF Connection Handler',
              'optionsString'        : '--set enabled:false',
              'expectedRC'           : 0 }
            </call>
            <!-- Check the entry on cn=LDIF Connection Handler,cn=monitor is not available -->
            <message>'######  Monitor the LDIF Connection Handler  ###### '</message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'    : DIRECTORY_INSTANCE_HOST ,
              'dsInstancePort'      : DIRECTORY_INSTANCE_PORT ,
              'dsInstanceDn'        : DIRECTORY_INSTANCE_DN,
              'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
              'dsBaseDN'            : 'cn=LDIF Connection Handler,cn=monitor',
              'dsFilter'            : 'objectclass=*',
              'expectedRC'      :  32 }
            </call>
            <message>'-- Enabled the LDIF Connection Handler --'</message>
            <call function="'dsconfig'">
              { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST,
              'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
              'dsInstancePswd'       : DIRECTORY_INSTANCE_PSWD ,
              'subcommand'           : 'set-connection-handler-prop' ,
              'objectType'           : 'handler-name',
              'objectName'           : 'LDIF Connection Handler',
              'optionsString'        : '--set enabled:true',
              'expectedRC'           : 0 }
            </call>
            <call function="'testCase_Postamble'"/>
          </sequence>
        </testcase>
        <!---
#@TestMarker            monitoring componants
#@TestName              monitoring componants
#@TestPurpose           Check the monitoring of a NEW componant LDIF connection handler
#@TestIssue             2884
#@TestPreamble          none
#@TestStep              Create a new LDIF connection handler
#@TestStep              Check the entry on cn=myLDIF,cn=monitor is available
#@TestStep              Delete the new LDIF connection handler componant
#@TestPostamble         none
-->
        <testcase name="getTestCaseName('Monitoring a new LDIF connection handler')">
          <sequence>
            <call function="'testCase_Preamble'"/>
            <message>'-- Create a new  LDIF Connection Handler --'</message>
            <call function="'dsconfig'">
              { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST,
              'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
              'dsInstancePswd'       : DIRECTORY_INSTANCE_PSWD ,
              'subcommand'           : 'create-connection-handler' ,
              'objectType'           : 'handler-name',
              'objectName'           : 'myLDIF',
              'optionsString'        : '--type ldif --set enabled:true',
              'expectedRC'           : 0 }
            </call>
            <!-- Check the entry on cn=myLDIF,cn=monitor is available -->
            <message>'######  Monitor the new LDIF connection handler ###### '</message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
              'dsInstancePort'     : DIRECTORY_INSTANCE_PORT ,
              'dsInstanceDn'       : DIRECTORY_INSTANCE_DN,
              'dsInstancePswd'     : DIRECTORY_INSTANCE_PSWD ,
              'dsBaseDN'           : 'cn=myLDIF,cn=monitor',
              'dsFilter'           : 'objectclass=*',
              'expectedRC'     :  0 }
            </call>
            <message>'-- Delete the new  LDIF Connection Handler --'</message>
            <call function="'dsconfig'">
              { 'dsInstanceHost'     : DIRECTORY_INSTANCE_HOST,
              'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
              'dsInstancePswd'       : DIRECTORY_INSTANCE_PSWD ,
              'subcommand'           : 'delete-connection-handler' ,
              'objectType'           : 'handler-name',
              'objectName'           : 'myLDIF',
              'expectedRC'           : 0 }
            </call>
            <script>
        knownIssue(2884)
            </script>
            <call function="'testCase_Postamble'"/>
          </sequence>
        </testcase>
        
        <!---
#@TestMarker            monitoring componants
opends/tests/staf-tests/functional-tests/testcases/plugins/plugins_7bit.xml
@@ -118,7 +118,19 @@
      }
    </call>
    <!-- Cleanup -->
    <message>'######  Cleanup ###### '</message>
    <message>'-- Delete the test entry --'</message>
    <call function="'DeleteEntry'">
      { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
      'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
      'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
      'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
      'dsBaseDN'         : 'uid=testuser_7bit,%s' % DIRECTORY_INSTANCE_SFX,
      'expectedRC'       : 'noCheck'
      }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>            
@@ -178,7 +190,19 @@
      }
    </call>
    <!-- Cleanup -->
    <message>'######  Cleanup ###### '</message>
    <message>'-- Delete the test entry --'</message>
    <call function="'DeleteEntry'">
      { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
      'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
      'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
      'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
      'dsBaseDN'         : 'uid=testuser_7bit,%s' % DIRECTORY_INSTANCE_SFX,
      'expectedRC'       : 'noCheck'
      }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>        
@@ -239,7 +263,6 @@
      }
    </call>
    <!-- Cleanup -->
    <message>'######  Cleanup ###### '</message>    
    <message>'-- Delete the test entry --'</message>
@@ -251,8 +274,7 @@
      'dsBaseDN'         : 'uid=testuser_7bit,%s' % DIRECTORY_INSTANCE_SFX,
      }
    </call>
    <call function="'testCase_Postamble'"/>
  </sequence>
 </testcase>     
opends/tests/staf-tests/functional-tests/testcases/sample/sample.xml
@@ -26,57 +26,64 @@
 !      Copyright 2007-2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="sample" />
  <function name="sample">
  <defaultcall function="main_sample" />
  <function name="main_sample">
    <function-list-args>
      <function-required-arg name="STAXParentID"/>
    </function-list-args>
    <sequence>
      <script>
        CurrentTestPath['group']= 'sample'
        envAlreadyLoaded='true'
      </script>
      <!--- Load the job environment for the test group execution -->
      <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR" />
      <call function="'loadJobEnvironment'">
           { 'parent' : STAXParentID }
      </call>
      <!---
        #@TestSuiteName             Sample
        #@TestSuitePurpose          Illustrate how to easily contribute functional tests
        #@TestSuiteGroup            Sample
        #@TestScript                aci_add_entry.xml
      -->
      <!-- Try/catch/finally structure are a handy way to alter the execution
    <sequence>
      <block name="'sample'">
        <sequence>
          <!--- Load the job environment for the test group execution -->
          <import machine="STAF_LOCAL_HOSTNAME"
              file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR"/>
          <call function="'loadJobEnvironment'">
            { 'parent' : STAXParentID }
          </call>
          <script>
            CurrentTestPath['group']= 'sample'
            envAlreadyLoaded='true'
          </script>
          <!---
            #@TestSuiteName             Sample
            #@TestSuitePurpose          Illustrate how to easily contribute functional tests
            #@TestSuiteGroup            Sample
            #@TestScript                aci_add_entry.xml
          -->
          <!-- Try/catch/finally structure are a handy way to alter the execution
           flow of a suite in front of unexpected conditions
       -->
      <try>
        <!-- this is an example of how to loop through a list of functions to
             run instead of duplicating calls
         -->
         <sequence>
          <iterate in="['testGroup_Preamble','testSuite_Preamble','sample_setup']" var="setupStep">
            <!-- the sequence tag is superfluous here since there is only a
                 single instruction to execute within the iterate block
          -->
          <try>
            <!-- this is an example of how to loop through a list of functions to
             run instead of duplicating calls
             -->
            <call function="setupStep" />
          </iterate>
          <iterate in="['sample_test','knownIssue_test','passing_test','inconclusive_test','failing_test']" var="testStep">
            <!-- the sequence tag is superfluous here since there is only a
                 single instruction to execute within the iterate block
             -->
            <call function="testStep" />
          </iterate>
        </sequence>
        <catch exception="'STAFException.Topology.CreationException'">
          <!-- it is a good idea to make sure that the messages getting
               sent to the gui also make their way in the logs for easier
            <sequence>
              <iterate in="['testGroup_Preamble','testSuite_Preamble','sample_setup']" var="setupStep">
                <!-- the sequence tag is superfluous here since there is only a
                 single instruction to execute within the iterate block
                 -->
                <call function="setupStep" />
              </iterate>
              <iterate in="['sample_test','knownIssue_test','passing_test','inconclusive_test','failing_test']" var="testStep">
                <!-- the sequence tag is superfluous here since there is only a
                 single instruction to execute within the iterate block
                 -->
                <call function="testStep" />
              </iterate>
            </sequence>
            <catch exception="'STAFException.Topology.CreationException'">
              <!-- it is a good idea to make sure that the messages getting
               sent to the gui also make their way in the logs for easier
               after-the-fact log mining. Use log="1" wherever it makes sense
               Setting the log level to an appropriate value will also make
               Setting the log level to an appropriate value will also make
               troubleshooting and debugging easier.
               Level values can be (among others):
                . fatal
@@ -85,18 +92,21 @@
                . info
                . trace
                . debug
           -->
          <message log="1" level="'fatal'">'Could not create the topology. Bailing out.'</message>
        </catch>
        <catch exception="'STAXException.Topology.StartException'">
          <message log="1" level="'fatal'">'Could not start at least one server in the topology. Bailing out.'</message>
        </catch>
        <finally>
          <iterate in="['sample_cleanup','testSuite_Postamble','testGroup_Postamble']" var="testStep">
            <call function="testStep" />
          </iterate>
        </finally>
      </try>
               -->
              <message log="1" level="'fatal'">'Could not create the topology. Bailing out.'</message>
            </catch>
            <catch exception="'STAXException.Topology.StartException'">
              <message log="1" level="'fatal'">'Could not start at least one server in the topology. Bailing out.'</message>
            </catch>
            <finally>
              <iterate in="['sample_cleanup','testSuite_Postamble','testGroup_Postamble']" var="testStep">
                <call function="testStep" />
              </iterate>
            </finally>
          </try>
        </sequence>
      </block>
    </sequence>
  </function>
  
opends/tests/staf-tests/functional-tests/testcases/setup/directory_manager.xml
@@ -449,48 +449,34 @@
          </call>
          <script>
            ldifDir = '%s/ldif' % (DM_I1_ROOT)
            ldifFile = '%s' % DM_O1_LDIF
            ldifNewFile = '%s/ldif/dm-o1.ldif' % (DM_I1_ROOT)
          </script>
          
          <call function="'runSTAFCommand'">
            { 'name'      :  'Copy LDIF file in I1',
              'location'  :  STAF_REMOTE_HOSTNAME,
              'service'   :  'FS',
              'request'   :  'COPY',
              'arguments' :  'FILE %s TODIRECTORY %s' % (ldifFile, ldifDir)
          <message>'Copy LDIF file in I1'</message>
          <call function="'copyFile'">
            { 'location'   : STAF_REMOTE_HOSTNAME,
              'srcfile'    : ldifFile,
              'destfile'   : ldifNewFile,
              'remotehost' : STAF_REMOTE_HOSTNAME
            }
          </call>
          <call function="'checktestRC'">
            { 'returncode' : RC,
              'expected'   : 0,
              'result'     : 'FAIL to copy LDIF file for I1',
            }
          </call>
          <script>
            ldifDir = '%s/ldif' % (DM_I2_ROOT)
            ldifFile = '%s' % DM_O1_LDIF
            ldifNewFile = '%s/ldif/dm-o1.ldif' % (DM_I2_ROOT)
          </script>
          
          <call function="'runSTAFCommand'">
            { 'name'      :  'Copy LDIF file in I2',
              'location'  :  STAF_REMOTE_HOSTNAME,
              'service'   :  'FS',
              'request'   :  'COPY',
              'arguments' :  'FILE %s TODIRECTORY %s' % (ldifFile, ldifDir)
          <message>'Copy LDIF file in I2'</message>
          <call function="'copyFile'">
            { 'location'   : STAF_REMOTE_HOSTNAME,
              'srcfile'    : ldifFile,
              'destfile'   : ldifNewFile,
              'remotehost' : STAF_REMOTE_HOSTNAME
            }
          </call>
          <call function="'checktestRC'">
            { 'returncode' : RC,
              'expected'   : 0,
              'result'     : 'FAIL to copy LDIF file for I2',
            }
          </call>
      <!-- 5. Uninstall I1: referencedHostTestcase adminUID bindPassword
          <!-- 5. Uninstall I1: referencedHostTestcase adminUID bindPassword
           configuration-files databases log-files server-libraries -->
          <message>'Uninstall I1'</message>
          <script>
@@ -567,41 +553,83 @@
          </call>
          <call function="'checkFileExists'">
            { 'file' : '%s/bak' % DM_I1_ROOT }
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file'     : '%s/bak' % DM_I1_ROOT
            }
          </call>
          <call function="'checkFileExists'">
            { 'file' : '%s/ldif' % DM_I1_ROOT }
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file'     : '%s/ldif' % DM_I1_ROOT
            }
          </call>
          <call function="'checkFileNotExists'">
            { 'file' : '%s/bin' % DM_I1_ROOT }
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file'     : '%s/bin' % DM_I1_ROOT
            }
          </call>
          <call function="'checkFileNotExists'">
            { 'file' : '%s/config' % DM_I1_ROOT }
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file'     : '%s/config' % DM_I1_ROOT
            }
          </call>
          <call function="'checkFileNotExists'">
            { 'file' : '%s/db' % DM_I1_ROOT }
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file'     : '%s/db' % DM_I1_ROOT
            }
          </call>
          <call function="'checkFileNotExists'">
            { 'file' : '%s/logs' % DM_I1_ROOT }
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file'     : '%s/logs' % DM_I1_ROOT
            }
          </call>
          <call function="'checkFileNotExists'">
            { 'file' : '%s/bak' % DM_I2_ROOT }
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file' : '%s/bak' % DM_I2_ROOT
            }
          </call>
          <call function="'checkFileNotExists'">
            { 'file' : '%s/ldif' % DM_I2_ROOT }
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file' : '%s/ldif' % DM_I2_ROOT
            }
          </call>
          <script>
            if is_windows_platform(STAF_REMOTE_HOSTNAME):
              subDir='bat'
            else:
              subDir='bin'
          </script>
          <call function="'checkFileExists'">
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file' : '%s/%s' % (DM_I2_ROOT, subDir)
            }
          </call>
          <call function="'checkFileExists'">
            { 'file' : '%s/bin' % DM_I2_ROOT }
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file' : '%s/config' % DM_I2_ROOT
            }
          </call>
          <call function="'checkFileExists'">
            { 'file' : '%s/config' % DM_I2_ROOT }
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file' : '%s/db' % DM_I2_ROOT
            }
          </call>
          <call function="'checkFileExists'">
            { 'file' : '%s/db' % DM_I2_ROOT }
          </call>
          <call function="'checkFileExists'">
            { 'file' : '%s/logs' % DM_I2_ROOT }
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file' : '%s/logs' % DM_I2_ROOT
            }
          </call>
opends/tests/staf-tests/functional-tests/testcases/setup/import.xml
@@ -480,6 +480,12 @@
            }
          </call>
          <script>
            nb = len(STAFResult)
            ct = (STAFResult[0] == 'lib')
            a = ' '
          </script>
          <call function="'checktestRC'">
            { 'returncode' : RC,
              'expected'   : 0,
@@ -487,12 +493,6 @@
            }
          </call>
          <script>
            nb = len(STAFResult)
            ct = (STAFResult[0] == 'lib')
            a = ' '
          </script>
          <call function="'checktestRC'">
            { 'returncode' : nb,
              'result'     : a,
opends/tests/staf-tests/functional-tests/testcases/setup/ports.xml
@@ -53,18 +53,13 @@
      <call function="'testSuite_Preamble'"/>
      <script>
        STAF_PORT = 6500
      </script>
      <call function="'getFreePort'">
        {
          'host'  : STAF_REMOTE_HOSTNAME,
          'port'  : 3000,
          'port'  : 2000,
        }
      </call>
      <script>FREE_PORT_1 = STAXResult</script>
      <script>PORTS_I1_PORT = STAXResult</script>
      <call function="'getFreePort'">
        {
@@ -72,13 +67,103 @@
          'port'  : 4000,
        }
      </call>
      <script>FREE_PORT_2 = STAXResult</script>
      <script>PORTS_I1_ADMIN_PORT = STAXResult</script>
      <call function="'getFreePort'">
        {
          'host'  : STAF_REMOTE_HOSTNAME,
          'port'  : 3000,
        }
      </call>
      <script>PORTS_I2_PORT = STAXResult</script>
      <message>
        'Got 2 free ports: %s and %s' % (FREE_PORT_1, FREE_PORT_2)
        'Got 3 free ports: %s, %s and %s' \
        % (PORTS_I1_PORT, PORTS_I1_ADMIN_PORT, PORTS_I2_PORT)
      </message>
      
      <!--- Test Case information
        #@TestMarker          Setup-Uninstall ports Tests
        #@TestName            Setup-Uninstall: Ports:
                              bind-port
        #@TestID              bind-port
        #@TestPurpose         Setup a first instance to bind a port
        #@TestPreamble
        #@TestStep            Setup a first instance to bind a port
        #@TestPostamble
        #@TestResult          PASS if all steps ran without errors
      -->
      <testcase name="getTestCaseName('bind-port')">
        <sequence>
          <call function="'testCase_Preamble'"/>
          <message>'Ports: Setup a first instance to bind a port'</message>
          <script>
            PORTS_I1_BASE = '%s/port_i1' % (OUT_GROUP)
            PORTS_I1_ROOT = '%s/%s' % (PORTS_I1_BASE, OPENDSNAME)
          </script>
          <message>'Prepare Open DS ZIP (in %s)' % PORTS_I1_ROOT</message>
          <call function="'runSTAFCommand'">
            { 'name'      :  'Create directory to contain I1',
              'location'  :  STAF_REMOTE_HOSTNAME,
              'service'   :  'FS',
              'request'   :  'CREATE',
              'arguments' :  'DIRECTORY %s FAILIFEXISTS' % PORTS_I1_BASE
            }
          </call>
          <call function="'checktestRC'">
            { 'returncode' : RC,
              'expected'   : 0,
              'result'     : 'FAIL to create directory',
            }
          </call>
          <call function="'runSTAFCommand'">
            { 'name'      :  'Extract OpenDS ZIP file',
              'location'  :  STAF_REMOTE_HOSTNAME,
              'service'   :  'ZIP',
              'request'   :  'UNZIP',
              'arguments' :  'ZIPFILE %s/%s TODIRECTORY %s RESTOREPERMISSION' \
                % (DIRECTORY_INSTANCE_DIR, ZIPNAME, PORTS_I1_BASE)
            }
          </call>
          <call function="'checktestRC'">
            { 'returncode' : RC,
              'expected'   : 0,
              'result'     : 'FAIL to unzip OpenDS ZIP file',
            }
          </call>
          <script>
            c = '%s/setup%s' % (PORTS_I1_ROOT, fileExt)
            p = []
            p.append('--cli --no-prompt --rootUserPassword kangourou')
            p.append('--ldapPort %s' % PORTS_I1_PORT)
            p.append('--adminConnectorPort %s' % PORTS_I1_ADMIN_PORT)
            p = ' '.join(p)
          </script>
      
          <message>'%s %s' % (c, p)</message>
          <call function="'runCommand'">
            { 'location'  : STAF_REMOTE_HOSTNAME,
              'name'      : 'Setup a first instance to bind a port',
              'command'   : c,
              'arguments' : p,
              'path'      : PORTS_I1_ROOT,
              'expectedRC': 0,
              'outputFile': '%s/ports-install-i1.txt' % OUT_GROUP,
            }
          </call>
          <call function="'testCase_Postamble'"/>
        </sequence>
      </testcase>
      <!--- Test Case information
        #@TestMarker          Setup-Uninstall ports Tests
        #@TestName            Setup-Uninstall: Ports: 
@@ -101,7 +186,7 @@
            c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
            p = []
            p.append('--cli --no-prompt --rootUserPassword kangourou')
            p.append('--ldapPort %s' % STAF_PORT)
            p.append('--ldapPort %s' % PORTS_I1_PORT)
            p = ' '.join(p)
          </script>
      
@@ -144,8 +229,8 @@
            c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
            p = []
            p.append('--cli --no-prompt --rootUserPassword kangourou')
            p.append('--ldapPort %s' % FREE_PORT_1)
            p.append('--ldapsPort %s' % STAF_PORT)
            p.append('--ldapPort %s' % PORTS_I2_PORT)
            p.append('--ldapsPort %s' % PORTS_I1_PORT)
            p.append('--generateSelfSignedCertificate')
            p = ' '.join(p)
          </script>
@@ -188,8 +273,8 @@
            c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
            p = []
            p.append('--cli --no-prompt --rootUserPassword kangourou')
            p.append('--ldapPort %s' % FREE_PORT_1)
            p.append('--jmxPort %s' % STAF_PORT)
            p.append('--ldapPort %s' % PORTS_I2_PORT)
            p.append('--jmxPort %s' % PORTS_I1_PORT)
            p = ' '.join(p)
          </script>
    
@@ -227,8 +312,8 @@
        <sequence>
          
          <script>
            PORTS_I1_BASE = '%s/ports_i1' % (OUT_GROUP)
            PORTS_I1_ROOT = '%s/%s' % (PORTS_I1_BASE, OPENDSNAME)
            PORTS_I2_BASE = '%s/ports_i2' % (OUT_GROUP)
            PORTS_I2_ROOT = '%s/%s' % (PORTS_I2_BASE, OPENDSNAME)
          </script>
          
          
@@ -239,11 +324,11 @@
          <message>'Prepare Open DS ZIP (in %s)' % PORTS_I1_ROOT</message>
          <call function="'runSTAFCommand'">
            { 'name'      :  'Create directory to contain I1',
            { 'name'      :  'Create directory to contain I2',
              'location'  :  STAF_REMOTE_HOSTNAME,
              'service'   :  'FS',
              'request'   :  'CREATE',
              'arguments' :  'DIRECTORY %s FAILIFEXISTS' % PORTS_I1_BASE
              'arguments' :  'DIRECTORY %s FAILIFEXISTS' % PORTS_I2_BASE
            }
          </call>
@@ -260,7 +345,7 @@
              'service'   :  'ZIP',
              'request'   :  'UNZIP',
              'arguments' :  'ZIPFILE %s/%s TODIRECTORY %s RESTOREPERMISSION' \
                % (DIRECTORY_INSTANCE_DIR, ZIPNAME, PORTS_I1_BASE)
                % (DIRECTORY_INSTANCE_DIR, ZIPNAME, PORTS_I2_BASE)
            }
          </call>
@@ -272,9 +357,9 @@
          </call>
          <script>
            c = '%s/setup%s' % (PORTS_I1_ROOT, fileExt)
            c = '%s/setup%s' % (PORTS_I2_ROOT, fileExt)
            p = []
            p.append('--cli --no-prompt --ldapPort %s' % (STAF_PORT))
            p.append('--cli --no-prompt --ldapPort %s' % PORTS_I1_PORT)
            p.append('--rootUserPassword "kangourou"')
            p.append('--skipPortCheck --doNotStart --noPropertiesFile')
            p = ' '.join(p)
@@ -283,17 +368,17 @@
          <message>'%s %s' % (c, p)</message>
          <call function="'runCommand'">
            { 'location'  : STAF_REMOTE_HOSTNAME,
              'name'      : 'Setup command for I1 (port conflict but nocheck)',
              'name'      : 'Setup command for I2 (port conflict but nocheck)',
              'command'   : c,
              'arguments' : p,
              'path'      : PORTS_I1_ROOT,
              'expectedRC': 0,
              'outputFile': '%s/ports-setup-confl-nocheck-i1.txt' % OUT_GROUP,
              'outputFile': '%s/ports-setup-confl-nocheck-i2.txt' % OUT_GROUP,
            }
          </call>
          <script>
            c = '%s/%s/start-ds%s' % (PORTS_I1_ROOT, fileFolder, fileExt)
            c = '%s/%s/start-ds%s' % (PORTS_I2_ROOT, fileFolder, fileExt)
            p = []
            p = ' '.join(p)
          </script>
@@ -304,14 +389,14 @@
              'name'      : 'start DS (will raise port conflict)',
              'command'   : c,
              'arguments' : p,
              'path'      : PORTS_I1_ROOT,
              'path'      : PORTS_I2_ROOT,
              'expectedRC': 1,
              'outputFile': '%s/ports-start-conflict-i1.txt' % OUT_GROUP,
              'outputFile': '%s/ports-start-conflict-i2.txt' % OUT_GROUP,
            }
          </call>
          
          <script>
            c = '%s/uninstall%s' % (PORTS_I1_ROOT, fileExt)
            c = '%s/uninstall%s' % (PORTS_I2_ROOT, fileExt)
            p = []
            p.append('--cli --no-prompt')
            p.append('--quiet --forceOnError --remove-all')
@@ -322,12 +407,12 @@
          <message>'%s %s' % (c, p)</message>
          <call function="'runCommand'">
            { 'location'  : STAF_REMOTE_HOSTNAME,
              'name'      : 'Uninstall I1',
              'name'      : 'Uninstall I2',
              'command'   : c,
              'arguments' : p,
              'path'      : PORTS_I1_ROOT,
              'expectedRC': 0,
              'outputFile': '%s/ports-uninstall-conflict-i1.txt' % OUT_GROUP,
              'outputFile': '%s/ports-uninstall-conflict-i2.txt' % OUT_GROUP,
            }
          </call>
          <call function="'testCase_Postamble'"/>
@@ -355,51 +440,95 @@
          <call function="'testCase_Preamble'"/>
          <message>'Ports: Unauthorized LDAP port'</message>
          
          <!-- This testcase is not relevant on Windows -->
          <script>
            c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
            p = []
            p.append('--cli --no-prompt --rootUserPassword kangourou')
            p.append('--ldapPort 1')
            p = ' '.join(p)
            if is_windows_platform(STAF_REMOTE_HOSTNAME):
              skip=1
            else:
              skip=0
          </script>
          <message>'%s %s' % (c, p)</message>
          <call function="'runCommand'">
            { 'location'  : STAF_REMOTE_HOSTNAME,
              'name'      : 'Launch setup command with unauthorized LDAP port',
              'command'   : c,
              'arguments' : p,
              'path'      : ODS_UNZIPPED,
              'expectedRC': 2,
              'outputFile': '%s/ports-unauthorized-ldap.txt' % OUT_GROUP,
            }
          </call>
          <!--- Temporary fix to avoid remaning processes
                when this testcase fails -->
          <script>
            cmd = '%s/%s/%s/stop-ds%s' \
                  % (ODS_UNZIPPED, OPENDSNAME, fileFolder, fileExt)
          </script>
          <if expr="os.path.exists(cmd)" >
          <if expr="skip == 0">
            <sequence>
              <message>'Stop instance'</message>
              <call function="'StopDsWithScript'">
              <script>
                c = '%s/%s/setup%s' % (ODS_UNZIPPED, OPENDSNAME, fileExt)
                p = []
                p.append('--cli --no-prompt --rootUserPassword kangourou')
                p.append('--ldapPort 1')
                p = ' '.join(p)
              </script>
              <message>'%s %s' % (c, p)</message>
              <call function="'runCommand'">
                { 'location'  : STAF_REMOTE_HOSTNAME,
                'dsPath'      : '%s/%s' % (ODS_UNZIPPED, OPENDSNAME),
                'dsAdminPort' : 1,
                'dsBindDN'    : 'cn=Directory Manager' ,
                'dsBindPwd'   : 'kangourou' ,
                'expectedRC'  : 'noCheck'
                  'name'      : 'Launch setup command with unauthorized LDAP port',
                  'command'   : c,
                  'arguments' : p,
                  'path'      : ODS_UNZIPPED,
                  'expectedRC': 2,
                  'outputFile': '%s/ports-unauthorized-ldap.txt' % OUT_GROUP,
                }
              </call>
            </sequence>
            <else>
              <sequence>
                <message>'This testcase is not relevant on Windows'</message>
                <tcstatus result="'pass'"/>
              </sequence>
            </else>
          </if>
          <call function="'testCase_Postamble'"/>
        </sequence>
      </testcase> 
      <!--- Test Case information
        #@TestMarker          Setup-Uninstall ports Tests
        #@TestName            Setup-Uninstall: Ports:
                              uninstall
        #@TestID              uninstall
        #@TestPurpose         Uninstall the first instance
        #@TestPreamble
        #@TestStep            Uninstall the first instance
        #@TestPostamble
        #@TestResult          PASS if all steps ran without errors
      -->
      <testcase name="getTestCaseName('uninstall')">
        <sequence>
          <call function="'testCase_Preamble'"/>
          <message>'Ports: Uninstall the first instance'</message>
          <script>
            PORTS_I1_BASE = '%s/port_i1' % (OUT_GROUP)
            PORTS_I1_ROOT = '%s/%s' % (PORTS_I1_BASE, OPENDSNAME)
          </script>
          <script>
            c = '%s/uninstall%s' % (PORTS_I1_ROOT, fileExt)
            p = []
            p.append('--cli --no-prompt')
            p.append('--quiet --forceOnError --remove-all')
            p.append('--referencedHostName %s' % STAF_REMOTE_HOSTNAME)
            p = ' '.join(p)
          </script>
          <message>'%s %s' % (c, p)</message>
          <call function="'runCommand'">
            { 'location'  : STAF_REMOTE_HOSTNAME,
              'name'      : 'Uninstall I1',
              'command'   : c,
              'arguments' : p,
              'path'      : PORTS_I1_ROOT,
              'expectedRC': 0,
              'outputFile': '%s/ports-uninstall-i1.txt' % OUT_GROUP,
            }
          </call>
          <call function="'testCase_Postamble'"/>
        </sequence>
      </testcase>
      <call function="'testSuite_Postamble'"/>
    </sequence>
opends/tests/staf-tests/functional-tests/testcases/setup/security.xml
@@ -155,7 +155,7 @@
            DM_PW = 'secret12'
            DM_PW_FILE = '%s/setup/pwd-security.ldif' % remote.data
            KEYTOOL = '%s/bin/keytool%s' % (JAVA_HOME, fileExt)
            KEYTOOL = '%s/bin/keytool' % (JAVA_HOME)
            SEC_I1_BASE = '%s/sec_i1' % (OUT_GROUP)
            SEC_I1_ROOT = '%s/%s' % (SEC_I1_BASE, OPENDSNAME)
            SEC_I2_BASE = '%s/sec_i2' % (OUT_GROUP)
@@ -165,7 +165,10 @@
          </script>
          <call function="'checkFileExists'">
            { 'file' : KEYTOOL }
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file'     : KEYTOOL
            }
          </call>
          <!-- 1.1. Setup I1 -->
@@ -268,7 +271,10 @@
          </script>
          <call function="'checkFileExists'">
            { 'file' : ks }
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file'     : ks
            }
          </call>
          <!-- 1.4. Check StartTLS non-enablement -->
@@ -326,7 +332,7 @@
              'service'   :  'ZIP',
              'request'   :  'UNZIP',
              'arguments' :  'ZIPFILE %s/%s TODIRECTORY %s RESTOREPERMISSION' \
                % (ZIPPATH, ZIPNAME, SEC_I2_BASE)
                % (DIRECTORY_INSTANCE_DIR, ZIPNAME, SEC_I2_BASE)
            }
          </call>
@@ -403,7 +409,10 @@
          </script>
          <call function="'checkFileExists'">
            { 'file' : ks }
            {
            'location' : STAF_REMOTE_HOSTNAME,
            'file'     : ks
            }
          </call>
          <!-- 2.4. Check StartTLS enablement -->
@@ -851,34 +860,8 @@
              'outputFile': '%s/sec-import-cert-i2.txt' % OUT_GROUP,
            }
          </call>
          <!-- 6.1. Uninstall I1 (should fail: incompatible options) -->
          <message>'++ Uninstall I1 (should fail)'</message>
          <script>
            c = '%s/uninstall%s' % (SEC_I1_ROOT, fileExt)
            p = []
            p.append('--cli --no-prompt')
            p.append('--adminUID admin --bindPassword %s' % DM_PW)
            p.append('--remove-all')
            p.append('--trustStorePath %s' % MY_KEYSTORE)
            p.append('--trustStorePassword secret12')
            p = ' '.join(p)
          </script>
          <message>'%s %s' % (c, p)</message>
          <call function="'runCommand'">
            { 'location'  : STAF_REMOTE_HOSTNAME,
              'name'      : 'Uninstall I1',
              'command'   : c,
              'arguments' : p,
              'path'      : SEC_I1_ROOT,
              'expectedRC': 2,
              'outputFile': '%s/sec-uninstall1-i1.txt' % OUT_GROUP,
            }
          </call>
          <!-- 6.2. Uninstall I1 -->
          <!-- 6.1. Uninstall I1 -->
          <message>'++ Uninstall I1'</message> 
          <script>
            c = '%s/uninstall%s' % (SEC_I1_ROOT, fileExt)
@@ -903,33 +886,12 @@
            }
          </call>
          <!--- Temporary fix to avoid remaning processes
                when this testcase fails -->
          <script>
            cmd = '%s/%s/%s/stop-ds%s' \
            % (ODS_UNZIPPED, OPENDSNAME, fileFolder, fileExt)
          </script>
          <if expr="os.path.exists(cmd)" >
            <sequence>
              <message>'Stop I1'</message>
              <call function="'StopDsWithScript'">
                { 'location'  : STAF_REMOTE_HOSTNAME,
                'dsPath'      : SEC_I1_ROOT,
                'dsAdminPort' : SEC_I1_ADMIN_PORT,
                'dsBindDN'    : DM_DN ,
                'dsBindPwd'   : DM_PW ,
                'expectedRC'  : 'noCheck'
                }
              </call>
            </sequence>
          </if>
          <!-- 6.3. Uninstall I2 -->
          <!-- 6.2. Uninstall I2 -->
          <message>'++ Uninstall I2'</message> 
          <script>
            c = '%s/uninstall%s' % (SEC_I2_ROOT, fileExt)
            p = []
            p.append('--cli --no-prompt')
            p.append('--cli --no-prompt --trustAll')
            p.append('--adminUID admin --bindPasswordFile %s' % DM_PW_FILE)
            p.append('--remove-all')
            p = ' '.join(p)
@@ -947,27 +909,6 @@
            }
          </call>
          <!--- Temporary fix to avoid remaning processes
                when this testcase fails -->
          <script>
            cmd = '%s/%s/%s/stop-ds%s' \
            % (ODS_UNZIPPED, OPENDSNAME, fileFolder, fileExt)
          </script>
          <if expr="os.path.exists(cmd)" >
            <sequence>
              <message>'Stop I2'</message>
              <call function="'StopDsWithScript'">
                { 'location'  : STAF_REMOTE_HOSTNAME,
                'dsPath'      : SEC_I2_ROOT,
                'dsAdminPort' : SEC_I2_ADMIN_PORT,
                'dsBindDN'    : DM_DN ,
                'dsBindPwd'   : DM_PW ,
                'expectedRC'  : 'noCheck'
                }
              </call>
            </sequence>
          </if>
          <call function="'testCase_Postamble'"/>
        </sequence>
opends/tests/staf-tests/functional-tests/testcases/snmp/snmp.xml
@@ -30,6 +30,7 @@
  <defaultcall function="main_snmp"/>
  <function name="main_snmp" scope="local">
    <function-list-args>
      <function-required-arg name="STAXParentID"/>
    </function-list-args>
@@ -40,13 +41,11 @@
        <sequence>
          <message log="1" level="'Info'">'STAXParentID= %s' % STAXParentID</message>
          <!--- Load the job environment for the test group execution -->
          <import machine="STAF_LOCAL_HOSTNAME"
                  file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR" />
                  file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR"/>
          <call function="'loadJobEnvironment'">
               { 'parent' : STAXParentID }
            { 'parent' : STAXParentID }
          </call>
            
          <!--- Test Group information
opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_mibvalues.xml
@@ -110,18 +110,16 @@
                                         % SNMP_PORT)
                indexLDAP = get_handler_index(DEFAULT_VALUES, '1.3.6.1.27.3.%s'\
                                         % DIRECTORY_INSTANCE_PORT)
                indexLDIF = get_handler_index(DEFAULT_VALUES, '1.3.6.1.4.1.42')
              </script>
              <if expr="nbHandler == 3 and indexSNMP != 0 and indexLDAP != 0 and indexLDIF != 0">
              <if expr="nbHandler == 2 and indexSNMP != 0 and indexLDAP != 0">
                <sequence>
                  <script>
                    msg1 = 'The connection handlers info are correct.\n'
                    msg2 = 'number of hanlder: %s\n' % nbHandler
                    msg3 = 'index SNMP hanlder: %s\n' % indexSNMP
                    msg4 = 'index LDAP hanlder: %s\n' % indexLDAP
                    msg5 = 'index LDIF hanlder: %s\n' % indexLDIF
                    msg = '%s%s%s%s%s' % (msg1, msg2, msg3, msg4, msg5)
                    msg = '%s%s%s%s' % (msg1, msg2, msg3, msg4)
                  </script>
                  <message>
                    '%s' % msg
@@ -135,8 +133,7 @@
                      msg2 = 'number of hanlder: %s/3\n' % nbHandler
                      msg3 = 'index SNMP hanlder: %s\n' % indexSNMP
                      msg4 = 'index LDAP hanlder: %s\n' % indexLDAP
                      msg5 = 'index LDIF hanlder: %s' % indexLDIF
                      msg = '%s%s%s%s%s' % (msg1, msg2, msg3, msg4, msg5)
                      msg = '%s%s%s%s' % (msg1, msg2, msg3, msg4)
                    </script>
                    <message>
                      '%s' % msg
@@ -173,14 +170,36 @@
                'snmp_mibvalues: check value of dsServerType entry'
              </message>
              <!-- Get the information about the server -->
              <call function="'GetVar'">
                { 'location'  : STAF_REMOTE_HOSTNAME,
                  'type'      : 'shared',
                  'variable'  : 'Job%s_ServerInfo' % STAXParentID
                }
              </call>
              <if expr="RC != 0">
                <script>
                  STAFResult='{}'
                </script>
              </if>
              <script>
                dsServerType = DEFAULT_VALUES['dsServerType.1']
                version = DSInfo.ServerDict['server version']
                dsVersion = DSInfo.getServerVersion(version)
                build = DSInfo.ServerDict['server buildid']
                dsBuild = DSInfo.getServerBuildId(build)
                jobInfo=eval(STAFResult)
                if jobInfo.has_key('%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)):
                  serverInformation=jobInfo['%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)]
                  dsVersion=serverInformation['server version']
                  dsBuild=serverInformation['server buildid']
                else:
                  dsVersion='unknown'
                  dsBuild='unknown'
                dsServer = 'OpenDS Directory Server %s - %s' \
                           % (dsVersion.rstrip(), dsBuild)
                dsServerType = DEFAULT_VALUES['dsServerType.1']
              </script>
              <if expr="dsServerType == dsServer">
opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_status.xml
@@ -687,132 +687,150 @@
              <call function="'testCase_Preamble'"/>
              <message>
                'status: set the listen-port to a wrong value'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'subcommand'       : 'set-connection-handler-prop' ,
                'objectType'       : 'handler-name' ,
                'objectName'       : 'SNMP Connection Handler' ,
                'optionsString'    : '--set listen-port:%s' \
                                     % DEFAULT_PROPERTIES['listen-port']
                }
              </call>
              <message>
                'status: restart DS running on port %s' \
                % (DIRECTORY_INSTANCE_PORT)
              </message>
              <call function="'StopDsWithScript'">
                {
                'location'    : STAF_REMOTE_HOSTNAME ,
                'dsHost'      : DIRECTORY_INSTANCE_HOST ,
                'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
                'dsBindDN'    : DIRECTORY_INSTANCE_DN ,
                'dsBindPwd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'StartDsWithScript'">
                { 'location' : STAF_REMOTE_HOSTNAME }
              </call>
              <!-- This testcase is not relevant on Windows -->
              <script>
                returnString = STAXResult[0][1]
                if is_windows_platform(STAF_REMOTE_HOSTNAME):
                  skip=1
                else:
                  skip=0
              </script>
              <!--- Check that DS started -->
              <call function="'isAlive'">
                {
                'noOfLoops'        : 5 ,
                'noOfMilliSeconds' : 2000
                }
              </call>
              <if expr="skip == 0">
                <sequence>
                  <message>
                    'status: set the listen-port to a wrong value'
                  </message>
              <script>
                msg1 = 'An unexpected error occurred while trying to initialize'
                msg2 = 'the SNMP Connection Handler. Please check the'
                msg3 = 'configuration attributes'
                msg = '%s %s %s' % (msg1, msg2, msg3)
              </script>
                  <call function="'dsconfig'">
                    {
                    'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                    'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                    'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                    'subcommand'       : 'set-connection-handler-prop' ,
                    'objectType'       : 'handler-name' ,
                    'objectName'       : 'SNMP Connection Handler' ,
                    'optionsString'    : '--set listen-port:%s' \
                                         % DEFAULT_PROPERTIES['listen-port']
                    }
                  </call>
              <call function="'checktestString'">
                {
                'returnString'   : returnString ,
                'expectedString' : msg
                }
              </call>
                  <message>
                    'status: restart DS running on port %s' \
                    % (DIRECTORY_INSTANCE_PORT)
                  </message>
                  <call function="'StopDsWithScript'">
                    {
                    'location'    : STAF_REMOTE_HOSTNAME ,
                    'dsHost'      : DIRECTORY_INSTANCE_HOST ,
                    'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
                    'dsBindDN'    : DIRECTORY_INSTANCE_DN ,
                    'dsBindPwd'   : DIRECTORY_INSTANCE_PSWD
                    }
                  </call>
                  <call function="'StartDsWithScript'">
                    { 'location' : STAF_REMOTE_HOSTNAME }
                  </call>
              <message>
                'status: status when the server is started'
              </message>
                  <script>
                    returnString = STAXResult[0][1]
                  </script>
              <call function="'StatusWithScript'">
                {
                'dsBindDN'  : DIRECTORY_INSTANCE_DN ,
                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
                }
              </call>
                  <!--- Check that DS started -->
                  <call function="'isAlive'">
                    {
                    'noOfLoops'        : 5 ,
                    'noOfMilliSeconds' : 2000
                    }
                  </call>
              <script>
                returnString = STAXResult[0][1]
              </script>
                  <script>
                    msg1 = 'An unexpected error occurred while trying to'
                    msg2 = 'initialize the SNMP Connection Handler. Please'
                    msg3 = 'check the configuration attributes'
                    msg = '%s %s %s' % (msg1, msg2, msg3)
                  </script>
              <call function="'checktestString'">
                {
                'returnString'   : returnString ,
                'expectedString' : '0.0.0.0:%s  : SNMP     : Enabled' \
                                   % DEFAULT_PROPERTIES['listen-port']
                }
              </call>
                  <call function="'checktestString'">
                    {
                    'returnString'   : returnString ,
                    'expectedString' : msg
                    }
                  </call>
              <message>
                'status: get request'
              </message>
                  <message>
                    'status: status when the server is started'
                  </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '1',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : community ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'reqTimeout'
                }
              </call>
                  <call function="'StatusWithScript'">
                    {
                    'dsBindDN'  : DIRECTORY_INSTANCE_DN ,
                    'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
                    }
                  </call>
              <message>
                'status: restore value for listen-port property'
              </message>
                  <script>
                    returnString = STAXResult[0][1]
                  </script>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'subcommand'       : 'set-connection-handler-prop' ,
                'objectType'       : 'handler-name' ,
                'objectName'       : 'SNMP Connection Handler' ,
                'optionsString'    : '--set listen-port:%s' \
                                     % SNMP_PROPERTIES['listen-port']
                }
              </call>
                  <call function="'checktestString'">
                    {
                    'returnString'   : returnString ,
                    'expectedString' : '0.0.0.0:%s  : SNMP     : Enabled' \
                                       % DEFAULT_PROPERTIES['listen-port']
                    }
                  </call>
              <message>
                'status: restart the SNMP Connection Handler'
              </message>
                  <message>
                    'status: get request'
                  </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
                  <call function="'SNMPGet'">
                    {
                    'snmpVersion'   : '1',
                    'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                    'snmpPort'      : SNMP_PORT ,
                    'snmpCommunity' : community ,
                    'snmpOIDs'      : oid ,
                    'snmpStatus'    : 'reqTimeout'
                    }
                  </call>
                  <message>
                    'status: restore value for listen-port property'
                  </message>
                  <call function="'dsconfig'">
                    {
                    'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                    'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                    'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                    'subcommand'       : 'set-connection-handler-prop' ,
                    'objectType'       : 'handler-name' ,
                    'objectName'       : 'SNMP Connection Handler' ,
                    'optionsString'    : '--set listen-port:%s' \
                                         % SNMP_PROPERTIES['listen-port']
                    }
                  </call>
                  <message>
                    'status: restart the SNMP Connection Handler'
                  </message>
                  <call function="'restartSNMPConnectionHandler'">
                    {
                    'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                    'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                    'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                    }
                  </call>
                </sequence>
                <else>
                  <sequence>
                    <message>'This testcase is not relevant on Windows'</message>
                    <tcstatus result="'pass'"/>
                  </sequence>
                </else>
              </if>
              <call function="'testCase_Postamble'"/>
opends/tests/staf-tests/shared/ant/build.xml
@@ -79,7 +79,7 @@
        <switch value="${os.arch}">
          <case value="sparc">
            <!-- Solaris sparc -->
            <exec executable="isainfo" output="os.bits">
            <exec executable="isainfo" outputproperty="os.bits">
              <arg value="-b"/>
            </exec>
            <switch value="${os.bits}">
opends/tests/staf-tests/shared/functions/dsadm.xml
@@ -1036,6 +1036,10 @@
          'expectedRC': expectedRC
        }
      </call>
      <return>
        STAXResult
      </return>
    </sequence>
  </function>
@@ -4266,11 +4270,12 @@
      </message>
            
      <call function="'runCommand'">
        { 'location'  : location,
          'name'      : 'manage-tasks Script',
          'command'   : STAFCmd,
          'arguments' : STAFCmdParams,
          'expectedRC': expectedRC
        { 'location'   : location,
          'envCmd'     : [ 'LANG=C' , 'LC_ALL=C' ] ,
          'name'       : 'manage-tasks Script',
          'command'    : STAFCmd,
          'arguments'  : STAFCmdParams,
          'expectedRC' : expectedRC
        }
      </call>
      <return>
opends/tests/staf-tests/shared/functions/environment.xml
@@ -400,7 +400,19 @@
      <call function="'importPythonLibraries'"/>
      
      <call function="'initialiseGlobalVariables'"/>
      <message>
        'Remove files from previous runs under %s.' % DIRECTORY_INSTANCE_DIR
      </message>
      <call function="'deleteFolder'">
        { 'location'   : STAF_REMOTE_HOSTNAME ,
          'foldername' : DIRECTORY_INSTANCE_DIR }
      </call>
      <call function="'createFolder'">
        { 'location'   : STAF_REMOTE_HOSTNAME ,
          'foldername' : DIRECTORY_INSTANCE_DIR }
      </call>
      <call function="'GetDirectoryServerInformation'"/>
      <!-- Set variables to build unique path to store data -->
opends/tests/staf-tests/shared/functions/ldap.xml
@@ -2715,7 +2715,7 @@
          'command'   : '%s/bin/java' % JAVA_HOME,
          'arguments' : '%s %s' % (STAFCmd,STAFCmdParams),
          'location'  : location,
          'env'       : ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s/../%s/ldap' % (dsPath,remote.reljavadir)],
          'envCmd'    : ['CLASSPATH=%s/../%s/ldap' % (dsPath,remote.reljavadir)],
          'path'      : '%s/../%s/ldap' % (dsPath,remote.reljavadir),
          'expectedRC': expectedRC
        }
@@ -2958,7 +2958,7 @@
          'command'   : '%s/bin/java' % JAVA_HOME,
          'arguments' : '%s %s' % (STAFCmd,STAFCmdParams),
          'location'  : location,
          'env'       : ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s/../%s/ldap' % (dsPath,remote.reljavadir)],
          'envCmd'    : ['CLASSPATH=%s/../%s/ldap' % (dsPath,remote.reljavadir)],
          'path'      : '%s/../%s/ldap' % (dsPath,remote.reljavadir),
          'expectedRC': expectedRC
        }
@@ -3070,7 +3070,7 @@
          'command'   : '%s/bin/java' % JAVA_HOME,
          'arguments' : '%s %s' % (STAFCmd,STAFCmdParams),
          'location'  : location,
          'env'       : ['PATH=/bin:/usr/bin:%s/bin' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME,'CLASSPATH=%s/../%s/ldap' % (dsPath,remote.reljavadir)],
          'envCmd'    : ['CLASSPATH=%s/../%s/ldap' % (dsPath,remote.reljavadir)],
          'path'      : '%s/../%s/ldap' % (dsPath,remote.reljavadir),
          'expectedRC': expectedRC
        }
opends/tests/staf-tests/shared/functions/snmp.xml
@@ -190,8 +190,8 @@
        'command'    : '%s/bin/java' % JAVA_HOME ,
        'arguments'  : '%s %s' % (STAFCmd, STAFCmdParams) ,
        'location'   : location ,
        'path'       : '%s/snmp' % remote.java,
        'env'        : env ,
        'path'       : '%s/snmp' % remote.java ,
        'envCmd'     : env ,
        'expectedRC' : expectedRC
        }
      </call>
@@ -358,8 +358,8 @@
        'command'    : '%s/bin/java' % JAVA_HOME ,
        'arguments'  : '%s %s' % (STAFCmd, STAFCmdParams) ,
        'location'   : location ,
        'path'       : '%s/snmp' % remote.java,
        'env'        : env ,
        'path'       : '%s/snmp' % remote.java ,
        'envCmd'     : env ,
        'expectedRC' : expectedRC
        }
      </call>
@@ -434,7 +434,7 @@
      </call>
      <script>
        if is_windows_platform(location):
          jstaf_jarfile='%s\\bin\\JSTAF.jar' % STAFResult
          jstaf_jarfile='%s\bin\JSTAF.jar' % STAFResult
        else:
          jstaf_jarfile='%s/lib/JSTAF.jar' % STAFResult
      </script>
@@ -485,7 +485,7 @@
        'arguments'  : '%s %s' % (STAFCmd, STAFCmdParams) ,
        'location'   : location ,
        'path'       : snmpPath ,
        'env'        : env ,
        'envCmd'     : env ,
        'outputFile' : outputFile ,
        'expectedRC' : expectedRC
        }
opends/tests/staf-tests/shared/functions/utils.xml
@@ -1534,8 +1534,9 @@
          the path where the command is to be found
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="env"
                        type="optional">
      <function-arg-def name="envCmd"
                        type="optional"
                        default="''">
        <function-arg-description>
          the environment variables to set. The default set here should just
          work for OpenDS commands
@@ -1615,11 +1616,15 @@
        random.seed(java.util.Date().getTime())
        _id = '%s#%d' % (strftime('%Y-%m-%d %H:%M:%S',localtime()),random.randint(0,999))
        
        if not env:
          if is_windows_platform(location):
            env=['PATH=C:\Windows;C:\Windows\system32;%s' % path, 'JAVA_HOME=%s' % JAVA_HOME]
          else:
            env=['PATH=/bin:/usr/bin:%s' % path, 'JAVA_HOME=%s' % JAVA_HOME]
        env=[]
        for item in envCmd:
          env.append('%s' % item)
        if is_windows_platform(location):
          env.append('PATH=C:\Windows;C:\Windows\system32;%s' % path)
          env.append('JAVA_HOME=%s' % JAVA_HOME)
        else:
          env.append('PATH=/bin:/usr/bin:%s' % path)
          env.append('JAVA_HOME=%s' % JAVA_HOME)
      </script>
      <message>
        '%s: Running command:\n %s %s\nlocation: %s\nenv: %s\nworkdir: %s' % (_id,command,arguments,location,env,path)
@@ -2204,7 +2209,7 @@
            'arguments'  : '-target 1.5 %s' % list ,
            'location'   : location ,
            'path'       : foldername ,
            'env'        : env ,
            'envCmd'     : env ,
            'expectedRC' : expectedRC
            }
          </call>
@@ -2270,6 +2275,14 @@
      Set testcase result to FAIL if file (as param) does not exist
    </function-description>
    <function-map-args>
      <function-arg-def name="location"
                        type="optional"
                        default="STAXServiceMachine">
        <function-arg-description>
          Location of target host
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="file" type="required">
        <function-arg-description>
          The file to check existence
@@ -2277,14 +2290,20 @@
      </function-arg-def>
    </function-map-args>
    <sequence>
      <script>
        if os.path.exists('%s' % file):
          exist=1
        else:
          exist=0
      </script>
      <if expr="exist == 0">
        <tcstatus result="'fail'"/>
      <call function="'GetEntry'">
        {
        'location'  : STAF_REMOTE_HOSTNAME ,
        'entry'     : file ,
        'attribute' : 'TYPE'
        }
      </call>
      <if expr="RC == 48">
        <sequence>
          <tcstatus result="'fail'"/>
          <message log="1" level="'Error'">
            'ERROR :  File %s does not exist' % file
          </message>
        </sequence>
      </if>
    </sequence>
  </function>
@@ -2294,6 +2313,14 @@
      Set testcase result to FAIL if file (as param) exists
    </function-description>
    <function-map-args>
      <function-arg-def name="location"
                        type="optional"
                        default="STAXServiceMachine">
        <function-arg-description>
          Location of target host
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="file" type="required">
        <function-arg-description>
          The file to check absence
@@ -2301,14 +2328,20 @@
      </function-arg-def>
    </function-map-args>
    <sequence>
      <script>
        if os.path.exists('%s' % file):
          exist=1
        else:
          exist=0
      </script>
      <if expr="exist == 1">
        <tcstatus result="'fail'"/>
      <call function="'GetEntry'">
        {
        'location'  : STAF_REMOTE_HOSTNAME ,
        'entry'     : file ,
        'attribute' : 'TYPE'
        }
      </call>
      <if expr="RC != 48">
        <sequence>
          <tcstatus result="'fail'"/>
          <message log="1" level="'Error'">
            'ERROR :  File %s does not exist' % file
          </message>
        </sequence>
      </if>
    </sequence>
  </function>
opends/tests/staf-tests/shared/functions/webcontainer.xml
@@ -292,7 +292,7 @@
      <call function="'runCommand'">
        { 'location' : location,
        'command'    : STAFCmd,
        'env'        : STAFCmdEnv,
        'envCmd'     : STAFCmdEnv,
        'name'       : STAFCmd,
        'path'       : wcBinPath
        }
@@ -347,7 +347,7 @@
      <call function="'runCommand'">
        { 'location' : location,
        'command'    : STAFCmd,
        'env'        : STAFCmdEnv,
        'envCmd'     : STAFCmdEnv,
        'name'       : STAFCmd,
        'path'       : wcBinPath,
        'expectedRC' : expectedRC