From a528b3e0b74df4b3986ca8b6321f41e44842d93e Mon Sep 17 00:00:00 2001
From: el_kaboing <el_kaboing@localhost>
Date: Tue, 12 Dec 2006 17:34:07 +0000
Subject: [PATCH] Added functional tests for Issue 543.
---
opendj-sdk/opends/tests/functional-tests/testcases/security/account_activation/security_account_expiration.xml | 200 ++++++++++++++++++++++++++++++++++++++++
opendj-sdk/opends/tests/functional-tests/shared/data/security/account_activation/admin_expire_account.ldif | 30 ++++++
opendj-sdk/opends/tests/functional-tests/shared/data/security/account_activation/admin_unexpire_account.ldif | 29 +++++
opendj-sdk/opends/tests/functional-tests/shared/data/security/account_activation/admin_expire_account_future.ldif | 30 ++++++
opendj-sdk/opends/tests/functional-tests/testcases/security/account_activation/security_account_activation.xml | 4
5 files changed, 293 insertions(+), 0 deletions(-)
diff --git a/opendj-sdk/opends/tests/functional-tests/shared/data/security/account_activation/admin_expire_account.ldif b/opendj-sdk/opends/tests/functional-tests/shared/data/security/account_activation/admin_expire_account.ldif
new file mode 100644
index 0000000..d0a7299
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/shared/data/security/account_activation/admin_expire_account.ldif
@@ -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=abergin,ou=People,ou=activation tests,o=Account Activation Tests,dc=example,dc=com
+changetype: modify
+add: ds-pwp-account-expiration-time
+ds-pwp-account-expiration-time: 20061111161234Z
+
diff --git a/opendj-sdk/opends/tests/functional-tests/shared/data/security/account_activation/admin_expire_account_future.ldif b/opendj-sdk/opends/tests/functional-tests/shared/data/security/account_activation/admin_expire_account_future.ldif
new file mode 100644
index 0000000..8e321f6
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/shared/data/security/account_activation/admin_expire_account_future.ldif
@@ -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=abergin,ou=People,ou=activation tests,o=Account Activation Tests,dc=example,dc=com
+changetype: modify
+replace: ds-pwp-account-expiration-time
+ds-pwp-account-expiration-time: 20161111161234Z
+
diff --git a/opendj-sdk/opends/tests/functional-tests/shared/data/security/account_activation/admin_unexpire_account.ldif b/opendj-sdk/opends/tests/functional-tests/shared/data/security/account_activation/admin_unexpire_account.ldif
new file mode 100644
index 0000000..9362ad1
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/shared/data/security/account_activation/admin_unexpire_account.ldif
@@ -0,0 +1,29 @@
+# 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=abergin,ou=People,ou=activation tests,o=Account Activation Tests,dc=example,dc=com
+changetype: modify
+delete: ds-pwp-account-expiration-time
+
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/security/account_activation/security_account_activation.xml b/opendj-sdk/opends/tests/functional-tests/testcases/security/account_activation/security_account_activation.xml
index 094ffe7..72f5e72 100755
--- a/opendj-sdk/opends/tests/functional-tests/testcases/security/account_activation/security_account_activation.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/security/account_activation/security_account_activation.xml
@@ -77,6 +77,10 @@
<call function="'test_account'" />
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+ file="'%s/testcases/security/account_activation/security_account_expiration.xml' % (TESTS_DIR)"/>
+ <call function="'account_expiration'" />
+
+ <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
file="'%s/testcases/security/account_activation/security_teardown_account_activation.xml' % (TESTS_DIR)"/>
<call function="'teardown_account_activation'" />
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/security/account_activation/security_account_expiration.xml b/opendj-sdk/opends/tests/functional-tests/testcases/security/account_activation/security_account_expiration.xml
new file mode 100755
index 0000000..bd65794
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/security/account_activation/security_account_expiration.xml
@@ -0,0 +1,200 @@
+<?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="account_expiration"/>
+
+ <function name="account_expiration">
+
+ <sequence>
+
+ <!--- Test case: User Bind Before Deactivation -->
+ <testcase name="'Security: Acct Exp: Preamble'">
+ <sequence>
+ <message>
+ 'Security: Account Expiration: Preamble - Checking User Bind Before Expiration'
+ </message>
+
+ <call function="'SearchObject'">
+ { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : 'uid=abergin,ou=people,ou=activation tests,o=Account Activation Tests,dc=example,dc=com' ,
+ 'dsInstancePswd' : 'inflict' ,
+ 'dsBaseDN' : 'dc=example,dc=com' ,
+ 'dsFilter' : 'objectclass=*' ,
+ 'extraParams' : '-s base' }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC ,
+ 'result' : STAXResult }
+ </call>
+ </sequence>
+ </testcase>
+
+ <!--- Test Case : Admin Expire User-->
+ <testcase name="'Security: Acct Exp: Admin Expire User'">
+ <sequence>
+ <message>
+ 'Security: Account Expiration Admin Expiring 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_expire_account.ldif' % STAGED_DATA_DIR }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC ,
+ 'result' : STAXResult }
+ </call>
+ </sequence>
+ </testcase>
+
+ <!--- Test Case : User Bind After Expiration-->
+ <testcase name="'Security: Acct Exp: User Bind After Expiration'">
+ <sequence>
+ <message>
+ 'Security: Acct Exp: User Binding After Expiration'
+ </message>
+
+ <call function="'SearchObject'">
+ { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : 'uid=abergin,ou=people,ou=activation tests,o=Account Activation Tests,dc=example,dc=com' ,
+ 'dsInstancePswd' : 'inflict' ,
+ 'dsBaseDN' : 'dc=example,dc=com' ,
+ 'dsFilter' : 'objectclass=*' ,
+ 'extraParams' : '-s base' }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC ,
+ 'result' : STAXResult ,
+ 'expected' : 1 }
+ </call>
+ </sequence>
+ </testcase>
+
+ <testcase name="'Security: Acct Exp: Admin Expire User in Future'">
+ <sequence>
+ <message>
+ 'Security: Account Expiration Admin Expiring User in Future'
+ </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_expire_account_future.ldif' % STAGED_DATA_DIR }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC ,
+ 'result' : STAXResult }
+ </call>
+ </sequence>
+ </testcase>
+
+ <!--- Test Case : User Bind After Expiration-->
+ <testcase name="'Security: Acct Exp: User Bind With Future Expiration'">
+ <sequence>
+ <message>
+ 'Security: Acct Exp: User Binding With Future Expiration'
+ </message>
+
+ <call function="'SearchObject'">
+ { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : 'uid=abergin,ou=people,ou=activation tests,o=Account Activation Tests,dc=example,dc=com' ,
+ 'dsInstancePswd' : 'inflict' ,
+ 'dsBaseDN' : 'dc=example,dc=com' ,
+ 'dsFilter' : 'objectclass=*' ,
+ 'extraParams' : '-s base' }
+ </call>
+
+ <call function="'checktestRC'">
+ { 'returncode' : RC ,
+ 'result' : STAXResult }
+ </call>
+ </sequence>
+ </testcase>
+
+ <!--- Test case: Admin Reactivate User -->
+ <testcase name="'Security: Acct Exp: Postamble'">
+ <sequence>
+ <message>
+ 'Security: Account Expiration: Postamble Step 1. Admin Removing User Expiration'
+ </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_unexpire_account.ldif' % STAGED_DATA_DIR }
+ </call>
+
+ <if expr="RC != 0">
+ <tcstatus result="'fail'"/>
+ </if>
+
+ <message>
+ 'Security: Account Expiration Postamble Step 2. Checking User Bind After Removing Expiration'
+ </message>
+
+ <call function="'SearchObject'">
+ { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : 'uid=abergin,ou=people,ou=activation tests,o=Account Activation Tests,dc=example,dc=com' ,
+ 'dsInstancePswd' : 'inflict' ,
+ '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>
--
Gitblit v1.10.0