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

el_kaboing
05.54.2006 4ec77ccd1b30b10da306ad2efbeb85aad86ec65a
Added functional tests for Issue 291, Account Activation/Inactivation Capability.
6 files added
1 files modified
576 ■■■■■ changed files
opends/tests/functional-tests/shared/data/security/account_activation/account_activation_startup.ldif 184 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/data/security/account_activation/admin_deactivate_account.ldif 30 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/data/security/account_activation/admin_reactivate_account.ldif 30 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/security/account_activation/security_account_activation.xml 108 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/security/account_activation/security_setup_account_activation.xml 65 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/security/account_activation/security_test_account.xml 155 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/security/security.xml 4 ●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/data/security/account_activation/account_activation_startup.ldif
New file
@@ -0,0 +1,184 @@
# 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 Sun Microsystems, Inc.
#
dn:  o=Account Activation Tests, dc=example,dc=com
o: Account Activation Tests
objectclass: top
objectclass: organization
dn: ou=activation tests,  o=Account Activation Tests, dc=example,dc=com
ou: activation tests
objectclass: top
objectclass: organizationalunit
dn: ou=People, ou=activation tests,  o=Account Activation Tests, dc=example,dc=com
objectclass: top
objectclass: organizationalunit
ou: People
dn: uid=scarter, ou=People, ou=activation tests,  o=Account Activation Tests, dc=example,dc=com
cn: Sam Carter
sn: Carter
givenname: Sam
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
ou: Accounting
ou: People
l: Sunnyvale
uid: scarter
mail: scarter@example.com
telephonenumber: +1 408 555 4798
facsimiletelephonenumber: +1 408 555 9751
roomnumber: 4612
userpassword: sprain
dn: uid=tmorris, ou=People, ou=activation tests,  o=Account Activation Tests, dc=example,dc=com
cn: Ted Morris
sn: Morris
givenname: Ted
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
ou: Accounting
ou: People
l: Santa Clara
uid: tmorris
mail: tmorris@example.com
telephonenumber: +1 408 555 9187
facsimiletelephonenumber: +1 408 555 8473
roomnumber: 4117
userpassword: irrefutable
dn: uid=kvaughan, ou=People, ou=activation tests,  o=Account Activation Tests, dc=example,dc=com
cn: Kirsten Vaughan
sn: Vaughan
givenname: Kirsten
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
ou: Human Resources
ou: People
l: Sunnyvale
uid: kvaughan
mail: kvaughan@example.com
telephonenumber: +1 408 555 5625
facsimiletelephonenumber: +1 408 555 3372
roomnumber: 2871
userpassword: bribery
dn: uid=abergin, ou=People, ou=activation tests,  o=Account Activation Tests, dc=example,dc=com
cn: Andy Bergin
sn: Bergin
givenname: Andy
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
ou: Product Testing
ou: People
l: Cupertino
uid: abergin
mail: abergin@example.com
telephonenumber: +1 408 555 8585
facsimiletelephonenumber: +1 408 555 7472
roomnumber: 3472
userpassword: inflict
dn: uid=dmiller, ou=People, ou=activation tests,  o=Account Activation Tests, dc=example,dc=com
cn: David Miller
sn: Miller
givenname: David
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
ou: Accounting
ou: People
l: Sunnyvale
uid: dmiller
mail: dmiller@example.com
telephonenumber: +1 408 555 9423
facsimiletelephonenumber: +1 408 555 0111
roomnumber: 4135
userpassword: gosling
dn: uid=gfarmer, ou=People, ou=activation tests,  o=Account Activation Tests, dc=example,dc=com
cn: Gern Farmer
sn: Farmer
givenname: Gern
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
ou: Accounting
ou: People
l: Cupertino
uid: gfarmer
mail: gfarmer@example.com
telephonenumber: +1 408 555 6201
facsimiletelephonenumber: +1 408 555 8473
roomnumber: 1269
userpassword: ruling
dn: uid=kwinters, ou=People, ou=activation tests,  o=Account Activation Tests, dc=example,dc=com
cn: Kelly Winters
sn: Winters
givenname: Kelly
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
ou: Product Development
ou: People
l: Santa Clara
uid: kwinters
mail: kwinters@example.com
telephonenumber: +1 408 555 9069
facsimiletelephonenumber: +1 408 555 1992
roomnumber: 4178
userpassword: forsook
dn: uid=trigden, ou=People, ou=activation tests,  o=Account Activation Tests, dc=example,dc=com
cn: Torrey Rigden
sn: Rigden
givenname: Torrey
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
ou: Product Development
ou: People
l: Santa Clara
uid: trigden
mail: trigden@example.com
telephonenumber: +1 408 555 9280
facsimiletelephonenumber: +1 408 555 8473
roomnumber: 3584
userpassword: sensitive
opends/tests/functional-tests/shared/data/security/account_activation/admin_deactivate_account.ldif
New file
@@ -0,0 +1,30 @@
# 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 Sun Microsystems, Inc.
#
dn: uid=scarter,ou=People,ou=activation tests,o=Account Activation Tests,dc=example,dc=com
changetype: modify
add: ds-pwp-account-disabled
ds-pwp-account-disabled: true
opends/tests/functional-tests/shared/data/security/account_activation/admin_reactivate_account.ldif
New file
@@ -0,0 +1,30 @@
# 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 Sun Microsystems, Inc.
#
dn: uid=scarter,ou=People,ou=activation tests,o=Account Activation Tests,dc=example,dc=com
changetype: modify
replace: ds-pwp-account-disabled
ds-pwp-account-disabled: false
opends/tests/functional-tests/testcases/security/account_activation/security_account_activation.xml
New file
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<!---
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying * information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006 Sun Microsystems, Inc.
 -->
<stax>
  <defaultcall function="security_account_activation"/>
  <function name="security_account_activation">
      <sequence>
<parallel>
    <block name="'Block DS Process Active'">
      <!--- Start DS -->
      <sequence>
        <message>
           'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
        </message>
        <!--- Start DS -->
        <call function="'startDS'">
          { 'dsbinpath' : '%s' % (OPENDS_BINPATH) }
        </call>
        <call function="'checkRC'">
            { 'returncode' : RC ,
              'result'     : STAXResult }
        </call>
      </sequence>
     <!--- End Block DS Process Active -->
     </block>
     <block name="'Block Clients'">
      <sequence>
        <!--- Check that DS started -->
        <call function="'isAlive'">
          { 'noOfLoops'        : 5 ,
            'noOfMilliSeconds' : 2000 }
        </call>
        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
          file="'%s/testcases/security/account_activation/security_setup_account_activation.xml' % (TESTS_DIR)"/>
        <call function="'setup_account_activation'" />
        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
          file="'%s/testcases/security/account_activation/security_test_account.xml' % (TESTS_DIR)"/>
        <call function="'test_account'" />
        <!--- Stop DS -->
        <sequence>
          <message>
             'Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
          </message>
          <call function="'stopDS'">
            { 'dsInstancePort' : '%s' % (DIRECTORY_INSTANCE_PORT) }
          </call>
          <call function="'checkRC'">
              { 'returncode' : RC ,
                'result'     : STAXResult }
          </call>
        </sequence>
        <return>RC</return>
        </sequence>
       <!--- End Block Clients -->
       </block>
</parallel>
     </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/security/account_activation/security_setup_account_activation.xml
New file
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<!---
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying * information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006 Sun Microsystems, Inc.
 -->
<stax>
  <defaultcall function="setup_account_activation"/>
  <function name="setup_account_activation">
      <sequence>
        <!--- Test Case : Add Entries for Acount Activation Tests -->
        <testcase name="'Security: Acct Act: Add Initial Entries'">
          <sequence>
            <message>
               'Security: Account Activation: Adding Initial Entries'
            </message>
            <call function="'addEntry'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'entryToBeAdded'   : '%s/security/account_activation/account_activation_startup.ldif' % STAGED_DATA_DIR }
            </call>
            <call function="'checktestRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult }
            </call>
          </sequence>
        </testcase>
        <return>RC</return>
     </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/security/account_activation/security_test_account.xml
New file
@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<!---
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying * information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006 Sun Microsystems, Inc.
 -->
<stax>
  <defaultcall function="test_account"/>
  <function name="test_account">
      <sequence>
        <!--- Test case: User Bind Before Deactivation -->
        <testcase name="'Security: Acct Act: Preamble'">
          <sequence>
            <message>
               'Security: Account Activation: Preamble - Checking User Bind Before Deactivation'
            </message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=scarter,ou=people,ou=activation tests,o=Account Activation Tests,dc=example,dc=com' ,
                'dsInstancePswd'   : 'sprain' ,
                'dsBaseDN'   : 'dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'extraParams'      : '-s base' }
            </call>
            <call function="'checktestRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult }
            </call>
          </sequence>
        </testcase>
        <!--- Test Case : Admin Deactivate User-->
        <testcase name="'Security: Acct Act: Admin Deactivate User'">
          <sequence>
            <message>
               'Security: Account Activation: Admin Deactivating User'
            </message>
            <call function="'modifyEntry'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'entryToBeModified'   : '%s/security/account_activation/admin_deactivate_account.ldif' % STAGED_DATA_DIR }
            </call>
            <call function="'checktestRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult }
            </call>
          </sequence>
        </testcase>
        <!--- Test Case : User Bind After Deactivation-->
        <testcase name="'Security: Acct Act: User Bind After Deactivation'">
          <sequence>
            <message>
               'Security: Acct Act: User Binding After Deactivation'
            </message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=scarter,ou=people,ou=activation tests,o=Account Activation Tests,dc=example,dc=com' ,
                'dsInstancePswd'   : 'sprain' ,
                'dsBaseDN'   : 'dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'extraParams'      : '-s base' }
            </call>
         <call function="'checktestRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult ,
                  'expected'   : 1 }
            </call>
          </sequence>
        </testcase>
       <!--- Test case: Admin Reactivate User -->
        <testcase name="'Security: Acct Act: Postamble'">
          <sequence>
            <message>
               'Security: Account Activation: Postamble Step 1.  Admin Reactivating User'
            </message>
            <call function="'modifyEntry'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'entryToBeModified'   : '%s/security/account_activation/admin_reactivate_account.ldif' % STAGED_DATA_DIR }
            </call>
            <if expr="RC != 0">
                <tcstatus result="'fail'"/>
            </if>
            <message>
               'Security: Account Activation: Postamble Step 2.  Checking User Bind After Reactivation'
            </message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=scarter,ou=people,ou=activation tests,o=Account Activation Tests,dc=example,dc=com' ,
                'dsInstancePswd'   : 'sprain' ,
                'dsBaseDN'   : 'dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'extraParams'      : '-s base' }
            </call>
            <call function="'checktestRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult }
            </call>
          </sequence>
        </testcase>
        <return>RC</return>
     </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/security/security.xml
@@ -58,6 +58,10 @@
          file="'%s/testcases/security/bind_no_pwd/security_bind_no_pwd.xml' % (TESTS_DIR)"/>
    <call function="'security_bind_no_pwd'" />
        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
          file="'%s/testcases/security/account_activation/security_account_activation.xml' % (TESTS_DIR)"/>
    <call function="'security_account_activation'" />
      </sequence>
  </function>