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

andrug
13.10.2007 493fd680b8f463fbce96d23ba9c9886a78e57e9d
add new control testsuites
3 files added
1 files modified
803 ■■■■■ changed files
opends/tests/functional-tests/testcases/core/controls/core_ctrls_assertion.xml 315 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/core/controls/core_ctrls_authorization_id.xml 209 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/core/controls/core_ctrls_password_policy.xml 260 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/core/core.xml 19 ●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/core/controls/core_ctrls_assertion.xml
New file
@@ -0,0 +1,315 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../../shared/stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="core_ctrls_assertion"/>
  <function name="core_ctrls_assertion">
    <sequence>
      <block name="'ctrls_assertion'">
        <sequence>
          <script>
            if not CurrentTestPath.has_key('group'):
              CurrentTestPath['group']='core'
            CurrentTestPath['suite']=STAXCurrentBlock
          </script>
          <call function="'testSuite_Preamble'"/>
          <import machine="STAF_LOCAL_HOSTNAME"
            file="'%s/testcases/core/core_setup.xml' % (TESTS_DIR)" />
          <call function="'core_setup'" />
          <!--- Test Suite information
          #@TestSuiteName       Core Controls assertion
          #@TestSuitePurpose    Verify that the controls functionality is
                                working in the Directory Server.
          #@TestSuiteGroup      Core: Controls: assertion
          #@TestScript          core_ctrls_assertion.xml
          -->
          <!-- Global variables -->
          <script>
            peopleDn = 'ou=North America,o=core tests,dc=example,dc=com'
          </script>
          <!--- Test Case information
          #@TestMarker          Core Controls assertion Tests
          #@TestName            Search with directory manager user
          #@TestPurpose         Check reportAuthzID option with dir manager
          #@TestPreamble
          #@TestSteps           Do a search and check the outputs
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('Search with Directory Manager')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <call function="'ldapSearchWithScript'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsBaseDN'         : 'uid=user.1,%s' % peopleDn ,
                'dsFilter'         : 'objectclass=*' ,
                'extraParams'      : '--assertionFilter "(objectclass=top)"' ,
                'dsAttributes'     : 'uid'
              }
              </call>
              <call function="'CheckMatches'">
              {
                'string2find'   : 'uid=user.1,%s' % peopleDn ,
                'mainString'    : STAXResult[0][1] ,
                'nbExpected'    : 1 ,
              }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
          #@TestMarker          Core Controls assertion Tests
          #@TestName            Search with a user entry without aci
          #@TestPurpose         Check reportAuthzID option with a user
          #@TestPreamble
          #@TestSteps           Do a search and check the outputs
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('Search with a user without aci')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>'Do a search with user without aci,should fail'</message>
              <call function="'ldapSearchWithScript'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=user.1,%s' % peopleDn ,
                'dsInstancePswd'   : 'password' ,
                'dsBaseDN'         : 'uid=user.1,%s' % peopleDn ,
                'dsFilter'         : 'objectclass=*' ,
                'extraParams'      : '--assertionFilter "(objectclass=top)"' ,
                'dsAttributes'     : 'uid' ,
                'expectedRC'       : 50
              }
              </call>
              <message>'++ Check assertion control id is displayed'</message>
              <call function="'CheckMatches'">
              {
                'string2find' : '1.3.6.1.1.12' ,
                'mainString'  : STAXResult[0][1] ,
                'nbExpected'  : 1
              }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
          #@TestMarker          Core Controls assertion Tests
          #@TestName            Add aci for the assertion control
          #@TestPurpose         Check aci is accepted by the server
          #@TestPreamble
          #@TestSteps           Add the aci
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('Add aci')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <script>
                ldifFile = '%s/core/ldifs/core_ctrls_assertion_add_aci.ldif'\
                            % logsRemoteDataDir
              </script>
              <message>
                '++ add aci for user.1 to be able to use assertion control'
              </message>
              <message>
                'aci : (targetcontrol = "1.3.6.1.1.12")(version 3.0; acl\
                 "all for user.1"; allow (all) userdn="\
                 ldap:///uid=user.1,ou=North America,o=core\
                 tests,dc=example,dc=com";)'
              </message>
              <call function="'ldapModifyWithScript'">
              {
                'dsAdd'            : 'True' ,
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsFilename'       : ldifFile
              }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
          #@TestMarker          Core Controls assertion Tests
          #@TestName            Search with a user entry with aci
          #@TestPurpose         Check reportAuthzID option with a user
          #@TestPreamble
          #@TestSteps           Do a search and check the outputs
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('Search with a user with aci')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>'Do a search with user with aci, should pass'</message>
              <call function="'ldapSearchWithScript'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=user.1,%s' % peopleDn ,
                'dsInstancePswd'   : 'password' ,
                'dsBaseDN'         : 'uid=user.1,%s' % peopleDn ,
                'dsFilter'         : 'objectclass=*' ,
                'extraParams'      : '--assertionFilter "(objectclass=top)"' ,
                'dsAttributes'     : 'uid'
              }
              </call>
              <call function="'CheckMatches'">
              {
                'string2find'   : 'uid=user.1,%s' % peopleDn ,
                'mainString'    : STAXResult[0][1] ,
                'nbExpected'    : 1 ,
              }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
          #@TestMarker          Core Controls assertion Tests
          #@TestName            Search with bad assertion value
          #@TestPurpose         Set bad assertion control value
          #@TestPreamble
          #@TestSteps           Do a search and check the outputs
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName
                          ('Search with bad assertion control value')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>'Do a search with bad assertion control value'</message>
              <call function="'ldapSearchWithScript'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=user.1,%s' % peopleDn ,
                'dsInstancePswd'   : 'password' ,
                'dsBaseDN'         : 'uid=user.1,%s' % peopleDn ,
                'dsFilter'         : 'objectclass=*' ,
                'extraParams'      : '--assertionFilter "(objectclass=hello)"',
                'dsAttributes'     : 'uid' ,
                'expectedRC'       : 122
              }
              </call>
              <call function="'CheckMatches'">
              {
                'string2find'   : 'Assertion Failed' ,
                'mainString'    : STAXResult[0][1] ,
                'nbExpected'    : 1 ,
              }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
          #@TestMarker          Core Controls assertion Tests
          #@TestName            Delete aci for the assertion control
          #@TestPurpose         Check aci is accepted by the server
          #@TestPreamble
          #@TestSteps           Delete the aci
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('Delete aci')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <script>
                ldifFile='%s/core/ldifs/core_ctrls_assertion_delete_aci.ldif'\
                          % logsRemoteDataDir
              </script>
              <message>
                '++ Delete aci which allow user.1 to use assertion control'
              </message>
              <message>
                'aci : (targetcontrol = "1.3.6.1.1.12")(version 3.0; acl\
                 "all for user.1"; allow (all) userdn="\
                 ldap:///uid=user.1,ou=North America,o=core\
                 tests,dc=example,dc=com";)'
              </message>
              <call function="'ldapModifyWithScript'">
              {
                'dsAdd'            : 'True' ,
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsFilename'       : ldifFile
              }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <import machine="STAF_LOCAL_HOSTNAME"
                  file="'%s/testcases/core/core_cleanup.xml' % (TESTS_DIR)" />
          <call function="'core_cleanup'" />
          <call function="'testSuite_Postamble'"/>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/core/controls/core_ctrls_authorization_id.xml
New file
@@ -0,0 +1,209 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../../shared/stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="core_ctrls_authorization_id"/>
  <function name="core_ctrls_authorization_id">
    <sequence>
      <block name="'ctrls_authorization_id'">
        <sequence>
          <script>
            if not CurrentTestPath.has_key('group'):
              CurrentTestPath['group']='core'
            CurrentTestPath['suite']=STAXCurrentBlock
          </script>
          <call function="'testSuite_Preamble'"/>
          <import machine="STAF_LOCAL_HOSTNAME"
            file="'%s/testcases/core/core_setup.xml' % (TESTS_DIR)" />
          <call function="'core_setup'" />
          <!--- Test Suite information
          #@TestSuiteName       Core Controls authorization id
          #@TestSuitePurpose    Verify that the controls functionality is
                                working in the Directory Server.
          #@TestSuiteGroup      core: Controls: authorization id
          #@TestScript          core_ctrls_authorization_id.xml
          -->
          <!-- Global variables -->
          <script>
            peopleDn = 'ou=North America,o=core tests,dc=example,dc=com'
          </script>
          <!--- Test Case information
          #@TestMarker          Core Controls authorization id Tests
          #@TestName            Search with directory manager user
          #@TestPurpose         Check reportAuthzID option with dir manager
          #@TestPreamble
          #@TestSteps           Do a search and check the outputs
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('Search with Directory Manager')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <call function="'ldapSearchWithScript'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsBaseDN'         : 'uid=user.1,%s' % peopleDn ,
                'dsFilter'         : 'objectclass=*' ,
                'extraParams'      : '--reportAuthzID'
              }
              </call>
              <script>
                string1 = '# Bound with authorization ID dn:'
                string2 = '%s,cn=Root DNs,cn=config' % DIRECTORY_INSTANCE_DN
                string2find = '%s%s' % (string1, string2)
              </script>
              <call function="'CheckMatches'">
              {
                'string2find'   : string2find ,
                'mainString'    : STAXResult[0][1] ,
                'nbExpected'    : 1 ,
                'caseSensitive' : False
              }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
          #@TestMarker          Core Controls authorization id Tests
          #@TestName            Search with a user entry
          #@TestPurpose         Check reportAuthzID option with a user
          #@TestPreamble
          #@TestSteps           Do a search and check the outputs
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('Search with a user entry')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <script>
                userDn = 'uid=user.1,%s' % peopleDn
              </script>
              <call function="'ldapSearchWithScript'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : userDn ,
                'dsInstancePswd'   : 'password' ,
                'dsBaseDN'         : userDn ,
                'dsFilter'         : 'objectclass=*' ,
                'extraParams'      : '--reportAuthzID'
              }
              </call>
              <script>
                string1 = '# Bound with authorization ID dn:'
                string2 = '%s' % userDn
                string2find = '%s%s' % (string1, string2)
              </script>
              <call function="'CheckMatches'">
              {
                'string2find' : string2find ,
                'mainString'  : STAXResult[0][1] ,
                'nbExpected'  : 1
              }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
          #@TestMarker          Core Controls authorization id Tests
          #@TestName            Search with a bad baseDn
          #@TestPurpose         Check reportAuthzID option with bad baseDn
          #@TestPreamble
          #@TestSteps           Do a search and check the outputs
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('Search with a bad baseDn')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <script>
                userDn = 'uid=user.1,%s' % peopleDn
              </script>
              <call function="'ldapSearchWithScript'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : userDn ,
                'dsInstancePswd'   : 'password' ,
                'dsBaseDN'         : 'uid=hello,%s' % peopleDn,
                'dsFilter'         : 'objectclass=*' ,
                'extraParams'      : '--reportAuthzID' ,
                'expectedRC'       : 32
              }
              </call>
              <script>
                string1 = '# Bound with authorization ID dn:'
                string2 = '%s' % userDn
                string2find = '%s%s' % (string1, string2)
              </script>
              <call function="'CheckMatches'">
              {
                'string2find' : string2find ,
                'mainString'  : STAXResult[0][1] ,
                'nbExpected'  : 1
              }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <import machine="STAF_LOCAL_HOSTNAME"
                  file="'%s/testcases/core/core_cleanup.xml' % (TESTS_DIR)" />
          <call function="'core_cleanup'" />
          <call function="'testSuite_Postamble'"/>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/core/controls/core_ctrls_password_policy.xml
New file
@@ -0,0 +1,260 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../../shared/stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="core_ctrls_password_policy"/>
  <function name="core_ctrls_password_policy">
    <sequence>
      <block name="'ctrls_password_policy'">
        <sequence>
          <script>
            if not CurrentTestPath.has_key('group'):
              CurrentTestPath['group']='core'
            CurrentTestPath['suite']=STAXCurrentBlock
          </script>
          <call function="'testSuite_Preamble'"/>
          <import machine="STAF_LOCAL_HOSTNAME"
            file="'%s/testcases/core/core_setup.xml' % (TESTS_DIR)" />
          <call function="'core_setup'" />
          <!--- Test Suite information
          #@TestSuiteName       Core Controls password policy
          #@TestSuitePurpose    Verify that the controls functionality is
                                working in the Directory Server.
          #@TestSuiteGroup      core: Controls: password policy
          #@TestScript          core_ctrls_password_policy.xml
          -->
          <!--- Test Case information
          #@TestMarker          Core Controls Password Policy Tests
          #@TestName            Core Ctrls Pwd Policy Force Change on Add
          #@TestPurpose         Verify the pwpolicy control is returned in the
                                ldapsearch when the password policy is changed
                                to force-change-on-add.
          #@TestPreamble
          #@TestSteps           modify the Default Password Policy, using
                                dsconfig, to set force-change-on-add to true.
          #@TestSteps           Next add a new user and do an ldapsearch of
                                that user using the verbose flag. The search
                                will fail with a LDAP_CONSTRAINT_VIOLATION.
          #@TestSteps           Next do a substring search of the output and
                                look for the control's OID
                                1.3.6.1.4.1.42.2.27.8.5.1.
          #@TestSteps           Lastly, reset the password policy.
          #@TestPostamble
          #@TestResult
          -->
          <!-- Global variables -->
          <script>
            peopleDn = 'ou=People,o=core tests,dc=example,dc=com'
          </script>
          <testcase name="getTestCaseName('Force Change on Add')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <call function="'modifyPwdPolicy'">
                { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                  'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                  'dsInstanceDn'           : DIRECTORY_INSTANCE_DN ,
                  'dsInstancePswd'         : DIRECTORY_INSTANCE_PSWD ,
                  'propertyName'           : 'Default Password Policy' ,
                  'attributeName'          : 'force-change-on-add' ,
                  'attributeValue'         : 'true' }
              </call>
              <call function="'addEntry'">
                { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'   : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
                  'entryToBeAdded' : '%s/core/ldifs/control1.ldif' %
                                     logsRemoteDataDir }
              </call>
              <call function="'ldapSearchWithScript'">
                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                  'dsInstanceDn'     : 'uid=test.user1,%s' % peopleDn ,
                  'dsInstancePswd'   : 'password' ,
                  'dsBaseDN'         : peopleDn ,
                  'dsControl'        : 'pwpolicy',
                  'dsVerbose'        : 'True',
                  'dsFilter'         : 'uid=test.user1' ,
                  'expectedRC'       : 19 }
              </call>
              <script>
                returnString = STAXResult[0][1]
              </script>
              <!-- looking for password policy control oid -->
              <call function="'searchStringForSubstring'">
                { 'returnString'       : returnString ,
                  'testString'         : '1.3.6.1.4.1.42.2.27.8.5.1' ,
                  'expectedResult'     : '1' }
              </call>
              <!-- reset password policy -->
              <call function="'modifyPwdPolicy'">
                { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                  'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                  'dsInstanceDn'           : DIRECTORY_INSTANCE_DN ,
                  'dsInstancePswd'         : DIRECTORY_INSTANCE_PSWD ,
                  'propertyName'           : 'Default Password Policy' ,
                  'attributeName'          : 'force-change-on-add' ,
                  'attributeValue'         : 'false' }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
          #@TestMarker          Core Controls Password Policy Tests
          #@TestName            Core Ctrls Pwd Policy Lockout Failure Count
          #@TestPurpose         Verify the pwpolicy control is returned in the
                                ldapsearch when the password policy
                                lockout-failure-count is changed to 3, allowing
                                for only three tries using a bad password.
          #@TestPreamble
          #@TestSteps           modify the Default Password Policy, using
                                dsconfig, to set lockout-failure-count to 3.
          #@TestSteps           Next add a new user and do three
                                ldapsearchs of that user suppling bad passwords
                                , and using the verbose flag. The search will
                                fail with a LDAP_INVALID_CREDENTIALS.
          #@TestSteps           Next do a substring search of the output and
                                look for the control's OID
                                1.3.6.1.4.1.42.2.27.8.5.1.
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('Lockout Failure Count')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <call function="'modifyPwdPolicy'">
                { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                  'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                  'dsInstanceDn'           : DIRECTORY_INSTANCE_DN ,
                  'dsInstancePswd'         : DIRECTORY_INSTANCE_PSWD ,
                  'propertyName'           : 'Default Password Policy' ,
                  'attributeName'          : 'lockout-failure-count' ,
                  'attributeValue'         : 3 }
              </call>
              <call function="'addEntry'">
                { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'   : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
                  'entryToBeAdded' : '%s/core/ldifs/control2.ldif'
                                     % logsRemoteDataDir }
              </call>
              <script>
                search_pwds = ['bad', 'bad', 'bad']
              </script>
              <iterate var="pwds" in="search_pwds" indexvar="index">
                <call function="'ldapSearchWithScript'">
                  { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                    'dsControl'        : 'pwpolicy',
                    'dsVerbose'        : 'True',
                    'dsInstanceDn'     : 'uid=test.user2,%s' % peopleDn ,
                    'dsInstancePswd'   : '%s' % pwds ,
                    'dsBaseDN'         : peopleDn ,
                    'dsFilter'         : 'uid=test.user2' ,
                    'expectedRC'       : 49 }
                </call>
              </iterate>
              <call function="'ldapSearchWithScript'">
                { 'dsInstanceHost'             : DIRECTORY_INSTANCE_HOST ,
                  'dsInstancePort'             : DIRECTORY_INSTANCE_PORT ,
                  'dsUsePasswordPolicyControl' : 'True',
                  'dsVerbose'        : 'True',
                  'dsInstanceDn'     : 'uid=test.user2,%s' % peopleDn ,
                  'dsInstancePswd'   : 'password' ,
                  'dsBaseDN'         : peopleDn ,
                  'dsFilter'         : 'uid=test.user2' ,
                  'expectedRC'       : 49 }
              </call>
              <script>
                 returnString = STAXResult[0][1]
              </script>
              <!-- looking for password policy control oid -->
              <call function="'searchStringForSubstring'">
                { 'returnString'       : returnString ,
                  'testString'         : '1.3.6.1.4.1.42.2.27.8.5.1' ,
                  'expectedResult'     : '1' }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <import machine="STAF_LOCAL_HOSTNAME"
                  file="'%s/testcases/core/core_cleanup.xml' % (TESTS_DIR)" />
          <call function="'core_cleanup'" />
          <call function="'testSuite_Postamble'"/>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/core/core.xml
@@ -34,13 +34,26 @@
          CurrentTestPath['group']='core'
        </script>
        <call function="'testGroup_Preamble'" />
        <iterate var="_test" in="['core_entry_cache','core_search_sizelimit','core_tf_filters','core_version_report','core_controls']">
        <script>
          testList = []
          testList.append(['.','core_entry_cache'])
          testList.append(['.','core_search_sizelimit'])
          testList.append(['.','core_tf_filters'])
          testList.append(['.','core_version_report'])
          testList.append(['controls','core_ctrls_password_policy'])
          testList.append(['controls','core_ctrls_authorization_id'])
          #testList.append(['controls','core_ctrls_assertion'])
        </script>
        <iterate var="_test" in="testList">
          <sequence>
            <import machine="STAF_LOCAL_HOSTNAME"
                    file="'%s/testcases/core/%s.xml' % (TESTS_DIR,_test)" />
            <call function="'%s' % _test" />
                    file="'%s/testcases/core/%s/%s.xml' %
                    (TESTS_DIR,_test[0],_test[1])"/>
            <call function="'%s' % _test[1]" />
          </sequence>
        </iterate>
        <call function="'testGroup_Postamble'" />
      </sequence>
    </block>