From 94c4211c7b8ee73f181f7084c6b89b811d5e78be Mon Sep 17 00:00:00 2001
From: el_kaboing <el_kaboing@localhost>
Date: Thu, 04 Jan 2007 14:54:03 +0000
Subject: [PATCH] Added test cases for Issue 676.

---
 opendj-sdk/opends/tests/functional-tests/testcases/security/security.xml                                 |    4 +
 opendj-sdk/opends/tests/functional-tests/testcases/security/pwd_policy_root/security_root_user_tests.xml |  125 +++++++++++++++++++++++++++++++
 opendj-sdk/opends/tests/functional-tests/testcases/security/pwd_policy_root/security_pwd_policy_root.xml |  104 ++++++++++++++++++++++++++
 3 files changed, 233 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/security/pwd_policy_root/security_pwd_policy_root.xml b/opendj-sdk/opends/tests/functional-tests/testcases/security/pwd_policy_root/security_pwd_policy_root.xml
new file mode 100755
index 0000000..444960e
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/security/pwd_policy_root/security_pwd_policy_root.xml
@@ -0,0 +1,104 @@
+<?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_pwd_policy_root"/>
+
+  <function name="security_pwd_policy_root">
+
+      <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/pwd_policy_root/security_root_user_tests.xml' % (TESTS_DIR)"/>
+        <call function="'root_user_tests'" />
+
+        <!--- 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>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/security/pwd_policy_root/security_root_user_tests.xml b/opendj-sdk/opends/tests/functional-tests/testcases/security/pwd_policy_root/security_root_user_tests.xml
new file mode 100755
index 0000000..7b42cd5
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/security/pwd_policy_root/security_root_user_tests.xml
@@ -0,0 +1,125 @@
+<?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="root_user_tests"/>
+
+  <function name="root_user_tests">
+
+      <sequence>
+
+        <!--- Check Existence of ds-cfg-default-password-storage-scheme Attr -->
+        <testcase name="'Security: Pwd Policy Root: Default Pwd Scheme'">
+          <sequence>
+            <message>
+               'Security: Pwd Policy Root: Checking default value ds-cfg-default-password-storage-scheme'
+            </message>
+
+            <call function="'SearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'dsBaseDN'         : 'cn=Root Password Policy,cn=Password Policies,cn=config' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'attributes'      : 'ds-cfg-default-password-storage-scheme' }
+            </call>
+
+            <script> 
+             returnString = STAXResult[0][1]
+            </script> 
+
+            <call function="'checktestString'">
+                { 'returnString'       : returnString ,
+                  'expectedString'     : 'SSHA512' }
+            </call>
+          
+          </sequence>
+        </testcase>
+
+        <!--- Check Existence of ds-cfg-password-generator-dn Attr -->
+        <testcase name="'Security: Pwd Policy Root: No Default Pwd Generator'">
+          <sequence>
+            <message>
+               'Security: Pwd Policy Root: Checking for ds-cfg-password-generator-dn'
+            </message>
+
+            <call function="'compareEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'attrToBeCompared'   : 'ds-cfg-password-generator-dn:cn=anything',
+                'entryToBeCompared'   : 'cn=Root Password Policy,cn=Password Policies,cn=config' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult ,
+                  'expected'   : 16 }
+            </call>
+          </sequence>
+        </testcase>
+
+       <!--- Check Existence of ds-cfg-password-change-requires-current-password Attr -->
+        <testcase name="'Security: Pwd Policy Root: Default Pwd Change Setting'">
+          <sequence>
+            <message>
+               'Security: Pwd Policy Root: Checking default value ds-cfg-password-change-requires-current-password'
+            </message>
+
+            <call function="'SearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'dsBaseDN'         : 'cn=Root Password Policy,cn=Password Policies,cn=config' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'attributes'      : 'ds-cfg-password-change-requires-current-password' }
+            </call>
+
+            <script> 
+             returnString = STAXResult[0][1]
+            </script> 
+
+            <call function="'checktestString'">
+                { 'returnString'       : returnString ,
+                  'expectedString'     : 'true' }
+            </call>
+          
+          </sequence>
+        </testcase>
+
+         <return>RC</return>
+
+     </sequence>
+
+  </function>
+
+</stax>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/security/security.xml b/opendj-sdk/opends/tests/functional-tests/testcases/security/security.xml
index f22a4ca..1f6b54e 100755
--- a/opendj-sdk/opends/tests/functional-tests/testcases/security/security.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/security/security.xml
@@ -51,6 +51,10 @@
 	<call function="'security_pwd_policy'" />
 
         <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/pwd_policy_root/security_pwd_policy_root.xml' % (TESTS_DIR)"/>
+	<call function="'security_pwd_policy_root'" />
+
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
           file="'%s/testcases/security/pwd_validator/security_pwd_validator.xml' % (TESTS_DIR)"/>
 	<call function="'security_pwd_validator'" />
 

--
Gitblit v1.10.0