From de9ad4f938491567e539ab5151320ec901ae1251 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Mon, 18 Sep 2006 17:06:45 +0000
Subject: [PATCH] Add test cases for various server elements, including:

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/NullConnectionSecurityProviderTestCase.java     |  183 ++
 opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java       |  603 +++++++++
 opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/DefaultEntryCacheTestCase.java                  |  336 +++++
 opends/src/server/org/opends/server/core/PluginConfigManager.java                                                      |   34 
 opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandlerTestCase.java      |  261 +++
 opends/tests/unit-tests-testng/resource/config-changes.ldif                                                            |   87 +
 opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/CRAMMD5SASLMechanismHandlerTestCase.java        |  775 +++++++++++
 opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/EntryUUIDPluginTestCase.java                       |  420 ++++++
 opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LDAPADListPluginTestCase.java                      |  346 +++++
 opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/PluginTestCase.java                                |   45 
 opends/ext/testng/testng.xml                                                                                           |    1 
 opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/PasswordPolicyImportPluginTestCase.java            |  306 ++++
 opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/InternalConnectionSecurityProviderTestCase.java |  123 +
 opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LastModPluginTestCase.java                         |  396 ++++++
 14 files changed, 3,916 insertions(+), 0 deletions(-)

diff --git a/opends/ext/testng/testng.xml b/opends/ext/testng/testng.xml
index c083fbc..0a51f85 100644
--- a/opends/ext/testng/testng.xml
+++ b/opends/ext/testng/testng.xml
@@ -14,6 +14,7 @@
             <package name="org.opends.server.monitors"/>
             <package name="org.opends.server.extensions"/>
             <package name="org.opends.server.tasks"/>
+            <package name="org.opends.server.plugins"/>
         </packages>
     </test>
 
diff --git a/opends/src/server/org/opends/server/core/PluginConfigManager.java b/opends/src/server/org/opends/server/core/PluginConfigManager.java
index 584704b..bf7afae 100644
--- a/opends/src/server/org/opends/server/core/PluginConfigManager.java
+++ b/opends/src/server/org/opends/server/core/PluginConfigManager.java
@@ -554,6 +554,40 @@
 
 
 
+  /**
+   * Retrieves the set of plugins that have been registered with the Directory
+   * Server.
+   *
+   * @return  The set of plugins that have been registered with the Directory
+   *          Server.
+   */
+  public ConcurrentHashMap<DN,DirectoryServerPlugin> getRegisteredPlugins()
+  {
+    assert debugEnter(CLASS_NAME, "getRegisteredPlugins");
+
+    return registeredPlugins;
+  }
+
+
+
+  /**
+   * Retrieves the plugin with the specified configuration entry DN.
+   *
+   * @param  pluginDN  The DN of the configuration entry for the plugin to
+   *                   retrieve.
+   *
+   * @return  The requested plugin, or <CODE>null</CODE> if there is no such
+   *          plugin.
+   */
+  public DirectoryServerPlugin getRegisteredPlugin(DN pluginDN)
+  {
+    assert debugEnter(CLASS_NAME, "getRegisteredPlugin",
+                      String.valueOf(pluginDN));
+
+    return registeredPlugins.get(pluginDN);
+  }
+
+
 
   /**
    * Indicates whether the configuration entry that will result from a proposed
diff --git a/opends/tests/unit-tests-testng/resource/config-changes.ldif b/opends/tests/unit-tests-testng/resource/config-changes.ldif
index 37e07d0..9695bc4 100644
--- a/opends/tests/unit-tests-testng/resource/config-changes.ldif
+++ b/opends/tests/unit-tests-testng/resource/config-changes.ldif
@@ -13,3 +13,90 @@
 replace: ds-cfg-suppress-internal-operations
 ds-cfg-suppress-internal-operations: false
 
+dn: cn=SSHA512 UserPassword Policy,cn=Password Policies,cn=config
+changetype: add
+objectClass: top
+objectClass: ds-cfg-password-policy
+cn: SSHA512 UserPassword Policy
+ds-cfg-password-attribute: userPassword
+ds-cfg-default-password-storage-scheme: SSHA512
+ds-cfg-allow-expired-password-changes: false
+ds-cfg-allow-multiple-password-values: false
+ds-cfg-allow-pre-encoded-passwords: false
+ds-cfg-allow-user-password-changes: true
+ds-cfg-expire-passwords-without-warning: false
+ds-cfg-force-change-on-add: false
+ds-cfg-force-change-on-reset: false
+ds-cfg-grace-login-count: 0
+ds-cfg-idle-lockout-interval: 0 seconds
+ds-cfg-lockout-failure-count: 0
+ds-cfg-lockout-duration: 0 seconds
+ds-cfg-lockout-failure-expiration-interval: 0 seconds
+ds-cfg-minimum-password-age: 0 seconds
+ds-cfg-maximum-password-age: 0 seconds
+ds-cfg-maximum-password-reset-age: 0 seconds
+ds-cfg-password-expiration-warning-interval: 5 days
+ds-cfg-password-generator-dn: cn=Random Password Generator,cn=Password Generators,cn=config
+ds-cfg-password-change-requires-current-password: false
+ds-cfg-require-secure-authentication: false
+ds-cfg-require-secure-password-changes: false
+ds-cfg-skip-validation-for-administrators: false
+
+dn: cn=SHA1 AuthPassword Policy,cn=Password Policies,cn=config
+changetype: add
+objectClass: top
+objectClass: ds-cfg-password-policy
+cn: SHA1 AuthPassword Policy
+ds-cfg-password-attribute: authPassword
+ds-cfg-default-password-storage-scheme: SHA1
+ds-cfg-allow-expired-password-changes: false
+ds-cfg-allow-multiple-password-values: false
+ds-cfg-allow-pre-encoded-passwords: false
+ds-cfg-allow-user-password-changes: true
+ds-cfg-expire-passwords-without-warning: false
+ds-cfg-force-change-on-add: false
+ds-cfg-force-change-on-reset: false
+ds-cfg-grace-login-count: 0
+ds-cfg-idle-lockout-interval: 0 seconds
+ds-cfg-lockout-failure-count: 0
+ds-cfg-lockout-duration: 0 seconds
+ds-cfg-lockout-failure-expiration-interval: 0 seconds
+ds-cfg-minimum-password-age: 0 seconds
+ds-cfg-maximum-password-age: 0 seconds
+ds-cfg-maximum-password-reset-age: 0 seconds
+ds-cfg-password-expiration-warning-interval: 5 days
+ds-cfg-password-generator-dn: cn=Random Password Generator,cn=Password Generators,cn=config
+ds-cfg-password-change-requires-current-password: false
+ds-cfg-require-secure-authentication: false
+ds-cfg-require-secure-password-changes: false
+ds-cfg-skip-validation-for-administrators: false
+
+dn: cn=Clear UserPassword Policy,cn=Password Policies,cn=config
+changetype: add
+objectClass: top
+objectClass: ds-cfg-password-policy
+cn: Test AuthPassword Policy
+ds-cfg-password-attribute: userPassword
+ds-cfg-default-password-storage-scheme: CLEAR
+ds-cfg-allow-expired-password-changes: false
+ds-cfg-allow-multiple-password-values: false
+ds-cfg-allow-pre-encoded-passwords: false
+ds-cfg-allow-user-password-changes: true
+ds-cfg-expire-passwords-without-warning: false
+ds-cfg-force-change-on-add: false
+ds-cfg-force-change-on-reset: false
+ds-cfg-grace-login-count: 0
+ds-cfg-idle-lockout-interval: 0 seconds
+ds-cfg-lockout-failure-count: 0
+ds-cfg-lockout-duration: 0 seconds
+ds-cfg-lockout-failure-expiration-interval: 0 seconds
+ds-cfg-minimum-password-age: 0 seconds
+ds-cfg-maximum-password-age: 0 seconds
+ds-cfg-maximum-password-reset-age: 0 seconds
+ds-cfg-password-expiration-warning-interval: 5 days
+ds-cfg-password-generator-dn: cn=Random Password Generator,cn=Password Generators,cn=config
+ds-cfg-password-change-requires-current-password: false
+ds-cfg-require-secure-authentication: false
+ds-cfg-require-secure-password-changes: false
+ds-cfg-skip-validation-for-administrators: false
+
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandlerTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandlerTestCase.java
new file mode 100644
index 0000000..4d910cf
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandlerTestCase.java
@@ -0,0 +1,261 @@
+/*
+ * 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.
+ */
+package org.opends.server.extensions;
+
+
+
+import java.util.ArrayList;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.opends.server.TestCaseUtils;
+import org.opends.server.core.BindOperation;
+import org.opends.server.protocols.asn1.ASN1OctetString;
+import org.opends.server.protocols.internal.InternalClientConnection;
+import org.opends.server.tools.LDAPSearch;
+import org.opends.server.types.Control;
+import org.opends.server.types.DN;
+import org.opends.server.types.ResultCode;
+
+import static org.testng.Assert.*;
+
+import static org.opends.server.util.ServerConstants.*;
+
+
+
+/**
+ * A set of test cases for the ANONYMOUS SASL mechanism handler.
+ */
+public class AnonymousSASLMechanismHandlerTestCase
+       extends ExtensionsTestCase
+{
+  /**
+   * Ensures that the Directory Server is running.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @BeforeClass()
+  public void startServer()
+         throws Exception
+  {
+    TestCaseUtils.startServer();
+  }
+
+
+
+  /**
+   * Tests the process of initializing and finalizing the ANONYMOUS SASL
+   * mechanism handler.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testInitializationAndFinalization()
+         throws Exception
+  {
+    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
+    handler.initializeSASLMechanismHandler(null);
+    handler.finalizeSASLMechanismHandler();
+  }
+
+
+
+  /**
+   * Tests the <CODE>isPasswordBased</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testIsPasswordBased()
+         throws Exception
+  {
+    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
+    handler.initializeSASLMechanismHandler(null);
+
+    assertFalse(handler.isPasswordBased(SASL_MECHANISM_ANONYMOUS));
+
+    handler.finalizeSASLMechanismHandler();
+  }
+
+
+
+  /**
+   * Tests the <CODE>isSecure</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testIsSecure()
+         throws Exception
+  {
+    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
+    handler.initializeSASLMechanismHandler(null);
+
+    assertFalse(handler.isSecure(SASL_MECHANISM_ANONYMOUS));
+
+    handler.finalizeSASLMechanismHandler();
+  }
+
+
+
+  /**
+   * Tests the <CODE>processSASLBind</CODE> method with no credentials.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testProcessSASLBindNoCreds()
+         throws Exception
+  {
+    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
+    handler.initializeSASLMechanismHandler(null);
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    BindOperation bindOperation =
+         new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
+                           new ArrayList<Control>(), new DN(),
+                           SASL_MECHANISM_ANONYMOUS, null);
+    handler.processSASLBind(bindOperation);
+    assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS);
+
+    handler.finalizeSASLMechanismHandler();
+  }
+
+
+
+  /**
+   * Tests the <CODE>processSASLBind</CODE> method with an empty set of
+   * credentials.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testProcessSASLBindEmptyCreds()
+         throws Exception
+  {
+    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
+    handler.initializeSASLMechanismHandler(null);
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    BindOperation bindOperation =
+         new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
+                           new ArrayList<Control>(), new DN(),
+                           SASL_MECHANISM_ANONYMOUS, new ASN1OctetString());
+    handler.processSASLBind(bindOperation);
+    assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS);
+
+    handler.finalizeSASLMechanismHandler();
+  }
+
+
+
+  /**
+   * Tests the <CODE>processSASLBind</CODE> method with trace information.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testProcessSASLBindWithTraceInfo()
+         throws Exception
+  {
+    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
+    handler.initializeSASLMechanismHandler(null);
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    BindOperation bindOperation =
+         new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
+                           new ArrayList<Control>(), new DN(),
+                           SASL_MECHANISM_ANONYMOUS,
+                           new ASN1OctetString("Internal Trace String"));
+    handler.processSASLBind(bindOperation);
+    assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS);
+
+    handler.finalizeSASLMechanismHandler();
+  }
+
+
+
+  /**
+   * Performs a SASL ANONYMOUS bind over LDAP with no credentials.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testLDAPBindNoCreds()
+         throws Exception
+  {
+    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
+    handler.initializeSASLMechanismHandler(null);
+
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-o", "mech=ANONYMOUS",
+      "-b", "",
+      "-s", "base",
+      "(objectClass=*)"
+    };
+    assertEquals(LDAPSearch.mainSearch(args, false, null, null), 0);
+
+    handler.finalizeSASLMechanismHandler();
+  }
+
+
+
+  /**
+   * Performs a SASL ANONYMOUS bind over LDAP with trace information.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testLDAPBindWithTraceInfo()
+         throws Exception
+  {
+    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
+    handler.initializeSASLMechanismHandler(null);
+
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-o", "mech=ANONYMOUS",
+      "-o", "trace=LDAP Trace String",
+      "-b", "",
+      "-s", "base",
+      "(objectClass=*)"
+    };
+    assertEquals(LDAPSearch.mainSearch(args, false, null, null), 0);
+
+    handler.finalizeSASLMechanismHandler();
+  }
+}
+
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/CRAMMD5SASLMechanismHandlerTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/CRAMMD5SASLMechanismHandlerTestCase.java
new file mode 100644
index 0000000..fa25c8e
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/CRAMMD5SASLMechanismHandlerTestCase.java
@@ -0,0 +1,775 @@
+/*
+ * 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.
+ */
+package org.opends.server.extensions;
+
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import org.opends.server.TestCaseUtils;
+import org.opends.server.config.ConfigEntry;
+import org.opends.server.config.ConfigException;
+import org.opends.server.core.AddOperation;
+import org.opends.server.core.BindOperation;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.core.InitializationException;
+import org.opends.server.protocols.asn1.ASN1OctetString;
+import org.opends.server.protocols.internal.InternalClientConnection;
+import org.opends.server.tools.LDAPSearch;
+import org.opends.server.types.AuthenticationInfo;
+import org.opends.server.types.Control;
+import org.opends.server.types.DN;
+import org.opends.server.types.Entry;
+import org.opends.server.types.ResultCode;
+
+import static org.testng.Assert.*;
+
+import static org.opends.server.util.ServerConstants.*;
+
+
+
+/**
+ * A set of test cases for the CRAM-MD5 SASL mechanism handler.
+ */
+public class CRAMMD5SASLMechanismHandlerTestCase
+       extends ExtensionsTestCase
+{
+  /**
+   * Ensures that the Directory Server is running.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @BeforeClass()
+  public void startServer()
+         throws Exception
+  {
+    TestCaseUtils.startServer();
+  }
+
+
+
+  /**
+   * Retrieves a set of invvalid configuration entries.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @DataProvider(name = "invalidConfigs")
+  public Object[][] getInvalidConfigs()
+         throws Exception
+  {
+    List<Entry> entries = TestCaseUtils.makeEntries(
+         "dn: cn=CRAM-MD5,cn=SASL Mechanisms,cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-sasl-mechanism-handler",
+         "objectClass: ds-cfg-cram-md5-sasl-mechanism-handler",
+         "cn: CRAM-MD5",
+         "ds-cfg-sasl-mechanism-handler-class: org.opends.server.extensions." +
+              "CRAMMD5SASLMechanismHandler",
+         "ds-cfg-sasl-mechanism-handler-enabled: true",
+         "",
+         "dn: cn=CRAM-MD5,cn=SASL Mechanisms,cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-sasl-mechanism-handler",
+         "objectClass: ds-cfg-cram-md5-sasl-mechanism-handler",
+         "cn: CRAM-MD5",
+         "ds-cfg-sasl-mechanism-handler-class: org.opends.server.extensions." +
+              "CRAMMD5SASLMechanismHandler",
+         "ds-cfg-sasl-mechanism-handler-enabled: true",
+         "ds-cfg-identity-mapper-dn: not a DN",
+         "",
+         "dn: cn=CRAM-MD5,cn=SASL Mechanisms,cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-sasl-mechanism-handler",
+         "objectClass: ds-cfg-cram-md5-sasl-mechanism-handler",
+         "cn: CRAM-MD5",
+         "ds-cfg-sasl-mechanism-handler-class: org.opends.server.extensions." +
+              "CRAMMD5SASLMechanismHandler",
+         "ds-cfg-sasl-mechanism-handler-enabled: true",
+         "ds-cfg-identity-mapper-dn: cn=does not exist");
+
+    Object[][] array = new Object[entries.size()][1];
+    for (int i=0; i < array.length; i++)
+    {
+      array[i] = new Object[] { entries.get(i) };
+    }
+
+    return array;
+  }
+
+
+
+  /**
+   * Tests the process of initializing the handler with invalid configurations.
+   *
+   * @param  entry  The configuration entry to use for the initialization.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(dataProvider = "invalidConfigs",
+        expectedExceptions = { ConfigException.class,
+                               InitializationException.class })
+  public void testInitializeWithInvalidConfigs(Entry e)
+         throws Exception
+  {
+    DN parentDN = DN.decode("cn=SASL Mechanisms,cn=config");
+    ConfigEntry parentEntry = DirectoryServer.getConfigEntry(parentDN);
+    ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
+
+    CRAMMD5SASLMechanismHandler handler = new CRAMMD5SASLMechanismHandler();
+    handler.initializeSASLMechanismHandler(configEntry);
+  }
+
+
+
+  /**
+   * Tests the <CODE>isPasswordBased</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testIsPasswordBased()
+         throws Exception
+  {
+    CRAMMD5SASLMechanismHandler handler =
+         (CRAMMD5SASLMechanismHandler)
+         DirectoryServer.getSASLMechanismHandler(SASL_MECHANISM_CRAM_MD5);
+
+    assertTrue(handler.isPasswordBased(SASL_MECHANISM_CRAM_MD5));
+  }
+
+
+
+  /**
+   * Tests the <CODE>isSecure</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testIsSecure()
+         throws Exception
+  {
+    CRAMMD5SASLMechanismHandler handler =
+         (CRAMMD5SASLMechanismHandler)
+         DirectoryServer.getSASLMechanismHandler(SASL_MECHANISM_CRAM_MD5);
+
+    assertTrue(handler.isSecure(SASL_MECHANISM_CRAM_MD5));
+  }
+
+
+
+  /**
+   * Performs a successful LDAP bind using CRAM-MD5 using the u: form of the
+   * authentication ID.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testLDAPBindSuccessWithUID()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    Entry e = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: password",
+         "pwdPolicySubentry: cn=Clear UserPassword Policy," +
+              "cn=Password Policies,cn=config");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    AddOperation addOperation =
+         conn.processAdd(e.getDN(), e.getObjectClasses(),
+                         e.getUserAttributes(), e.getOperationalAttributes());
+    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-o", "mech=CRAM-MD5",
+      "-o", "authid=u:test.user",
+      "-w", "password",
+      "-b", "",
+      "-s", "base",
+      "(objectClass=*)"
+    };
+    assertEquals(LDAPSearch.mainSearch(args, false, null, null), 0);
+  }
+
+
+
+  /**
+   * Performs a successful LDAP bind using CRAM-MD5 using the dn: form of the
+   * authentication ID.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testLDAPBindSuccessWithDN()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    Entry e = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: password",
+         "pwdPolicySubentry: cn=Clear UserPassword Policy," +
+              "cn=Password Policies,cn=config");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    AddOperation addOperation =
+         conn.processAdd(e.getDN(), e.getObjectClasses(),
+                         e.getUserAttributes(), e.getOperationalAttributes());
+    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-o", "mech=CRAM-MD5",
+      "-o", "authid=dn:uid=test.user,o=test",
+      "-w", "password",
+      "-b", "",
+      "-s", "base",
+      "(objectClass=*)"
+    };
+    assertEquals(LDAPSearch.mainSearch(args, false, null, null), 0);
+  }
+
+
+
+  /**
+   * Performs a successful LDAP bind using CRAM-MD5 using the dn: form of the
+   * authentication ID using a long password (longer than 64 bytes).
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testLDAPBindSuccessWithDNAndLongPassword()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    String password =
+         "reallyreallyreallyreallyreallyreallyreallyreallyreallylongpassword";
+
+    Entry e = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: " + password,
+         "pwdPolicySubentry: cn=Clear UserPassword Policy," +
+              "cn=Password Policies,cn=config");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    AddOperation addOperation =
+         conn.processAdd(e.getDN(), e.getObjectClasses(),
+                         e.getUserAttributes(), e.getOperationalAttributes());
+    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-o", "mech=CRAM-MD5",
+      "-o", "authid=dn:uid=test.user,o=test",
+      "-w", password,
+      "-b", "",
+      "-s", "base",
+      "(objectClass=*)"
+    };
+    assertEquals(LDAPSearch.mainSearch(args, false, null, null), 0);
+  }
+
+
+
+  /**
+   * Performs a failed LDAP bind using CRAM-MD5 using the u: form of the
+   * authentication ID with the wrong password.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testLDAPBindFailWrongPasswordWithUID()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    Entry e = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: password",
+         "pwdPolicySubentry: cn=Clear UserPassword Policy," +
+              "cn=Password Policies,cn=config");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    AddOperation addOperation =
+         conn.processAdd(e.getDN(), e.getObjectClasses(),
+                         e.getUserAttributes(), e.getOperationalAttributes());
+    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-o", "mech=CRAM-MD5",
+      "-o", "authid=u:test.user",
+      "-w", "wrongpassword",
+      "-b", "",
+      "-s", "base",
+      "(objectClass=*)"
+    };
+    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
+  }
+
+
+
+  /**
+   * Performs a failed LDAP bind using CRAM-MD5 using the dn: form of the
+   * authentication ID with the wrong password.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testLDAPBindFailWrongPasswordWithDN()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    Entry e = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: password",
+         "pwdPolicySubentry: cn=Clear UserPassword Policy," +
+              "cn=Password Policies,cn=config");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    AddOperation addOperation =
+         conn.processAdd(e.getDN(), e.getObjectClasses(),
+                         e.getUserAttributes(), e.getOperationalAttributes());
+    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-o", "mech=CRAM-MD5",
+      "-o", "authid=dn:uid=test.user,o=test",
+      "-w", "wrongpassword",
+      "-b", "",
+      "-s", "base",
+      "(objectClass=*)"
+    };
+    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
+  }
+
+
+
+  /**
+   * Performs a failed LDAP bind using CRAM-MD5 using the u: form of the
+   * authentication ID with a stored password that's not reversible.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testLDAPBindFailIrreversiblePasswordWithUID()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    Entry e = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: password");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    AddOperation addOperation =
+         conn.processAdd(e.getDN(), e.getObjectClasses(),
+                         e.getUserAttributes(), e.getOperationalAttributes());
+    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-o", "mech=CRAM-MD5",
+      "-o", "authid=u:test.user",
+      "-w", "password",
+      "-b", "",
+      "-s", "base",
+      "(objectClass=*)"
+    };
+    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
+  }
+
+
+
+  /**
+   * Performs a failed LDAP bind using CRAM-MD5 using the dn: form of the
+   * authentication ID with a stored password that's not reversible.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testLDAPBindFailIrreversiblePasswordWithDN()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    Entry e = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: password");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    AddOperation addOperation =
+         conn.processAdd(e.getDN(), e.getObjectClasses(),
+                         e.getUserAttributes(), e.getOperationalAttributes());
+    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-o", "mech=CRAM-MD5",
+      "-o", "authid=dn:uid=test.user,o=test",
+      "-w", "password",
+      "-b", "",
+      "-s", "base",
+      "(objectClass=*)"
+    };
+    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
+  }
+
+
+
+  /**
+   * Performs a failed LDAP bind using CRAM-MD5 using the dn: form of the
+   * authentication ID with an invalid DN.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testLDAPBindFailInvalidDN()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    Entry e = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: password");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    AddOperation addOperation =
+         conn.processAdd(e.getDN(), e.getObjectClasses(),
+                         e.getUserAttributes(), e.getOperationalAttributes());
+    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-o", "mech=CRAM-MD5",
+      "-o", "authid=dn:invaliddn",
+      "-w", "password",
+      "-b", "",
+      "-s", "base",
+      "(objectClass=*)"
+    };
+    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
+  }
+
+
+
+  /**
+   * Performs a failed LDAP bind using CRAM-MD5 using the dn: form of the
+   * authentication ID with the DN of a user that doesn't exist.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testLDAPBindFailNoSuchUser()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    Entry e = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: password");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    AddOperation addOperation =
+         conn.processAdd(e.getDN(), e.getObjectClasses(),
+                         e.getUserAttributes(), e.getOperationalAttributes());
+    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-o", "mech=CRAM-MD5",
+      "-o", "authid=dn:uid=doesntexist,o=test",
+      "-w", "password",
+      "-b", "",
+      "-s", "base",
+      "(objectClass=*)"
+    };
+    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
+  }
+
+
+
+  /**
+   * Performs a failed LDAP bind using CRAM-MD5 using the dn: form of the
+   * authentication ID with the null DN.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testLDAPBindFailNullDN()
+         throws Exception
+  {
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-o", "mech=CRAM-MD5",
+      "-o", "authid=dn:",
+      "-w", "",
+      "-b", "",
+      "-s", "base",
+      "(objectClass=*)"
+    };
+    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
+  }
+
+
+
+  /**
+   * Performs a failed LDAP bind using CRAM-MD5 using the dn: form of the
+   * authentication ID with the root DN (which has a stored password that's not
+   * reversible).
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testLDAPBindFailIrreversiblePasswordWithRootDN()
+         throws Exception
+  {
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-o", "mech=CRAM-MD5",
+      "-o", "authid=dn:cn=Directory Manager",
+      "-w", "password",
+      "-b", "",
+      "-s", "base",
+      "(objectClass=*)"
+    };
+    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
+  }
+
+
+
+  /**
+   * Verifies that the server will reject a CRAM-MD5 bind in which the first
+   * message contains SASL credentials (which isn't allowed).
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testOutOfSequenceBind()
+         throws Exception
+  {
+    InternalClientConnection conn =
+         new InternalClientConnection(new AuthenticationInfo());
+    BindOperation bindOperation =
+         conn.processSASLBind(new DN(), SASL_MECHANISM_CRAM_MD5,
+                              new ASN1OctetString("invalid"));
+    assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS);
+  }
+
+
+
+  /**
+   * Verifies that the server will reject a CRAM-MD5 bind with malformed
+   * credentials.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testMalformedCredentials()
+         throws Exception
+  {
+    InternalClientConnection conn =
+         new InternalClientConnection(new AuthenticationInfo());
+    BindOperation bindOperation =
+         conn.processSASLBind(new DN(), SASL_MECHANISM_CRAM_MD5, null);
+    assertEquals(bindOperation.getResultCode(),
+                 ResultCode.SASL_BIND_IN_PROGRESS);
+
+    bindOperation =
+         conn.processSASLBind(new DN(), SASL_MECHANISM_CRAM_MD5,
+                              new ASN1OctetString("malformed"));
+    assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS);
+  }
+
+
+
+  /**
+   * Verifies that the server will reject a CRAM-MD5 bind with credentials
+   * containing a malformed digest.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testMalformedDigest()
+         throws Exception
+  {
+    InternalClientConnection conn =
+         new InternalClientConnection(new AuthenticationInfo());
+    BindOperation bindOperation =
+         conn.processSASLBind(new DN(), SASL_MECHANISM_CRAM_MD5, null);
+    assertEquals(bindOperation.getResultCode(),
+                 ResultCode.SASL_BIND_IN_PROGRESS);
+
+    ASN1OctetString creds =
+         new ASN1OctetString("dn:cn=Directory Manager malformeddigest");
+    bindOperation =
+         conn.processSASLBind(new DN(), SASL_MECHANISM_CRAM_MD5, creds);
+    assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS);
+  }
+
+
+
+  /**
+   * Verifies that the server will reject a CRAM-MD5 bind with credentials
+   * containing a malformed digest with the correct length but not only hex
+   * characters.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testMalformedDigestWithCorrectLength()
+         throws Exception
+  {
+    InternalClientConnection conn =
+         new InternalClientConnection(new AuthenticationInfo());
+    BindOperation bindOperation =
+         conn.processSASLBind(new DN(), SASL_MECHANISM_CRAM_MD5, null);
+    assertEquals(bindOperation.getResultCode(),
+                 ResultCode.SASL_BIND_IN_PROGRESS);
+
+    ASN1OctetString creds =
+         new ASN1OctetString("dn:cn=Directory Manager " +
+                          "malformedcredswiththerightlength");
+    bindOperation =
+         conn.processSASLBind(new DN(), SASL_MECHANISM_CRAM_MD5, creds);
+    assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS);
+  }
+}
+
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/DefaultEntryCacheTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/DefaultEntryCacheTestCase.java
new file mode 100644
index 0000000..f4c80d5
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/DefaultEntryCacheTestCase.java
@@ -0,0 +1,336 @@
+/*
+ * 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.
+ */
+package org.opends.server.extensions;
+
+
+
+import java.util.ArrayList;
+import java.util.concurrent.locks.Lock;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.opends.server.TestCaseUtils;
+import org.opends.server.api.Backend;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.types.DN;
+import org.opends.server.types.Entry;
+import org.opends.server.types.LockType;
+
+import static org.testng.Assert.*;
+
+
+
+/**
+ * A set of test cases for the default entry cache.
+ */
+public class DefaultEntryCacheTestCase
+       extends ExtensionsTestCase
+{
+  /**
+   * Ensures that the Directory Server is running.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @BeforeClass()
+  public void startServer()
+         throws Exception
+  {
+    TestCaseUtils.startServer();
+  }
+
+
+
+  /**
+   * Tests the process of creating, initializing, and finalizing the cache.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testInitializeAndFinalizeCache()
+         throws Exception
+  {
+    DefaultEntryCache cache = new DefaultEntryCache();
+    cache.initializeEntryCache(null);
+    cache.finalizeEntryCache();
+  }
+
+
+
+  /**
+   * Tests the <CODE>containsEntry</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testContainsEntry()
+         throws Exception
+  {
+    DefaultEntryCache cache = new DefaultEntryCache();
+    cache.initializeEntryCache(null);
+
+    assertFalse(cache.containsEntry(DN.decode("uid=test,o=test")));
+
+    cache.finalizeEntryCache();
+  }
+
+
+
+  /**
+   * Tests the first <CODE>getEntry</CODE> method, which takes a single DN
+   * argument.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testGetEntry1()
+         throws Exception
+  {
+    DefaultEntryCache cache = new DefaultEntryCache();
+    cache.initializeEntryCache(null);
+
+    assertNull(cache.getEntry(DN.decode("uid=test,o=test")));
+
+    cache.finalizeEntryCache();
+  }
+
+
+
+  /**
+   * Tests the second <CODE>getEntry</CODE> method, which takes a DN, lock type,
+   * and list attributes.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testGetEntry2()
+         throws Exception
+  {
+    DefaultEntryCache cache = new DefaultEntryCache();
+    cache.initializeEntryCache(null);
+
+    assertNull(cache.getEntry(DN.decode("uid=test,o=test"), LockType.NONE,
+                              new ArrayList<Lock>()));
+
+    cache.finalizeEntryCache();
+  }
+
+
+
+  /**
+   * Tests the third <CODE>getEntry</CODE> method, which takes a backend, entry
+   * ID, lock type, and list attributes.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testGetEntry3()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(false);
+    Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
+
+    DefaultEntryCache cache = new DefaultEntryCache();
+    cache.initializeEntryCache(null);
+
+    assertNull(cache.getEntry(b, -1, LockType.NONE, new ArrayList<Lock>()));
+
+    cache.finalizeEntryCache();
+  }
+
+
+
+  /**
+   * Tests the <CODE>getEntryID</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testGetEntryID()
+         throws Exception
+  {
+    DefaultEntryCache cache = new DefaultEntryCache();
+    cache.initializeEntryCache(null);
+
+    assertEquals(cache.getEntryID(DN.decode("uid=test,o=test")), -1);
+
+    cache.finalizeEntryCache();
+  }
+
+
+
+  /**
+   * Tests the <CODE>putEntry</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testPutEntry()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(false);
+    Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
+
+    Entry e = TestCaseUtils.makeEntry("dn: o=test",
+                                      "objectClass: top",
+                                      "objectClass: organization",
+                                      "o: test");
+
+    DefaultEntryCache cache = new DefaultEntryCache();
+    cache.initializeEntryCache(null);
+
+    cache.putEntry(e, b, 1);
+
+    cache.finalizeEntryCache();
+  }
+
+
+
+  /**
+   * Tests the <CODE>putEntryIfAbsent</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testPutEntryIfAbsent()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(false);
+    Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
+
+    Entry e = TestCaseUtils.makeEntry("dn: o=test",
+                                      "objectClass: top",
+                                      "objectClass: organization",
+                                      "o: test");
+
+    DefaultEntryCache cache = new DefaultEntryCache();
+    cache.initializeEntryCache(null);
+
+    assertTrue(cache.putEntryIfAbsent(e, b, 1));
+
+    cache.finalizeEntryCache();
+  }
+
+
+
+  /**
+   * Tests the <CODE>removeEntry</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testRemoveEntry()
+         throws Exception
+  {
+    DefaultEntryCache cache = new DefaultEntryCache();
+    cache.initializeEntryCache(null);
+
+    cache.removeEntry(DN.decode("uid=test,o=test"));
+
+    cache.finalizeEntryCache();
+  }
+
+
+
+  /**
+   * Tests the <CODE>clear</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testClear()
+         throws Exception
+  {
+    DefaultEntryCache cache = new DefaultEntryCache();
+    cache.initializeEntryCache(null);
+
+    cache.clear();
+
+    cache.finalizeEntryCache();
+  }
+
+
+
+  /**
+   * Tests the <CODE>clearBackend</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testClearBackend()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(false);
+    Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
+
+    DefaultEntryCache cache = new DefaultEntryCache();
+    cache.initializeEntryCache(null);
+
+    cache.clearBackend(b);
+
+    cache.finalizeEntryCache();
+  }
+
+
+
+  /**
+   * Tests the <CODE>clearSubtree</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testClearSubtree()
+         throws Exception
+  {
+    DefaultEntryCache cache = new DefaultEntryCache();
+    cache.initializeEntryCache(null);
+
+    cache.clearSubtree(DN.decode("o=test"));
+
+    cache.finalizeEntryCache();
+  }
+
+
+
+  /**
+   * Tests the <CODE>handleLowMemory</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void handleLowMemory()
+         throws Exception
+  {
+    DefaultEntryCache cache = new DefaultEntryCache();
+    cache.initializeEntryCache(null);
+
+    cache.handleLowMemory();
+
+    cache.finalizeEntryCache();
+  }
+}
+
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/InternalConnectionSecurityProviderTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/InternalConnectionSecurityProviderTestCase.java
new file mode 100644
index 0000000..e8fc7ba
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/InternalConnectionSecurityProviderTestCase.java
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+package org.opends.server.extensions;
+
+
+
+import java.util.ArrayList;
+import java.util.concurrent.locks.Lock;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.opends.server.TestCaseUtils;
+import org.opends.server.api.Backend;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.types.DN;
+import org.opends.server.types.Entry;
+import org.opends.server.types.LockType;
+
+import static org.testng.Assert.*;
+
+
+
+/**
+ * A set of test cases for the internal connection security provider.
+ */
+public class InternalConnectionSecurityProviderTestCase
+       extends ExtensionsTestCase
+{
+  /**
+   * Ensures that the Directory Server is running.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @BeforeClass()
+  public void startServer()
+         throws Exception
+  {
+    TestCaseUtils.startServer();
+  }
+
+
+
+  /**
+   * Tests the default constructor for this class.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testConstructor()
+         throws Exception
+  {
+    InternalConnectionSecurityProvider provider =
+         new InternalConnectionSecurityProvider();
+    provider.initializeConnectionSecurityProvider(null);
+    provider.finalizeConnectionSecurityProvider();
+  }
+
+
+
+  /**
+   * Tests the <CODE>getSecurityMechanismName</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testGetSecurityMechanismName()
+         throws Exception
+  {
+    InternalConnectionSecurityProvider provider =
+         new InternalConnectionSecurityProvider();
+    provider.initializeConnectionSecurityProvider(null);
+
+    assertNotNull(provider.getSecurityMechanismName());
+
+    provider.finalizeConnectionSecurityProvider();
+  }
+
+
+
+  /**
+   * Tests the <CODE>isSecure</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testIsSecure()
+         throws Exception
+  {
+    InternalConnectionSecurityProvider provider =
+         new InternalConnectionSecurityProvider();
+    provider.initializeConnectionSecurityProvider(null);
+
+    assertTrue(provider.isSecure());
+
+    provider.finalizeConnectionSecurityProvider();
+  }
+}
+
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java
new file mode 100644
index 0000000..1141c2c
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java
@@ -0,0 +1,603 @@
+/*
+ * 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.
+ */
+package org.opends.server.extensions;
+
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import org.opends.server.TestCaseUtils;
+import org.opends.server.config.ConfigEntry;
+import org.opends.server.config.ConfigException;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.core.InitializationException;
+import org.opends.server.core.ModifyOperation;
+import org.opends.server.protocols.asn1.ASN1OctetString;
+import org.opends.server.protocols.internal.InternalClientConnection;
+import org.opends.server.types.Attribute;
+import org.opends.server.types.Control;
+import org.opends.server.types.DN;
+import org.opends.server.types.Entry;
+import org.opends.server.types.Modification;
+import org.opends.server.types.ModificationType;
+
+import static org.testng.Assert.*;
+
+
+
+/**
+ * A set of test cases for the length-based password validator.
+ */
+public class LengthBasedPasswordValidatorTestCase
+       extends ExtensionsTestCase
+{
+  /**
+   * Ensures that the Directory Server is running.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @BeforeClass()
+  public void startServer()
+         throws Exception
+  {
+    TestCaseUtils.startServer();
+  }
+
+
+
+  /**
+   * Retrieves a set of valid configuration entries that may be used to
+   * initialize the validator.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @DataProvider(name = "validConfigs")
+  public Object[][] getValidConfigs()
+         throws Exception
+  {
+    List<Entry> entries = TestCaseUtils.makeEntries(
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-minimum-password-length: 6",
+         "ds-cfg-maximum-password-length: 0",
+         "",
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-minimum-password-length: 6",
+         "ds-cfg-maximum-password-length: 10",
+         "",
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-minimum-password-length: 0",
+         "ds-cfg-maximum-password-length: 0",
+         "",
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-minimum-password-length: 6",
+         "ds-cfg-maximum-password-length: 6",
+         "",
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-minimum-password-length: 6",
+         "",
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-minimum-password-length: 0",
+         "",
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-maximum-password-length: 10",
+         "",
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true");
+
+    Object[][] array = new Object[entries.size()][1];
+    for (int i=0; i < array.length; i++)
+    {
+      array[i] = new Object[] { entries.get(i) };
+    }
+
+    return array;
+  }
+
+
+
+  /**
+   * Tests the process of initializing the server with valid configurations.
+   *
+   * @param  entry  The configuration entry to use for the initialization.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(dataProvider = "validConfigs")
+  public void testInitializeWithValidConfigs(Entry e)
+         throws Exception
+  {
+    DN parentDN = DN.decode("cn=Password Validators,cn=config");
+    ConfigEntry parentEntry = DirectoryServer.getConfigEntry(parentDN);
+    ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
+
+    LengthBasedPasswordValidator validator =
+         new LengthBasedPasswordValidator();
+    validator.initializePasswordValidator(configEntry);
+    validator.finalizePasswordValidator();
+  }
+
+
+
+  /**
+   * Retrieves a set of invvalid configuration entries.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @DataProvider(name = "invalidConfigs")
+  public Object[][] getInvalidConfigs()
+         throws Exception
+  {
+    List<Entry> entries = TestCaseUtils.makeEntries(
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-minimum-password-length: -1",
+         "",
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-minimum-password-length: notNumeric",
+         "",
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-maximum-password-length: -1",
+         "",
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-maximum-password-length: notNumeric",
+         "",
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-minimum-password-length: 6",
+         "ds-cfg-maximum-password-length: 5");
+
+    Object[][] array = new Object[entries.size()][1];
+    for (int i=0; i < array.length; i++)
+    {
+      array[i] = new Object[] { entries.get(i) };
+    }
+
+    return array;
+  }
+
+
+
+  /**
+   * Tests the process of initializing the server with invalid configurations.
+   *
+   * @param  entry  The configuration entry to use for the initialization.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(dataProvider = "invalidConfigs",
+        expectedExceptions = { ConfigException.class,
+                               InitializationException.class })
+  public void testInitializeWithInvalidConfigs(Entry e)
+         throws Exception
+  {
+    DN parentDN = DN.decode("cn=Password Validators,cn=config");
+    ConfigEntry parentEntry = DirectoryServer.getConfigEntry(parentDN);
+    ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
+
+    LengthBasedPasswordValidator validator =
+         new LengthBasedPasswordValidator();
+    validator.initializePasswordValidator(configEntry);
+  }
+
+
+
+  /**
+   * Tests the <CODE>passwordIsValid</CODE> method with no constraints on
+   * password length.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testPasswordIsValidNoConstraints()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+    Entry userEntry = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: password");
+
+    Entry validatorEntry = TestCaseUtils.makeEntry(
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-minimum-password-length: 0",
+         "ds-cfg-maximum-password-length: 0");
+
+    DN parentDN = DN.decode("cn=Password Validators,cn=config");
+    ConfigEntry parentEntry = DirectoryServer.getConfigEntry(parentDN);
+    ConfigEntry configEntry = new ConfigEntry(validatorEntry, parentEntry);
+
+    LengthBasedPasswordValidator validator =
+         new LengthBasedPasswordValidator();
+    validator.initializePasswordValidator(configEntry);
+
+    StringBuilder buffer = new StringBuilder();
+    for (int i=0; i < 20; i++)
+    {
+      buffer.append('x');
+      ASN1OctetString password = new ASN1OctetString(buffer.toString());
+
+      ArrayList<Modification> mods = new ArrayList<Modification>();
+      mods.add(new Modification(ModificationType.REPLACE,
+                                new Attribute("userPassword",
+                                              buffer.toString())));
+
+      InternalClientConnection conn =
+           InternalClientConnection.getRootConnection();
+      ModifyOperation op =
+           new ModifyOperation(conn, conn.nextOperationID(),
+                               conn.nextMessageID(), new ArrayList<Control>(),
+                               DN.decode("cn=uid=test.user,o=test"), mods);
+
+      StringBuilder invalidReason = new StringBuilder();
+      assertTrue(validator.passwordIsValid(password, op, userEntry,
+                                           invalidReason));
+    }
+
+    validator.finalizePasswordValidator();
+  }
+
+
+
+  /**
+   * Tests the <CODE>passwordIsValid</CODE> method with a constraint on the
+   * minimum password length.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testPasswordIsValidMinLengthConstraint()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+    Entry userEntry = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: password");
+
+    Entry validatorEntry = TestCaseUtils.makeEntry(
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-minimum-password-length: 10",
+         "ds-cfg-maximum-password-length: 0");
+
+    DN parentDN = DN.decode("cn=Password Validators,cn=config");
+    ConfigEntry parentEntry = DirectoryServer.getConfigEntry(parentDN);
+    ConfigEntry configEntry = new ConfigEntry(validatorEntry, parentEntry);
+
+    LengthBasedPasswordValidator validator =
+         new LengthBasedPasswordValidator();
+    validator.initializePasswordValidator(configEntry);
+
+    StringBuilder buffer = new StringBuilder();
+    for (int i=0; i < 20; i++)
+    {
+      buffer.append('x');
+      ASN1OctetString password = new ASN1OctetString(buffer.toString());
+
+      ArrayList<Modification> mods = new ArrayList<Modification>();
+      mods.add(new Modification(ModificationType.REPLACE,
+                                new Attribute("userPassword",
+                                              buffer.toString())));
+
+      InternalClientConnection conn =
+           InternalClientConnection.getRootConnection();
+      ModifyOperation op =
+           new ModifyOperation(conn, conn.nextOperationID(),
+                               conn.nextMessageID(), new ArrayList<Control>(),
+                               DN.decode("cn=uid=test.user,o=test"), mods);
+
+      StringBuilder invalidReason = new StringBuilder();
+      assertEquals((buffer.length() >= 10),
+                   validator.passwordIsValid(password, op, userEntry,
+                                             invalidReason));
+    }
+
+    validator.finalizePasswordValidator();
+  }
+
+
+
+  /**
+   * Tests the <CODE>passwordIsValid</CODE> method with a constraint on the
+   * maximum password length.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testPasswordIsValidMaxLengthConstraint()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+    Entry userEntry = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: password");
+
+    Entry validatorEntry = TestCaseUtils.makeEntry(
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-minimum-password-length: 0",
+         "ds-cfg-maximum-password-length: 10");
+
+    DN parentDN = DN.decode("cn=Password Validators,cn=config");
+    ConfigEntry parentEntry = DirectoryServer.getConfigEntry(parentDN);
+    ConfigEntry configEntry = new ConfigEntry(validatorEntry, parentEntry);
+
+    LengthBasedPasswordValidator validator =
+         new LengthBasedPasswordValidator();
+    validator.initializePasswordValidator(configEntry);
+
+    StringBuilder buffer = new StringBuilder();
+    for (int i=0; i < 20; i++)
+    {
+      buffer.append('x');
+      ASN1OctetString password = new ASN1OctetString(buffer.toString());
+
+      ArrayList<Modification> mods = new ArrayList<Modification>();
+      mods.add(new Modification(ModificationType.REPLACE,
+                                new Attribute("userPassword",
+                                              buffer.toString())));
+
+      InternalClientConnection conn =
+           InternalClientConnection.getRootConnection();
+      ModifyOperation op =
+           new ModifyOperation(conn, conn.nextOperationID(),
+                               conn.nextMessageID(), new ArrayList<Control>(),
+                               DN.decode("cn=uid=test.user,o=test"), mods);
+
+      StringBuilder invalidReason = new StringBuilder();
+      assertEquals((buffer.length() <= 10),
+                   validator.passwordIsValid(password, op, userEntry,
+                                             invalidReason));
+    }
+
+    validator.finalizePasswordValidator();
+  }
+
+
+
+  /**
+   * Tests the <CODE>passwordIsValid</CODE> method with constraints on both the
+   * minimum and maximum password length.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testPasswordIsValidMinAndMaxLengthConstraints()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+    Entry userEntry = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: password");
+
+    Entry validatorEntry = TestCaseUtils.makeEntry(
+         "dn: cn=Length-Based Password Validator,cn=Password Validators," +
+              "cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-length-based-password-validator",
+         "cn: Length-Based Password Validator",
+         "ds-cfg-password-validator-class: org.opends.server.extensions." +
+              "LengthBasedPasswordValidator",
+         "ds-cfg-password-validator-enabled: true",
+         "ds-cfg-minimum-password-length: 6",
+         "ds-cfg-maximum-password-length: 10");
+
+    DN parentDN = DN.decode("cn=Password Validators,cn=config");
+    ConfigEntry parentEntry = DirectoryServer.getConfigEntry(parentDN);
+    ConfigEntry configEntry = new ConfigEntry(validatorEntry, parentEntry);
+
+    LengthBasedPasswordValidator validator =
+         new LengthBasedPasswordValidator();
+    validator.initializePasswordValidator(configEntry);
+
+    StringBuilder buffer = new StringBuilder();
+    for (int i=0; i < 20; i++)
+    {
+      buffer.append('x');
+      ASN1OctetString password = new ASN1OctetString(buffer.toString());
+
+      ArrayList<Modification> mods = new ArrayList<Modification>();
+      mods.add(new Modification(ModificationType.REPLACE,
+                                new Attribute("userPassword",
+                                              buffer.toString())));
+
+      InternalClientConnection conn =
+           InternalClientConnection.getRootConnection();
+      ModifyOperation op =
+           new ModifyOperation(conn, conn.nextOperationID(),
+                               conn.nextMessageID(), new ArrayList<Control>(),
+                               DN.decode("cn=uid=test.user,o=test"), mods);
+
+      StringBuilder invalidReason = new StringBuilder();
+      assertEquals(((buffer.length() >= 6) && (buffer.length() <= 10)),
+                   validator.passwordIsValid(password, op, userEntry,
+                                             invalidReason));
+    }
+
+    validator.finalizePasswordValidator();
+  }
+}
+
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/NullConnectionSecurityProviderTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/NullConnectionSecurityProviderTestCase.java
new file mode 100644
index 0000000..6148b14
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/NullConnectionSecurityProviderTestCase.java
@@ -0,0 +1,183 @@
+/*
+ * 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.
+ */
+package org.opends.server.extensions;
+
+
+
+import java.util.ArrayList;
+import java.util.concurrent.locks.Lock;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.opends.server.TestCaseUtils;
+import org.opends.server.api.Backend;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.types.DN;
+import org.opends.server.types.Entry;
+import org.opends.server.types.LockType;
+
+import static org.testng.Assert.*;
+
+
+
+/**
+ * A set of test cases for the null connection security provider.
+ */
+public class NullConnectionSecurityProviderTestCase
+       extends ExtensionsTestCase
+{
+  /**
+   * Ensures that the Directory Server is running.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @BeforeClass()
+  public void startServer()
+         throws Exception
+  {
+    TestCaseUtils.startServer();
+  }
+
+
+
+  /**
+   * Tests the default constructor for this class.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testConstructor()
+         throws Exception
+  {
+    NullConnectionSecurityProvider provider =
+         new NullConnectionSecurityProvider();
+    provider.initializeConnectionSecurityProvider(null);
+    provider.finalizeConnectionSecurityProvider();
+  }
+
+
+
+  /**
+   * Tests the <CODE>getSecurityMechanismName</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testGetSecurityMechanismName()
+         throws Exception
+  {
+    NullConnectionSecurityProvider provider =
+         new NullConnectionSecurityProvider();
+    provider.initializeConnectionSecurityProvider(null);
+
+    assertNotNull(provider.getSecurityMechanismName());
+
+    provider.finalizeConnectionSecurityProvider();
+  }
+
+
+
+  /**
+   * Tests the <CODE>isSecure</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testIsSecure()
+         throws Exception
+  {
+    NullConnectionSecurityProvider provider =
+         new NullConnectionSecurityProvider();
+    provider.initializeConnectionSecurityProvider(null);
+
+    assertFalse(provider.isSecure());
+
+    provider.finalizeConnectionSecurityProvider();
+  }
+
+
+
+  /**
+   * Tests the <CODE>disconnect</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testDisconnect()
+         throws Exception
+  {
+    NullConnectionSecurityProvider provider =
+         new NullConnectionSecurityProvider();
+    provider.initializeConnectionSecurityProvider(null);
+
+    provider.disconnect(true);
+
+    provider.finalizeConnectionSecurityProvider();
+  }
+
+
+
+  /**
+   * Tests the <CODE>getClearBufferSize</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testGetClearBufferSize()
+         throws Exception
+  {
+    NullConnectionSecurityProvider provider =
+         new NullConnectionSecurityProvider();
+    provider.initializeConnectionSecurityProvider(null);
+
+    assertTrue(provider.getClearBufferSize() > 0);
+
+    provider.finalizeConnectionSecurityProvider();
+  }
+
+
+
+  /**
+   * Tests the <CODE>getEncodedBufferSize</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testGetEncodedBufferSize()
+         throws Exception
+  {
+    NullConnectionSecurityProvider provider =
+         new NullConnectionSecurityProvider();
+    provider.initializeConnectionSecurityProvider(null);
+
+    assertTrue(provider.getEncodedBufferSize() > 0);
+
+    provider.finalizeConnectionSecurityProvider();
+  }
+}
+
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/EntryUUIDPluginTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/EntryUUIDPluginTestCase.java
new file mode 100644
index 0000000..5beac4a
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/EntryUUIDPluginTestCase.java
@@ -0,0 +1,420 @@
+/*
+ * 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.
+ */
+package org.opends.server.plugins;
+
+
+
+import java.io.ByteArrayInputStream;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.UUID;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import org.opends.server.TestCaseUtils;
+import org.opends.server.api.plugin.DirectoryServerPlugin;
+import org.opends.server.api.plugin.PluginType;
+import org.opends.server.config.ConfigEntry;
+import org.opends.server.config.ConfigException;
+import org.opends.server.core.AddOperation;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.protocols.internal.InternalClientConnection;
+import org.opends.server.types.Attribute;
+import org.opends.server.types.AttributeType;
+import org.opends.server.types.AttributeValue;
+import org.opends.server.types.AuthenticationInfo;
+import org.opends.server.types.Control;
+import org.opends.server.types.DN;
+import org.opends.server.types.Entry;
+import org.opends.server.types.LDIFImportConfig;
+import org.opends.server.types.Modification;
+import org.opends.server.types.ModificationType;
+import org.opends.server.types.RDN;
+import org.opends.server.types.ResultCode;
+
+import static org.testng.Assert.*;
+
+
+
+/**
+ * This class defines a set of tests for the
+ * org.opends.server.plugins.EntryUUIDPlugin class.
+ */
+public class EntryUUIDPluginTestCase
+       extends PluginTestCase
+{
+  /**
+   * Ensures that the Directory Server is running.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @BeforeClass()
+  public void startServer()
+         throws Exception
+  {
+    TestCaseUtils.startServer();
+  }
+
+
+
+  /**
+   * Retrieves a set of valid configuration entries that may be used to
+   * initialize the plugin.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @DataProvider(name = "validConfigs")
+  public Object[][] getValidConfigs()
+         throws Exception
+  {
+    List<Entry> entries = TestCaseUtils.makeEntries(
+         "dn: cn=Entry UUID,cn=Plugins,cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-plugin",
+         "cn: Entry UUID",
+         "ds-cfg-plugin-class: org.opends.server.plugins.EntryUUIDPlugin",
+         "ds-cfg-plugin-enabled: true",
+         "ds-cfg-plugin-type: ldifImport",
+         "ds-cfg-plugin-type: preOperationAdd",
+         "",
+         "dn: cn=Entry UUID,cn=Plugins,cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-plugin",
+         "cn: Entry UUID",
+         "ds-cfg-plugin-class: org.opends.server.plugins.EntryUUIDPlugin",
+         "ds-cfg-plugin-enabled: true",
+         "ds-cfg-plugin-type: ldifImport",
+         "",
+         "dn: cn=Entry UUID,cn=Plugins,cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-plugin",
+         "cn: Entry UUID",
+         "ds-cfg-plugin-class: org.opends.server.plugins.EntryUUIDPlugin",
+         "ds-cfg-plugin-enabled: true",
+         "ds-cfg-plugin-type: preOperationAdd");
+
+    Object[][] array = new Object[entries.size()][1];
+    for (int i=0; i < array.length; i++)
+    {
+      array[i] = new Object[] { entries.get(i) };
+    }
+
+    return array;
+  }
+
+
+
+  /**
+   * Tests the process of initializing the server with valid configurations.
+   *
+   * @param  entry  The configuration entry to use for the initialization.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(dataProvider = "validConfigs")
+  public void testInitializeWithValidConfigs(Entry e)
+         throws Exception
+  {
+    HashSet<PluginType> pluginTypes = new HashSet<PluginType>();
+    List<Attribute> attrList = e.getAttribute("ds-cfg-plugin-type");
+    for (Attribute a : attrList)
+    {
+      for (AttributeValue v : a.getValues())
+      {
+        pluginTypes.add(PluginType.forName(v.getStringValue().toLowerCase()));
+      }
+    }
+
+
+    ConfigEntry parentEntry =
+         DirectoryServer.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
+    ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
+
+    EntryUUIDPlugin plugin = new EntryUUIDPlugin();
+    plugin.initializePlugin(DirectoryServer.getInstance(), pluginTypes,
+                            configEntry);
+  }
+
+
+
+  /**
+   * Tests the process of initializing the server with valid configurations but
+   * without the entryUUID attribute type defined in the server.
+   *
+   * @param  entry  The configuration entry to use for the initialization.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(dataProvider = "validConfigs")
+  public void testInitializeWithValidConfigsWithoutSchema(Entry e)
+         throws Exception
+  {
+    AttributeType entryUUIDType = DirectoryServer.getAttributeType("entryuuid");
+    DirectoryServer.deregisterAttributeType(entryUUIDType);
+
+
+    HashSet<PluginType> pluginTypes = new HashSet<PluginType>();
+    List<Attribute> attrList = e.getAttribute("ds-cfg-plugin-type");
+    for (Attribute a : attrList)
+    {
+      for (AttributeValue v : a.getValues())
+      {
+        pluginTypes.add(PluginType.forName(v.getStringValue().toLowerCase()));
+      }
+    }
+
+
+    ConfigEntry parentEntry =
+         DirectoryServer.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
+    ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
+
+    EntryUUIDPlugin plugin = new EntryUUIDPlugin();
+    plugin.initializePlugin(DirectoryServer.getInstance(), pluginTypes,
+                            configEntry);
+
+
+    DirectoryServer.registerAttributeType(entryUUIDType, false);
+  }
+
+
+
+  /**
+   * Retrieves a set of invalid configuration entries.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @DataProvider(name = "invalidConfigs")
+  public Object[][] getInvalidConfigs()
+         throws Exception
+  {
+    ArrayList<Entry> entries = new ArrayList<Entry>();
+
+    for (String s : PluginType.getPluginTypeNames())
+    {
+      if (s.equalsIgnoreCase("ldifImport") ||
+          s.equalsIgnoreCase("preOperationAdd"))
+      {
+        continue;
+      }
+
+      Entry e = TestCaseUtils.makeEntry(
+           "dn: cn=Entry UUID,cn=Plugins,cn=config",
+           "objectClass: top",
+           "objectClass: ds-cfg-plugin",
+           "cn: Entry UUID",
+           "ds-cfg-plugin-class: org.opends.server.plugins.EntryUUIDPlugin",
+           "ds-cfg-plugin-enabled: true",
+           "ds-cfg-plugin-type: " + s);
+      entries.add(e);
+    }
+
+    Object[][] array = new Object[entries.size()][1];
+    for (int i=0; i < array.length; i++)
+    {
+      array[i] = new Object[] { entries.get(i) };
+    }
+
+    return array;
+  }
+
+
+
+  /**
+   * Tests the process of initializing the server with valid configurations.
+   *
+   * @param  entry  The configuration entry to use for the initialization.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(dataProvider = "invalidConfigs",
+        expectedExceptions = { ConfigException.class })
+  public void testInitializeWithInvalidConfigs(Entry e)
+         throws Exception
+  {
+    HashSet<PluginType> pluginTypes = new HashSet<PluginType>();
+    List<Attribute> attrList = e.getAttribute("ds-cfg-plugin-type");
+    for (Attribute a : attrList)
+    {
+      for (AttributeValue v : a.getValues())
+      {
+        pluginTypes.add(PluginType.forName(v.getStringValue().toLowerCase()));
+      }
+    }
+
+
+    ConfigEntry parentEntry =
+         DirectoryServer.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
+    ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
+
+    EntryUUIDPlugin plugin = new EntryUUIDPlugin();
+    plugin.initializePlugin(DirectoryServer.getInstance(), pluginTypes,
+                            configEntry);
+  }
+
+
+
+  /**
+   * Tests the <CODE>doLDIFImport</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testDoLDIFImport()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    String ldifString = TestCaseUtils.makeLdif("dn: o=test",
+                                               "objectClass: top",
+                                               "objectClass: organization",
+                                               "o: test");
+
+    Entry e = TestCaseUtils.makeEntry("dn: o=test",
+                                      "objectClass: top",
+                                      "objectClass: organization",
+                                      "o: test");
+
+    ByteArrayInputStream bais =
+         new ByteArrayInputStream(ldifString.getBytes("UTF-8"));
+    LDIFImportConfig importConfig = new LDIFImportConfig(bais);
+
+    DN dn = DN.decode("cn=Entry UUID,cn=plugins,cn=config");
+    EntryUUIDPlugin plugin =
+         (EntryUUIDPlugin)
+         DirectoryServer.getPluginConfigManager().getRegisteredPlugin(dn);
+    plugin.doLDIFImport(importConfig, e);
+
+    assertNotNull(e.getAttribute("entryuuid"));
+  }
+
+
+
+  /**
+   * Tests the <CODE>doLDIFImport</CODE> method with an entry that already has
+   * the entryUUID operational attribute.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testDoLDIFImportWithExistingUUID()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    String uuid = UUID.randomUUID().toString();
+
+    String ldifString = TestCaseUtils.makeLdif("dn: o=test",
+                                               "objectClass: top",
+                                               "objectClass: organization",
+                                               "o: test",
+                                               "entryUUID: " + uuid);
+
+    Entry e = TestCaseUtils.makeEntry("dn: o=test",
+                                      "objectClass: top",
+                                      "objectClass: organization",
+                                      "o: test",
+                                      "entryUUID: " + uuid);
+
+    ByteArrayInputStream bais =
+         new ByteArrayInputStream(ldifString.getBytes("UTF-8"));
+    LDIFImportConfig importConfig = new LDIFImportConfig(bais);
+
+    DN dn = DN.decode("cn=Entry UUID,cn=plugins,cn=config");
+    EntryUUIDPlugin plugin =
+         (EntryUUIDPlugin)
+         DirectoryServer.getPluginConfigManager().getRegisteredPlugin(dn);
+    plugin.doLDIFImport(importConfig, e);
+
+    assertNotNull(e.getAttribute("entryuuid"));
+  }
+
+
+
+  /**
+   * Tests the <CODE>doPreOperationAdd</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testDoPreOperationAdd()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test",
+                                      "objectClass: top",
+                                      "objectClass: device",
+                                      "cn: test");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    AddOperation addOperation =
+         conn.processAdd(e.getDN(), e.getObjectClasses(), e.getUserAttributes(),
+                         e.getOperationalAttributes());
+    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+    e = DirectoryServer.getEntry(e.getDN());
+    assertNotNull(e);
+    assertNotNull(e.getAttribute("entryuuid"));
+  }
+
+
+
+  /**
+   * Tests the <CODE>doPreOperationAdd</CODE> method with an entry that already
+   * has the entryUUID operational attribute.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testDoPreOperationAddWithExistingUUID()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test",
+                                      "objectClass: top",
+                                      "objectClass: device",
+                                      "cn: test",
+                                      "entryUUID: " + UUID.randomUUID());
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    AddOperation addOperation =
+         conn.processAdd(e.getDN(), e.getObjectClasses(), e.getUserAttributes(),
+                         e.getOperationalAttributes());
+    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+    e = DirectoryServer.getEntry(e.getDN());
+    assertNotNull(e);
+    assertNotNull(e.getAttribute("entryuuid"));
+  }
+}
+
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LDAPADListPluginTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LDAPADListPluginTestCase.java
new file mode 100644
index 0000000..118d1fc
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LDAPADListPluginTestCase.java
@@ -0,0 +1,346 @@
+/*
+ * 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.
+ */
+package org.opends.server.plugins;
+
+
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import org.opends.server.TestCaseUtils;
+import org.opends.server.api.plugin.PluginType;
+import org.opends.server.config.ConfigEntry;
+import org.opends.server.config.ConfigException;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.protocols.internal.InternalClientConnection;
+import org.opends.server.protocols.internal.InternalSearchOperation;
+import org.opends.server.types.Attribute;
+import org.opends.server.types.AttributeValue;
+import org.opends.server.types.DereferencePolicy;
+import org.opends.server.types.DN;
+import org.opends.server.types.Entry;
+import org.opends.server.types.ResultCode;
+import org.opends.server.types.SearchFilter;
+import org.opends.server.types.SearchScope;
+
+import static org.testng.Assert.*;
+
+
+
+/**
+ * This class defines a set of tests for the
+ * org.opends.server.plugins.LDAPADListPlugin class.
+ */
+public class LDAPADListPluginTestCase
+       extends PluginTestCase
+{
+  /**
+   * Ensures that the Directory Server is running.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @BeforeClass()
+  public void startServer()
+         throws Exception
+  {
+    TestCaseUtils.startServer();
+  }
+
+
+
+  /**
+   * Retrieves a set of valid configuration entries that may be used to
+   * initialize the plugin.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @DataProvider(name = "validConfigs")
+  public Object[][] getValidConfigs()
+         throws Exception
+  {
+    List<Entry> entries = TestCaseUtils.makeEntries(
+         "dn: cn=LDAP Attribute Description List,cn=Plugins,cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-plugin",
+         "cn: LDAP Attribute Description List",
+         "ds-cfg-plugin-class: org.opends.server.plugins.LDAPADListPlugin",
+         "ds-cfg-plugin-enabled: true",
+         "ds-cfg-plugin-type: preParseSearch");
+
+    Object[][] array = new Object[entries.size()][1];
+    for (int i=0; i < array.length; i++)
+    {
+      array[i] = new Object[] { entries.get(i) };
+    }
+
+    return array;
+  }
+
+
+
+  /**
+   * Tests the process of initializing the server with valid configurations.
+   *
+   * @param  entry  The configuration entry to use for the initialization.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(dataProvider = "validConfigs")
+  public void testInitializeWithValidConfigs(Entry e)
+         throws Exception
+  {
+    HashSet<PluginType> pluginTypes = new HashSet<PluginType>();
+    List<Attribute> attrList = e.getAttribute("ds-cfg-plugin-type");
+    for (Attribute a : attrList)
+    {
+      for (AttributeValue v : a.getValues())
+      {
+        pluginTypes.add(PluginType.forName(v.getStringValue().toLowerCase()));
+      }
+    }
+
+
+    ConfigEntry parentEntry =
+         DirectoryServer.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
+    ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
+
+    LDAPADListPlugin plugin = new LDAPADListPlugin();
+    plugin.initializePlugin(DirectoryServer.getInstance(), pluginTypes,
+                            configEntry);
+  }
+
+
+
+  /**
+   * Retrieves a set of invalid configuration entries.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @DataProvider(name = "invalidConfigs")
+  public Object[][] getInvalidConfigs()
+         throws Exception
+  {
+    ArrayList<Entry> entries = new ArrayList<Entry>();
+    Entry e = TestCaseUtils.makeEntry(
+         "dn: cn=LDAP Attribute Description List,cn=Plugins,cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-plugin",
+         "cn: LDAP Attribute Description List",
+         "ds-cfg-plugin-class: org.opends.server.plugins.LDAPADListPlugin",
+         "ds-cfg-plugin-enabled: true");
+    entries.add(e);
+
+    for (String s : PluginType.getPluginTypeNames())
+    {
+      if (s.equalsIgnoreCase("preParseSearch"))
+      {
+        continue;
+      }
+
+      e = TestCaseUtils.makeEntry(
+           "dn: cn=LDAP Attribute Description List,cn=Plugins,cn=config",
+           "objectClass: top",
+           "objectClass: ds-cfg-plugin",
+           "cn: LDAP Attribute Description List",
+           "ds-cfg-plugin-class: org.opends.server.plugins.LDAPADListPlugin",
+           "ds-cfg-plugin-enabled: true",
+           "ds-cfg-plugin-type: " + s);
+      entries.add(e);
+    }
+
+    Object[][] array = new Object[entries.size()][1];
+    for (int i=0; i < array.length; i++)
+    {
+      array[i] = new Object[] { entries.get(i) };
+    }
+
+    return array;
+  }
+
+
+
+  /**
+   * Tests the process of initializing the server with valid configurations.
+   *
+   * @param  entry  The configuration entry to use for the initialization.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(dataProvider = "invalidConfigs",
+        expectedExceptions = { ConfigException.class })
+  public void testInitializeWithInvalidConfigs(Entry e)
+         throws Exception
+  {
+    HashSet<PluginType> pluginTypes = new HashSet<PluginType>();
+    List<Attribute> attrList = e.getAttribute("ds-cfg-plugin-type");
+    if (attrList != null)
+    {
+      for (Attribute a : attrList)
+      {
+        for (AttributeValue v : a.getValues())
+        {
+          pluginTypes.add(PluginType.forName(v.getStringValue().toLowerCase()));
+        }
+      }
+    }
+
+
+    ConfigEntry parentEntry =
+         DirectoryServer.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
+    ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
+
+    LDAPADListPlugin plugin = new LDAPADListPlugin();
+    plugin.initializePlugin(DirectoryServer.getInstance(), pluginTypes,
+                            configEntry);
+  }
+
+
+
+  /**
+   * Tests the <CODE>doPreParseSearch</CODE> method with an empty attribute
+   * list.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testDoPreParseSearchWithEmptyAttrList()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    LinkedHashSet<String> attrList = new LinkedHashSet<String>();
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    InternalSearchOperation searchOperation =
+         conn.processSearch(DN.decode("o=test"), SearchScope.BASE_OBJECT,
+              DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false,
+              SearchFilter.createFilterFromString("(objectClass=*)"), attrList);
+    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
+    assertFalse(searchOperation.getSearchEntries().isEmpty());
+
+    Entry e = searchOperation.getSearchEntries().get(0);
+    assertNotNull(e.getAttribute("o"));
+  }
+
+
+
+  /**
+   * Tests the <CODE>doPreParseSearch</CODE> method with an attribute list that
+   * contains a standard attribute.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testDoPreParseSearchWithRequestedAttribute()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    LinkedHashSet<String> attrList = new LinkedHashSet<String>();
+    attrList.add("o");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    InternalSearchOperation searchOperation =
+         conn.processSearch(DN.decode("o=test"), SearchScope.BASE_OBJECT,
+              DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false,
+              SearchFilter.createFilterFromString("(objectClass=*)"), attrList);
+    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
+    assertFalse(searchOperation.getSearchEntries().isEmpty());
+
+    Entry e = searchOperation.getSearchEntries().get(0);
+    assertNotNull(e.getAttribute("o"));
+  }
+
+
+
+  /**
+   * Tests the <CODE>doPreParseSearch</CODE> method with an attribute list that
+   * contains an objectclass name.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testDoPreParseSearchWithRequestedObjectClass()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    LinkedHashSet<String> attrList = new LinkedHashSet<String>();
+    attrList.add("@organization");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    InternalSearchOperation searchOperation =
+         conn.processSearch(DN.decode("o=test"), SearchScope.BASE_OBJECT,
+              DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false,
+              SearchFilter.createFilterFromString("(objectClass=*)"), attrList);
+    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
+    assertFalse(searchOperation.getSearchEntries().isEmpty());
+
+    Entry e = searchOperation.getSearchEntries().get(0);
+    assertNotNull(e.getAttribute("o"));
+  }
+
+
+
+  /**
+   * Tests the <CODE>doPreParseSearch</CODE> method with an attribute list that
+   * contains an undefined objectclass name.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testDoPreParseSearchWithRequestedUndefinedObjectClass()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    LinkedHashSet<String> attrList = new LinkedHashSet<String>();
+    attrList.add("@undefined");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    InternalSearchOperation searchOperation =
+         conn.processSearch(DN.decode("o=test"), SearchScope.BASE_OBJECT,
+              DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false,
+              SearchFilter.createFilterFromString("(objectClass=*)"), attrList);
+    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
+    assertFalse(searchOperation.getSearchEntries().isEmpty());
+
+    Entry e = searchOperation.getSearchEntries().get(0);
+    assertNotNull(e.getAttribute("o"));
+  }
+}
+
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LastModPluginTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LastModPluginTestCase.java
new file mode 100644
index 0000000..cf73a1f
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LastModPluginTestCase.java
@@ -0,0 +1,396 @@
+/*
+ * 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.
+ */
+package org.opends.server.plugins;
+
+
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import org.opends.server.TestCaseUtils;
+import org.opends.server.api.plugin.DirectoryServerPlugin;
+import org.opends.server.api.plugin.PluginType;
+import org.opends.server.config.ConfigEntry;
+import org.opends.server.config.ConfigException;
+import org.opends.server.core.AddOperation;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.core.ModifyOperation;
+import org.opends.server.core.ModifyDNOperation;
+import org.opends.server.protocols.internal.InternalClientConnection;
+import org.opends.server.types.Attribute;
+import org.opends.server.types.AttributeType;
+import org.opends.server.types.AttributeValue;
+import org.opends.server.types.AuthenticationInfo;
+import org.opends.server.types.Control;
+import org.opends.server.types.DN;
+import org.opends.server.types.Entry;
+import org.opends.server.types.Modification;
+import org.opends.server.types.ModificationType;
+import org.opends.server.types.RDN;
+import org.opends.server.types.ResultCode;
+
+import static org.testng.Assert.*;
+
+
+
+/**
+ * This class defines a set of tests for the
+ * org.opends.server.plugins.LastModPlugin class.
+ */
+public class LastModPluginTestCase
+       extends PluginTestCase
+{
+  /**
+   * Ensures that the Directory Server is running.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @BeforeClass()
+  public void startServer()
+         throws Exception
+  {
+    TestCaseUtils.startServer();
+  }
+
+
+
+  /**
+   * Retrieves a set of valid configuration entries that may be used to
+   * initialize the plugin.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @DataProvider(name = "validConfigs")
+  public Object[][] getValidConfigs()
+         throws Exception
+  {
+    List<Entry> entries = TestCaseUtils.makeEntries(
+         "dn: cn=LastMod,cn=Plugins,cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-plugin",
+         "cn: LastMod",
+         "ds-cfg-plugin-class: org.opends.server.plugins.LastModPlugin",
+         "ds-cfg-plugin-enabled: true",
+         "ds-cfg-plugin-type: preOperationAdd",
+         "ds-cfg-plugin-type: preOperationModify",
+         "ds-cfg-plugin-type: preOperationModifyDN",
+         "",
+         "dn: cn=LastMod,cn=Plugins,cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-plugin",
+         "cn: LastMod",
+         "ds-cfg-plugin-class: org.opends.server.plugins.LastModPlugin",
+         "ds-cfg-plugin-enabled: true",
+         "ds-cfg-plugin-type: preOperationAdd",
+         "",
+         "dn: cn=LastMod,cn=Plugins,cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-plugin",
+         "cn: LastMod",
+         "ds-cfg-plugin-class: org.opends.server.plugins.LastModPlugin",
+         "ds-cfg-plugin-enabled: true",
+         "ds-cfg-plugin-type: preOperationModify",
+         "",
+         "dn: cn=LastMod,cn=Plugins,cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-plugin",
+         "cn: LastMod",
+         "ds-cfg-plugin-class: org.opends.server.plugins.LastModPlugin",
+         "ds-cfg-plugin-enabled: true",
+         "ds-cfg-plugin-type: preOperationModifyDN");
+
+    Object[][] array = new Object[entries.size()][1];
+    for (int i=0; i < array.length; i++)
+    {
+      array[i] = new Object[] { entries.get(i) };
+    }
+
+    return array;
+  }
+
+
+
+  /**
+   * Tests the process of initializing the server with valid configurations.
+   *
+   * @param  entry  The configuration entry to use for the initialization.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(dataProvider = "validConfigs")
+  public void testInitializeWithValidConfigs(Entry e)
+         throws Exception
+  {
+    HashSet<PluginType> pluginTypes = new HashSet<PluginType>();
+    List<Attribute> attrList = e.getAttribute("ds-cfg-plugin-type");
+    for (Attribute a : attrList)
+    {
+      for (AttributeValue v : a.getValues())
+      {
+        pluginTypes.add(PluginType.forName(v.getStringValue().toLowerCase()));
+      }
+    }
+
+
+    ConfigEntry parentEntry =
+         DirectoryServer.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
+    ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
+
+    LastModPlugin plugin = new LastModPlugin();
+    plugin.initializePlugin(DirectoryServer.getInstance(), pluginTypes,
+                            configEntry);
+  }
+
+
+
+  /**
+   * Tests the process of initializing the server with valid configurations but
+   * without the lastmod schema defined in the server.
+   *
+   * @param  entry  The configuration entry to use for the initialization.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(dataProvider = "validConfigs")
+  public void testInitializeWithValidConfigsWithoutSchema(Entry e)
+         throws Exception
+  {
+    AttributeType ctType = DirectoryServer.getAttributeType("createtimestamp");
+    AttributeType cnType = DirectoryServer.getAttributeType("creatorsname");
+    AttributeType mtType = DirectoryServer.getAttributeType("modifytimestamp");
+    AttributeType mnType = DirectoryServer.getAttributeType("modifiersname");
+
+    DirectoryServer.deregisterAttributeType(ctType);
+    DirectoryServer.deregisterAttributeType(cnType);
+    DirectoryServer.deregisterAttributeType(mtType);
+    DirectoryServer.deregisterAttributeType(mnType);
+
+
+    HashSet<PluginType> pluginTypes = new HashSet<PluginType>();
+    List<Attribute> attrList = e.getAttribute("ds-cfg-plugin-type");
+    for (Attribute a : attrList)
+    {
+      for (AttributeValue v : a.getValues())
+      {
+        pluginTypes.add(PluginType.forName(v.getStringValue().toLowerCase()));
+      }
+    }
+
+
+    ConfigEntry parentEntry =
+         DirectoryServer.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
+    ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
+
+    LastModPlugin plugin = new LastModPlugin();
+    plugin.initializePlugin(DirectoryServer.getInstance(), pluginTypes,
+                            configEntry);
+
+
+    DirectoryServer.registerAttributeType(ctType, false);
+    DirectoryServer.registerAttributeType(cnType, false);
+    DirectoryServer.registerAttributeType(mtType, false);
+    DirectoryServer.registerAttributeType(mnType, false);
+  }
+
+
+
+  /**
+   * Retrieves a set of invalid configuration entries.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @DataProvider(name = "invalidConfigs")
+  public Object[][] getInvalidConfigs()
+         throws Exception
+  {
+    ArrayList<Entry> entries = new ArrayList<Entry>();
+
+    for (String s : PluginType.getPluginTypeNames())
+    {
+      if (s.equalsIgnoreCase("preOperationAdd") ||
+          s.equalsIgnoreCase("preOperationModify") ||
+          s.equalsIgnoreCase("preOperationModifyDN"))
+      {
+        continue;
+      }
+
+      Entry e = TestCaseUtils.makeEntry(
+           "dn: cn=LastMod,cn=Plugins,cn=config",
+           "objectClass: top",
+           "objectClass: ds-cfg-plugin",
+           "cn: LastMod",
+           "ds-cfg-plugin-class: org.opends.server.plugins.LastModPlugin",
+           "ds-cfg-plugin-enabled: true",
+           "ds-cfg-plugin-type: " + s);
+      entries.add(e);
+    }
+
+    Object[][] array = new Object[entries.size()][1];
+    for (int i=0; i < array.length; i++)
+    {
+      array[i] = new Object[] { entries.get(i) };
+    }
+
+    return array;
+  }
+
+
+
+  /**
+   * Tests the process of initializing the server with valid configurations.
+   *
+   * @param  entry  The configuration entry to use for the initialization.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(dataProvider = "invalidConfigs",
+        expectedExceptions = { ConfigException.class })
+  public void testInitializeWithInvalidConfigs(Entry e)
+         throws Exception
+  {
+    HashSet<PluginType> pluginTypes = new HashSet<PluginType>();
+    List<Attribute> attrList = e.getAttribute("ds-cfg-plugin-type");
+    for (Attribute a : attrList)
+    {
+      for (AttributeValue v : a.getValues())
+      {
+        pluginTypes.add(PluginType.forName(v.getStringValue().toLowerCase()));
+      }
+    }
+
+
+    ConfigEntry parentEntry =
+         DirectoryServer.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
+    ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
+
+    LastModPlugin plugin = new LastModPlugin();
+    plugin.initializePlugin(DirectoryServer.getInstance(), pluginTypes,
+                            configEntry);
+  }
+
+
+
+  /**
+   * Tests the <CODE>doPreOperationAdd</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testDoPreOperationAdd()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test",
+                                      "objectClass: top",
+                                      "objectClass: device",
+                                      "cn: test");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    AddOperation addOperation =
+         conn.processAdd(e.getDN(), e.getObjectClasses(), e.getUserAttributes(),
+                         e.getOperationalAttributes());
+    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+    e = DirectoryServer.getEntry(e.getDN());
+    assertNotNull(e);
+    assertNotNull(e.getAttribute("creatorsname"));
+    assertNotNull(e.getAttribute("createtimestamp"));
+  }
+
+
+
+  /**
+   * Tests the <CODE>doPreOperationModify</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testDoPreOperationModify()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    ArrayList<Modification> mods = new ArrayList<Modification>();
+    mods.add(new Modification(ModificationType.REPLACE,
+                              new Attribute("description", "foo")));
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    ModifyOperation modifyOperation =
+         conn.processModify(DN.decode("o=test"), mods);
+    assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
+
+    Entry e = DirectoryServer.getEntry(DN.decode("o=test"));
+    assertNotNull(e);
+    assertNotNull(e.getAttribute("modifiersname"));
+    assertNotNull(e.getAttribute("modifytimestamp"));
+  }
+
+
+
+  /**
+   * Tests the <CODE>doPreOperationModifyDN</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testDoPreOperationModifyDN()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test",
+                                      "objectClass: top",
+                                      "objectClass: device",
+                                      "cn: test");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    AddOperation addOperation =
+         conn.processAdd(e.getDN(), e.getObjectClasses(), e.getUserAttributes(),
+                         e.getOperationalAttributes());
+    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+
+    ModifyDNOperation modifyDNOperation =
+         conn.processModifyDN(e.getDN(), RDN.decode("cn=test2"), false);
+    assertEquals(modifyDNOperation.getResultCode(), ResultCode.SUCCESS);
+
+    e = DirectoryServer.getEntry(DN.decode("cn=test2,o=test"));
+    assertNotNull(e);
+    assertNotNull(e.getAttribute("modifiersname"));
+    assertNotNull(e.getAttribute("modifytimestamp"));
+  }
+}
+
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/PasswordPolicyImportPluginTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/PasswordPolicyImportPluginTestCase.java
new file mode 100644
index 0000000..84ac3d0
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/PasswordPolicyImportPluginTestCase.java
@@ -0,0 +1,306 @@
+/*
+ * 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.
+ */
+package org.opends.server.plugins;
+
+
+
+import java.io.ByteArrayInputStream;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.UUID;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import org.opends.server.TestCaseUtils;
+import org.opends.server.api.plugin.DirectoryServerPlugin;
+import org.opends.server.api.plugin.PluginType;
+import org.opends.server.config.ConfigEntry;
+import org.opends.server.config.ConfigException;
+import org.opends.server.core.AddOperation;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.protocols.internal.InternalClientConnection;
+import org.opends.server.protocols.internal.InternalSearchOperation;
+import org.opends.server.types.Attribute;
+import org.opends.server.types.AttributeType;
+import org.opends.server.types.AttributeValue;
+import org.opends.server.types.AuthenticationInfo;
+import org.opends.server.types.Control;
+import org.opends.server.types.DereferencePolicy;
+import org.opends.server.types.DN;
+import org.opends.server.types.Entry;
+import org.opends.server.types.LDIFImportConfig;
+import org.opends.server.types.Modification;
+import org.opends.server.types.ModificationType;
+import org.opends.server.types.RDN;
+import org.opends.server.types.ResultCode;
+import org.opends.server.types.SearchFilter;
+import org.opends.server.types.SearchScope;
+
+import static org.testng.Assert.*;
+
+
+
+/**
+ * This class defines a set of tests for the
+ * org.opends.server.plugins.PasswordPolicyImportPluginTestCase class.
+ */
+public class PasswordPolicyImportPluginTestCase
+       extends PluginTestCase
+{
+  /**
+   * Ensures that the Directory Server is running.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @BeforeClass()
+  public void startServer()
+         throws Exception
+  {
+    TestCaseUtils.startServer();
+  }
+
+
+
+  /**
+   * Retrieves a set of valid configuration entries that may be used to
+   * initialize the plugin.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @DataProvider(name = "validConfigs")
+  public Object[][] getValidConfigs()
+         throws Exception
+  {
+    List<Entry> entries = TestCaseUtils.makeEntries(
+         "dn: cn=Password Policy Import,cn=Plugins,cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-plugin",
+         "cn: Password Policy Import",
+         "ds-cfg-plugin-class: org.opends.server.plugins." +
+              "PasswordPolicyImportPlugin",
+         "ds-cfg-plugin-enabled: true",
+         "ds-cfg-plugin-type: ldifImport");
+
+    Object[][] array = new Object[entries.size()][1];
+    for (int i=0; i < array.length; i++)
+    {
+      array[i] = new Object[] { entries.get(i) };
+    }
+
+    return array;
+  }
+
+
+
+  /**
+   * Tests the process of initializing the server with valid configurations.
+   *
+   * @param  entry  The configuration entry to use for the initialization.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(dataProvider = "validConfigs")
+  public void testInitializeWithValidConfigs(Entry e)
+         throws Exception
+  {
+    HashSet<PluginType> pluginTypes = new HashSet<PluginType>();
+    List<Attribute> attrList = e.getAttribute("ds-cfg-plugin-type");
+    for (Attribute a : attrList)
+    {
+      for (AttributeValue v : a.getValues())
+      {
+        pluginTypes.add(PluginType.forName(v.getStringValue().toLowerCase()));
+      }
+    }
+
+
+    ConfigEntry parentEntry =
+         DirectoryServer.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
+    ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
+
+    PasswordPolicyImportPlugin plugin = new PasswordPolicyImportPlugin();
+    plugin.initializePlugin(DirectoryServer.getInstance(), pluginTypes,
+                            configEntry);
+  }
+
+
+
+  /**
+   * Retrieves a set of invalid configuration entries.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @DataProvider(name = "invalidConfigs")
+  public Object[][] getInvalidConfigs()
+         throws Exception
+  {
+    ArrayList<Entry> entries = new ArrayList<Entry>();
+    for (String s : PluginType.getPluginTypeNames())
+    {
+      if (s.equalsIgnoreCase("ldifimport"))
+      {
+        continue;
+      }
+
+      Entry e = TestCaseUtils.makeEntry(
+           "dn: cn=Password Policy Import,cn=Plugins,cn=config",
+           "objectClass: top",
+           "objectClass: ds-cfg-plugin",
+           "cn: Password Policy Import",
+           "ds-cfg-plugin-class: org.opends.server.plugins." +
+                "PasswordPolicyImportPlugin",
+           "ds-cfg-plugin-enabled: true",
+           "ds-cfg-plugin-type: " + s);
+      entries.add(e);
+    }
+
+    Object[][] array = new Object[entries.size()][1];
+    for (int i=0; i < array.length; i++)
+    {
+      array[i] = new Object[] { entries.get(i) };
+    }
+
+    return array;
+  }
+
+
+
+  /**
+   * Tests the process of initializing the server with valid configurations.
+   *
+   * @param  entry  The configuration entry to use for the initialization.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(dataProvider = "invalidConfigs",
+        expectedExceptions = { ConfigException.class })
+  public void testInitializeWithInvalidConfigs(Entry e)
+         throws Exception
+  {
+    HashSet<PluginType> pluginTypes = new HashSet<PluginType>();
+    List<Attribute> attrList = e.getAttribute("ds-cfg-plugin-type");
+    if (attrList != null)
+    {
+      for (Attribute a : attrList)
+      {
+        for (AttributeValue v : a.getValues())
+        {
+          pluginTypes.add(PluginType.forName(v.getStringValue().toLowerCase()));
+        }
+      }
+    }
+
+
+    ConfigEntry parentEntry =
+         DirectoryServer.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
+    ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
+
+    PasswordPolicyImportPlugin plugin = new PasswordPolicyImportPlugin();
+    plugin.initializePlugin(DirectoryServer.getInstance(), pluginTypes,
+                            configEntry);
+  }
+
+
+
+  /**
+   * Tests the <CODE>doLDIFImport</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testDoLDIFImport()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    DN dn = DN.decode("cn=Password Policy Import,cn=plugins,cn=config");
+    PasswordPolicyImportPlugin plugin =
+         (PasswordPolicyImportPlugin)
+         DirectoryServer.getPluginConfigManager().getRegisteredPlugin(dn);
+
+    String[] entryLines =
+    {
+      "dn: o=test",
+      "objectClass: top",
+      "objectClass: organization",
+      "o: test",
+      "",
+      "dn: uid=test.user1,o=test",
+      "objectClass: top",
+      "objectClass: person",
+      "objectClass: organizationalPerson",
+      "objectClass: inetOrgPerson",
+      "uid: test.user1",
+      "givenName: Test",
+      "sn: User1",
+      "cn: Test User1",
+      "userPassword: password",
+      "",
+      "dn: uid=test.user2,o=test",
+      "objectClass: top",
+      "objectClass: person",
+      "objectClass: organizationalPerson",
+      "objectClass: inetOrgPerson",
+      "uid: test.user2",
+      "givenName: Test",
+      "sn: User2",
+      "cn: Test User2",
+      "userPassword: password",
+      "pwdPolicySubentry: cn=SSHA512 UserPassword Policy," +
+           "cn=Password Policies,cn=config",
+      "",
+      "dn: uid=test.user3,o=test",
+      "objectClass: top",
+      "objectClass: person",
+      "objectClass: organizationalPerson",
+      "objectClass: inetOrgPerson",
+      "objectClass: authPasswordObject",
+      "uid: test.user3",
+      "givenName: Test",
+      "sn: User3",
+      "cn: Test User3",
+      "authPassword: password",
+      "pwdPolicySubentry: cn=SHA1 AuthPassword Policy,cn=Password Policies," +
+           "cn=config"
+    };
+
+    String ldifString = TestCaseUtils.makeLdif(entryLines);
+    ByteArrayInputStream bais =
+         new ByteArrayInputStream(ldifString.getBytes("UTF-8"));
+    LDIFImportConfig importConfig = new LDIFImportConfig(bais);
+
+    for (Entry e : TestCaseUtils.makeEntries(entryLines))
+    {
+      plugin.doLDIFImport(importConfig, e);
+    }
+  }
+}
+
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/PluginTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/PluginTestCase.java
new file mode 100644
index 0000000..d4d1383
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/PluginTestCase.java
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+package org.opends.server.plugins;
+
+
+
+import org.opends.server.DirectoryServerTestCase;
+import org.testng.annotations.Test;
+
+
+
+/**
+ * An abstract base class for all plugin test cases.
+ */
+@Test(groups = { "precommit", "plugins" })
+public abstract class PluginTestCase
+       extends DirectoryServerTestCase
+{
+  // No implementation required.
+}
+

--
Gitblit v1.10.0