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

tdj_tx
22.37.2007 492e90b5bf3af22bef7f94cba0c6f69bf3884410
Initial version of controls testcases
1 files added
235 ■■■■■ changed files
opends/tests/functional-tests/testcases/core/core_controls.xml 235 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/core/core_controls.xml
New file
@@ -0,0 +1,235 @@
<?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="main_controls"/>
  <function name="main_controls">
    <sequence>
      <block name="'controls'">
        <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
          #@TestSuitePurpose    Verify that the basic import functionality is working in the Directory Server.
          #@TestSuiteID         Controls Tests
          #@TestSuiteGroup      Controls
          #@TestGroup           Core
          #@TestScript          core_controls.xml
          #@TestHTMLLink        http://opends.dev.java.net/
          -->
          <!--- Test Case information
          #@TestMarker          Core Controls Tests
          #@TestName            Core: Controls: Password Policy
          #@TestID              LDIF Default
          #@TestPurpose         Verify an import of a LDIF file using the default backend.
          #@TestPreamble
          #@TestSteps           ./import-ldif.sh -l ../ldif/Example.ldif -n "userRoot"
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('Controls Password Policy')">
            <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,ou=People,o=core tests,dc=example,dc=com' ,
                  'dsInstancePswd'   : 'password' ,
                  'dsBaseDN'         : 'ou=People,o=core tests,dc=example,dc=com' ,
                  '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 Tests
          #@TestName            Core: Controls: Password Policy
          #@TestID              LDIF Default
          #@TestPurpose         Verify an import of a LDIF file using the default backend.
          #@TestPreamble
          #@TestSteps           ./import-ldif.sh -l ../ldif/Example.ldif -n "userRoot"
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('Controls Password Policy')">
            <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,ou=People,o=core tests,dc=example,dc=com' ,
                    'dsInstancePswd'   : '%s' % pwds ,
                    'dsBaseDN'         : 'ou=People,o=core tests,dc=example,dc=com' ,
                    'dsFilter'         : 'uid=test.user2' ,
                    'expectedRC'       : 49 }
                </call>
              </iterate>
              <call function="'ldapSearchWithScript'">
                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                  'dsControl'        : 'pwpolicy',
                  'dsVerbose'        : 'True',
                  'dsInstanceDn'     : 'uid=test.user2,ou=People,o=core tests,dc=example,dc=com' ,
                  'dsInstancePswd'   : 'password' ,
                  'dsBaseDN'         : 'ou=People,o=core tests,dc=example,dc=com' ,
                  '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>
          <call function="'testSuite_Postamble'"/>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>