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

Jean-Noël Rouvignac
21.24.2016 0c4fd5b96ee97c414f6a120e7bb683e94bdd1caf
Replace server's AdminTestCaseUtils by the SDK equivalent

Added InitializationUtils as a helper
1 files deleted
1 files added
54 files modified
1789 ■■■■ changed files
opendj-config/pom.xml 2 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/forgerock/opendj/config/server/AdminTestCaseUtils.java 125 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/api/plugin/DirectoryServerPluginTestCase.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/core/PasswordPolicyTestCase.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/AESPasswordStorageSchemeTestCase.java 38 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/AttributeValuePasswordValidatorTestCase.java 33 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/Base64PasswordStorageSchemeTestCase.java 21 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/BcryptPasswordStorageSchemeTestCase.java 12 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/BlowfishPasswordStorageSchemeTestCase.java 21 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/CRAMMD5SASLMechanismHandlerTestCase.java 20 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/CharacterSetPasswordValidatorTestCase.java 32 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/ClearPasswordStorageSchemeTestCase.java 39 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/CryptPasswordStorageSchemeTestCase.java 14 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/DefaultEntryCacheTestCase.java 9 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/DictionaryPasswordValidatorTestCase.java 33 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/DigestMD5SASLMechanismHandlerTestCase.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/ErrorLogAccountStatusNotificationHandlerTestCase.java 13 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java 82 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/ExternalSASLMechanismHandlerTestCase.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/FIFOEntryCacheTestCase.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/FileBasedKeyManagerProviderTestCase.java 23 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/FileBasedTrustManagerProviderTestCase.java 27 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/InitializationUtils.java 136 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java 55 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/MD5PasswordStorageSchemeTestCase.java 39 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/PBKDF2PasswordStorageSchemeTestCase.java 15 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/PKCS5S2PasswordStorageSchemeTestCase.java 15 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordModifyExtendedOperationTestCase.java 9 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/RC4PasswordStorageSchemeTestCase.java 38 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/RandomPasswordGeneratorTestCase.java 26 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/RegularExpressionIdentityMapperTestCase.java 126 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/RepeatedCharactersPasswordValidatorTestCase.java 43 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/SHA1PasswordStorageSchemeTestCase.java 39 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/SaltedMD5PasswordStorageSchemeTestCase.java 42 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/SaltedSHA1PasswordStorageSchemeTestCase.java 16 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/SaltedSHA256PasswordStorageSchemeTestCase.java 23 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/SaltedSHA384PasswordStorageSchemeTestCase.java 32 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/SaltedSHA512PasswordStorageSchemeTestCase.java 33 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/SimilarityBasedPasswordValidatorTestCase.java 42 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/SoftReferenceEntryCacheTestCase.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java 14 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java 14 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/TripleDESPasswordStorageSchemeTestCase.java 39 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/UniqueCharactersPasswordValidatorTestCase.java 84 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/AttributeCleanupPluginTestCase.java 86 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java 36 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/LDAPADListPluginTestCase.java 28 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java 36 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/PasswordPolicyImportPluginTestCase.java 28 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java 25 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java 26 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxConnectTest.java 7 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LdapTestCase.java 9 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/schema/AuthPasswordEqualityMatchingRuleTest.java 13 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/schema/UserPasswordEqualityMatchingRuleTest.java 13 ●●●● patch | view | raw | blame | history
opendj-config/pom.xml
@@ -119,6 +119,8 @@
            <configuration>
              <includes>
                <!-- Classes to have mocks with configuration defaults -->
                <include>**/AdminTestCaseUtils.class</include>
                <include>**/AdminTestCaseUtils$*.class</include>
                <include>**/ConfigurationMock.class</include>
                <include>**/ConfigurationMock$*.class</include>
              </includes>
opendj-server-legacy/src/test/java/org/forgerock/opendj/config/server/AdminTestCaseUtils.java
File was deleted
opendj-server-legacy/src/test/java/org/opends/server/api/plugin/DirectoryServerPluginTestCase.java
@@ -26,10 +26,10 @@
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.PluginCfgDefn;
import org.forgerock.opendj.server.config.server.PluginCfg;
import org.opends.server.core.DirectoryServer;
import org.opends.server.extensions.InitializationUtils;
import org.opends.server.plugins.NullPlugin;
import org.opends.server.types.DisconnectReason;
import org.forgerock.opendj.ldap.DN;
@@ -800,7 +800,7 @@
      "ds-cfg-plugin-type: intermediateResponse");
    PluginCfg configuration =
         AdminTestCaseUtils.getConfiguration(PluginCfgDefn.getInstance(), pluginEntry);
         InitializationUtils.getConfiguration(PluginCfgDefn.getInstance(), pluginEntry);
    NullPlugin nullPlugin = new NullPlugin();
    DN pluginEntryDN = DN.valueOf("cn=Null Plugin,cn=Plugins,cn=config");
@@ -884,7 +884,7 @@
      "ds-cfg-plugin-type: intermediateResponse");
    PluginCfg configuration =
         AdminTestCaseUtils.getConfiguration(PluginCfgDefn.getInstance(), pluginEntry);
         InitializationUtils.getConfiguration(PluginCfgDefn.getInstance(), pluginEntry);
    NullPlugin nullPlugin = new NullPlugin();
opendj-server-legacy/src/test/java/org/opends/server/core/PasswordPolicyTestCase.java
@@ -25,16 +25,15 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.PasswordPolicyCfgDefn;
import org.forgerock.opendj.server.config.server.PasswordPolicyCfg;
import org.opends.server.api.PasswordStorageScheme;
import org.opends.server.extensions.InitializationUtils;
import org.opends.server.types.Entry;
import org.opends.server.schema.UserPasswordSyntax;
import org.opends.server.tools.LDAPModify;
import org.opends.server.types.Attribute;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.util.TimeThread;
import org.testng.annotations.BeforeClass;
@@ -2163,7 +2162,7 @@
         throws Exception
  {
    PasswordPolicyCfg configuration =
      AdminTestCaseUtils.getConfiguration(PasswordPolicyCfgDefn.getInstance(), e);
      InitializationUtils.getConfiguration(PasswordPolicyCfgDefn.getInstance(), e);
    new PasswordPolicyFactory().createAuthenticationPolicy(configuration);
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/AESPasswordStorageSchemeTestCase.java
@@ -16,50 +16,22 @@
 */
package org.opends.server.extensions;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.AESPasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.AESPasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
/**
 * A set of test cases for the AES password storage scheme.
 */
/** A set of test cases for the AES password storage scheme. */
public class AESPasswordStorageSchemeTestCase
       extends PasswordStorageSchemeTestCase
{
  /**
   * Creates a new instance of this storage scheme test case.
   */
  /** Creates a new instance of this storage scheme test case. */
  public AESPasswordStorageSchemeTestCase()
  {
    super("cn=AES,cn=Password Storage Schemes,cn=config");
  }
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  protected PasswordStorageScheme getScheme()
         throws Exception
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    AESPasswordStorageScheme scheme = new AESPasswordStorageScheme();
    AESPasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          AESPasswordStorageSchemeCfgDefn.getInstance(),
          configEntry);
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new AESPasswordStorageScheme(), configEntry, AESPasswordStorageSchemeCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/AttributeValuePasswordValidatorTestCase.java
@@ -28,9 +28,7 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ModificationType;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.AttributeValuePasswordValidatorCfgDefn;
import org.forgerock.opendj.server.config.server.AttributeValuePasswordValidatorCfg;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.types.Attributes;
@@ -153,13 +151,7 @@
  public void testInitializeWithValidConfigs(Entry e)
         throws Exception
  {
    AttributeValuePasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              AttributeValuePasswordValidatorCfgDefn.getInstance(), e);
    AttributeValuePasswordValidator validator =
         new AttributeValuePasswordValidator();
    validator.initializePasswordValidator(configuration);
    AttributeValuePasswordValidator validator = initializePasswordValidator(e);
    validator.finalizePasswordValidator();
  }
@@ -222,13 +214,7 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    AttributeValuePasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              AttributeValuePasswordValidatorCfgDefn.getInstance(), e);
    AttributeValuePasswordValidator validator =
         new AttributeValuePasswordValidator();
    validator.initializePasswordValidator(configuration);
    initializePasswordValidator(e);
  }
@@ -415,14 +401,7 @@
         "cn: Test User",
         "userPassword: doesntmatter");
    AttributeValuePasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              AttributeValuePasswordValidatorCfgDefn.getInstance(),
              configEntry);
    AttributeValuePasswordValidator validator =
         new AttributeValuePasswordValidator();
    validator.initializePasswordValidator(configuration);
    AttributeValuePasswordValidator validator = initializePasswordValidator(configEntry);
    ByteString pwOS = ByteString.valueOfUtf8(password);
    ArrayList<Modification> mods = CollectionUtils.newArrayList(
@@ -442,5 +421,9 @@
    validator.finalizePasswordValidator();
  }
}
  private AttributeValuePasswordValidator initializePasswordValidator(Entry configEntry) throws ConfigException, InitializationException {
    return InitializationUtils.initializePasswordValidator(
        new AttributeValuePasswordValidator(), configEntry, AttributeValuePasswordValidatorCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/Base64PasswordStorageSchemeTestCase.java
@@ -16,15 +16,9 @@
 */
package org.opends.server.extensions;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.Base64PasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.Base64PasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
/**
 * A set of test cases for the base64 password storage scheme.
 */
@@ -48,19 +42,10 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  protected PasswordStorageScheme getScheme()
         throws Exception
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    Base64PasswordStorageScheme scheme = new Base64PasswordStorageScheme();
    Base64PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          Base64PasswordStorageSchemeCfgDefn.getInstance(),
          configEntry
          );
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new Base64PasswordStorageScheme(), configEntry, Base64PasswordStorageSchemeCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/BcryptPasswordStorageSchemeTestCase.java
@@ -16,8 +16,6 @@
package org.opends.server.extensions;
import org.forgerock.opendj.server.config.meta.BcryptPasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.BcryptPasswordStorageSchemeCfg;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.opends.server.api.PasswordStorageScheme;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -43,14 +41,8 @@
  @Override
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    BcryptPasswordStorageScheme scheme =
         new BcryptPasswordStorageScheme();
    BcryptPasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(BcryptPasswordStorageSchemeCfgDefn.getInstance(), configEntry);
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new BcryptPasswordStorageScheme(), configEntry, BcryptPasswordStorageSchemeCfgDefn.getInstance());
  }
  /**
opendj-server-legacy/src/test/java/org/opends/server/extensions/BlowfishPasswordStorageSchemeTestCase.java
@@ -16,15 +16,9 @@
 */
package org.opends.server.extensions;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.BlowfishPasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.BlowfishPasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
/**
 * A set of test cases for the Blowfish password storage scheme.
 */
@@ -48,18 +42,9 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  protected PasswordStorageScheme getScheme()
         throws Exception
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    BlowfishPasswordStorageScheme scheme = new BlowfishPasswordStorageScheme();
    BlowfishPasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          BlowfishPasswordStorageSchemeCfgDefn.getInstance(),
          configEntry);
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new BlowfishPasswordStorageScheme(), configEntry, BlowfishPasswordStorageSchemeCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/CRAMMD5SASLMechanismHandlerTestCase.java
@@ -23,9 +23,7 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.CramMD5SASLMechanismHandlerCfgDefn;
import org.forgerock.opendj.server.config.server.CramMD5SASLMechanismHandlerCfg;
import org.opends.server.core.BindOperation;
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.internal.InternalClientConnection;
@@ -39,18 +37,11 @@
import static org.opends.server.util.ServerConstants.*;
import static org.testng.Assert.*;
/**
 * A set of test cases for the CRAM-MD5 SASL mechanism handler.
 */
/** A set of test cases for the CRAM-MD5 SASL mechanism handler. */
@SuppressWarnings("javadoc")
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
  {
@@ -119,13 +110,8 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    CramMD5SASLMechanismHandlerCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              CramMD5SASLMechanismHandlerCfgDefn.getInstance(),
              e);
    CRAMMD5SASLMechanismHandler handler = new CRAMMD5SASLMechanismHandler();
    handler.initializeSASLMechanismHandler(configuration);
    InitializationUtils.initializeSASLMechanismHandler(
        new CRAMMD5SASLMechanismHandler(), e, CramMD5SASLMechanismHandlerCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/CharacterSetPasswordValidatorTestCase.java
@@ -27,8 +27,6 @@
import org.opends.server.TestCaseUtils;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.opendj.server.config.meta.CharacterSetPasswordValidatorCfgDefn;
import org.forgerock.opendj.server.config.server.CharacterSetPasswordValidatorCfg;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.protocols.internal.InternalClientConnection;
@@ -189,17 +187,14 @@
  public void testInitializeWithValidConfigs(Entry e)
         throws Exception
  {
    CharacterSetPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              CharacterSetPasswordValidatorCfgDefn.getInstance(), e);
    CharacterSetPasswordValidator validator =
         new CharacterSetPasswordValidator();
    validator.initializePasswordValidator(configuration);
    CharacterSetPasswordValidator validator = initializePasswordValidator(e);
    validator.finalizePasswordValidator();
  }
  private CharacterSetPasswordValidator initializePasswordValidator(Entry e) throws ConfigException, InitializationException {
    return InitializationUtils.initializePasswordValidator(
        new CharacterSetPasswordValidator(), e, CharacterSetPasswordValidatorCfgDefn.getInstance());
  }
  /**
   * Retrieves a set of invalid configuration entries.
@@ -486,13 +481,7 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    CharacterSetPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              CharacterSetPasswordValidatorCfgDefn.getInstance(), e);
    CharacterSetPasswordValidator validator =
         new CharacterSetPasswordValidator();
    validator.initializePasswordValidator(configuration);
    initializePasswordValidator(e);
    StringBuilder buffer = new StringBuilder();
    for (StringBuilder line : e.toLDIF())
@@ -971,14 +960,7 @@
         "cn: Test User",
         "userPassword: doesntmatter");
    CharacterSetPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              CharacterSetPasswordValidatorCfgDefn.getInstance(),
              configEntry);
    CharacterSetPasswordValidator validator =
         new CharacterSetPasswordValidator();
    validator.initializePasswordValidator(configuration);
    CharacterSetPasswordValidator validator = initializePasswordValidator(configEntry);
    ByteString pwOS = ByteString.valueOfUtf8(password);
    ArrayList<Modification> mods = newArrayList(
opendj-server-legacy/src/test/java/org/opends/server/extensions/ClearPasswordStorageSchemeTestCase.java
@@ -16,51 +16,22 @@
 */
package org.opends.server.extensions;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.ClearPasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.ClearPasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
/**
 * A set of test cases for the clear password storage scheme.
 */
/** A set of test cases for the clear password storage scheme. */
public class ClearPasswordStorageSchemeTestCase
       extends PasswordStorageSchemeTestCase
{
  /**
   * Creates a new instance of this storage scheme test case.
   */
  /** Creates a new instance of this storage scheme test case. */
  public ClearPasswordStorageSchemeTestCase()
  {
    super("cn=Clear,cn=Password Storage Schemes,cn=config");
  }
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  protected PasswordStorageScheme getScheme()
         throws Exception
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    ClearPasswordStorageScheme scheme = new ClearPasswordStorageScheme();
    ClearPasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          ClearPasswordStorageSchemeCfgDefn.getInstance(),
          configEntry
          );
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new ClearPasswordStorageScheme(), configEntry, ClearPasswordStorageSchemeCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/CryptPasswordStorageSchemeTestCase.java
@@ -19,9 +19,7 @@
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.CryptPasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.CryptPasswordStorageSchemeCfg;
import org.opends.server.types.Entry;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -29,7 +27,6 @@
import static org.opends.server.extensions.PasswordStorageSchemeTestCase.*;
/**
 * A set of test cases for the crypt password storage scheme.
 */
@@ -164,8 +161,6 @@
  private CryptPasswordStorageScheme getScheme(String algo)
         throws Exception
  {
    CryptPasswordStorageScheme scheme =
         new CryptPasswordStorageScheme();
    Entry e = TestCaseUtils.makeEntry(
      "dn: cn=CRYPT,cn=Password Storage Schemes,cn=config",
      "objectClass: top",
@@ -176,13 +171,8 @@
      "ds-cfg-enabled: true",
      "ds-cfg-crypt-password-storage-encryption-algrithm: " + algo
);
    CryptPasswordStorageSchemeCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              CryptPasswordStorageSchemeCfgDefn.getInstance(),
              e);
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new CryptPasswordStorageScheme(), e, CryptPasswordStorageSchemeCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/DefaultEntryCacheTestCase.java
@@ -16,15 +16,12 @@
 */
package org.opends.server.extensions;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.SortedMap;
import java.util.TreeMap;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.testng.annotations.BeforeClass;
import org.forgerock.opendj.server.config.meta.*;
import org.forgerock.opendj.server.config.server.EntryCacheCfg;
@@ -40,8 +37,6 @@
import static org.testng.Assert.*;
/**
 * A set of test cases for default entry cache implementation.
 */
@@ -95,7 +90,7 @@
      "ds-cfg-include-filter: uid=softref*",
      "ds-cfg-include-filter: uid=test1*",
      "ds-cfg-exclude-filter: uid=test0*");
    softRefCache.initializeEntryCache(AdminTestCaseUtils.getConfiguration(
    softRefCache.initializeEntryCache(InitializationUtils.getConfiguration(
      SoftReferenceEntryCacheCfgDefn.getInstance(), cacheSoftReferenceConfigEntry));
    cacheOrderMap.put(1, softRefCache);
@@ -112,7 +107,7 @@
      "ds-cfg-include-filter: uid=fifo*",
      "ds-cfg-include-filter: uid=test2*",
      "ds-cfg-include-filter: uid=test0*");
    fifoCache.initializeEntryCache(AdminTestCaseUtils.getConfiguration(
    fifoCache.initializeEntryCache(InitializationUtils.getConfiguration(
      FIFOEntryCacheCfgDefn.getInstance(), cacheFIFOConfigEntry));
    cacheOrderMap.put(2, fifoCache);
opendj-server-legacy/src/test/java/org/opends/server/extensions/DictionaryPasswordValidatorTestCase.java
@@ -29,8 +29,6 @@
import org.opends.server.TestCaseUtils;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.opendj.server.config.meta.DictionaryPasswordValidatorCfgDefn;
import org.forgerock.opendj.server.config.server.DictionaryPasswordValidatorCfg;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.protocols.internal.InternalClientConnection;
@@ -166,13 +164,7 @@
  public void testInitializeWithValidConfigs(Entry e)
         throws Exception
  {
    DictionaryPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              DictionaryPasswordValidatorCfgDefn.getInstance(), e);
    DictionaryPasswordValidator validator =
         new DictionaryPasswordValidator();
    validator.initializePasswordValidator(configuration);
    DictionaryPasswordValidator validator = initializePasswordValidator(e);
    validator.finalizePasswordValidator();
  }
@@ -297,13 +289,7 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    DictionaryPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              DictionaryPasswordValidatorCfgDefn.getInstance(), e);
    DictionaryPasswordValidator validator =
         new DictionaryPasswordValidator();
    validator.initializePasswordValidator(configuration);
    initializePasswordValidator(e);
  }
@@ -652,14 +638,7 @@
         "cn: Test User",
         "userPassword: doesntmatter");
    DictionaryPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              DictionaryPasswordValidatorCfgDefn.getInstance(),
              configEntry);
    DictionaryPasswordValidator validator =
         new DictionaryPasswordValidator();
    validator.initializePasswordValidator(configuration);
    DictionaryPasswordValidator validator = initializePasswordValidator(configEntry);
    ByteString pwOS = ByteString.valueOfUtf8(password);
    ArrayList<Modification> mods = newArrayList(
@@ -680,5 +659,11 @@
    validator.finalizePasswordValidator();
  }
  private DictionaryPasswordValidator initializePasswordValidator(Entry configEntry)
      throws ConfigException, InitializationException {
    return InitializationUtils.initializePasswordValidator(
        new DictionaryPasswordValidator(), configEntry, DictionaryPasswordValidatorCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/DigestMD5SASLMechanismHandlerTestCase.java
@@ -22,9 +22,7 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.DigestMD5SASLMechanismHandlerCfgDefn;
import org.forgerock.opendj.server.config.server.DigestMD5SASLMechanismHandlerCfg;
import org.opends.server.core.BindOperation;
import org.opends.server.core.DeleteOperation;
import org.opends.server.core.DirectoryServer;
@@ -139,13 +137,8 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    DigestMD5SASLMechanismHandlerCfg configuration =
       AdminTestCaseUtils.getConfiguration(
            DigestMD5SASLMechanismHandlerCfgDefn.getInstance(),
            e);
    DigestMD5SASLMechanismHandler handler = new DigestMD5SASLMechanismHandler();
    handler.initializeSASLMechanismHandler(configuration);
    InitializationUtils.initializeSASLMechanismHandler(
        new DigestMD5SASLMechanismHandler(), e, DigestMD5SASLMechanismHandlerCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/ErrorLogAccountStatusNotificationHandlerTestCase.java
@@ -23,9 +23,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.ErrorLogAccountStatusNotificationHandlerCfgDefn;
import org.forgerock.opendj.server.config.server.ErrorLogAccountStatusNotificationHandlerCfg;
import org.opends.server.api.AccountStatusNotificationHandler;
import org.opends.server.api.AuthenticationPolicy;
import org.opends.server.types.Entry;
@@ -35,7 +33,6 @@
import org.opends.server.types.AccountStatusNotificationProperty;
import org.opends.server.types.AccountStatusNotificationType;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -140,14 +137,8 @@
  public void testInvalidConfigs(Entry configEntry)
         throws Exception
  {
    ErrorLogAccountStatusNotificationHandler handler =
         new ErrorLogAccountStatusNotificationHandler();
    ErrorLogAccountStatusNotificationHandlerCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          ErrorLogAccountStatusNotificationHandlerCfgDefn.getInstance(),
          configEntry
          );
    handler.initializeStatusNotificationHandler(configuration);
    InitializationUtils.initializeStatusNotificationHandler(
        new ErrorLogAccountStatusNotificationHandler(), configEntry, ErrorLogAccountStatusNotificationHandlerCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java
@@ -26,9 +26,7 @@
import org.forgerock.opendj.ldap.requests.ModifyRequest;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.ExactMatchIdentityMapperCfgDefn;
import org.forgerock.opendj.server.config.server.ExactMatchIdentityMapperCfg;
import org.opends.server.api.IdentityMapper;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyOperation;
@@ -165,11 +163,7 @@
  public void testValidConfigs(Entry e)
         throws Exception
  {
    ExactMatchIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              ExactMatchIdentityMapperCfgDefn.getInstance(), e);
    ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper();
    mapper.initializeIdentityMapper(configuration);
    ExactMatchIdentityMapper mapper = initializeIdentityMapper(e);
    mapper.finalizeIdentityMapper();
  }
@@ -249,11 +243,7 @@
  public void testInvalidConfigs(Entry e)
         throws Exception
  {
    ExactMatchIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              ExactMatchIdentityMapperCfgDefn.getInstance(), e);
    ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper();
    mapper.initializeIdentityMapper(configuration);
    initializeIdentityMapper(e);
  }
@@ -269,7 +259,7 @@
         throws Exception
  {
    DN mapperDN = DN.valueOf(MAPPER_DN);
    IdentityMapper mapper = DirectoryServer.getIdentityMapper(mapperDN);
    IdentityMapper<?> mapper = DirectoryServer.getIdentityMapper(mapperDN);
    assertNotNull(mapper);
    assertTrue(mapper instanceof ExactMatchIdentityMapper);
  }
@@ -299,12 +289,7 @@
         "ds-cfg-enabled: true",
         "ds-cfg-match-attribute: uid");
    ExactMatchIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              ExactMatchIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper();
    mapper.initializeIdentityMapper(configuration);
    ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
    // Create a user entry and add it to the directory.
@@ -358,12 +343,7 @@
         "ds-cfg-match-attribute: uid",
         "ds-cfg-match-base-dn: o=test");
    ExactMatchIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              ExactMatchIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper();
    mapper.initializeIdentityMapper(configuration);
    ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
    // Create a user entry and add it to the directory.
@@ -418,12 +398,7 @@
         "ds-cfg-match-attribute: uid",
         "ds-cfg-match-base-dn: o=notdefined");
    ExactMatchIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              ExactMatchIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper();
    mapper.initializeIdentityMapper(configuration);
    ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
    // Create a user entry and add it to the directory.
@@ -474,12 +449,7 @@
         "ds-cfg-match-attribute: uid",
         "ds-cfg-match-base-dn: o=test");
    ExactMatchIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              ExactMatchIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper();
    mapper.initializeIdentityMapper(configuration);
    ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
    // Create a user entry and add it to the directory.
@@ -530,12 +500,7 @@
         "ds-cfg-match-attribute: cn",
         "ds-cfg-match-base-dn: o=test");
    ExactMatchIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              ExactMatchIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper();
    mapper.initializeIdentityMapper(configuration);
    ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
    // Create two user entries and add them to the directory.
@@ -603,12 +568,7 @@
         "ds-cfg-match-attribute: uid",
         "ds-cfg-match-attribute: cn");
    ExactMatchIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              ExactMatchIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper();
    mapper.initializeIdentityMapper(configuration);
    ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
    // Create a user entry and add it to the directory.
@@ -662,12 +622,7 @@
         "ds-cfg-match-attribute: uid",
         "ds-cfg-match-attribute: cn");
    ExactMatchIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              ExactMatchIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper();
    mapper.initializeIdentityMapper(configuration);
    ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
    // Create a user entry and add it to the directory.
@@ -721,12 +676,7 @@
         "ds-cfg-match-attribute: uid",
         "ds-cfg-match-attribute: cn");
    ExactMatchIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              ExactMatchIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper();
    mapper.initializeIdentityMapper(configuration);
    ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
    // Create a user entry and add it to the directory.
@@ -752,7 +702,11 @@
    mapper.finalizeIdentityMapper();
  }
  private ExactMatchIdentityMapper initializeIdentityMapper(Entry mapperEntry)
      throws ConfigException, InitializationException {
    return InitializationUtils.initializeIdentityMapper(
        new ExactMatchIdentityMapper(), mapperEntry, ExactMatchIdentityMapperCfgDefn.getInstance());
  }
  /**
   * Tests that an internal modification to change the map attribute will take
@@ -765,7 +719,7 @@
         throws Exception
  {
    DN mapperDN = DN.valueOf(MAPPER_DN);
    IdentityMapper mapper = DirectoryServer.getIdentityMapper(mapperDN);
    IdentityMapper<?> mapper = DirectoryServer.getIdentityMapper(mapperDN);
    assertNotNull(mapper);
    assertTrue(mapper instanceof ExactMatchIdentityMapper);
@@ -838,7 +792,7 @@
         throws Exception
  {
    DN mapperDN = DN.valueOf(MAPPER_DN);
    IdentityMapper mapper = DirectoryServer.getIdentityMapper(mapperDN);
    IdentityMapper<?> mapper = DirectoryServer.getIdentityMapper(mapperDN);
    assertNotNull(mapper);
    assertTrue(mapper instanceof ExactMatchIdentityMapper);
opendj-server-legacy/src/test/java/org/opends/server/extensions/ExternalSASLMechanismHandlerTestCase.java
@@ -27,9 +27,7 @@
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.ExternalSASLMechanismHandlerCfgDefn;
import org.forgerock.opendj.server.config.server.ExternalSASLMechanismHandlerCfg;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyOperation;
import org.opends.server.protocols.internal.InternalClientConnection;
@@ -132,13 +130,8 @@
  public void testInvalidConfigs(Entry e)
         throws Exception
  {
    ExternalSASLMechanismHandlerCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              ExternalSASLMechanismHandlerCfgDefn.getInstance(),
              e);
    ExternalSASLMechanismHandler handler = new ExternalSASLMechanismHandler();
    handler.initializeSASLMechanismHandler(configuration);
    InitializationUtils.initializeSASLMechanismHandler(
        new ExternalSASLMechanismHandler(), e, ExternalSASLMechanismHandlerCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/FIFOEntryCacheTestCase.java
@@ -16,12 +16,9 @@
 */
package org.opends.server.extensions;
import java.util.ArrayList;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.testng.annotations.BeforeClass;
import org.forgerock.opendj.server.config.meta.*;
import org.forgerock.opendj.server.config.server.FIFOEntryCacheCfg;
@@ -36,8 +33,6 @@
import static org.testng.Assert.*;
/**
 * A set of test cases for FIFO entry cache implementation.
 */
@@ -68,7 +63,7 @@
      "ds-cfg-java-class: org.opends.server.extensions.FIFOEntryCache",
      "ds-cfg-enabled: true",
      "ds-cfg-max-entries: " + super.MAXENTRIES);
    super.configuration = AdminTestCaseUtils.getConfiguration(
    super.configuration = InitializationUtils.getConfiguration(
      FIFOEntryCacheCfgDefn.getInstance(), cacheConfigEntry);
    // Force GC to make sure we have enough memory for
opendj-server-legacy/src/test/java/org/opends/server/extensions/FileBasedKeyManagerProviderTestCase.java
@@ -24,9 +24,7 @@
import org.testng.annotations.Test;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.FileBasedKeyManagerProviderCfgDefn;
import org.forgerock.opendj.server.config.server.FileBasedKeyManagerProviderCfg;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.Entry;
@@ -168,12 +166,7 @@
  public void testVvalidConfigs(Entry e)
         throws Exception
  {
    FileBasedKeyManagerProviderCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              FileBasedKeyManagerProviderCfgDefn.getInstance(), e);
    FileBasedKeyManagerProvider provider = new FileBasedKeyManagerProvider();
    provider.initializeKeyManagerProvider(configuration);
    FileBasedKeyManagerProvider provider = initializeKeyManagerProvider(e);
    provider.finalizeKeyManagerProvider();
  }
@@ -293,13 +286,11 @@
  public void testInvalidConfigs(Entry e)
         throws Exception
  {
    FileBasedKeyManagerProviderCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              FileBasedKeyManagerProviderCfgDefn.getInstance(), e);
    FileBasedKeyManagerProvider provider = new FileBasedKeyManagerProvider();
    provider.initializeKeyManagerProvider(configuration);
  }
    initializeKeyManagerProvider(e);
}
  private FileBasedKeyManagerProvider initializeKeyManagerProvider(Entry e) throws ConfigException, InitializationException {
    return InitializationUtils.initializeKeyManagerProvider(
        new FileBasedKeyManagerProvider(), e, FileBasedKeyManagerProviderCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/FileBasedTrustManagerProviderTestCase.java
@@ -16,8 +16,6 @@
 */
package org.opends.server.extensions;
import java.io.File;
import java.io.FileWriter;
import java.util.List;
@@ -26,9 +24,7 @@
import org.testng.annotations.Test;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.FileBasedTrustManagerProviderCfgDefn;
import org.forgerock.opendj.server.config.server.FileBasedTrustManagerProviderCfg;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.Entry;
@@ -36,8 +32,6 @@
import static org.opends.server.util.ServerConstants.*;
/**
 * A set of test cases for the file-based trust manager provider.
 */
@@ -160,12 +154,7 @@
  public void testVvalidConfigs(Entry e)
         throws Exception
  {
    FileBasedTrustManagerProviderCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              FileBasedTrustManagerProviderCfgDefn.getInstance(), e);
    FileBasedTrustManagerProvider provider = new FileBasedTrustManagerProvider();
    provider.initializeTrustManagerProvider(configuration);
    FileBasedTrustManagerProvider provider = initializeTrustManagerProvider(e);
    provider.finalizeTrustManagerProvider();
  }
@@ -285,17 +274,15 @@
  public void testInvalidConfigs(Entry e)
         throws Exception
  {
    FileBasedTrustManagerProviderCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              FileBasedTrustManagerProviderCfgDefn.getInstance(), e);
    FileBasedTrustManagerProvider provider =
         new FileBasedTrustManagerProvider();
    provider.initializeTrustManagerProvider(configuration);
    initializeTrustManagerProvider(e);
    for (StringBuilder sb : e.toLDIF())
    {
      System.err.println(sb.toString());
    }
  }
}
  private FileBasedTrustManagerProvider initializeTrustManagerProvider(Entry e) throws ConfigException, InitializationException {
    return InitializationUtils.initializeTrustManagerProvider(
        new FileBasedTrustManagerProvider(), e, FileBasedTrustManagerProviderCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java
@@ -28,9 +28,7 @@
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.requests.ModifyRequest;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.FingerprintCertificateMapperCfgDefn;
import org.forgerock.opendj.server.config.server.FingerprintCertificateMapperCfg;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyOperation;
import org.opends.server.tools.LDAPSearch;
@@ -157,13 +155,8 @@
  public void testInvalidConfigs(Entry e)
         throws Exception
  {
    FingerprintCertificateMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              FingerprintCertificateMapperCfgDefn.getInstance(),
              e);
    FingerprintCertificateMapper mapper = new FingerprintCertificateMapper();
    mapper.initializeCertificateMapper(configuration);
    InitializationUtils.initializeCertificateMapper(
        new FingerprintCertificateMapper(), e, FingerprintCertificateMapperCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/InitializationUtils.java
New file
@@ -0,0 +1,136 @@
/*
 * The contents of this file are subject to the terms of the Common Development and
 * Distribution License (the License). You may not use this file except in compliance with the
 * License.
 *
 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
 * specific language governing permission and limitations under the License.
 *
 * When distributing Covered Software, include this CDDL Header Notice in each file and include
 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
 * Header, with the fields enclosed by brackets [] replaced by your own identifying
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2016 ForgeRock AS.
 */
package org.opends.server.extensions;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.adapter.server3x.Converters;
import org.forgerock.opendj.config.Configuration;
import org.forgerock.opendj.config.ManagedObjectDefinition;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.config.server.ServerManagementContext;
import org.forgerock.opendj.server.config.server.AccountStatusNotificationHandlerCfg;
import org.forgerock.opendj.server.config.server.CertificateMapperCfg;
import org.forgerock.opendj.server.config.server.ExtendedOperationHandlerCfg;
import org.forgerock.opendj.server.config.server.IdentityMapperCfg;
import org.forgerock.opendj.server.config.server.KeyManagerProviderCfg;
import org.forgerock.opendj.server.config.server.PasswordGeneratorCfg;
import org.forgerock.opendj.server.config.server.PasswordStorageSchemeCfg;
import org.forgerock.opendj.server.config.server.PasswordValidatorCfg;
import org.forgerock.opendj.server.config.server.PluginCfg;
import org.forgerock.opendj.server.config.server.SASLMechanismHandlerCfg;
import org.forgerock.opendj.server.config.server.TrustManagerProviderCfg;
import org.opends.server.TestCaseUtils;
import org.opends.server.api.AccountStatusNotificationHandler;
import org.opends.server.api.CertificateMapper;
import org.opends.server.api.ExtendedOperationHandler;
import org.opends.server.api.IdentityMapper;
import org.opends.server.api.KeyManagerProvider;
import org.opends.server.api.PasswordGenerator;
import org.opends.server.api.PasswordStorageScheme;
import org.opends.server.api.PasswordValidator;
import org.opends.server.api.SASLMechanismHandler;
import org.opends.server.api.TrustManagerProvider;
import org.opends.server.api.plugin.DirectoryServerPlugin;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
public final class InitializationUtils {
  private InitializationUtils() {
    // private to prevent instantiation of util class
  }
  public static <M extends CertificateMapper<C>, C extends CertificateMapperCfg> M initializeCertificateMapper(
      M mapper, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException {
    mapper.initializeCertificateMapper(getConfiguration(cfgDefn, e));
    return mapper;
  }
  public static <H extends ExtendedOperationHandler<C>, C extends ExtendedOperationHandlerCfg> H initializeExtendedOperationHandler(
      H handler, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException {
    handler.initializeExtendedOperationHandler(getConfiguration(cfgDefn, e));
    return handler;
  }
  public static <P extends KeyManagerProvider<C>, C extends KeyManagerProviderCfg> P initializeKeyManagerProvider(
      P provider, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException {
    provider.initializeKeyManagerProvider(getConfiguration(cfgDefn, e));
    return provider;
  }
  public static <M extends IdentityMapper<C>, C extends IdentityMapperCfg> M initializeIdentityMapper(
      M mapper, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException {
    mapper.initializeIdentityMapper(getConfiguration(cfgDefn, e));
    return mapper;
  }
  public static <G extends AccountStatusNotificationHandler<C>, C extends AccountStatusNotificationHandlerCfg>
      G initializeStatusNotificationHandler(G generator, Entry e, ManagedObjectDefinition<?, C> cfgDefn)
        throws ConfigException, InitializationException {
    generator.initializeStatusNotificationHandler(getConfiguration(cfgDefn, e));
    return generator;
  }
  public static <G extends PasswordGenerator<C>, C extends PasswordGeneratorCfg> G initializePasswordGenerator(
      G generator, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException {
    generator.initializePasswordGenerator(getConfiguration(cfgDefn, e));
    return generator;
  }
  public static <S extends PasswordStorageScheme<C>, C extends PasswordStorageSchemeCfg>
      S initializePasswordStorageScheme(S scheme, Entry cfgEntry, ManagedObjectDefinition<?, C> cfgDefn)
        throws ConfigException, InitializationException {
    scheme.initializePasswordStorageScheme(getConfiguration(cfgDefn, cfgEntry));
    return scheme;
  }
  public static <V extends PasswordValidator<C>, C extends PasswordValidatorCfg> V initializePasswordValidator(
        V validator, Entry cfgEntry, ManagedObjectDefinition<?, C> cfgDefn)
            throws ConfigException, InitializationException {
    validator.initializePasswordValidator(getConfiguration(cfgDefn, cfgEntry));
    return validator;
  }
  public static <P extends DirectoryServerPlugin<C>, C extends PluginCfg> P initializePlugin(
      P plugin, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException {
    plugin.initializePlugin(TestCaseUtils.getPluginTypes(e), getConfiguration(cfgDefn, e));
    return plugin;
  }
  public static <H extends SASLMechanismHandler<C>,C extends SASLMechanismHandlerCfg> H initializeSASLMechanismHandler(
      H handler, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException {
    handler.initializeSASLMechanismHandler(getConfiguration(cfgDefn, e));
    return handler;
  }
  public static <P extends TrustManagerProvider<C>,C extends TrustManagerProviderCfg> P initializeTrustManagerProvider(
      P provider, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException {
    provider.initializeTrustManagerProvider(getConfiguration(cfgDefn, e));
    return provider;
  }
  public static <C extends Configuration> C getConfiguration(ManagedObjectDefinition<?, C> cfgDefn, Entry cfgEntry)
      throws ConfigException {
    ServerManagementContext context = DirectoryServer.getInstance().getServerContext().getServerManagementContext();
    try {
      return AdminTestCaseUtils.getConfiguration(context, cfgDefn, Converters.from(cfgEntry));
    } catch (IllegalArgumentException e) {
      throw new ConfigException(LocalizableMessage.raw(""), e);
    }
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java
@@ -29,9 +29,7 @@
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.LengthBasedPasswordValidatorCfgDefn;
import org.forgerock.opendj.server.config.server.LengthBasedPasswordValidatorCfg;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.types.Attributes;
import org.opends.server.types.Control;
@@ -188,13 +186,7 @@
  public void testInitializeWithValidConfigs(Entry e)
         throws Exception
  {
    LengthBasedPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              LengthBasedPasswordValidatorCfgDefn.getInstance(),
              e);
    LengthBasedPasswordValidator validator = new LengthBasedPasswordValidator();
    validator.initializePasswordValidator(configuration);
    initializePasswordValidator(e);
  }
@@ -289,13 +281,7 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    LengthBasedPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              LengthBasedPasswordValidatorCfgDefn.getInstance(),
              e);
    LengthBasedPasswordValidator validator = new LengthBasedPasswordValidator();
    validator.initializePasswordValidator(configuration);
    initializePasswordValidator(e);
  }
@@ -336,13 +322,7 @@
         "ds-cfg-min-password-length: 0",
         "ds-cfg-max-password-length: 0");
    LengthBasedPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              LengthBasedPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);
    LengthBasedPasswordValidator validator = new LengthBasedPasswordValidator();
    validator.initializePasswordValidator(configuration);
    LengthBasedPasswordValidator validator = initializePasswordValidator(validatorEntry);
    StringBuilder buffer = new StringBuilder();
    for (int i=0; i < 20; i++)
@@ -361,6 +341,11 @@
    validator.finalizePasswordValidator();
  }
  private LengthBasedPasswordValidator initializePasswordValidator(Entry validatorEntry) throws ConfigException, InitializationException {
    return InitializationUtils.initializePasswordValidator(
        new LengthBasedPasswordValidator(), validatorEntry, LengthBasedPasswordValidatorCfgDefn.getInstance());
  }
  private ModifyOperationBasis newModifyOperation(StringBuilder buffer) throws DirectoryException
  {
    ArrayList<Modification> mods = newArrayList(
@@ -408,13 +393,7 @@
         "ds-cfg-min-password-length: 10",
         "ds-cfg-max-password-length: 0");
    LengthBasedPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              LengthBasedPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);
    LengthBasedPasswordValidator validator = new LengthBasedPasswordValidator();
    validator.initializePasswordValidator(configuration);
    LengthBasedPasswordValidator validator = initializePasswordValidator(validatorEntry);
    StringBuilder buffer = new StringBuilder();
    for (int i=0; i < 20; i++)
@@ -471,13 +450,7 @@
         "ds-cfg-min-password-length: 0",
         "ds-cfg-max-password-length: 10");
    LengthBasedPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              LengthBasedPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);
    LengthBasedPasswordValidator validator = new LengthBasedPasswordValidator();
    validator.initializePasswordValidator(configuration);
    LengthBasedPasswordValidator validator = initializePasswordValidator(validatorEntry);
    StringBuilder buffer = new StringBuilder();
    for (int i=0; i < 20; i++)
@@ -534,13 +507,7 @@
         "ds-cfg-min-password-length: 6",
         "ds-cfg-max-password-length: 10");
    LengthBasedPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              LengthBasedPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);
    LengthBasedPasswordValidator validator = new LengthBasedPasswordValidator();
    validator.initializePasswordValidator(configuration);
    LengthBasedPasswordValidator validator = initializePasswordValidator(validatorEntry);
    StringBuilder buffer = new StringBuilder();
    for (int i=0; i < 20; i++)
opendj-server-legacy/src/test/java/org/opends/server/extensions/MD5PasswordStorageSchemeTestCase.java
@@ -16,51 +16,22 @@
 */
package org.opends.server.extensions;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.MD5PasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.MD5PasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
/**
 * A set of test cases for the MD5 password storage scheme.
 */
/** A set of test cases for the MD5 password storage scheme. */
public class MD5PasswordStorageSchemeTestCase
       extends PasswordStorageSchemeTestCase
{
  /**
   * Creates a new instance of this storage scheme test case.
   */
  /** Creates a new instance of this storage scheme test case. */
  public MD5PasswordStorageSchemeTestCase()
  {
    super("cn=MD5,cn=Password Storage Schemes,cn=config");
  }
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  protected PasswordStorageScheme getScheme()
         throws Exception
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    MD5PasswordStorageScheme scheme = new MD5PasswordStorageScheme();
    MD5PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          MD5PasswordStorageSchemeCfgDefn.getInstance(),
          configEntry
          );
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new MD5PasswordStorageScheme(), configEntry, MD5PasswordStorageSchemeCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/PBKDF2PasswordStorageSchemeTestCase.java
@@ -15,9 +15,7 @@
 */
package org.opends.server.extensions;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.PBKDF2PasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.PBKDF2PasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
import org.opends.server.types.DirectoryException;
import org.testng.annotations.DataProvider;
@@ -63,17 +61,8 @@
  @Override
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    PBKDF2PasswordStorageScheme scheme =
         new PBKDF2PasswordStorageScheme();
    PBKDF2PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
              PBKDF2PasswordStorageSchemeCfgDefn.getInstance(),
          configEntry
          );
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new PBKDF2PasswordStorageScheme(), configEntry, PBKDF2PasswordStorageSchemeCfgDefn.getInstance());
  }
  @Override
opendj-server-legacy/src/test/java/org/opends/server/extensions/PKCS5S2PasswordStorageSchemeTestCase.java
@@ -15,9 +15,7 @@
 */
package org.opends.server.extensions;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.PKCS5S2PasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.PKCS5S2PasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
import org.opends.server.types.DirectoryException;
import org.testng.annotations.DataProvider;
@@ -66,17 +64,8 @@
  @Override
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    PKCS5S2PasswordStorageScheme scheme =
         new PKCS5S2PasswordStorageScheme();
    PKCS5S2PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
              PKCS5S2PasswordStorageSchemeCfgDefn.getInstance(),
          configEntry
          );
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new PKCS5S2PasswordStorageScheme(), configEntry, PKCS5S2PasswordStorageSchemeCfgDefn.getInstance());
  }
  /**
opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordModifyExtendedOperationTestCase.java
@@ -28,9 +28,7 @@
import org.forgerock.opendj.ldap.requests.Requests;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.PasswordModifyExtendedOperationHandlerCfgDefn;
import org.forgerock.opendj.server.config.server.PasswordModifyExtendedOperationHandlerCfg;
import org.opends.server.core.BindOperation;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ExtendedOperation;
@@ -131,11 +129,8 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    PasswordModifyExtendedOperationHandlerCfg configuration =
         AdminTestCaseUtils.getConfiguration(PasswordModifyExtendedOperationHandlerCfgDefn.getInstance(), e);
    PasswordModifyExtendedOperation handler = new PasswordModifyExtendedOperation();
    handler.initializeExtendedOperationHandler(configuration);
    InitializationUtils.initializeExtendedOperationHandler(
        new PasswordModifyExtendedOperation(), e, PasswordModifyExtendedOperationHandlerCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/RC4PasswordStorageSchemeTestCase.java
@@ -16,50 +16,22 @@
 */
package org.opends.server.extensions;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.RC4PasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.RC4PasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
/**
 * A set of test cases for the RC4 password storage scheme.
 */
/** A set of test cases for the RC4 password storage scheme. */
public class RC4PasswordStorageSchemeTestCase
       extends PasswordStorageSchemeTestCase
{
  /**
   * Creates a new instance of this storage scheme test case.
   */
  /** Creates a new instance of this storage scheme test case. */
  public RC4PasswordStorageSchemeTestCase()
  {
    super("cn=RC4,cn=Password Storage Schemes,cn=config");
  }
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  protected PasswordStorageScheme getScheme()
         throws Exception
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    RC4PasswordStorageScheme scheme = new RC4PasswordStorageScheme();
    RC4PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          RC4PasswordStorageSchemeCfgDefn.getInstance(),
          configEntry);
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new RC4PasswordStorageScheme(), configEntry, RC4PasswordStorageSchemeCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/RandomPasswordGeneratorTestCase.java
@@ -16,8 +16,6 @@
 */
package org.opends.server.extensions;
import java.util.List;
import org.testng.annotations.BeforeClass;
@@ -25,20 +23,15 @@
import org.testng.annotations.Test;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.RandomPasswordGeneratorCfgDefn;
import org.forgerock.opendj.server.config.server.RandomPasswordGeneratorCfg;
import org.opends.server.types.Entry;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import static org.testng.Assert.*;
/**
 * A set of test cases for the random password generator.
 */
@@ -73,13 +66,8 @@
    Entry configEntry = DirectoryServer.getConfigEntry(dn);
    assertNotNull(configEntry);
    RandomPasswordGeneratorCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          RandomPasswordGeneratorCfgDefn.getInstance(),
           configEntry);
    RandomPasswordGenerator generator = new RandomPasswordGenerator();
    generator.initializePasswordGenerator(configuration);
    RandomPasswordGenerator generator = InitializationUtils.initializePasswordGenerator(
        new RandomPasswordGenerator(), configEntry, RandomPasswordGeneratorCfgDefn.getInstance());
    assertNotNull(generator.generatePassword(null));
    generator.finalizePasswordGenerator();
  }
@@ -197,13 +185,7 @@
  public void testInvalidConfigurations(Entry entry)
         throws Exception
  {
    RandomPasswordGeneratorCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          RandomPasswordGeneratorCfgDefn.getInstance(),
           entry);
    RandomPasswordGenerator generator = new RandomPasswordGenerator();
    generator.initializePasswordGenerator(configuration);
    InitializationUtils.initializePasswordGenerator(
        new RandomPasswordGenerator(), entry, RandomPasswordGeneratorCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/RegularExpressionIdentityMapperTestCase.java
@@ -16,8 +16,6 @@
 */
package org.opends.server.extensions;
import java.util.LinkedList;
import org.testng.annotations.BeforeClass;
@@ -25,7 +23,6 @@
import org.opends.server.TestCaseUtils;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.
            RegularExpressionIdentityMapperCfgDefn;
import org.forgerock.opendj.server.config.server.RegularExpressionIdentityMapperCfg;
@@ -39,8 +36,6 @@
import static org.testng.Assert.*;
/**
 * A set of test cases for the regular expression identity mapper.
 */
@@ -105,10 +100,7 @@
         "ds-cfg-match-pattern: :-(",
         "ds-cfg-replace-pattern: $1");
    RegularExpressionIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RegularExpressionIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    RegularExpressionIdentityMapperCfg configuration = getConfiguration(mapperEntry);
    RegularExpressionIdentityMapper mapper =
         new RegularExpressionIdentityMapper();
    assertFalse(mapper.isConfigurationAcceptable(configuration,
@@ -143,10 +135,7 @@
         "ds-cfg-match-pattern: ^([^@]+)@.+$",
         "ds-cfg-replace-pattern: $1");
    RegularExpressionIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RegularExpressionIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    RegularExpressionIdentityMapperCfg configuration = getConfiguration(mapperEntry);
    RegularExpressionIdentityMapper mapper =
         new RegularExpressionIdentityMapper();
    assertFalse(mapper.isConfigurationAcceptable(configuration,
@@ -154,7 +143,18 @@
    mapper.initializeIdentityMapper(configuration);
  }
  private RegularExpressionIdentityMapper initializeIdentityMapper(Entry mapperEntry)
      throws ConfigException, InitializationException {
    RegularExpressionIdentityMapperCfg configuration = getConfiguration(mapperEntry);
    RegularExpressionIdentityMapper mapper = new RegularExpressionIdentityMapper();
    assertTrue(mapper.isConfigurationAcceptable(configuration, new LinkedList<LocalizableMessage>()));
    mapper.initializeIdentityMapper(configuration);
    return mapper;
  }
  private RegularExpressionIdentityMapperCfg getConfiguration(Entry mapperEntry) throws ConfigException {
    return InitializationUtils.getConfiguration(RegularExpressionIdentityMapperCfgDefn.getInstance(), mapperEntry);
  }
  /**
   * Tests the {@code getEntryForID} method with a simple match with only one
@@ -182,15 +182,7 @@
         "ds-cfg-match-pattern: ^([^@]+)@.+$",
         "ds-cfg-replace-pattern: $1");
    RegularExpressionIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RegularExpressionIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    RegularExpressionIdentityMapper mapper =
         new RegularExpressionIdentityMapper();
    assertTrue(mapper.isConfigurationAcceptable(configuration,
                                                new LinkedList<LocalizableMessage>()));
    mapper.initializeIdentityMapper(configuration);
    RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
@@ -247,15 +239,7 @@
         "ds-cfg-match-pattern: ^([^@]+)@.+$",
         "ds-cfg-replace-pattern: $1");
    RegularExpressionIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RegularExpressionIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    RegularExpressionIdentityMapper mapper =
         new RegularExpressionIdentityMapper();
    assertTrue(mapper.isConfigurationAcceptable(configuration,
                                                new LinkedList<LocalizableMessage>()));
    mapper.initializeIdentityMapper(configuration);
    RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
@@ -312,15 +296,7 @@
         "ds-cfg-match-pattern: ^([^@]+)@.+$",
         "ds-cfg-replace-pattern: $1");
    RegularExpressionIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RegularExpressionIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    RegularExpressionIdentityMapper mapper =
         new RegularExpressionIdentityMapper();
    assertTrue(mapper.isConfigurationAcceptable(configuration,
                                                new LinkedList<LocalizableMessage>()));
    mapper.initializeIdentityMapper(configuration);
    RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
@@ -377,15 +353,7 @@
         "ds-cfg-match-pattern: ^([^@]+)@.+$",
         "ds-cfg-replace-pattern: $1");
    RegularExpressionIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RegularExpressionIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    RegularExpressionIdentityMapper mapper =
         new RegularExpressionIdentityMapper();
    assertTrue(mapper.isConfigurationAcceptable(configuration,
                                                new LinkedList<LocalizableMessage>()));
    mapper.initializeIdentityMapper(configuration);
    RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
@@ -442,15 +410,7 @@
         "ds-cfg-match-pattern: ^([^@]+)@.+$",
         "ds-cfg-replace-pattern: $1");
    RegularExpressionIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RegularExpressionIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    RegularExpressionIdentityMapper mapper =
         new RegularExpressionIdentityMapper();
    assertTrue(mapper.isConfigurationAcceptable(configuration,
                                                new LinkedList<LocalizableMessage>()));
    mapper.initializeIdentityMapper(configuration);
    RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
@@ -506,15 +466,7 @@
         "ds-cfg-match-pattern: ^([^@]+)@.+$",
         "ds-cfg-replace-pattern: $1");
    RegularExpressionIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RegularExpressionIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    RegularExpressionIdentityMapper mapper =
         new RegularExpressionIdentityMapper();
    assertTrue(mapper.isConfigurationAcceptable(configuration,
                                                new LinkedList<LocalizableMessage>()));
    mapper.initializeIdentityMapper(configuration);
    RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
@@ -568,15 +520,7 @@
         "ds-cfg-match-attribute: uid",
         "ds-cfg-match-pattern: @.+$");
    RegularExpressionIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RegularExpressionIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    RegularExpressionIdentityMapper mapper =
         new RegularExpressionIdentityMapper();
    assertTrue(mapper.isConfigurationAcceptable(configuration,
                                                new LinkedList<LocalizableMessage>()));
    mapper.initializeIdentityMapper(configuration);
    RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
@@ -631,15 +575,7 @@
         "ds-cfg-match-pattern: ^(.*)$",
         "ds-cfg-replace-pattern: $1@example.com");
    RegularExpressionIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RegularExpressionIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    RegularExpressionIdentityMapper mapper =
         new RegularExpressionIdentityMapper();
    assertTrue(mapper.isConfigurationAcceptable(configuration,
                                                new LinkedList<LocalizableMessage>()));
    mapper.initializeIdentityMapper(configuration);
    RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
@@ -695,15 +631,7 @@
         "ds-cfg-match-pattern: ^([^@]+)@.+$",
         "ds-cfg-replace-pattern: $1");
    RegularExpressionIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RegularExpressionIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    RegularExpressionIdentityMapper mapper =
         new RegularExpressionIdentityMapper();
    assertTrue(mapper.isConfigurationAcceptable(configuration,
                                                new LinkedList<LocalizableMessage>()));
    mapper.initializeIdentityMapper(configuration);
    RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
@@ -774,15 +702,7 @@
         "ds-cfg-match-pattern: ^([^@]+)@.+$",
         "ds-cfg-replace-pattern: $1");
    RegularExpressionIdentityMapperCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RegularExpressionIdentityMapperCfgDefn.getInstance(),
              mapperEntry);
    RegularExpressionIdentityMapper mapper =
         new RegularExpressionIdentityMapper();
    assertTrue(mapper.isConfigurationAcceptable(configuration,
                                                new LinkedList<LocalizableMessage>()));
    mapper.initializeIdentityMapper(configuration);
    RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry);
opendj-server-legacy/src/test/java/org/opends/server/extensions/RepeatedCharactersPasswordValidatorTestCase.java
@@ -32,7 +32,6 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.RepeatedCharactersPasswordValidatorCfgDefn;
import org.forgerock.opendj.server.config.server.RepeatedCharactersPasswordValidatorCfg;
import org.opends.server.core.ModifyOperationBasis;
@@ -133,13 +132,7 @@
  public void testInitializeWithValidConfigs(Entry e)
         throws Exception
  {
    RepeatedCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(), e);
    RepeatedCharactersPasswordValidator validator =
         new RepeatedCharactersPasswordValidator();
    validator.initializePasswordValidator(configuration);
    RepeatedCharactersPasswordValidator validator = initializePasswordValidator(e);
    validator.finalizePasswordValidator();
  }
@@ -237,16 +230,14 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    RepeatedCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(), e);
    RepeatedCharactersPasswordValidator validator =
         new RepeatedCharactersPasswordValidator();
    validator.initializePasswordValidator(configuration);
    initializePasswordValidator(e);
  }
  private RepeatedCharactersPasswordValidator initializePasswordValidator(Entry e)
        throws ConfigException, InitializationException {
    return InitializationUtils.initializePasswordValidator(
        new RepeatedCharactersPasswordValidator(), e, RepeatedCharactersPasswordValidatorCfgDefn.getInstance());
  }
  /**
   * Tests the {@code passwordIsAcceptable} method with a password that falls
@@ -356,14 +347,7 @@
         "ds-cfg-max-consecutive-length: 0",
         "ds-cfg-case-sensitive-validation: true");
    RepeatedCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);
    RepeatedCharactersPasswordValidator validator =
         new RepeatedCharactersPasswordValidator();
    validator.initializePasswordValidator(configuration);
    RepeatedCharactersPasswordValidator validator = initializePasswordValidator(validatorEntry);
    String value = "aaaaaaaa";
    assertAcceptable(validator, value, userEntry, true);
@@ -380,8 +364,7 @@
         "ds-cfg-max-consecutive-length: 2",
         "ds-cfg-case-sensitive-validation: true");
    RepeatedCharactersPasswordValidatorCfg updatedConfiguration =
         AdminTestCaseUtils.getConfiguration(
    RepeatedCharactersPasswordValidatorCfg updatedConfiguration = InitializationUtils.getConfiguration(
              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(),
              updatedValidatorEntry);
@@ -426,14 +409,8 @@
         "ds-cfg-max-consecutive-length: " + maxConsecutiveLength,
         "ds-cfg-case-sensitive-validation: " + caseSensitiveValidation);
    RepeatedCharactersPasswordValidatorCfgDefn defn = RepeatedCharactersPasswordValidatorCfgDefn.getInstance();
    RepeatedCharactersPasswordValidatorCfg configuration = AdminTestCaseUtils.getConfiguration(defn, validatorEntry);
    RepeatedCharactersPasswordValidator validator = new RepeatedCharactersPasswordValidator();
    validator.initializePasswordValidator(configuration);
    RepeatedCharactersPasswordValidator validator = initializePasswordValidator(validatorEntry);
    assertAcceptable(validator, value, userEntry, expectedResult);
    validator.finalizePasswordValidator();
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/SHA1PasswordStorageSchemeTestCase.java
@@ -16,51 +16,22 @@
 */
package org.opends.server.extensions;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.SHA1PasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.SHA1PasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
/**
 * A set of test cases for the SHA-1 password storage scheme.
 */
/** A set of test cases for the SHA-1 password storage scheme. */
public class SHA1PasswordStorageSchemeTestCase
       extends PasswordStorageSchemeTestCase
{
  /**
   * Creates a new instance of this storage scheme test case.
   */
  /** Creates a new instance of this storage scheme test case. */
  public SHA1PasswordStorageSchemeTestCase()
  {
    super("cn=SHA-1,cn=Password Storage Schemes,cn=config");
  }
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  protected PasswordStorageScheme getScheme()
         throws Exception
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    SHA1PasswordStorageScheme scheme = new SHA1PasswordStorageScheme();
    SHA1PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          SHA1PasswordStorageSchemeCfgDefn.getInstance(),
          configEntry
          );
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new SHA1PasswordStorageScheme(), configEntry, SHA1PasswordStorageSchemeCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/SaltedMD5PasswordStorageSchemeTestCase.java
@@ -18,46 +18,26 @@
import org.testng.annotations.Test;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.SaltedMD5PasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.SaltedMD5PasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
import org.forgerock.opendj.ldap.ByteString;
import static org.testng.Assert.*;
/**
 * A set of test cases for the salted MD5 password storage scheme.
 */
/** A set of test cases for the salted MD5 password storage scheme. */
public class SaltedMD5PasswordStorageSchemeTestCase
       extends PasswordStorageSchemeTestCase
{
  /**
   * Creates a new instance of this storage scheme test case.
   */
  /** Creates a new instance of this storage scheme test case. */
  public SaltedMD5PasswordStorageSchemeTestCase()
  {
    super("cn=Salted MD5,cn=Password Storage Schemes,cn=config");
  }
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @return  An initialized instance of this password storage scheme.
   */
  protected PasswordStorageScheme getScheme() throws Exception
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    SaltedMD5PasswordStorageScheme scheme =
         new SaltedMD5PasswordStorageScheme();
    SaltedMD5PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          SaltedMD5PasswordStorageSchemeCfgDefn.getInstance(),
          configEntry
          );
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new SaltedMD5PasswordStorageScheme(), configEntry, SaltedMD5PasswordStorageSchemeCfgDefn.getInstance());
  }
@@ -67,16 +47,8 @@
   */
  @Test
  public void testDifferentSaltSize() throws Exception {
    SaltedMD5PasswordStorageScheme scheme =
      new SaltedMD5PasswordStorageScheme();
    SaltedMD5PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
        SaltedMD5PasswordStorageSchemeCfgDefn.getInstance(),
        configEntry
      );
    scheme.initializePasswordStorageScheme(configuration);
    SaltedMD5PasswordStorageScheme scheme = InitializationUtils.initializePasswordStorageScheme(
        new SaltedMD5PasswordStorageScheme(), configEntry, SaltedMD5PasswordStorageSchemeCfgDefn.getInstance());
    // The stored value has a 12 byte salt instead of the default 8
    assertTrue(scheme.passwordMatches(ByteString.valueOfUtf8("password"),
      ByteString.valueOfUtf8("so5s1vK3oEi4uL/oVY3bqs5LRlKjgMN+u4A4bw==")));
opendj-server-legacy/src/test/java/org/opends/server/extensions/SaltedSHA1PasswordStorageSchemeTestCase.java
@@ -16,9 +16,7 @@
 */
package org.opends.server.extensions;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.SaltedSHA1PasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.SaltedSHA1PasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
import org.opends.server.types.DirectoryException;
@@ -47,20 +45,10 @@
  @Override
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    SaltedSHA1PasswordStorageScheme scheme =
         new SaltedSHA1PasswordStorageScheme();
    SaltedSHA1PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          SaltedSHA1PasswordStorageSchemeCfgDefn.getInstance(),
          configEntry
          );
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new SaltedSHA1PasswordStorageScheme(), configEntry, SaltedSHA1PasswordStorageSchemeCfgDefn.getInstance());
  }
  /** {@inheritDoc} */
  @Override
  protected String encodeOffline(final byte[] plaintextBytes) throws DirectoryException
  {
opendj-server-legacy/src/test/java/org/opends/server/extensions/SaltedSHA256PasswordStorageSchemeTestCase.java
@@ -16,23 +16,17 @@
 */
package org.opends.server.extensions;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.SaltedSHA256PasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.SaltedSHA256PasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
 * A set of test cases for the salted SHA-256 password storage scheme.
 */
/** A set of test cases for the salted SHA-256 password storage scheme. */
@SuppressWarnings("javadoc")
public class SaltedSHA256PasswordStorageSchemeTestCase
       extends PasswordStorageSchemeTestCase
{
  /**
   * Creates a new instance of this storage scheme test case.
   */
  /** Creates a new instance of this storage scheme test case. */
  public SaltedSHA256PasswordStorageSchemeTestCase()
  {
    super("cn=Salted SHA-256,cn=Password Storage Schemes,cn=config");
@@ -50,17 +44,8 @@
  @Override
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    SaltedSHA256PasswordStorageScheme scheme =
         new SaltedSHA256PasswordStorageScheme();
    SaltedSHA256PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          SaltedSHA256PasswordStorageSchemeCfgDefn.getInstance(),
          configEntry
          );
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new SaltedSHA256PasswordStorageScheme(), configEntry, SaltedSHA256PasswordStorageSchemeCfgDefn.getInstance());
  }
  /**
opendj-server-legacy/src/test/java/org/opends/server/extensions/SaltedSHA384PasswordStorageSchemeTestCase.java
@@ -16,51 +16,27 @@
 */
package org.opends.server.extensions;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.SaltedSHA384PasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.SaltedSHA384PasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
 * A set of test cases for the salted SHA-384 password storage scheme.
 */
/** A set of test cases for the salted SHA-384 password storage scheme. */
@SuppressWarnings("javadoc")
public class SaltedSHA384PasswordStorageSchemeTestCase
       extends PasswordStorageSchemeTestCase
{
  /**
   * Creates a new instance of this storage scheme test case.
   */
  /** Creates a new instance of this storage scheme test case. */
  public SaltedSHA384PasswordStorageSchemeTestCase()
  {
    super("cn=Salted SHA-384,cn=Password Storage Schemes,cn=config");
  }
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    SaltedSHA384PasswordStorageScheme scheme =
         new SaltedSHA384PasswordStorageScheme();
    SaltedSHA384PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          SaltedSHA384PasswordStorageSchemeCfgDefn.getInstance(),
          configEntry
          );
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new SaltedSHA384PasswordStorageScheme(), configEntry, SaltedSHA384PasswordStorageSchemeCfgDefn.getInstance());
  }
  /**
opendj-server-legacy/src/test/java/org/opends/server/extensions/SaltedSHA512PasswordStorageSchemeTestCase.java
@@ -16,52 +16,28 @@
 */
package org.opends.server.extensions;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.SaltedSHA512PasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.SaltedSHA512PasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
import org.opends.server.types.DirectoryException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
 * A set of test cases for the salted SHA-512 password storage scheme.
 */
/** A set of test cases for the salted SHA-512 password storage scheme. */
@SuppressWarnings("javadoc")
public class SaltedSHA512PasswordStorageSchemeTestCase
       extends PasswordStorageSchemeTestCase
{
  /**
   * Creates a new instance of this storage scheme test case.
   */
  /** Creates a new instance of this storage scheme test case. */
  public SaltedSHA512PasswordStorageSchemeTestCase()
  {
    super("cn=Salted SHA-512,cn=Password Storage Schemes,cn=config");
  }
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    SaltedSHA512PasswordStorageScheme scheme =
         new SaltedSHA512PasswordStorageScheme();
    SaltedSHA512PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          SaltedSHA512PasswordStorageSchemeCfgDefn.getInstance(),
          configEntry
          );
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new SaltedSHA512PasswordStorageScheme(), configEntry, SaltedSHA512PasswordStorageSchemeCfgDefn.getInstance());
  }
  /**
@@ -92,7 +68,6 @@
    testAuthPasswords("TestSSHA512", plaintextPassword, encodedPassword);
  }
  /** {@inheritDoc} */
  @Override
  protected String encodeOffline(byte[] plaintextBytes) throws DirectoryException
  {
opendj-server-legacy/src/test/java/org/opends/server/extensions/SimilarityBasedPasswordValidatorTestCase.java
@@ -39,8 +39,6 @@
import static org.opends.server.util.CollectionUtils.*;
import static org.testng.Assert.*;
import org.forgerock.opendj.server.config.meta.SimilarityBasedPasswordValidatorCfgDefn;
import org.forgerock.opendj.server.config.server.SimilarityBasedPasswordValidatorCfg;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
/**
 * A set of test cases for the Similarity-Based Password Reject.
@@ -129,13 +127,7 @@
  public void testInitializeWithValidConfigs(Entry e)
         throws Exception
  {
    SimilarityBasedPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              SimilarityBasedPasswordValidatorCfgDefn.getInstance(),
              e);
    SimilarityBasedPasswordValidator validator = new SimilarityBasedPasswordValidator();
    validator.initializePasswordValidator(configuration);
    initializePasswordValidator(e);
  }
@@ -209,13 +201,7 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    SimilarityBasedPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              SimilarityBasedPasswordValidatorCfgDefn.getInstance(),
              e);
    SimilarityBasedPasswordValidator validator = new SimilarityBasedPasswordValidator();
    validator.initializePasswordValidator(configuration);
    initializePasswordValidator(e);
  }
@@ -256,14 +242,7 @@
         "ds-cfg-min-password-difference: 0"
         );
    SimilarityBasedPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              SimilarityBasedPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);
    SimilarityBasedPasswordValidator validator =
         new SimilarityBasedPasswordValidator();
    validator.initializePasswordValidator(configuration);
    SimilarityBasedPasswordValidator validator = initializePasswordValidator(validatorEntry);
    StringBuilder buffer = new StringBuilder();
    for (int i=0; i < 20; i++)
@@ -328,14 +307,7 @@
         "ds-cfg-min-password-difference: 3"
         );
    SimilarityBasedPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              SimilarityBasedPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);
    SimilarityBasedPasswordValidator validator =
         new SimilarityBasedPasswordValidator();
    validator.initializePasswordValidator(configuration);
    SimilarityBasedPasswordValidator validator = initializePasswordValidator(validatorEntry);
    StringBuilder buffer = new StringBuilder();
    HashSet<ByteString> currentPassword = new HashSet<>(3);
@@ -363,5 +335,9 @@
    validator.finalizePasswordValidator();
  }
}
  private SimilarityBasedPasswordValidator initializePasswordValidator(Entry cfgEntry) throws Exception {
    return InitializationUtils.initializePasswordValidator(
        new SimilarityBasedPasswordValidator(), cfgEntry, SimilarityBasedPasswordValidatorCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/SoftReferenceEntryCacheTestCase.java
@@ -16,11 +16,8 @@
 */
package org.opends.server.extensions;
import java.util.ArrayList;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.testng.annotations.BeforeClass;
import org.forgerock.opendj.server.config.meta.*;
import org.forgerock.opendj.server.config.server.SoftReferenceEntryCacheCfg;
@@ -32,8 +29,6 @@
import org.testng.annotations.Test;
import static org.testng.Assert.*;
/**
 * A set of test cases for SoftReference entry cache implementation.
 */
@@ -64,7 +59,7 @@
      "ds-cfg-java-class: " +
      "org.opends.server.extensions.SoftReferenceEntryCache",
      "ds-cfg-enabled: true");
    super.configuration = AdminTestCaseUtils.getConfiguration(
    super.configuration = InitializationUtils.getConfiguration(
      SoftReferenceEntryCacheCfgDefn.getInstance(), cacheConfigEntry);
    // Force GC to make sure we have enough memory for
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java
@@ -29,9 +29,7 @@
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.requests.ModifyRequest;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.SubjectAttributeToUserAttributeCertificateMapperCfgDefn;
import org.forgerock.opendj.server.config.server.SubjectAttributeToUserAttributeCertificateMapperCfg;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyOperation;
import org.opends.server.tools.LDAPSearch;
@@ -182,14 +180,10 @@
  public void testInvalidConfigs(Entry e)
         throws Exception
  {
    SubjectAttributeToUserAttributeCertificateMapperCfg config =
       AdminTestCaseUtils.getConfiguration(
       SubjectAttributeToUserAttributeCertificateMapperCfgDefn.
            getInstance(), e);
    SubjectAttributeToUserAttributeCertificateMapper mapper =
         new SubjectAttributeToUserAttributeCertificateMapper();
    mapper.initializeCertificateMapper(config);
    InitializationUtils.initializeCertificateMapper(
            new SubjectAttributeToUserAttributeCertificateMapper(),
            e,
            SubjectAttributeToUserAttributeCertificateMapperCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java
@@ -28,9 +28,7 @@
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.requests.ModifyRequest;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.SubjectDNToUserAttributeCertificateMapperCfgDefn;
import org.forgerock.opendj.server.config.server.SubjectDNToUserAttributeCertificateMapperCfg;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyOperation;
import org.opends.server.tools.LDAPSearch;
@@ -124,14 +122,10 @@
  public void testInvalidConfigs(Entry e)
         throws Exception
  {
    SubjectDNToUserAttributeCertificateMapperCfg configuration =
       AdminTestCaseUtils.getConfiguration(
            SubjectDNToUserAttributeCertificateMapperCfgDefn.
                 getInstance(), e);
    SubjectDNToUserAttributeCertificateMapper mapper =
         new SubjectDNToUserAttributeCertificateMapper();
    mapper.initializeCertificateMapper(configuration);
    InitializationUtils.initializeCertificateMapper(
            new SubjectDNToUserAttributeCertificateMapper(),
            e,
            SubjectDNToUserAttributeCertificateMapperCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/TripleDESPasswordStorageSchemeTestCase.java
@@ -16,51 +16,22 @@
 */
package org.opends.server.extensions;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.TripleDESPasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.TripleDESPasswordStorageSchemeCfg;
import org.opends.server.api.PasswordStorageScheme;
/**
 * A set of test cases for the 3DES password storage scheme.
 */
/** A set of test cases for the 3DES password storage scheme. */
public class TripleDESPasswordStorageSchemeTestCase
       extends PasswordStorageSchemeTestCase
{
  /**
   * Creates a new instance of this storage scheme test case.
   */
  /** Creates a new instance of this storage scheme test case. */
  public TripleDESPasswordStorageSchemeTestCase()
  {
    super("cn=3DES,cn=Password Storage Schemes,cn=config");
  }
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  protected PasswordStorageScheme getScheme()
         throws Exception
  protected PasswordStorageScheme<?> getScheme() throws Exception
  {
    TripleDESPasswordStorageScheme scheme =
         new TripleDESPasswordStorageScheme();
    TripleDESPasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          TripleDESPasswordStorageSchemeCfgDefn.getInstance(),
          configEntry);
    scheme.initializePasswordStorageScheme(configuration);
    return scheme;
    return InitializationUtils.initializePasswordStorageScheme(
        new TripleDESPasswordStorageScheme(), configEntry, TripleDESPasswordStorageSchemeCfgDefn.getInstance());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/UniqueCharactersPasswordValidatorTestCase.java
@@ -16,6 +16,8 @@
 */
package org.opends.server.extensions;
import static org.opends.server.extensions.InitializationUtils.getConfiguration;
import static org.opends.server.extensions.InitializationUtils.initializePasswordValidator;
import static org.testng.Assert.*;
import java.util.ArrayList;
@@ -31,7 +33,6 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.server.config.meta.UniqueCharactersPasswordValidatorCfgDefn;
import org.forgerock.opendj.server.config.server.UniqueCharactersPasswordValidatorCfg;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.protocols.internal.InternalClientConnection;
@@ -132,17 +133,14 @@
  public void testInitializeWithValidConfigs(Entry e)
         throws Exception
  {
    UniqueCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              UniqueCharactersPasswordValidatorCfgDefn.getInstance(), e);
    UniqueCharactersPasswordValidator validator =
         new UniqueCharactersPasswordValidator();
    validator.initializePasswordValidator(configuration);
    UniqueCharactersPasswordValidator validator = initializePasswordValidator0(e);
    validator.finalizePasswordValidator();
  }
  private static UniqueCharactersPasswordValidator initializePasswordValidator0(Entry validatorEntry) throws ConfigException, InitializationException {
    return initializePasswordValidator(
        new UniqueCharactersPasswordValidator(), validatorEntry, UniqueCharactersPasswordValidatorCfgDefn.getInstance());
  }
  /**
   * Retrieves a set of invalid configuration entries.
@@ -236,13 +234,7 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    UniqueCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              UniqueCharactersPasswordValidatorCfgDefn.getInstance(), e);
    UniqueCharactersPasswordValidator validator =
         new UniqueCharactersPasswordValidator();
    validator.initializePasswordValidator(configuration);
    initializePasswordValidator0(e);
  }
@@ -283,14 +275,7 @@
         "ds-cfg-min-unique-characters: 5",
         "ds-cfg-case-sensitive-validation: false");
    UniqueCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              UniqueCharactersPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);
    UniqueCharactersPasswordValidator validator =
         new UniqueCharactersPasswordValidator();
    validator.initializePasswordValidator(configuration);
    UniqueCharactersPasswordValidator validator = initializePasswordValidator0(validatorEntry);
    ByteString password = ByteString.valueOfUtf8("password");
    ArrayList<Modification> mods = new ArrayList<>();
@@ -314,8 +299,6 @@
    validator.finalizePasswordValidator();
  }
  /**
   * Tests the {@code passwordIsAcceptable} method with a password that falls
   * outside the constraints of the password validator.  Case-sensitivity will
@@ -352,14 +335,7 @@
         "ds-cfg-min-unique-characters: 5",
         "ds-cfg-case-sensitive-validation: false");
    UniqueCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              UniqueCharactersPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);
    UniqueCharactersPasswordValidator validator =
         new UniqueCharactersPasswordValidator();
    validator.initializePasswordValidator(configuration);
    UniqueCharactersPasswordValidator validator = initializePasswordValidator0(validatorEntry);
    ByteString password = ByteString.valueOfUtf8("passw");
    ArrayList<Modification> mods = new ArrayList<>();
@@ -420,14 +396,7 @@
         "ds-cfg-min-unique-characters: 5",
         "ds-cfg-case-sensitive-validation: true");
    UniqueCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              UniqueCharactersPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);
    UniqueCharactersPasswordValidator validator =
         new UniqueCharactersPasswordValidator();
    validator.initializePasswordValidator(configuration);
    UniqueCharactersPasswordValidator validator = initializePasswordValidator0(validatorEntry);
    ByteString password = ByteString.valueOfUtf8("pasSw");
    ArrayList<Modification> mods = new ArrayList<>();
@@ -489,14 +458,7 @@
         "ds-cfg-min-unique-characters: 5",
         "ds-cfg-case-sensitive-validation: false");
    UniqueCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              UniqueCharactersPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);
    UniqueCharactersPasswordValidator validator =
         new UniqueCharactersPasswordValidator();
    validator.initializePasswordValidator(configuration);
    UniqueCharactersPasswordValidator validator = initializePasswordValidator0(validatorEntry);
    ByteString password = ByteString.valueOfUtf8("pasSw");
    ArrayList<Modification> mods = new ArrayList<>();
@@ -556,14 +518,7 @@
         "ds-cfg-min-unique-characters: 0",
         "ds-cfg-case-sensitive-validation: true");
    UniqueCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              UniqueCharactersPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);
    UniqueCharactersPasswordValidator validator =
         new UniqueCharactersPasswordValidator();
    validator.initializePasswordValidator(configuration);
    UniqueCharactersPasswordValidator validator = initializePasswordValidator0(validatorEntry);
    ByteString password = ByteString.valueOfUtf8("aaaaaaaa");
    ArrayList<Modification> mods = new ArrayList<>();
@@ -624,14 +579,7 @@
         "ds-cfg-min-unique-characters: 0",
         "ds-cfg-case-sensitive-validation: true");
    UniqueCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              UniqueCharactersPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);
    UniqueCharactersPasswordValidator validator =
         new UniqueCharactersPasswordValidator();
    validator.initializePasswordValidator(configuration);
    UniqueCharactersPasswordValidator validator = initializePasswordValidator0(validatorEntry);
    ByteString password = ByteString.valueOfUtf8("aaaaaaaa");
    ArrayList<Modification> mods = new ArrayList<>();
@@ -665,9 +613,7 @@
         "ds-cfg-case-sensitive-validation: true");
    UniqueCharactersPasswordValidatorCfg updatedConfiguration =
         AdminTestCaseUtils.getConfiguration(
              UniqueCharactersPasswordValidatorCfgDefn.getInstance(),
              updatedValidatorEntry);
        getConfiguration(UniqueCharactersPasswordValidatorCfgDefn.getInstance(), updatedValidatorEntry);
    ArrayList<LocalizableMessage> unacceptableReasons = new ArrayList<>();
    assertTrue(validator.isConfigurationChangeAcceptable(updatedConfiguration,
opendj-server-legacy/src/test/java/org/opends/server/plugins/AttributeCleanupPluginTestCase.java
@@ -19,20 +19,17 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.AttributeCleanupPluginCfgDefn;
import org.forgerock.opendj.server.config.server.AttributeCleanupPluginCfg;
import org.opends.server.api.plugin.PluginResult;
import org.opends.server.api.plugin.PluginType;
import org.opends.server.core.AddOperationBasis;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.extensions.InitializationUtils;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.types.RawAttribute;
@@ -42,7 +39,6 @@
import org.testng.annotations.Test;
import static org.forgerock.opendj.ldap.ModificationType.*;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.testng.Assert.*;
@@ -104,18 +100,7 @@
  public void testInitializeWithValidConfigs(Entry e)
    throws Exception
  {
    Set<PluginType> pluginTypes = getPluginTypes(e);
    assertFalse(pluginTypes.isEmpty());
    AttributeCleanupPluginCfg config =
      AdminTestCaseUtils.getConfiguration(
        AttributeCleanupPluginCfgDefn.getInstance(),e);
    assertNotNull(config);
    AttributeCleanupPlugin plugin = new AttributeCleanupPlugin();
    plugin.initializePlugin(pluginTypes, config);
    AttributeCleanupPlugin plugin = initializePlugin(e);
    plugin.finalizePlugin();
  }
@@ -188,18 +173,7 @@
  public void testInitializeWithInvalidConfigs(Entry e)
    throws ConfigException, InitializationException
  {
    Set<PluginType> pluginTypes = getPluginTypes(e);
    assertFalse(pluginTypes.isEmpty());
    AttributeCleanupPluginCfg config =
      AdminTestCaseUtils.getConfiguration(
        AttributeCleanupPluginCfgDefn.getInstance(),e);
    assertNotNull(config);
    AttributeCleanupPlugin plugin = new AttributeCleanupPlugin();
    plugin.initializePlugin(pluginTypes, config);
    AttributeCleanupPlugin plugin = initializePlugin(e);
    plugin.finalizePlugin();
  }
@@ -225,15 +199,7 @@
      "ds-cfg-rename-inbound-attributes: cn:description",
      "ds-cfg-java-class: org.opends.server.plugins.AttributeCleanupPlugin");
    Set<PluginType> pluginTypes = getPluginTypes(confEntry);
    AttributeCleanupPluginCfg config =
      AdminTestCaseUtils.getConfiguration(
        AttributeCleanupPluginCfgDefn.getInstance(),confEntry);
    AttributeCleanupPlugin plugin = new AttributeCleanupPlugin();
    plugin.initializePlugin(pluginTypes, config);
    AttributeCleanupPlugin plugin = initializePlugin(confEntry);
    /* Construct the ADD operation as follows:
     *
@@ -320,15 +286,7 @@
      "ds-cfg-remove-inbound-attributes: createTimeStamp",
      "ds-cfg-java-class: org.opends.server.plugins.AttributeCleanupPlugin");
    Set<PluginType> pluginTypes = getPluginTypes(confEntry);
    AttributeCleanupPluginCfg config =
      AdminTestCaseUtils.getConfiguration(
        AttributeCleanupPluginCfgDefn.getInstance(),confEntry);
    AttributeCleanupPlugin plugin = new AttributeCleanupPlugin();
    plugin.initializePlugin(pluginTypes, config);
    AttributeCleanupPlugin plugin = initializePlugin(confEntry);
    /* Create the ADD operation as follows:
     *
@@ -404,15 +362,7 @@
      "ds-cfg-remove-inbound-attributes: createTimeStamp",
      "ds-cfg-java-class: org.opends.server.plugins.AttributeCleanupPlugin");
    Set<PluginType> pluginTypes = getPluginTypes(confEntry);
    AttributeCleanupPluginCfg config =
      AdminTestCaseUtils.getConfiguration(
        AttributeCleanupPluginCfgDefn.getInstance(),confEntry);
    AttributeCleanupPlugin plugin = new AttributeCleanupPlugin();
    plugin.initializePlugin(pluginTypes, config);
    AttributeCleanupPlugin plugin = initializePlugin(confEntry);
    /* Create the MODIFY request as follows:
     *
@@ -437,7 +387,11 @@
    assertSame(res.getResultCode(), ResultCode.SUCCESS);
    plugin.finalizePlugin();
  }
  private AttributeCleanupPlugin initializePlugin(Entry confEntry) throws ConfigException, InitializationException {
    return InitializationUtils.initializePlugin(
        new AttributeCleanupPlugin(), confEntry, AttributeCleanupPluginCfgDefn.getInstance());
  }
  private ModifyOperationBasis modify(String entryDN, RawModification... rawMods)
@@ -469,15 +423,7 @@
      "ds-cfg-remove-inbound-attributes: createTimeStamp",
      "ds-cfg-java-class: org.opends.server.plugins.AttributeCleanupPlugin");
    Set<PluginType> pluginTypes = getPluginTypes(confEntry);
    AttributeCleanupPluginCfg config =
      AdminTestCaseUtils.getConfiguration(
        AttributeCleanupPluginCfgDefn.getInstance(),confEntry);
    AttributeCleanupPlugin plugin = new AttributeCleanupPlugin();
    plugin.initializePlugin(pluginTypes, config);
    AttributeCleanupPlugin plugin = initializePlugin(confEntry);
    /* Create the MODIFY operation as follows:
     *
@@ -555,15 +501,7 @@
      "ds-cfg-rename-inbound-attributes: modifyTimeStamp:description",
      "ds-cfg-java-class: org.opends.server.plugins.AttributeCleanupPlugin");
    Set<PluginType> pluginTypes = getPluginTypes(confEntry);
    AttributeCleanupPluginCfg config =
      AdminTestCaseUtils.getConfiguration(
        AttributeCleanupPluginCfgDefn.getInstance(),confEntry);
    AttributeCleanupPlugin plugin = new AttributeCleanupPlugin();
    plugin.initializePlugin(pluginTypes, config);
    AttributeCleanupPlugin plugin = initializePlugin(confEntry);
    /* Create the MODIFY operation as follows:
     *
opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java
@@ -20,20 +20,19 @@
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.UUID;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.EntryUUIDPluginCfgDefn;
import org.forgerock.opendj.server.config.server.EntryUUIDPluginCfg;
import org.opends.server.api.plugin.PluginType;
import org.opends.server.core.DirectoryServer;
import org.opends.server.extensions.InitializationUtils;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.types.LDIFImportConfig;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -121,14 +120,7 @@
  public void testInitializeWithValidConfigs(Entry e)
         throws Exception
  {
    HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
    EntryUUIDPluginCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              EntryUUIDPluginCfgDefn.getInstance(), e);
    EntryUUIDPlugin plugin = new EntryUUIDPlugin();
    plugin.initializePlugin(pluginTypes, configuration);
    EntryUUIDPlugin plugin = initializePlugin(e);
    plugin.finalizePlugin();
  }
@@ -149,14 +141,7 @@
    AttributeType entryUUIDType = DirectoryServer.getAttributeType("entryuuid");
    DirectoryServer.deregisterAttributeType(entryUUIDType);
    HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
    EntryUUIDPluginCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              EntryUUIDPluginCfgDefn.getInstance(), e);
    EntryUUIDPlugin plugin = new EntryUUIDPlugin();
    plugin.initializePlugin(pluginTypes, configuration);
    EntryUUIDPlugin plugin = initializePlugin(e);
    plugin.finalizePlugin();
@@ -219,17 +204,12 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
    EntryUUIDPluginCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              EntryUUIDPluginCfgDefn.getInstance(), e);
    EntryUUIDPlugin plugin = new EntryUUIDPlugin();
    plugin.initializePlugin(pluginTypes, configuration);
    initializePlugin(e);
  }
  private EntryUUIDPlugin initializePlugin(Entry e) throws ConfigException, InitializationException {
    return InitializationUtils.initializePlugin(new EntryUUIDPlugin(), e, EntryUUIDPluginCfgDefn.getInstance());
  }
  /**
   * Tests the <CODE>doLDIFImport</CODE> method.
opendj-server-legacy/src/test/java/org/opends/server/plugins/LDAPADListPluginTestCase.java
@@ -22,21 +22,20 @@
import static org.testng.Assert.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.LDAPAttributeDescriptionListPluginCfgDefn;
import org.forgerock.opendj.server.config.server.LDAPAttributeDescriptionListPluginCfg;
import org.opends.server.api.plugin.PluginType;
import org.opends.server.extensions.InitializationUtils;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -104,14 +103,7 @@
  public void testInitializeWithValidConfigs(Entry e)
         throws Exception
  {
    HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
    LDAPAttributeDescriptionListPluginCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              LDAPAttributeDescriptionListPluginCfgDefn.getInstance(), e);
    LDAPADListPlugin plugin = new LDAPADListPlugin();
    plugin.initializePlugin(pluginTypes, configuration);
    LDAPADListPlugin plugin = initializePlugin0(e);
    plugin.finalizePlugin();
  }
@@ -178,18 +170,14 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
    LDAPAttributeDescriptionListPluginCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              LDAPAttributeDescriptionListPluginCfgDefn.getInstance(), e);
    LDAPADListPlugin plugin = new LDAPADListPlugin();
    plugin.initializePlugin(pluginTypes, configuration);
    LDAPADListPlugin plugin = initializePlugin0(e);
    plugin.finalizePlugin();
  }
  private LDAPADListPlugin initializePlugin0(Entry e) throws ConfigException, InitializationException {
    return InitializationUtils.initializePlugin(
        new LDAPADListPlugin(), e, LDAPAttributeDescriptionListPluginCfgDefn.getInstance());
  }
  /**
   * Tests the <CODE>doPreParseSearch</CODE> method with an empty attribute
opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java
@@ -21,26 +21,25 @@
import static org.testng.Assert.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.LastModPluginCfgDefn;
import org.forgerock.opendj.server.config.server.LastModPluginCfg;
import org.opends.server.api.plugin.PluginType;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyDNOperation;
import org.opends.server.core.ModifyOperation;
import org.opends.server.extensions.InitializationUtils;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.Attributes;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryConfig;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.types.Modification;
import org.forgerock.opendj.ldap.RDN;
import org.testng.annotations.BeforeClass;
@@ -139,18 +138,13 @@
  public void testInitializeWithValidConfigs(Entry e)
         throws Exception
  {
    HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
    LastModPluginCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              LastModPluginCfgDefn.getInstance(), e);
    LastModPlugin plugin = new LastModPlugin();
    plugin.initializePlugin(pluginTypes, configuration);
    LastModPlugin plugin = pp(e);
    plugin.finalizePlugin();
  }
  private LastModPlugin pp(Entry e) throws ConfigException, InitializationException {
    return InitializationUtils.initializePlugin(new LastModPlugin(), e, LastModPluginCfgDefn.getInstance());
  }
  /**
   * Tests the process of initializing the server with valid configurations but
@@ -175,14 +169,7 @@
    DirectoryServer.deregisterAttributeType(mnType);
    HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
    LastModPluginCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              LastModPluginCfgDefn.getInstance(), e);
    LastModPlugin plugin = new LastModPlugin();
    plugin.initializePlugin(pluginTypes, configuration);
    LastModPlugin plugin = pp(e);
    plugin.finalizePlugin();
@@ -249,14 +236,7 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
    LastModPluginCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              LastModPluginCfgDefn.getInstance(), e);
    LastModPlugin plugin = new LastModPlugin();
    plugin.initializePlugin(pluginTypes, configuration);
    LastModPlugin plugin = pp(e);
    plugin.finalizePlugin();
  }
opendj-server-legacy/src/test/java/org/opends/server/plugins/PasswordPolicyImportPluginTestCase.java
@@ -18,18 +18,17 @@
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.PasswordPolicyImportPluginCfgDefn;
import org.forgerock.opendj.server.config.server.PasswordPolicyImportPluginCfg;
import org.opends.server.api.plugin.PluginType;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.extensions.InitializationUtils;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.types.LDIFImportConfig;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -152,18 +151,14 @@
  public void testInitializeWithValidConfigs(Entry e)
         throws Exception
  {
    HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
    PasswordPolicyImportPluginCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              PasswordPolicyImportPluginCfgDefn.getInstance(), e);
    PasswordPolicyImportPlugin plugin = new PasswordPolicyImportPlugin();
    plugin.initializePlugin(pluginTypes, configuration);
    PasswordPolicyImportPlugin plugin = initializePlugin(e);
    plugin.finalizePlugin();
  }
  private PasswordPolicyImportPlugin initializePlugin(Entry e) throws ConfigException, InitializationException {
    return InitializationUtils.initializePlugin(
            new PasswordPolicyImportPlugin(), e, PasswordPolicyImportPluginCfgDefn.getInstance());
  }
  /**
   * Retrieves a set of invalid configuration entries.
@@ -218,14 +213,7 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
    PasswordPolicyImportPluginCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              PasswordPolicyImportPluginCfgDefn.getInstance(), e);
    PasswordPolicyImportPlugin plugin = new PasswordPolicyImportPlugin();
    plugin.initializePlugin(pluginTypes, configuration);
    PasswordPolicyImportPlugin plugin = initializePlugin(e);
    plugin.finalizePlugin();
  }
opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java
@@ -17,7 +17,6 @@
 */
package org.opends.server.plugins;
import java.util.HashSet;
import java.util.List;
import org.forgerock.opendj.config.server.ConfigException;
@@ -30,11 +29,8 @@
import org.forgerock.opendj.ldap.requests.Requests;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.ReferentialIntegrityPluginCfgDefn;
import org.forgerock.opendj.server.config.server.ReferentialIntegrityPluginCfg;
import org.opends.server.api.Group;
import org.opends.server.api.plugin.PluginType;
import org.opends.server.controls.SubtreeDeleteControl;
import org.opends.server.core.AddOperation;
import org.opends.server.core.DeleteOperation;
@@ -42,11 +38,13 @@
import org.opends.server.core.GroupManager;
import org.opends.server.core.ModifyDNOperation;
import org.opends.server.core.ModifyOperation;
import org.opends.server.extensions.InitializationUtils;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.types.Control;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.types.SearchResultEntry;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@@ -525,12 +523,7 @@
  public void testInitializeWithValidConfigs(Entry e)
          throws Exception
  {
    HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
    ReferentialIntegrityPluginCfg configuration =
            AdminTestCaseUtils.getConfiguration(
                    ReferentialIntegrityPluginCfgDefn.getInstance(), e);
    ReferentialIntegrityPlugin plugin = new ReferentialIntegrityPlugin();
    plugin.initializePlugin(pluginTypes, configuration);
    ReferentialIntegrityPlugin plugin = initializePlugin(e);
    plugin.finalizePlugin();
  }
@@ -783,15 +776,15 @@
  public void testInitializeWithInValidConfigs(Entry e)
          throws Exception
  {
    HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
    ReferentialIntegrityPluginCfg configuration =
            AdminTestCaseUtils.getConfiguration(
                    ReferentialIntegrityPluginCfgDefn.getInstance(), e);
    ReferentialIntegrityPlugin plugin = new ReferentialIntegrityPlugin();
    plugin.initializePlugin(pluginTypes, configuration);
    ReferentialIntegrityPlugin plugin = initializePlugin(e);
    plugin.finalizePlugin();
  }
  private ReferentialIntegrityPlugin initializePlugin(Entry e) throws ConfigException, InitializationException {
    return InitializationUtils.initializePlugin(
        new ReferentialIntegrityPlugin(), e, ReferentialIntegrityPluginCfgDefn.getInstance());
  }
  /**
   * Ensures that the Directory Server is running.
   *
opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
@@ -16,7 +16,6 @@
 */
package org.opends.server.plugins;
import java.util.HashSet;
import java.util.List;
import org.forgerock.opendj.config.server.ConfigException;
@@ -25,16 +24,15 @@
import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
import org.forgerock.opendj.ldap.requests.ModifyRequest;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.UniqueAttributePluginCfgDefn;
import org.forgerock.opendj.server.config.server.UniqueAttributePluginCfg;
import org.opends.server.api.plugin.PluginType;
import org.opends.server.core.AddOperation;
import org.opends.server.core.ModifyDNOperation;
import org.opends.server.core.ModifyOperation;
import org.opends.server.extensions.InitializationUtils;
import org.opends.server.types.Attributes;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
@@ -193,13 +191,7 @@
  public void testInitializeWithValidConfigs(Entry e)
          throws Exception
  {
    HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
    UniqueAttributePluginCfg configuration =
            AdminTestCaseUtils.getConfiguration(
                    UniqueAttributePluginCfgDefn.getInstance(), e);
    UniqueAttributePlugin plugin = new UniqueAttributePlugin();
    plugin.initializePlugin(pluginTypes, configuration);
    UniqueAttributePlugin plugin = initializePlugin(e);
    plugin.finalizePlugin();
  }
@@ -305,15 +297,15 @@
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
    UniqueAttributePluginCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              UniqueAttributePluginCfgDefn.getInstance(), e);
    UniqueAttributePlugin plugin = new UniqueAttributePlugin();
    plugin.initializePlugin(pluginTypes, configuration);
    UniqueAttributePlugin plugin = initializePlugin(e);
    plugin.finalizePlugin();
  }
  private UniqueAttributePlugin initializePlugin(Entry e) throws ConfigException, InitializationException {
    return InitializationUtils.initializePlugin(
        new UniqueAttributePlugin(), e, UniqueAttributePluginCfgDefn.getInstance());
  }
  /**
   * Test modify DN operation with various scenarios. See method comments.
   *
opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxConnectTest.java
@@ -37,7 +37,6 @@
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.JMXConnectionHandlerCfgDefn;
import org.forgerock.opendj.server.config.server.JMXConnectionHandlerCfg;
import org.opends.server.config.JMXMBean;
@@ -45,6 +44,7 @@
import org.opends.server.core.DeleteOperation;
import org.opends.server.core.DeleteOperationBasis;
import org.opends.server.core.DirectoryServer;
import org.opends.server.extensions.InitializationUtils;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.ldap.DN;
@@ -472,9 +472,8 @@
    JmxConnectionHandler jmxConnectionHandler = getJmxConnectionHandler();
    assertNotNull(jmxConnectionHandler);
    JMXConnectionHandlerCfg config = AdminTestCaseUtils
        .getConfiguration(JMXConnectionHandlerCfgDefn
            .getInstance(), entry);
    JMXConnectionHandlerCfg config = InitializationUtils.getConfiguration(
        JMXConnectionHandlerCfgDefn.getInstance(), entry);
    if (!jmxConnectionHandler.isConfigurationChangeAcceptable(config,
        reasons)) {
opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LdapTestCase.java
@@ -25,10 +25,10 @@
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.LDAPConnectionHandlerCfgDefn;
import org.forgerock.opendj.server.config.server.LDAPConnectionHandlerCfg;
import org.opends.server.core.ServerContext;
import org.opends.server.extensions.InitializationUtils;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.types.Attribute;
import org.opends.server.types.Attributes;
@@ -119,10 +119,7 @@
   * @throws ConfigException
   *           If the configuration entry could not be decoded.
   */
  static LDAPConnectionHandlerCfg getConfiguration(
      Entry handlerEntry) throws ConfigException {
    return AdminTestCaseUtils.getConfiguration(
        LDAPConnectionHandlerCfgDefn.getInstance(), handlerEntry);
  static LDAPConnectionHandlerCfg getConfiguration(Entry handlerEntry) throws ConfigException {
    return InitializationUtils.getConfiguration(LDAPConnectionHandlerCfgDefn.getInstance(), handlerEntry);
  }
}
opendj-server-legacy/src/test/java/org/opends/server/schema/AuthPasswordEqualityMatchingRuleTest.java
@@ -16,11 +16,10 @@
 */
package org.opends.server.schema;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.SaltedMD5PasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.SaltedMD5PasswordStorageSchemeCfg;
import org.opends.server.types.Entry;
import org.opends.server.core.DirectoryServer;
import org.opends.server.extensions.InitializationUtils;
import org.opends.server.extensions.SaltedMD5PasswordStorageScheme;
import org.forgerock.opendj.ldap.Assertion;
import org.forgerock.opendj.ldap.ByteString;
@@ -55,19 +54,13 @@
  private Object[] generateValues(String password) throws Exception
  {
    ByteString bytePassword = ByteString.valueOfUtf8(password);
    SaltedMD5PasswordStorageScheme scheme = new SaltedMD5PasswordStorageScheme();
    Entry configEntry =
       DirectoryServer.getConfigEntry(
           DN.valueOf("cn=Salted MD5,cn=Password Storage Schemes,cn=config"));
    SaltedMD5PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          SaltedMD5PasswordStorageSchemeCfgDefn.getInstance(),
          configEntry
          );
    scheme.initializePasswordStorageScheme(configuration);
    SaltedMD5PasswordStorageScheme scheme = InitializationUtils.initializePasswordStorageScheme(
        new SaltedMD5PasswordStorageScheme(), configEntry, SaltedMD5PasswordStorageSchemeCfgDefn.getInstance());
    ByteString encodedAuthPassword = scheme.encodeAuthPassword(bytePassword);
    String[] authPWComponents = AuthPasswordSyntax.decodeAuthPassword(encodedAuthPassword.toString());
opendj-server-legacy/src/test/java/org/opends/server/schema/UserPasswordEqualityMatchingRuleTest.java
@@ -16,11 +16,10 @@
 */
package org.opends.server.schema;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.SaltedMD5PasswordStorageSchemeCfgDefn;
import org.forgerock.opendj.server.config.server.SaltedMD5PasswordStorageSchemeCfg;
import org.opends.server.types.Entry;
import org.opends.server.core.DirectoryServer;
import org.opends.server.extensions.InitializationUtils;
import org.opends.server.extensions.SaltedMD5PasswordStorageScheme;
import org.forgerock.opendj.ldap.Assertion;
import org.forgerock.opendj.ldap.ByteString;
@@ -33,7 +32,6 @@
import static org.testng.Assert.*;
@SuppressWarnings("javadoc")
public class UserPasswordEqualityMatchingRuleTest extends SchemaTestCase
{
@@ -55,17 +53,12 @@
  private Object[] generateValues(String password) throws Exception
  {
    ByteString bytePassword = ByteString.valueOfUtf8(password);
    SaltedMD5PasswordStorageScheme scheme = new SaltedMD5PasswordStorageScheme();
    Entry configEntry = DirectoryServer.getConfigEntry(
           DN.valueOf("cn=Salted MD5,cn=Password Storage Schemes,cn=config"));
    SaltedMD5PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          SaltedMD5PasswordStorageSchemeCfgDefn.getInstance(),
          configEntry);
    scheme.initializePasswordStorageScheme(configuration);
    SaltedMD5PasswordStorageScheme scheme = InitializationUtils.initializePasswordStorageScheme(
        new SaltedMD5PasswordStorageScheme(), configEntry, SaltedMD5PasswordStorageSchemeCfgDefn.getInstance());
    ByteString encodedAuthPassword =
         scheme.encodePasswordWithScheme(bytePassword);