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

Jean-Noël Rouvignac
29.42.2016 f78f372a776579b6c2fb0a0bbb77b098a535aa20
unit tests: removed some additional suppressions (compared to forgerock-build-tools equivalent file)
75 files modified
2234 ■■■■ changed files
opendj-server-legacy/src/main/resources/org/forgerock/checkstyle/unit-test-suppressions.xml 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java 3 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/TestListener.java 62 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTests.java 86 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java 10 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java 6 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/pdb/PDBStorageTest.java patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/OnDiskMergeImporterTest.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java 15 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/controls/ExternalChangelogControlTest.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/controls/PasswordPolicyControlTestCase.java 32 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/controls/PersistentSearchControlTest.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/core/AbandonOperationTestCase.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/core/BindOperationTestCase.java 352 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/core/TestModifyDNOperation.java 116 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/crypto/CryptoManagerTestCase.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/crypto/GetSymmetricKeyExtendedOperationTestCase.java 15 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/AnonymousSASLMechanismHandlerTestCase.java 57 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/AttributeValuePasswordValidatorTestCase.java 10 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/BcryptPasswordStorageSchemeTestCase.java 27 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/CharacterSetPasswordValidatorTestCase.java 50 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/CryptPasswordStorageSchemeTestCase.java 21 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/DictionaryPasswordValidatorTestCase.java 21 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/ErrorLogAccountStatusNotificationHandlerTestCase.java 4 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/FileBasedKeyManagerProviderTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/FileBasedTrustManagerProviderTestCase.java 12 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java 7 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/InitializationUtils.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java 24 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordStorageSchemeTestCase.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/RegularExpressionIdentityMapperTestCase.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/RepeatedCharactersPasswordValidatorTestCase.java patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/SaltedSHA512PasswordStorageSchemeTestCase.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/UniqueCharactersPasswordValidatorTestCase.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/AttributeCleanupPluginTestCase.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/LDAPADListPluginTestCase.java patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/plugins/PasswordPolicyImportPluginTestCase.java patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/protocols/asn1/GSERParserTestCase.java 119 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/protocols/internal/InternalSearchOperationTestCase.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/ASN1ByteChannelReaderTestCase.java 49 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LdapTestCase.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestModifyDNRequestProtocolOp.java 82 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java 9 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/ProtocolWindowTest.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/ReplicationTestCase.java 9 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/common/CSNTest.java 29 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/common/MultiDomainServerStateTest.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java 4 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java 20 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java 59 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/server/AssuredReplicationServerTest.java 466 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/server/MonitorTest.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/CompositeDBCursorTest.java 5 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/ECLMultiDomainDBCursorTest.java 13 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/ReplicaCursorTest.java 13 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/ReplicationEnvironmentTest.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/SequentialDBCursor.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/schema/JPEGSyntaxTest.java 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/schema/LDAPSyntaxTest.java 8 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/snmp/SNMPSyncManagerV2AccessTest.java 15 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/snmp/SNMPTrapManagerTest.java 1 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/tools/RemoteConnection.java 56 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/tools/dsconfig/DsconfigLdapConnectionTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java 118 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/types/LDAPURLTest.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/types/SearchFilterTests.java 14 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/util/BackupManagerTestCase.java 16 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/util/TestCrypt.java 20 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java 54 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/resources/org/forgerock/checkstyle/unit-test-suppressions.xml
@@ -12,7 +12,7 @@
  Header, with the fields enclosed by brackets [] replaced by your own identifying
  information: "Portions Copyrighted [year] [name of copyright owner]".
 
  Copyright 2012-2015 ForgeRock AS. All rights reserved.
  Copyright 2012-2016 ForgeRock AS. All rights reserved.
-->
<!DOCTYPE suppressions PUBLIC
    "-//Puppy Crawl//DTD Suppressions 1.1//EN"
@@ -27,7 +27,6 @@
    Once additional suppressions added at the end of the file can be removed due to code 
    cleaning, then this file may be deleted and replaced by equivalent in 
    forgerock-build-tools. 
  -->
 
 <!-- check-src-default.xml -->
@@ -55,13 +54,6 @@
 <suppress checks="TodoComment"                 files="/src/test/java" />
 <!-- Additional suppressions (compared to forgerock-build-tools equivalent file)  --> 
 <suppress checks="LineLength"                  files="/src/test/java" />
 <suppress checks="RegexpSingleline"            files="/src/test/java" />
 <suppress checks="FileTabCharacter"            files="/src/test/java" />
 <suppress checks="LineLength"                  files="/src/test/java" />
 <suppress checks="RedundantImport"             files="/src/test/java" />
 <suppress checks="UnusedImports"               files="/src/test/java" />
 <suppress checks="EmptyStatement"              files="/src/test/java" />
 <suppress checks="EqualsHashCode"              files="/src/test/java" />
</suppressions>
opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
@@ -350,9 +350,10 @@
        Modification mod = new Modification(ModificationType.ADD, attribute);
        org.opends.server.types.Modification srvModification = toModification(mod);
        Attribute attr = srvModification.getAttribute();
        assertThat(srvModification.getModificationType()).isEqualTo(ModificationType.ADD);
        assertThat(srvModification.getAttribute().getAttributeDescription().getAttributeType().getNameOrOID()).isEqualTo("test");
        assertThat(srvModification.getAttribute().size()).isEqualTo(2);
        assertThat(attr.getAttributeDescription().getAttributeType().getNameOrOID()).isEqualTo("test");
        assertThat(attr.size()).isEqualTo(2);
        mod = new Modification(ModificationType.INCREMENT, attribute);
        srvModification = toModification(mod);
opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java
@@ -39,7 +39,6 @@
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
@@ -647,7 +646,6 @@
   * @return the bounded Server socket.
   *
   * @throws IOException in case of underlying exception.
   * @throws SocketException in case of underlying exception.
   */
  private static ServerSocket bindPort(int port)
          throws IOException
@@ -663,7 +661,6 @@
   * @return the bounded Server socket.
   *
   * @throws IOException in case of underlying exception.
   * @throws SocketException in case of underlying exception.
   */
  public static ServerSocket bindFreePort() throws IOException
  {
opendj-server-legacy/src/test/java/org/opends/server/TestListener.java
@@ -12,7 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2008 Sun Microsystems, Inc.
 * Portions Copyright 2013-2015 ForgeRock AS.
 * Portions Copyright 2013-2016 ForgeRock AS.
 */
package org.opends.server;
@@ -24,9 +24,26 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.testng.*;
import org.testng.IClass;
import org.testng.IReporter;
import org.testng.ISuite;
import org.testng.ITestContext;
import org.testng.ITestNGMethod;
import org.testng.ITestResult;
import org.testng.TestListenerAdapter;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.xml.XmlSuite;
@@ -130,7 +147,8 @@
  }
  private static final String DIVIDER_LINE = "-------------------------------------------------------------------------------" + EOL;
  private static final String DIVIDER_LINE =
      "-------------------------------------------------------------------------------" + EOL;
  @Override
  public void onStart(ITestContext testContext) {
@@ -169,7 +187,8 @@
    try {
      reportStream = new PrintStream(new FileOutputStream(reportFile));
    } catch (FileNotFoundException e) {
      originalSystemErr.println("Could not open " + reportFile + " for writing.  Will write the unit test report to the console instead.");
      originalSystemErr.println(
          "Could not open " + reportFile + " for writing.  Will write the unit test report to the console instead.");
      e.printStackTrace(originalSystemErr);
      reportStream = originalSystemErr;
    }
@@ -203,7 +222,8 @@
    if (countTestsWithStatus(ITestResult.FAILURE) == 0
        && countTestsWithStatus(ITestResult.SKIP) != 0) {
      originalSystemErr.println("There were no explicit test failures, but some tests were skipped (possibly due to errors in @Before* or @After* methods).");
      originalSystemErr.println("There were no explicit test failures,"
          + " but some tests were skipped (possibly due to errors in @Before* or @After* methods).");
      System.exit(-1);
    }
  }
@@ -553,9 +573,9 @@
    }
    Class<?> classWithTestAnnotation = findClassWithTestAnnotation(testClass);
    Class<?> annotatedClass = findClassWithTestAnnotation(testClass);
    if (classWithTestAnnotation == null) {
    if (annotatedClass == null) {
      String errorMessage =
              "The test class " + testClass.getName() + " does not have a @Test annotation.  " +
              "All test classes must have a @Test annotation, and this annotation must have " +
@@ -564,12 +584,13 @@
      throw new RuntimeException(errorMessage);
    }
    Test testAnnotation = classWithTestAnnotation.getAnnotation(Test.class);
    Test testAnnotation = annotatedClass.getAnnotation(Test.class);
    if (!testAnnotation.sequential()) {
      // Give an error message that is as specific as possible.
      boolean isTestClass = annotatedClass.equals(testClass);
      String errorMessage =
              "The @Test annotation for class " + testClass.getName() +
              (classWithTestAnnotation.equals(testClass) ? " " : (", which is declared by class " + classWithTestAnnotation.getName() + ", ")) +
              (isTestClass ? " " : (", which is declared by class " + annotatedClass.getName() + ", ")) +
              "must include sequential=true to ensure that tests for a single class are run together.";
      TestCaseUtils.originalSystemErr.println("\n\nERROR: " + errorMessage + "\n\n");
      throw new RuntimeException(errorMessage);
@@ -664,31 +685,38 @@
    if (doProgressTime) {
      originalSystemErr.println("  Test duration status: {Total min:sec.  Since last status sec.}");
      originalSystemErr.println(
          "  Test duration status: {Total min:sec.  Since last status sec.}");
    }
    if (doProgressTestCount) {
      originalSystemErr.println("  Test count status:  {# test classes  # test methods  # test method invocations  # test failures}.");
      originalSystemErr.println(
          "  Test count status:  {# test classes  # test methods  # test method invocations  # test failures}.");
    }
    if (doProgressMemory) {
      originalSystemErr.println("  Memory usage status: {MB in use  +/-change since last status}");
      originalSystemErr.println(
          "  Memory usage status: {MB in use  +/-change since last status}");
    }
    if (doProgressMemoryGcs) {
      originalSystemErr.println("  GCs during status:  {GCs done to settle used memory   time to do it}");
      originalSystemErr.println(
          "  GCs during status:  {GCs done to settle used memory   time to do it}");
    }
    if (doProgressThreadCount) {
      originalSystemErr.println("  Thread count status:  {#td number of active threads}");
      originalSystemErr.println(
          "  Thread count status:  {#td number of active threads}");
    }
    if (doProgressRestarts) {
      originalSystemErr.println("  In core restart status: {#rs number of in-core restarts}");
      originalSystemErr.println(
          "  In core restart status: {#rs number of in-core restarts}");
    }
    if (doProgressThreadChange) {
      originalSystemErr.println("  Thread change status: +/- thread name for new or finished threads since last status");
      originalSystemErr.println(
          "  Thread change status: +/- thread name for new or finished threads since last status");
    }
    originalSystemErr.println("  TestClass (the class that just completed)");
opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTests.java
@@ -12,7 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2008-2010 Sun Microsystems, Inc.
 * Portions Copyright 2011-2015 ForgeRock AS.
 * Portions Copyright 2011-2016 ForgeRock AS.
 * Portions Copyright 2013 Manuel Gaupp
 */
package org.opends.server.authorization.dseecompat;
@@ -23,15 +23,32 @@
import static org.opends.server.util.ServerConstants.*;
import static org.testng.Assert.*;
import java.io.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.TestCaseUtils;
import org.opends.server.protocols.ldap.LDAPResultCode;
import org.opends.server.tools.*;
import org.opends.server.tools.LDAPCompare;
import org.opends.server.tools.LDAPModify;
import org.opends.server.tools.LDAPSearch;
import org.opends.server.tools.LDIFDiff;
import org.opends.server.tools.LDIFModify;
import org.opends.server.types.LDIFExportConfig;
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.util.LDIFReader;
@@ -212,10 +229,12 @@
  private static final String BIND_RULE_USERDN_PARENT = "userdn=\"ldap:///parent\"";
  private static final String BIND_RULE_USERDN_CN_RDN = "userdn=\"ldap:///CN=*,dc=example,dc=com\"";
  private static final String BIND_RULE_USERDN_NOT_UID_RDN = "userdn!=\"ldap:///uid=*,dc=example,dc=com\"";
  // @Checkstyle:off
  private static final String BIND_RULE_USERDN_UID_OR_CN_RDN = "userdn=\"ldap:///uid=*,dc=example,dc=com || ldap:///cn=*,dc=example,dc=com\"";
  private static final String BIND_RULE_USERDN_ALL_CN_ADMINS = "userdn=\"ldap:///dc=example,dc=com??sub?(cn=*admin*)\"";
  /** TODO: this might be invalid? */
  private static final String BIND_RULE_USERDN_TOP_LEVEL_CN_ADMINS = "userdn=\"ldap:///dc=example,dc=com??one?(cn=*admin*)\"";
  // @Checkstyle:on
  private static final String BIND_RULE_GROUPDN_GROUP_1 =
                                    "groupdn=\"ldap:///" + OU_GROUP_1_DN + "\"";
  private static final String BIND_RULE_IP_LOCALHOST = "ip=\"127.0.0.1\"";
@@ -236,6 +255,7 @@
  private static final String BIND_RULE_AUTHMETHOD_SSL = "authmethod=\"ssl\"";
  private static final String BIND_RULE_AUTHMETHOD_SASL_DIGEST_MD5 = "authmethod=\"sasl DIGEST-MD5\"";
  // @Checkstyle:off
  /** Admin, but not anonymous. */
  private static final String BIND_RULE_USERDN_NOT_ADMIN = and(not(BIND_RULE_USERDN_ADMIN), BIND_RULE_AUTHMETHOD_SIMPLE);
@@ -247,13 +267,16 @@
  private static final String BIND_RULE_IP_NOT_LOCALHOST_OR_USERDN_ADMIN = or(BIND_RULE_IP_NOT_LOCALHOST, BIND_RULE_USERDN_ADMIN);
  private static final String BIND_RULE_ADMIN_AND_LOCALHOST_OR_SSL = and(BIND_RULE_USERDN_ADMIN, or(BIND_RULE_AUTHMETHOD_SSL, BIND_RULE_DNS_LOCALHOST));
  // @Checkstyle:on
  // These are made up
  // @Checkstyle:off
  private static final String BIND_RULE_GROUPDN_1 = "groupdn=\"ldap:///cn=SomeGroup,dc=example,dc=com\"";
  private static final String BIND_RULE_GROUPDN_2 = "groupdn=\"ldap:///cn=SomeGroup,dc=example,dc=com || ldap:///cn=SomeOtherGroup,dc=example,dc=com\"";
  private static final String BIND_RULE_GROUPDN_3 = "groupdn=\"ldap:///cn=SomeGroup,dc=example,dc=com || ldap:///cn=SomeOtherGroup,dc=example,dc=com || ldap:///cn=SomeThirdGroup,dc=example,dc=com\"";
  private static final String BIND_RULE_USERDN_FILTER = "userdn=\"ldap:///dc=example,dc=com??one?(|(ou=eng)(ou=acct))\"";
  // @Checkstyle:on
  //bind rule user attr ACIs
  private static final String BIND_RULE_USERATTR_USERDN = "userattr=\"manager#USERDN\"";
@@ -274,6 +297,7 @@
  private static final String BIND_RULE_NOON_AND_AFTER = "timeofday>=\"1200\"";
  private static final String BIND_RULE_BEFORE_NOON = "timeofday<\"1200\"";
  private static final String BIND_RULE_NOON_AND_BEFORE = "timeofday<=\"1200\"";
  // @Checkstyle:off
  //targattrfilters
  private static final String TARG_ATTR_FILTERS =  "add=cn:(!(cn=superAdmin))";
  private static final String TARG_ATTR_FILTERS_1 =  "add=cn:(!(cn=superAdmin)) && telephoneNumber:(telephoneNumber=123*)";
@@ -291,12 +315,15 @@
  private static final String TARG_ATTR_FILTERS_ATTR_TYPE_NAME =  "del=cn:(&(cn=foo)(cn=f*)) && 1sn_:(1sn_=joe*)";
  private static final String SELF_MODIFY_ACI = "aci: (targetattr=\"*\")(version 3.0; acl \"self modify\";allow(all) userdn=\"userdn=\"ldap:///self\";)";
  // @Checkstyle:on
  private static final String ALLOW_ALL_TO_ALL =
             buildAciValue("name", "allow all", "targetattr", "*", "allow(all)", BIND_RULE_USERDN_ALL);
  // @Checkstyle:off
  private static final String ALLOW_ALL_TO_COMPARE =
             buildAciValue("name", "allow compare", "targetattr", "*", "target", "ldap:///cn=*," + OU_LEAF_DN, "allow(compare)", BIND_RULE_USERDN_ALL);
  // @Checkstyle:on
  private static final String DENY_READ_CN_SN_IF_PERSON = buildAciValue("name",
      "deny read cn sn if person", "targetfilter", "objectClass=person",
@@ -336,6 +363,7 @@
          buildAciValue("name", "allow proxy to userdn level1", "targetattr", "*",
                     "allow(proxy)", BIND_RULE_USERDN_LEVEL_1);
  // @Checkstyle:off
  private static final String ALLOW_ALL_TO_IMPORT_MGR_NEW =
             buildAciValue("name", "allow import mgr new tree", "target", MGR_NEW_DN_URL, "allow(import)", BIND_RULE_USERDN_ALL);
@@ -523,7 +551,7 @@
  private static final String ALLOW_SEARCH_OU_AND_PERSON_TO_SIMPLE =
          buildAciValue("name", "allow search ou and person to localhost", "targetattr", "*", "targetfilter", "(|(objectclass=organizationalunit)(objectclass=person))", "allow(search, read)", BIND_RULE_AUTHMETHOD_SIMPLE);
  // @Checkstyle:on
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
@@ -581,6 +609,7 @@
    // Test each feature in isolation.
// <PASSES>
//    // TARGETS
    // @Checkstyle:off
    buildAciValue("name", "self mod", "allow (write)", BIND_RULE_USERDN_SELF),
    buildAciValue("name", "parenthesis (dummy) and ( ) and () test", "allow (read)", BIND_RULE_USERDN_SELF),
    buildAciValue("name", "w/ target", "target", LDAP_URL_OU_INNER, "allow (write)", BIND_RULE_USERDN_SELF),
@@ -660,6 +689,7 @@
    buildAciValue("name", "userattr", "targetattr", "*", "allow (read)", BIND_RULE_USERATTR_USERDN_INHERITANCE),
    buildAciValue("name", "userattr", "targetattr", "*", "allow (read)", BIND_RULE_USERATTR_GROUPDN_INHERITANCE),
    buildAciValue("name", "userattr", "targetattr", "*", "allow (read)", BIND_RULE_USERATTR_VALUE),
    // @Checkstyle:on
    // BUG!  These work with DS 5.2p4, but not with OpenDS.
// <FAIL>
//    DENY_ALL_TO_LOCALHOST_SUBNET,
@@ -711,6 +741,7 @@
          buildAciValue("name", "invalid", "targetattr", "cn ||", "allow (write)", BIND_RULE_USERDN_SELF),
          buildAciValue("name", "invalid", "targetattr", "not/an/attr", "allow (write)", BIND_RULE_USERDN_SELF),
          buildAciValue("name", "invalid", "targetattr", "cn", "allow (write)", BIND_RULE_INVALID_DAY),
          // @Checkstyle:off
          /* Test cases for OPENDJ-433 */
          buildAciValue("name", "invalid", "targetattr", "cn", "garbage allow (read)", BIND_RULE_USERDN_SELF),
          buildAciValue("name", "invalid", "targetattr", "cn", "allow (read)", BIND_RULE_USERDN_SELF, "garbage allow (search)", BIND_RULE_USERDN_SELF),
@@ -737,7 +768,7 @@
          // OpenDJ 2.5 doesn't support acis with options
          buildAciValue("name", "unsupported option in targetattr", "targetattr", "locality;lang-fr-ca", "allow (write)", BIND_RULE_USERDN_SELF),
          buildAciValue("name", "complicated unsupported option in targetattr", "targetattr", "1ocal_ity;lang-fr-ca", "allow (write)", BIND_RULE_USERDN_SELF),
          // @Checkstyle:on
// </PASSES>
  };
@@ -801,7 +832,7 @@
  @DataProvider
  public Object[][] validBasisOfValidityTests() throws Exception {
    TestCaseUtils.startServer();  // This appears to be necessary since the DataProviders can be called before @BeforeClass.
    TestCaseUtils.startServer();  // Apparently necessary since the DataProviders can be called before @BeforeClass.
    List<String> acis = new ArrayList<>();
    for (String[] aciAndMask: INVALID_ACIS_IF_ANY_CHAR_REMOVED) {
@@ -815,7 +846,8 @@
   * tests are valid acis.
   */
  @Test(dataProvider = "validBasisOfValidityTests")
  public void testBasisOfInvalidityTestsAreValid(String modifierDn, String modifierPw, String aciModLdif) throws Throwable {
  public void testBasisOfInvalidityTestsAreValid(String modifierDn, String modifierPw, String aciModLdif)
      throws Throwable {
    if (TESTS_ARE_DISABLED) {  // This is a hack to make sure we can disable the tests.
      return;
    }
@@ -824,14 +856,14 @@
  @DataProvider
  public Object[][] validAcis() throws Exception {
    TestCaseUtils.startServer();  // This appears to be necessary since the DataProviders can be called before @BeforeClass.
    TestCaseUtils.startServer();  // Apparently necessary since the DataProviders can be called before @BeforeClass.
    return buildAciValidationParams(Arrays.asList(VALID_ACIS), false /*test once per aci*/);
  }
  @DataProvider
  public Object[][] invalidAcis() throws Exception {
    TestCaseUtils.startServer();  // This appears to be necessary since the DataProviders can be called before @BeforeClass.
    TestCaseUtils.startServer();  // Apparently necessary since the DataProviders can be called before @BeforeClass.
    List<String> invalid = newArrayList(INVALID_ACIS);
    for (String[] aciAndMask: INVALID_ACIS_IF_ANY_CHAR_REMOVED) {
@@ -929,10 +961,10 @@
      // Test that we can add entries with valid ACIs as well as set valid ACIs on a an entry
      modEntries(aciModLdif, modifierDn, modifierPw);
    } catch (Throwable e) {
      System.err.println("Started with dit:\nldapmodify -a -D \"cn=Directory Manager\" -w etegrity -p 13324\n" + VALIDITY_TESTS_DIT +
              "and as '" + modifierDn + "' failed to perform these modifications:\n" +
              "ldapmodify -D \"" + modifierDn + "\" -w " + modifierPw + " -p 13324\n" +
              aciModLdif);
      System.err.println("Started with dit:\nldapmodify -a -D \"cn=Directory Manager\" -w etegrity -p 13324\n"
          + VALIDITY_TESTS_DIT + "and as '" + modifierDn + "' failed to perform these modifications:\n"
          + "ldapmodify -D \"" + modifierDn + "\" -w " + modifierPw + " -p 13324\n"
          + aciModLdif);
      throw e;
    }
  }
@@ -951,17 +983,17 @@
      // Test that we can add entries with valid ACIs as well as set valid ACIs on a an entry
      modEntriesExpectFailure(aciModLdif, modifierDn, modifierPw);
    } catch (Throwable e) {
      System.err.println("Started with dit:\nldapmodify -a -D \"cn=Directory Manager\" -w etegrity -p 13324\n" + VALIDITY_TESTS_DIT +
              "and as '" + modifierDn + "' successfully added an invalid aci:\n" +
              "ldapmodify -D \"" + modifierDn + "\" -w " + modifierPw + " -p 13324\n" +
              aciModLdif);
      System.err.println("Started with dit:\nldapmodify -a -D \"cn=Directory Manager\" -w etegrity -p 13324\n"
          + VALIDITY_TESTS_DIT + "and as '" + modifierDn + "' successfully added an invalid aci:\n"
          + "ldapmodify -D \"" + modifierDn + "\" -w " + modifierPw + " -p 13324\n"
          + aciModLdif);
      throw e;
    }
  }
  @DataProvider
  public Object[][] invalidAcisMultiCombos() throws Exception {
    TestCaseUtils.startServer();  // This appears to be necessary since the DataProviders can be called before @BeforeClass.
    TestCaseUtils.startServer();  // Apparently necessary since the DataProviders can be called before @BeforeClass.
    List<String> invalid = new ArrayList<>();
    invalid.add(INVALID_ACIS[0]);
@@ -993,11 +1025,12 @@
  private static final String ADMIN_LDIF__SEARCH_TESTS = makeUserLdif(ADMIN_DN, "aci", "admin", ADMIN_PW);
  private static final String USER_LDIF__SEARCH_TESTS = makeUserLdif(USER_DN, "some", "user", USER_PW);
  // @Checkstyle:off
  private static final String LEVEL_1_USER_LDIF__SEARCH_TESTS = makeUserLdif(LEVEL_1_USER_DN, "level1", "user", "pa$$word");
  private static final String LEVEL_2_USER_LDIF__SEARCH_TESTS = makeUserLdif(LEVEL_2_USER_DN, "level2", "user", "pa$$word");
  private static final String LEVEL_3_USER_LDIF__SEARCH_TESTS = makeUserLdif(LEVEL_3_USER_DN, "level3", "user", "pa$$word");
  private static final String PROXY_USER_LDIF__SEARCH_TESTS =
                       makeUserLdif(PROXY_USER_DN, "proxy", "user", "pa$$word");
  private static final String PROXY_USER_LDIF__SEARCH_TESTS = makeUserLdif(PROXY_USER_DN, "proxy", "user", "pa$$word");
  // @Checkstyle:on
    private static final String SALES_USER_1__SEARCH_TESTS =
@@ -1720,9 +1753,11 @@
      _equivalentAciLdifs = Arrays.asList(equivalentAciLdifs);
    }
    private void addSingleSearch(String bindDn, String searchBaseDn, String searchFilter, String searchScope, String expectedResultsLdif) {
    private void addSingleSearch(
        String bindDn, String searchBaseDn, String searchFilter, String searchScope, String expectedResultsLdif) {
      for (String equivalentAci: _equivalentAciLdifs) {
        _searchTests.add(SingleSearchParams.nonProxiedSearch(bindDn, DN_TO_PW.get(bindDn), searchBaseDn, searchFilter, searchScope, expectedResultsLdif, _initialDitLdif, equivalentAci));
        _searchTests.add(SingleSearchParams.nonProxiedSearch(bindDn, DN_TO_PW.get(bindDn), searchBaseDn,
            searchFilter, searchScope, expectedResultsLdif, _initialDitLdif, equivalentAci));
      }
    }
@@ -1747,7 +1782,7 @@
  @DataProvider
  private Object[][] searchTestParams() throws Throwable {
    TestCaseUtils.startServer();  // This appears to be necessary since the DataProviders can be called before @BeforeClass.
    TestCaseUtils.startServer();  // Apparently necessary since the DataProviders can be called before @BeforeClass.
    try {
      List<Object[]> allTestParams = new ArrayList<>();
@@ -2445,7 +2480,8 @@
    }
    anyAttr += ")";
    Pattern pattern = Pattern.compile("^" + anyAttr + "\\:(.*?)^", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
    Pattern pattern = Pattern.compile("^" + anyAttr + "\\:(.*?)^",
        Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
    return pattern.matcher(ldif).replaceAll("");
  }
opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java
@@ -47,6 +47,8 @@
import org.assertj.core.api.SoftAssertions;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.RDN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.server.config.server.ExternalChangelogDomainCfg;
@@ -92,13 +94,11 @@
import org.opends.server.types.Attributes;
import org.opends.server.types.AuthenticationInfo;
import org.opends.server.types.Control;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.LDIFExportConfig;
import org.opends.server.types.Modification;
import org.opends.server.types.Operation;
import org.forgerock.opendj.ldap.RDN;
import org.opends.server.types.SearchFilter;
import org.opends.server.types.SearchResultEntry;
import org.opends.server.util.LDIFWriter;
@@ -489,7 +489,8 @@
      {
        final ReplicationDomainDB domainDB = replicationServer.getChangelogDB().getReplicationDomainDB();
        CursorOptions options = new CursorOptions(GREATER_THAN_OR_EQUAL_TO_KEY, ON_MATCHING_KEY);
        try (DBCursor<UpdateMsg> cursor = domainDB.getCursorFrom(replicaId.getBaseDN(), csn.getServerId(), csn, options))
        try (DBCursor<UpdateMsg> cursor =
            domainDB.getCursorFrom(replicaId.getBaseDN(), csn.getServerId(), csn, options))
        {
          assertTrue(cursor.next(), "Expected to find at least one change in replicaDB for " + replicaId);
          assertEquals(cursor.getRecord().getCSN(), csn);
@@ -1184,7 +1185,8 @@
    return new DeleteMsg(DN.valueOf(dn), csn, testName + "uuid" + testIndex);
  }
  private UpdateMsg generateAddMsg(ReplicaId replicaId, CSN csn, String user1entryUUID, String testName)      throws Exception
  private UpdateMsg generateAddMsg(ReplicaId replicaId, CSN csn, String user1entryUUID, String testName)
      throws Exception
  {
    assertSameServerId(replicaId, csn);
    String baseUUID = "22222222-2222-2222-2222-222222222222";
opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java
@@ -28,7 +28,6 @@
import java.io.File;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -39,6 +38,7 @@
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.opendj.ldap.schema.MatchingRuleUse;
import org.forgerock.opendj.ldap.schema.Schema;
import org.forgerock.opendj.ldap.schema.SchemaBuilder;
import org.forgerock.util.Utils;
@@ -61,7 +61,6 @@
import org.opends.server.types.LDIFExportConfig;
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.LDIFImportResult;
import org.forgerock.opendj.ldap.schema.MatchingRuleUse;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.SearchFilter;
import org.opends.server.util.CollectionUtils;
@@ -214,9 +213,8 @@
  {
    DN schemaDN = DN.valueOf("cn=schema");
    InternalClientConnection conn = getRootConnection();
    DeleteOperationBasis deleteOperation =
         new DeleteOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
         new DeleteOperationBasis(getRootConnection(), nextOperationID(), nextMessageID(),
                             null, schemaDN);
    schemaBackend.deleteEntry(schemaDN, deleteOperation);
opendj-server-legacy/src/test/java/org/opends/server/backends/pdb/PDBStorageTest.java
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/OnDiskMergeImporterTest.java
@@ -299,7 +299,8 @@
    for (Pair<Long, Integer> region : regions)
    {
      buffer.position(region.getFirst().intValue()).limit(buffer.position() + region.getSecond());
      assertThat(toPairs(new FileRegion.Cursor("test", buffer.slice()))).containsExactlyElementsOf(content(contents[regionNumber]));
      assertThat(toPairs(new FileRegion.Cursor("test", buffer.slice())))
          .containsExactlyElementsOf(content(contents[regionNumber]));
      regionNumber++;
    }
  }
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java
@@ -858,7 +858,8 @@
    searchOperation = new InternalSearchOperation(connection, 1, 1, request, null);
    searchOperation.run();
    assertThat(searchOperation.getResultCode()).isEqualTo(ResultCode.INSUFFICIENT_ACCESS_RIGHTS);
    assertThat(searchOperation.getErrorMessage().toString()).contains("not have sufficient privileges", "unindexed search");
    assertThat(searchOperation.getErrorMessage().toString())
    .contains("not have sufficient privileges", "unindexed search");
    assertThat(searchOperation.getEntriesSent()).isEqualTo(0);
  }
@@ -963,7 +964,8 @@
    assertEquals(backend.getNumberOfChildren(testBaseDN), 1,
                 "Not enough entries in DIT.");
    /** -2 for baseDn and People entry */
    assertEquals(backend.getNumberOfChildren(testBaseDN.child(DN.valueOf("ou=People"))), getTotalNumberOfLDIFEntries() - 2,
    assertEquals(backend.getNumberOfChildren(testBaseDN.child(DN.valueOf("ou=People"))),
                 getTotalNumberOfLDIFEntries() - 2,
                 "Not enough entries in DIT.");
    VerifyConfig config = new VerifyConfig();
@@ -1048,7 +1050,7 @@
  {
    final EntryContainer entryContainer =  backend.getRootContainer().getEntryContainers().iterator().next();
    final Set<String> dirtyIndexes = new HashSet<>(Arrays.asList(new String[] { "sn", "uid", "telephoneNumber" }));
    final Set<String> dirtyIndexes = new HashSet<>(Arrays.asList("sn", "uid", "telephoneNumber"));
    assertThat(backendIndexes.keySet()).containsAll(dirtyIndexes);
    // Delete all the indexes
@@ -1100,7 +1102,8 @@
  {
    final Storage storage = backend.getRootContainer().getStorage();
    final DN2ID dn2ID = backend.getRootContainer().getEntryContainer(testBaseDN).getDN2ID();
    final ID2ChildrenCount id2ChildrenCount = backend.getRootContainer().getEntryContainer(testBaseDN).getID2ChildrenCount();
    final ID2ChildrenCount id2ChildrenCount =
        backend.getRootContainer().getEntryContainer(testBaseDN).getID2ChildrenCount();
    final VerifyConfig config = new VerifyConfig();
    config.setBaseDN(DN.valueOf("dc=test,dc=com"));
@@ -1171,7 +1174,9 @@
        @Override
        public void run(WriteableTransaction txn) throws Exception
        {
          txn.put(new TreeName("dc=test,dc=com", "id2entry"), ByteString.valueOfUtf8("key"), ByteString.valueOfUtf8("value"));
          txn.put(new TreeName("dc=test,dc=com", "id2entry"),
                  ByteString.valueOfUtf8("key"),
                  ByteString.valueOfUtf8("value"));
        }
      });
    }
opendj-server-legacy/src/test/java/org/opends/server/controls/ExternalChangelogControlTest.java
@@ -12,7 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2009 Sun Microsystems, Inc.
 * Portions Copyright 2014-2015 ForgeRock AS.
 * Portions Copyright 2014-2016 ForgeRock AS.
 */
package org.opends.server.controls;
@@ -44,7 +44,8 @@
        {false, "o=test:;" },
        {false, "o=test:000001210b6f21e904b100000002;" },
        {false, "o=test:000001210b6f21e904b100000001;o=test2:000001210b6f21e904b100000002;" },
        {false, "o=test:000001210b6f21e904b100000001 000001210b6f21e904b200000001;o=test2:000001210b6f21e904b100000002 000001210b6f21e904b200000002;" },
        {false, "o=test:000001210b6f21e904b100000001 000001210b6f21e904b200000001;"
                + "o=test2:000001210b6f21e904b100000002 000001210b6f21e904b200000002;" },
        };
  }
opendj-server-legacy/src/test/java/org/opends/server/controls/PasswordPolicyControlTestCase.java
@@ -49,6 +49,7 @@
import static org.forgerock.opendj.ldap.ModificationType.*;
import static org.forgerock.opendj.ldap.requests.Requests.*;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.controls.PasswordPolicyErrorType.*;
import static org.opends.server.util.ServerConstants.*;
import static org.testng.Assert.*;
@@ -108,7 +109,7 @@
      SimpleBindRequest bindRequest = newSimpleBindRequest("uid=test.user,o=test", "password".toCharArray())
          .addControl(newPasswordPolicyControl());
      LDAPMessage bindMessage = conn.bind(bindRequest, false);
      assertTrue(passwordPolicyControlExists(bindMessage.getControls(), PasswordPolicyErrorType.CHANGE_AFTER_RESET));
      assertTrue(passwordPolicyControlExists(bindMessage.getControls(), CHANGE_AFTER_RESET));
      AddRequest addRequest = newAddRequest("ou=People,o=test")
          .addAttribute("objectClass", "organizationalUnit")
@@ -118,7 +119,7 @@
      AddResponseProtocolOp addResponse = message.getAddResponseProtocolOp();
      assertNotEquals(addResponse.getResultCode(), LDAPResultCode.SUCCESS);
      assertTrue(passwordPolicyControlExists(message.getControls(), PasswordPolicyErrorType.CHANGE_AFTER_RESET));
      assertTrue(passwordPolicyControlExists(message.getControls(), CHANGE_AFTER_RESET));
    }
    finally
    {
@@ -153,7 +154,7 @@
      LDAPMessage message = c.add(addRequest, false);
      AddResponseProtocolOp addResponse = message.getAddResponseProtocolOp();
      assertNotEquals(addResponse.getResultCode(), LDAPResultCode.SUCCESS);
      assertTrue(passwordPolicyControlExists(message.getControls(), PasswordPolicyErrorType.INSUFFICIENT_PASSWORD_QUALITY));
      assertTrue(passwordPolicyControlExists(message.getControls(), INSUFFICIENT_PASSWORD_QUALITY));
    }
  }
@@ -212,7 +213,7 @@
      LDAPMessage message = c.add(addRequest, false);
      AddResponseProtocolOp addResponse = message.getAddResponseProtocolOp();
      assertNotEquals(addResponse.getResultCode(), LDAPResultCode.SUCCESS);
      assertTrue(passwordPolicyControlExists(message.getControls(), PasswordPolicyErrorType.INSUFFICIENT_PASSWORD_QUALITY));
      assertTrue(passwordPolicyControlExists(message.getControls(), INSUFFICIENT_PASSWORD_QUALITY));
    }
    finally
    {
@@ -267,7 +268,7 @@
      LDAPMessage message = c.bind(request, false);
      assertNotEquals(message.getBindResponseProtocolOp().getResultCode(), LDAPResultCode.SUCCESS);
      assertTrue(passwordPolicyControlExists(message.getControls(), PasswordPolicyErrorType.ACCOUNT_LOCKED));
      assertTrue(passwordPolicyControlExists(message.getControls(), ACCOUNT_LOCKED));
    }
    finally
    {
@@ -312,7 +313,7 @@
      CompareResponseProtocolOp compareResponse = message.getCompareResponseProtocolOp();
      assertNotEquals(compareResponse.getResultCode(), LDAPResultCode.SUCCESS);
      assertTrue(passwordPolicyControlExists(message.getControls(), PasswordPolicyErrorType.CHANGE_AFTER_RESET));
      assertTrue(passwordPolicyControlExists(message.getControls(), CHANGE_AFTER_RESET));
    }
    finally
    {
@@ -368,7 +369,7 @@
      DeleteResponseProtocolOp deleteResponse = message.getDeleteResponseProtocolOp();
      assertNotEquals(deleteResponse.getResultCode(), LDAPResultCode.SUCCESS);
      assertTrue(passwordPolicyControlExists(message.getControls(), PasswordPolicyErrorType.CHANGE_AFTER_RESET));
      assertTrue(passwordPolicyControlExists(message.getControls(), CHANGE_AFTER_RESET));
    }
    finally
    {
@@ -489,8 +490,7 @@
            pwpControl = (PasswordPolicyResponseControl)c;
          }
          if (changeAfterReset) {
            assertEquals(pwpControl.getErrorType(),
                         PasswordPolicyErrorType.CHANGE_AFTER_RESET);
            assertEquals(pwpControl.getErrorType(), CHANGE_AFTER_RESET);
          } else {
            assertNull(pwpControl.getErrorType());
          }
@@ -579,7 +579,7 @@
      ModifyResponseProtocolOp modifyResponse = message.getModifyResponseProtocolOp();
      assertEquals(modifyResponse.getResultCode(), LDAPResultCode.CONSTRAINT_VIOLATION);
      assertTrue(passwordPolicyControlExists(message.getControls(), PasswordPolicyErrorType.CHANGE_AFTER_RESET));
      assertTrue(passwordPolicyControlExists(message.getControls(), CHANGE_AFTER_RESET));
    }
    finally
    {
@@ -628,7 +628,7 @@
      ModifyResponseProtocolOp modifyResponse = message.getModifyResponseProtocolOp();
      assertNotEquals(modifyResponse.getResultCode(), LDAPResultCode.SUCCESS);
      assertTrue(passwordPolicyControlExists(message.getControls(), PasswordPolicyErrorType.PASSWORD_MOD_NOT_ALLOWED));
      assertTrue(passwordPolicyControlExists(message.getControls(), PASSWORD_MOD_NOT_ALLOWED));
    }
    finally
    {
@@ -675,7 +675,7 @@
      ModifyResponseProtocolOp modifyResponse = message.getModifyResponseProtocolOp();
      assertNotEquals(modifyResponse.getResultCode(), LDAPResultCode.SUCCESS);
      assertTrue(passwordPolicyControlExists(message.getControls(), PasswordPolicyErrorType.PASSWORD_IN_HISTORY));
      assertTrue(passwordPolicyControlExists(message.getControls(), PASSWORD_IN_HISTORY));
    }
    finally
    {
@@ -724,7 +724,7 @@
      ModifyResponseProtocolOp modifyResponse = message.getModifyResponseProtocolOp();
      assertNotEquals(modifyResponse.getResultCode(), LDAPResultCode.SUCCESS);
      assertTrue(passwordPolicyControlExists(message.getControls(), PasswordPolicyErrorType.MUST_SUPPLY_OLD_PASSWORD));
      assertTrue(passwordPolicyControlExists(message.getControls(), MUST_SUPPLY_OLD_PASSWORD));
    }
    finally
    {
@@ -773,7 +773,7 @@
      ModifyResponseProtocolOp modifyResponse = message.getModifyResponseProtocolOp();
      assertNotEquals(modifyResponse.getResultCode(), LDAPResultCode.SUCCESS);
      assertTrue(passwordPolicyControlExists(message.getControls(), PasswordPolicyErrorType.PASSWORD_TOO_YOUNG));
      assertTrue(passwordPolicyControlExists(message.getControls(), PASSWORD_TOO_YOUNG));
    }
    finally
    {
@@ -826,7 +826,7 @@
      ModifyDNResponseProtocolOp modifyDNResponse = message.getModifyDNResponseProtocolOp();
      assertNotEquals(modifyDNResponse.getResultCode(), LDAPResultCode.SUCCESS);
      assertTrue(passwordPolicyControlExists(message.getControls(), PasswordPolicyErrorType.CHANGE_AFTER_RESET));
      assertTrue(passwordPolicyControlExists(message.getControls(), CHANGE_AFTER_RESET));
    }
    finally
    {
@@ -872,7 +872,7 @@
      SearchResultDoneProtocolOp searchDone = message.getSearchResultDoneProtocolOp();
      assertNotEquals(searchDone.getResultCode(), LDAPResultCode.SUCCESS);
      assertTrue(passwordPolicyControlExists(message.getControls(), PasswordPolicyErrorType.CHANGE_AFTER_RESET));
      assertTrue(passwordPolicyControlExists(message.getControls(), CHANGE_AFTER_RESET));
    }
    finally
    {
opendj-server-legacy/src/test/java/org/opends/server/controls/PersistentSearchControlTest.java
@@ -181,8 +181,7 @@
    }
    catch (LDAPException expected)
    {
      assertEquals(
          expected.getMessage(),
      assertEquals(expected.getMessage(),
          "The provided integer value indicated that there were no persistent search change types, which is not allowed");
    }
opendj-server-legacy/src/test/java/org/opends/server/core/AbandonOperationTestCase.java
@@ -203,7 +203,8 @@
    {
      // Send the abandon request to the server and wait a few seconds to ensure
      // it has completed before closing the connection.
      conn.writeMessage(new AbandonRequestProtocolOp(1), DisconnectClientPlugin.createDisconnectControlList("PreParse"));
      conn.writeMessage(new AbandonRequestProtocolOp(1),
                        DisconnectClientPlugin.createDisconnectControlList("PreParse"));
      Thread.sleep(3000);
    }
opendj-server-legacy/src/test/java/org/opends/server/core/BindOperationTestCase.java
@@ -55,9 +55,7 @@
import static org.opends.server.util.ServerConstants.*;
import static org.testng.Assert.*;
/**
 * A set of test cases for bind operations.
 */
/** A set of test cases for bind operations. */
public class BindOperationTestCase
       extends OperationTestCase
{
@@ -72,68 +70,34 @@
  public Object[][] getSimpleBindOperations()
         throws Exception
  {
    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
    ArrayList<Control> noControls = new ArrayList<>(0);
    ByteString nullOS = null;
    DN nullDN = null;
    BindOperation[] simpleBinds = new BindOperation[]
    {
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", ByteString.empty(),
                        ByteString.empty()),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", ByteString.empty(),
                        ByteString.empty()),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", nullOS, ByteString.empty()),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", nullOS, ByteString.empty()),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", ByteString.empty(), nullOS),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", ByteString.empty(), nullOS),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", nullOS, nullOS),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", nullOS, nullOS),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3",
                        ByteString.valueOfUtf8("cn=Directory Manager"),
                        ByteString.valueOfUtf8("password")),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", DN.rootDN(), ByteString.empty()),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", DN.rootDN(), ByteString.empty()),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", nullDN, ByteString.empty()),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", nullDN, ByteString.empty()),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", DN.rootDN(), nullOS),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", DN.rootDN(), nullOS),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", nullDN, nullOS),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", nullDN, nullOS),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", DN.valueOf("cn=Directory Manager"),
                        ByteString.valueOfUtf8("password"))
    return new Object[][] {
      // @formatter:off
      { newBindOp(null, ByteString.empty(), ByteString.empty()) },
      { newBindOp(noControls, ByteString.empty(), ByteString.empty()) },
      { newBindOp(null, nullOS, ByteString.empty()) },
      { newBindOp(noControls, nullOS, ByteString.empty()) },
      { newBindOp(null, ByteString.empty(), nullOS) },
      { newBindOp(noControls, ByteString.empty(), nullOS) },
      { newBindOp(null, nullOS, nullOS) },
      { newBindOp(noControls, nullOS, nullOS) },
      { newBindOp(noControls, bs("cn=Directory Manager"), bs("password")) },
      { newBindOp(null, DN.rootDN(), ByteString.empty()) },
      { newBindOp(noControls, DN.rootDN(), ByteString.empty()) },
      { newBindOp(null, nullDN, ByteString.empty()) },
      { newBindOp(noControls, nullDN, ByteString.empty()) },
      { newBindOp(null, DN.rootDN(), nullOS) },
      { newBindOp(noControls, DN.rootDN(), nullOS) },
      { newBindOp(null, nullDN, nullOS) },
      { newBindOp(noControls, nullDN, nullOS) },
      { newBindOp(noControls, DN.valueOf("cn=Directory Manager"), bs("password")) },
      // @formatter:on
    };
    Object[][] array = new Object[simpleBinds.length][1];
    for (int i=0; i < simpleBinds.length; i++)
    {
      array[i][0] = simpleBinds[i];
    }
    return array;
  }
  /**
   * Retrieves a set of bind operation objects using SASL authentication.
   *
@@ -145,70 +109,65 @@
  public Object[][] getSASLBindOperations()
         throws Exception
  {
    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
    ArrayList<Control> noControls = new ArrayList<>(0);
    ByteString nullOS = null;
    DN nullDN = null;
    BindOperation[] saslBinds = new BindOperation[]
    {
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", ByteString.empty(), "EXTERNAL", null),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", ByteString.empty(), "EXTERNAL",
                        null),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", nullOS, "EXTERNAL", null),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", nullOS, "EXTERNAL", null),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", ByteString.empty(), "PLAIN",
                        ByteString.valueOfUtf8("\u0000u:test.user\u0000password")),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", ByteString.empty(), "PLAIN",
                        ByteString.valueOfUtf8("\u0000u:test.user\u0000password")),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", nullOS, "PLAIN",
                        ByteString.valueOfUtf8("\u0000u:test.user\u0000password")),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", nullOS, "PLAIN",
                        ByteString.valueOfUtf8("\u0000u:test.user\u0000password")),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", DN.rootDN(), "EXTERNAL", null),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", DN.rootDN(), "EXTERNAL", null),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", nullDN, "EXTERNAL", null),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", nullDN, "EXTERNAL", null),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", DN.rootDN(), "PLAIN",
                        ByteString.valueOfUtf8("\u0000u:test.user\u0000password")),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", DN.rootDN(), "PLAIN",
                        ByteString.valueOfUtf8("\u0000u:test.user\u0000password")),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        null, "3", nullDN, "PLAIN",
                        ByteString.valueOfUtf8("\u0000u:test.user\u0000password")),
      new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                        noControls, "3", nullDN, "PLAIN",
                        ByteString.valueOfUtf8("\u0000u:test.user\u0000password"))
    return new Object[][] {
      // @formatter:off
      { newBindOp(null, ByteString.empty(), "EXTERNAL", null) },
      { newBindOp(noControls, ByteString.empty(), "EXTERNAL", null) },
      { newBindOp(null, nullOS, "EXTERNAL", null) },
      { newBindOp(noControls, nullOS, "EXTERNAL", null) },
      { newBindOp(null, ByteString.empty(), "PLAIN", bs("\u0000u:test.user\u0000password")) },
      { newBindOp(noControls, ByteString.empty(), "PLAIN", bs("\u0000u:test.user\u0000password")) },
      { newBindOp(null, nullOS, "PLAIN", bs("\u0000u:test.user\u0000password")) },
      { newBindOp(noControls, nullOS, "PLAIN", bs("\u0000u:test.user\u0000password")) },
      { newBindOp(null, DN.rootDN(), "EXTERNAL", null) },
      { newBindOp(noControls, DN.rootDN(), "EXTERNAL", null) },
      { newBindOp(null, nullDN, "EXTERNAL", null) },
      { newBindOp(noControls, nullDN, "EXTERNAL", null) },
      { newBindOp(null, DN.rootDN(), "PLAIN", bs("\u0000u:test.user\u0000password")) },
      { newBindOp(noControls, DN.rootDN(), "PLAIN", bs("\u0000u:test.user\u0000password")) },
      { newBindOp(null, nullDN, "PLAIN", bs("\u0000u:test.user\u0000password")) },
      { newBindOp(noControls, nullDN, "PLAIN", bs("\u0000u:test.user\u0000password")) },
      // @formatter:on
    };
  }
    Object[][] array = new Object[saslBinds.length][1];
    for (int i=0; i < saslBinds.length; i++)
  private BindOperation newBindOp(List<Control> requestControls, ByteString rawBindDN, ByteString simplePassword)
    {
      array[i][0] = saslBinds[i];
    return new BindOperationBasis(getRootConnection(), nextOperationID(), nextMessageID(),
        requestControls, "3", rawBindDN, simplePassword);
    }
    return array;
  private BindOperation newBindOp(List<Control> requestControls, DN bindDN, ByteString simplePassword)
  {
    return new BindOperationBasis(getRootConnection(), nextOperationID(), nextMessageID(),
        requestControls, "3", bindDN, simplePassword);
  }
  /** {@inheritDoc} */
  private BindOperation newBindOp(List<Control> requestControls,
      ByteString rawBindDN, String saslMechanism, ByteString saslCredentials)
  {
    return new BindOperationBasis(getRootConnection(), nextOperationID(), nextMessageID(),
        requestControls, "3", rawBindDN, saslMechanism, saslCredentials);
  }
  private BindOperation newBindOp(List<Control> requestControls,
      DN bindDN, String saslMechanism, ByteString saslCredentials)
  {
    return new BindOperationBasis(getRootConnection(), nextOperationID(), nextMessageID(),
        requestControls, "3", bindDN, saslMechanism, saslCredentials);
  }
  private ByteString bs(String s)
  {
    return ByteString.valueOfUtf8(s);
  }
  @Override
  protected Operation[] createTestOperations()
         throws Exception
  protected Operation[] createTestOperations() throws Exception
  {
    Object[][] simpleBinds = getSimpleBindOperations();
    Object[][] saslBinds   = getSASLBindOperations();
@@ -229,8 +188,6 @@
    return bindOps;
  }
  /**
   * Tests the <CODE>getAuthenticationType</CODE> method for simple bind
   * operations.
@@ -243,8 +200,6 @@
    assertEquals(o.getAuthenticationType(), AuthenticationType.SIMPLE);
  }
  /**
   * Tests the <CODE>getAuthenticationType</CODE> method for SASL bind
   * operations.
@@ -257,8 +212,6 @@
    assertEquals(o.getAuthenticationType(), AuthenticationType.SASL);
  }
  /**
   * Tests the <CODE>getGetProtocolVersion</CODE> method for simple bind
   * operations.
@@ -272,8 +225,6 @@
    assertTrue(o.getProtocolVersion().length() > 0);
  }
  /**
   * Tests the <CODE>getProtocolVersion</CODE> method for SASL bind operations.
   *
@@ -286,8 +237,6 @@
    assertTrue(o.getProtocolVersion().length() > 0);
  }
  /**
   * Tests the <CODE>getRawBindDN</CODE> method for simple bind operations.
   *
@@ -299,8 +248,6 @@
    assertNotNull(o.getRawBindDN());
  }
  /**
   * Tests the <CODE>getRawBindDN</CODE> method for SASL bind operations.
   *
@@ -312,8 +259,6 @@
    assertNotNull(o.getRawBindDN());
  }
  /**
   * Tests the <CODE>setRawBindDN()</CODE> method for simple bind operations.
   *
@@ -338,8 +283,6 @@
    assertEquals(o.getRawBindDN(), originalRawBindDN);
  }
  /**
   * Tests the <CODE>setRawBindDN()</CODE> method for SASL bind operations.
   *
@@ -364,8 +307,6 @@
    assertEquals(o.getRawBindDN(), originalRawBindDN);
  }
  /**
   * Tests the <CODE>getBindDN</CODE> method on bind operations using simple
   * authentication.
@@ -381,8 +322,6 @@
    o.getBindDN();
  }
  /**
   * Tests the <CODE>getSimplePassword</CODE> method for bind operations using
   * simple authentication.
@@ -395,8 +334,6 @@
    assertNotNull(o.getSimplePassword());
  }
  /**
   * Tests the <CODE>getSimplePassword</CODE> method for bind operations using
   * SASL authentication.
@@ -409,8 +346,6 @@
    assertNull(o.getSimplePassword());
  }
  /**
   * Tests the <CODE>getSASLMechanism</CODE> method for bind operations using
   * simple authentication.
@@ -423,8 +358,6 @@
    assertNull(o.getSASLMechanism());
  }
  /**
   * Tests the <CODE>getSASLMechanism</CODE> method for bind operations using
   * SASL authentication.
@@ -437,8 +370,6 @@
    assertNotNull(o.getSASLMechanism());
  }
  /**
   * Tests the <CODE>getSASLCredentials</CODE> method for bind operations using
   * simple authentication.
@@ -451,8 +382,6 @@
    assertNull(o.getSASLCredentials());
  }
  /**
   * Tests the <CODE>getSASLCredentials</CODE> method for bind operations using
   * SASL authentication.
@@ -467,8 +396,6 @@
    o.getSASLCredentials();
  }
  /**
   * Tests the ability to change a simple bind operation to a SASL bind
   * operation and back again.
@@ -507,8 +434,6 @@
    assertNull(o.getSASLCredentials());
  }
  /**
   * Tests the ability to change a SASL bind operation to a simple bind
   * operation and back again.
@@ -550,8 +475,6 @@
    assertNull(o.getSimplePassword());
  }
  /**
   * Tests the <CODE>getServerSASLCredentials</CODE> method for bind operations
   * using simple authentication.
@@ -564,8 +487,6 @@
    assertNull(o.getServerSASLCredentials());
  }
  /**
   * Tests the <CODE>getServerSASLCredentials</CODE> method for bind operations
   * using SASL authentication.
@@ -578,8 +499,6 @@
    assertNull(o.getServerSASLCredentials());
  }
  /**
   * Tests the <CODE>getSASLAuthUserEntry</CODE> method for bind operations
   * using simple authentication.
@@ -592,8 +511,6 @@
    assertNull(o.getSASLAuthUserEntry());
  }
  /**
   * Tests the <CODE>getSASLAuthUserEntry</CODE> method for bind operations
   * using SASL authentication.
@@ -606,8 +523,6 @@
    assertNull(o.getSASLAuthUserEntry());
  }
  /**
   * Tests the <CODE>getSASLAuthUserEntry</CODE> method for completed SASL bind
   * operations in which this value will be set.
@@ -623,8 +538,6 @@
    assertNotNull(bindOperation.getSASLAuthUserEntry());
  }
  /**
   * Tests the <CODE>getUserEntryDN</CODE> method for bind operations using
   * simple authentication.
@@ -637,8 +550,6 @@
    assertNull(o.getUserEntryDN());
  }
  /**
   * Tests the <CODE>getUserEntryDN</CODE> method for a completed bind operation
   * using simple authentication in which this value will be set.
@@ -656,8 +567,6 @@
    assertNotNull(bindOperation.getUserEntryDN());
  }
  /**
   * Tests the <CODE>getUserEntryDN</CODE> method for bind operations using SASL
   * authentication.
@@ -670,8 +579,6 @@
    assertNull(o.getUserEntryDN());
  }
  /**
   * Tests the <CODE>getUserEntryDN</CODE> method for a completed bind operation
   * using SASL authentication in which this value will be set.
@@ -687,8 +594,6 @@
    assertNotNull(bindOperation.getUserEntryDN());
  }
  /**
   * Tests the <CODE>getProcessingStartTime</CODE>,
   * <CODE>getProcessingStopTime</CODE>, and <CODE>getProcessingTime()</CODE>
@@ -710,8 +615,6 @@
    assertTrue(bindOperation.getProcessingTime() >= 0);
  }
  /**
   * Tests the <CODE>getProcessingStartTime</CODE>,
   * <CODE>getProcessingStopTime</CODE>, and <CODE>getProcessingTime()</CODE>
@@ -731,8 +634,6 @@
    assertTrue(bindOperation.getProcessingTime() >= 0);
  }
  /**
   * Tests the <CODE>getOperationType</CODE> method for bind operations using
   * simple authentication.
@@ -745,8 +646,6 @@
    assertEquals(o.getOperationType(), OperationType.BIND);
  }
  /**
   * Tests the <CODE>getOperationType</CODE> method for bind operations using
   * SASL authentication.
@@ -759,12 +658,7 @@
    assertEquals(o.getOperationType(), OperationType.BIND);
  }
  /**
   * Tests a simple bind operation to ensure that all plugin types are invoked
   * as expected.
   */
  /** Tests a simple bind operation to ensure that all plugin types are invoked as expected. */
  @Test
  public void testAllPluginsCalledSimple()
  {
@@ -785,12 +679,7 @@
//    assertTrue(InvocationCounterPlugin.getPostResponseCount() > 0);
  }
  /**
   * Tests a SASL bind operation to ensure that all plugin types are invoked
   * as expected.
   */
  /** Tests a SASL bind operation to ensure that all plugin types are invoked as expected. */
  @Test
  public void testAllPluginsCalledSASL()
  {
@@ -809,8 +698,6 @@
//    assertTrue(InvocationCounterPlugin.getPostResponseCount() > 0);
  }
  /**
   * Tests an anonymous simple bind operation to ensure that it's treated
   * properly if the client connection is lost in pre-parse plugin processing.
@@ -835,8 +722,6 @@
    }
  }
  /**
   * Tests an anonymous simple bind operation to ensure that it's treated
   * properly if the client connection is lost in pre-operation plugin
@@ -862,8 +747,6 @@
    }
  }
  /**
   * Tests an anonymous simple bind operation to ensure that it's treated
   * properly if the client connection is lost in post-operation plugin
@@ -889,8 +772,6 @@
    }
  }
  /**
   * Tests an anonymous simple bind operation to ensure that it's treated
   * properly if the client connection is lost in post-response plugin
@@ -915,8 +796,6 @@
    }
  }
  /**
   * Tests an authenticated simple bind operation to ensure that it's treated
   * properly if the client connection is lost in pre-parse plugin processing.
@@ -988,8 +867,6 @@
    }
  }
  /**
   * Tests an authenticated simple bind operation to ensure that it's treated
   * properly if the client connection is lost in post-operation plugin
@@ -1015,8 +892,6 @@
    }
  }
  /**
   * Tests an authenticated simple bind operation to ensure that it's treated
   * properly if the client connection is lost in post-response plugin
@@ -1041,8 +916,6 @@
    }
  }
  /**
   * Tests a SASL bind operation to ensure that it's treated properly if the
   * client connection is lost in pre-parse plugin processing.
@@ -1067,8 +940,6 @@
    }
  }
  /**
   * Tests a SASL bind operation to ensure that it's treated properly if the
   * client connection is lost in pre-operation plugin processing.
@@ -1095,8 +966,6 @@
    }
  }
  /**
   * Tests a SASL bind operation to ensure that it's treated properly if the
   * client connection is lost in post-operation plugin processing.
@@ -1165,8 +1034,6 @@
    }
  }
  /**
   * Tests an anonymous simple bind operation to ensure that it's treated
   * properly if the operation gets short-circuited in pre-operation plugin
@@ -1209,8 +1076,6 @@
    }
  }
  /**
   * Tests an authenticated simple bind operation to ensure that it's treated
   * properly if the operation gets short-circuited in pre-operation plugin
@@ -1232,8 +1097,6 @@
    }
  }
  /**
   * Tests a SASL bind operation to ensure that it's treated properly if the
   * operation gets short-circuited in pre-parse plugin processing.
@@ -1254,8 +1117,6 @@
    }
  }
  /**
   * Tests a SASL bind operation to ensure that it's treated properly if the
   * operation gets short-circuited in pre-operation plugin processing.
@@ -1276,11 +1137,7 @@
    }
  }
  /**
   * Tests performing a simple bind operation with an invalid user DN.
   */
  /** Tests performing a simple bind operation with an invalid user DN. */
  @Test
  public void testSimpleBindInvalidDN()
  {
@@ -1293,11 +1150,7 @@
    assertEquals(bindOperation.getResultCode(), ResultCode.INVALID_CREDENTIALS);
  }
  /**
   * Tests performing a SASL bind operation with an invalid user DN.
   */
  /** Tests performing a SASL bind operation with an invalid user DN. */
  @Test
  public void testSASLBindInvalidDN()
  {
@@ -1308,8 +1161,6 @@
    assertEquals(bindOperation.getResultCode(), ResultCode.INVALID_CREDENTIALS);
  }
  /**
   * Tests performing a simple bind operation with an unsupported control that
   * is marked critical.
@@ -1324,20 +1175,14 @@
    requestControls.add(new LDAPControl("1.2.3.4", true));
    BindOperationBasis bindOperation =
         new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                           requestControls, "3", DN.rootDN(),
                        ByteString.empty());
         new BindOperationBasis(conn, nextOperationID(), nextMessageID(),
                           requestControls, "3", DN.rootDN(), ByteString.empty());
    bindOperation.run();
    assertEquals(bindOperation.getResultCode(),
                 ResultCode.UNAVAILABLE_CRITICAL_EXTENSION);
  }
  /**
   * Tests performing a SASL bind operation with an unsupported control that is
   * marked critical.
   */
  /** Tests performing a SASL bind operation with an unsupported control that is marked critical. */
  @Test
  public void testSASLBindUnsupportedCriticalControl()
  {
@@ -1356,8 +1201,6 @@
                 ResultCode.UNAVAILABLE_CRITICAL_EXTENSION);
  }
  /**
   * Tests performing a simple bind operation with an unsupported control that
   * is not marked critical.
@@ -1372,16 +1215,13 @@
    requestControls.add(new LDAPControl("1.2.3.4", false));
    BindOperationBasis bindOperation =
         new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                           requestControls, "3", DN.rootDN(),
                           ByteString.empty());
         new BindOperationBasis(conn, nextOperationID(), nextMessageID(),
                           requestControls, "3", DN.rootDN(), ByteString.empty());
    bindOperation.run();
    assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS);
  }
  /**
   * Tests performing a SASL bind operation with an unsupported control that is
   * is not marked critical.
@@ -1403,8 +1243,6 @@
    assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS);
  }
  /**
   * Tests performing a simple bind operation with the DN of a user that doesn't
   * exist.
@@ -1426,8 +1264,6 @@
    assertEquals(bindOperation.getResultCode(), ResultCode.INVALID_CREDENTIALS);
  }
  /**
   * Tests performing a simple bind operation with the DN of a valid user but
   * without including a password in the request, with the server configured to
@@ -1451,8 +1287,6 @@
                           ResultCode.UNWILLING_TO_PERFORM);
  }
  /**
   * Tests performing a simple bind operation with the DN of a valid user but
   * without including a password in the request, with the server configured to
@@ -1511,8 +1345,6 @@
    assertEquals(bindOperation.getResultCode(), ResultCode.INVALID_CREDENTIALS);
  }
  /**
   * Tests performing a simple bind operation as a user who exists on
   * another server for which a named subordinate reference exists.
@@ -1546,12 +1378,7 @@
    assertEquals(referralURLs.get(0), "ldap://example.com:1389/uid=test,ou=people,o=test");
  }
  /**
   * Tests performing a simple bind operation with a valid DN but incorrect
   * password.
   */
  /** Tests performing a simple bind operation with a valid DN but incorrect password. */
  @Test
  public void testSimpleBindWrongPassword()
  {
@@ -1564,11 +1391,7 @@
    assertEquals(bindOperation.getResultCode(), ResultCode.INVALID_CREDENTIALS);
  }
  /**
   * Tests the behavior of the returnBindErrorMessage configuration option.
   */
  /** Tests the behavior of the returnBindErrorMessage configuration option. */
  @Test
  public void testReturnBindErrorMessage()
  {
@@ -1582,7 +1405,6 @@
    assertEquals(bindOperation.getResultCode(), ResultCode.INVALID_CREDENTIALS);
    assertThat(bindOperation.getErrorMessage()).isEmpty();
    // Change the server configuration so that error messages should be
    // returned.
    TestCaseUtils.dsconfig(
@@ -1595,7 +1417,6 @@
    assertEquals(bindOperation.getResultCode(), ResultCode.INVALID_CREDENTIALS);
    assertTrue(bindOperation.getErrorMessage().length() > 0);
    // Change the configuration back and make sure that the error message goes
    // away.
    TestCaseUtils.dsconfig(
@@ -1609,8 +1430,6 @@
    assertThat(bindOperation.getErrorMessage()).isEmpty();
  }
  /**
   * Tests to ensure that performing multiple binds on a client connection will
   * cause the connection to no longer be associated with the previous identity.
@@ -1654,8 +1473,6 @@
    }
  }
  /**
   * Tests to ensure that performing subtree delete will
   * cause the connection to no longer be associated
@@ -1716,8 +1533,6 @@
    }
  }
  /**
   * Tests to ensure that performing subtree modify will
   * cause the connection to be associated with new auth
@@ -1784,8 +1599,6 @@
    }
  }
  /**
   * Tests to ensure that the "ignore" password policy state update policy
   * works as expected.
@@ -1878,8 +1691,6 @@
    }
  }
  /**
   * Tests to ensure that the "reactive" password policy state update policy
   * works as expected.
@@ -1973,8 +1784,6 @@
    }
  }
  /**
   * Tests to ensure that the "proactive" password policy state update policy
   * works as expected.
@@ -2101,4 +1910,3 @@
    assertNull(bindOperation.getCancelRequest());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/core/TestModifyDNOperation.java
@@ -17,12 +17,22 @@
 */
package org.opends.server.core;
import static org.assertj.core.api.Assertions.*;
import static org.forgerock.opendj.ldap.ResultCode.*;
import static org.forgerock.opendj.ldap.requests.Requests.*;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.util.ServerConstants.*;
import static org.testng.Assert.*;
import java.util.Collections;
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.AVA;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.RDN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
import org.forgerock.opendj.ldap.schema.AttributeType;
@@ -43,23 +53,13 @@
import org.opends.server.types.CancelRequest;
import org.opends.server.types.CancelResult;
import org.opends.server.types.Control;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.LockManager.DNLock;
import org.opends.server.types.Operation;
import org.forgerock.opendj.ldap.RDN;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.forgerock.opendj.ldap.ResultCode.*;
import static org.forgerock.opendj.ldap.requests.Requests.*;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.util.ServerConstants.*;
import static org.testng.Assert.*;
@SuppressWarnings("javadoc")
public class TestModifyDNOperation extends OperationTestCase
{
@@ -230,43 +230,44 @@
  protected Operation[] createTestOperations() throws Exception
  {
    return new ModifyDNOperation[] {
      newModifyDNOperationRaw("cn=test,ou=test", "cn=test2", true, "dc=example,dc=com"),
      newModifyDNOperation("cn=test,ou=test", "cn=test2", true, "dc=example,dc=com")
      newModifyDNOpRaw("cn=test,ou=test", "cn=test2", true, "dc=example,dc=com"),
      newModifyDNOp("cn=test,ou=test", "cn=test2", true, "dc=example,dc=com")
    };
  }
  private ModifyDNOperation runModifyDNOperation(
  private ModifyDNOperation runModifyDNOp(
      String entryDN, String newRDN, boolean deleteOldRDN, String newSuperior) throws DirectoryException
  {
    ModifyDNOperation op = newModifyDNOperation(entryDN, newRDN, deleteOldRDN, newSuperior);
    ModifyDNOperation op = newModifyDNOp(entryDN, newRDN, deleteOldRDN, newSuperior);
    op.run();
    return op;
  }
  private ModifyDNOperation runModifyDNOperationRaw(
  private ModifyDNOperation runModifyDNOpRaw(
      String entryDN, String newRDN, boolean deleteOldRDN, String newSuperior)
  {
    ModifyDNOperation op = newModifyDNOperationRaw(entryDN, newRDN, deleteOldRDN, newSuperior);
    ModifyDNOperation op = newModifyDNOpRaw(entryDN, newRDN, deleteOldRDN, newSuperior);
    op.run();
    return op;
  }
  private ModifyDNOperationBasis newModifyDNOperation(
  private ModifyDNOperationBasis newModifyDNOp(
      String entryDN, String newRDN, boolean deleteOldRDN, String newSuperior) throws DirectoryException
  {
    return new ModifyDNOperationBasis(getRootConnection(), nextOperationID(), nextMessageID(),
        Collections.<Control> emptyList(), dn(entryDN), rdn(newRDN), deleteOldRDN, dn(newSuperior));
  }
  private ModifyDNOperationBasis newModifyDNOperationRaw(
  private ModifyDNOperationBasis newModifyDNOpRaw(
      String entryDN, String newRDN, boolean deleteOldRDN, String newSuperior)
  {
    return new ModifyDNOperationBasis(getRootConnection(), nextOperationID(), nextMessageID(),
        Collections.<Control> emptyList(), b(entryDN), b(newRDN), deleteOldRDN, b(newSuperior));
  }
  private ModifyDNOperation runModifyDNOperation(
      InternalClientConnection conn, String entryDN, String newRDN, boolean deleteOldRDN, Control control) throws DirectoryException
  private ModifyDNOperation runModifyDNOp(
      InternalClientConnection conn, String entryDN, String newRDN, boolean deleteOldRDN, Control control)
          throws DirectoryException
  {
    ModifyDNOperation op = new ModifyDNOperationBasis(conn, nextOperationID(), nextMessageID(),
        Collections.singletonList(control), dn(entryDN), rdn(newRDN), deleteOldRDN, null);
@@ -274,7 +275,7 @@
    return op;
  }
  private ModifyDNOperation runModifyDNOperationRaw(
  private ModifyDNOperation runModifyDNOpRaw(
      String entryDN, String newRDN, boolean deleteOldRDN, String newSuperior, Control control)
  {
    ModifyDNOperation op = new ModifyDNOperationBasis(proxyUserConn, nextOperationID(), nextMessageID(),
@@ -321,12 +322,12 @@
    String newEntryDN = "uid=user.test0,ou=People,dc=example,dc=com";
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = runModifyDNOperationRaw(oldEntryDN, "uid=user.test0", false, null);
    ModifyDNOperation modifyDNOperation = runModifyDNOpRaw(oldEntryDN, "uid=user.test0", false, null);
    assertSuccessAndEntryExists(modifyDNOperation, newEntryDN, true, true);
    examineCompletedOperation(modifyDNOperation);
    InvocationCounterPlugin.resetAllCounters();
    modifyDNOperation = runModifyDNOperationRaw(newEntryDN, "uid=user.0", true, null);
    modifyDNOperation = runModifyDNOpRaw(newEntryDN, "uid=user.0", true, null);
    assertSuccessAndEntryExists(modifyDNOperation, oldEntryDN, true, false);
    examineCompletedOperation(modifyDNOperation);
  }
@@ -338,12 +339,12 @@
    String newEntryDN = "uid=user.test0,ou=People,dc=example,dc=com";
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = runModifyDNOperation(oldEntryDN, "uid=user.test0", false, null);
    ModifyDNOperation modifyDNOperation = runModifyDNOp(oldEntryDN, "uid=user.test0", false, null);
    assertSuccessAndEntryExists(modifyDNOperation, newEntryDN, true, true);
    examineCompletedOperation(modifyDNOperation);
    InvocationCounterPlugin.resetAllCounters();
    modifyDNOperation = runModifyDNOperation(newEntryDN, "uid=user.0", true, null);
    modifyDNOperation = runModifyDNOp(newEntryDN, "uid=user.0", true, null);
    assertSuccessAndEntryExists(modifyDNOperation, oldEntryDN, true, false);
    examineCompletedOperation(modifyDNOperation);
  }
@@ -359,7 +360,7 @@
    String newEntryDN = "uid=USER.0,ou=People,dc=example,dc=com";
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = runModifyDNOperation(oldEntryDN, "uid=USER.0", true, null);
    ModifyDNOperation modifyDNOperation = runModifyDNOp(oldEntryDN, "uid=USER.0", true, null);
    assertSuccess(modifyDNOperation);
    Entry newEntry = DirectoryServer.getEntry(dn(oldEntryDN));
@@ -370,7 +371,7 @@
    examineCompletedOperation(modifyDNOperation);
    InvocationCounterPlugin.resetAllCounters();
    modifyDNOperation = runModifyDNOperation(newEntryDN, "uid=user.0", true, null);
    modifyDNOperation = runModifyDNOp(newEntryDN, "uid=user.0", true, null);
    assertSuccess(modifyDNOperation);
    assertNotNull(DirectoryServer.getEntry(dn(oldEntryDN)));
    examineCompletedOperation(modifyDNOperation);
@@ -395,7 +396,7 @@
    String newEntryDN = "uid=UserID.0+cn=Test,ou=People,dc=example,dc=com";
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = runModifyDNOperation(oldEntryDN, "uid=UserID.0+cn=Test", false, null);
    ModifyDNOperation modifyDNOperation = runModifyDNOp(oldEntryDN, "uid=UserID.0+cn=Test", false, null);
    assertSuccess(modifyDNOperation);
    assertEntryAttrValue(newEntryDN, "uid", "UserID.0");
    examineCompletedOperation(modifyDNOperation);
@@ -447,7 +448,7 @@
    String newEntryDN = "uid=userid.0+sn=JENSEN,ou=People,dc=example,dc=com";
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = runModifyDNOperation(oldEntryDN, "uid=userid.0+sn=JENSEN", false, null);
    ModifyDNOperation modifyDNOperation = runModifyDNOp(oldEntryDN, "uid=userid.0+sn=JENSEN", false, null);
    assertSuccess(modifyDNOperation);
    assertEntryAttrValue(newEntryDN, "sn", "JENSEN");
    examineCompletedOperation(modifyDNOperation);
@@ -468,12 +469,12 @@
    String newEntryDN = "uid=user.test0,ou=People,dc=example,dc=com";
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = runModifyDNOperationRaw(oldEntryDN, "uid=user.test0", true, null);
    ModifyDNOperation modifyDNOperation = runModifyDNOpRaw(oldEntryDN, "uid=user.test0", true, null);
    assertSuccessAndEntryExists(modifyDNOperation, newEntryDN, false, true);
    examineCompletedOperation(modifyDNOperation);
    InvocationCounterPlugin.resetAllCounters();
    modifyDNOperation = runModifyDNOperationRaw(newEntryDN, "uid=user.0", true, null);
    modifyDNOperation = runModifyDNOpRaw(newEntryDN, "uid=user.0", true, null);
    assertSuccessAndEntryExists(modifyDNOperation, oldEntryDN, true, false);
    examineCompletedOperation(modifyDNOperation);
  }
@@ -485,7 +486,7 @@
    String newEntryDN = "uid=user.test0,ou=People,dc=example,dc=com";
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = runModifyDNOperation(oldEntryDN, "uid=user.test0", true, null);
    ModifyDNOperation modifyDNOperation = runModifyDNOp(oldEntryDN, "uid=user.test0", true, null);
    CancelRequest cancelRequest = new CancelRequest(false, LocalizableMessage.raw("testCancelBeforeStartup"));
    CancelResult cancelResult = modifyDNOperation.cancel(cancelRequest);
@@ -495,7 +496,7 @@
    examineCompletedOperation(modifyDNOperation);
    InvocationCounterPlugin.resetAllCounters();
    modifyDNOperation = runModifyDNOperation(newEntryDN, "uid=user.0", true, null);
    modifyDNOperation = runModifyDNOp(newEntryDN, "uid=user.0", true, null);
    assertSuccessAndEntryExists(modifyDNOperation, oldEntryDN, true, false);
    examineCompletedOperation(modifyDNOperation);
  }
@@ -508,12 +509,12 @@
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation =
        runModifyDNOperationRaw(oldEntryDN, "uid=user.test0", true, "dc=example,dc=com");
        runModifyDNOpRaw(oldEntryDN, "uid=user.test0", true, "dc=example,dc=com");
    assertSuccessAndEntryExists(modifyDNOperation, newEntryDN, false, true);
    examineCompletedOPNoExtraPluginCounts(modifyDNOperation);
    InvocationCounterPlugin.resetAllCounters();
    modifyDNOperation = runModifyDNOperationRaw(newEntryDN, "uid=user.0", true, "ou=People,dc=example,dc=com");
    modifyDNOperation = runModifyDNOpRaw(newEntryDN, "uid=user.0", true, "ou=People,dc=example,dc=com");
    assertSuccessAndEntryExists(modifyDNOperation, oldEntryDN, true, false);
    examineCompletedOPNoExtraPluginCounts(modifyDNOperation);
  }
@@ -525,12 +526,12 @@
    String newEntryDN = "uid=user.test0,dc=example,dc=com";
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = runModifyDNOperation(oldEntryDN, "uid=user.test0", true, "dc=example,dc=com");
    ModifyDNOperation modifyDNOperation = runModifyDNOp(oldEntryDN, "uid=user.test0", true, "dc=example,dc=com");
    assertSuccessAndEntryExists(modifyDNOperation, newEntryDN, false, true);
    examineCompletedOPNoExtraPluginCounts(modifyDNOperation);
    InvocationCounterPlugin.resetAllCounters();
    modifyDNOperation = runModifyDNOperation(newEntryDN, "uid=user.0", true, "ou=People,dc=example,dc=com");
    modifyDNOperation = runModifyDNOp(newEntryDN, "uid=user.0", true, "ou=People,dc=example,dc=com");
    assertSuccessAndEntryExists(modifyDNOperation, oldEntryDN, true, false);
    examineCompletedOPNoExtraPluginCounts(modifyDNOperation);
  }
@@ -543,14 +544,14 @@
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation =
        runModifyDNOperation(oldEntryDN, "cn=Aaccf Amar Test", true, "dc=example,dc=com");
        runModifyDNOp(oldEntryDN, "cn=Aaccf Amar Test", true, "dc=example,dc=com");
    assertSuccess(modifyDNOperation);
    Entry entry = assertCnAttrValues(newEntryDN, oldEntryDN);
    assertThat(entry.getAttribute("uid")).isEmpty();
    examineCompletedOPNoExtraPluginCounts(modifyDNOperation);
    InvocationCounterPlugin.resetAllCounters();
    modifyDNOperation = runModifyDNOperation(newEntryDN, "uid=user.0", false, "ou=People,dc=example,dc=com");
    modifyDNOperation = runModifyDNOp(newEntryDN, "uid=user.0", false, "ou=People,dc=example,dc=com");
    assertSuccess(modifyDNOperation);
    Entry newOldEntry = assertCnAttrValues(oldEntryDN, newEntryDN);
    for(Attribute attribute : newOldEntry.getAttribute("uid"))
@@ -578,7 +579,7 @@
  public void testInvalidEntryModify() throws Exception
  {
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = runModifyDNOperation(
    ModifyDNOperation modifyDNOperation = runModifyDNOp(
        "uid=user.invalid,ou=People,dc=example,dc=com", "uid=user.test0", true, "dc=example,dc=com");
    examineIncompleteOperation(modifyDNOperation, NO_SUCH_OBJECT);
  }
@@ -587,7 +588,7 @@
  public void testInvalidRDNModify() throws Exception
  {
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = runModifyDNOperation(
    ModifyDNOperation modifyDNOperation = runModifyDNOp(
        "uid=user.0,ou=People,dc=example,dc=com", "invalid=invalid", true, "dc=example,dc=com");
    examineIncompleteOperation(modifyDNOperation, OBJECTCLASS_VIOLATION);
  }
@@ -596,7 +597,7 @@
  public void testInvalidSuperiorModify() throws Exception
  {
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = runModifyDNOperation(
    ModifyDNOperation modifyDNOperation = runModifyDNOp(
        "uid=user.0,ou=People,dc=example,dc=com", "uid=user.test0", true, "dc=invalid,dc=com");
    examineIncompleteOperation(modifyDNOperation, NO_SUCH_OBJECT);
  }
@@ -606,7 +607,7 @@
  {
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation =
        runModifyDNOperationRaw("invalid DN", "uid=user.test0", true, "dc=example,dc=com");
        runModifyDNOpRaw("invalid DN", "uid=user.test0", true, "dc=example,dc=com");
    examineUnparsedOperation(modifyDNOperation, INVALID_DN_SYNTAX);
  }
@@ -615,7 +616,7 @@
  {
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation =
        runModifyDNOperationRaw("uid=user.0,ou=People,dc=example,dc=com", "invalid RDN", true, "dc=example,dc=com");
        runModifyDNOpRaw("uid=user.0,ou=People,dc=example,dc=com", "invalid RDN", true, "dc=example,dc=com");
    examineUnparsedOperation(modifyDNOperation, INVALID_DN_SYNTAX);
  }
@@ -624,7 +625,7 @@
  {
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation =
        runModifyDNOperationRaw("uid=user.0,ou=People,dc=example,dc=com", "uid=user.test0", true, "invalid superior");
        runModifyDNOpRaw("uid=user.0,ou=People,dc=example,dc=com", "uid=user.test0", true, "invalid superior");
    examineUnparsedOperation(modifyDNOperation, INVALID_DN_SYNTAX);
  }
@@ -632,7 +633,7 @@
  public void testModifySuffix() throws Exception
  {
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = runModifyDNOperation("dc=example,dc=com", "dc=exampletest", true, null);
    ModifyDNOperation modifyDNOperation = runModifyDNOp("dc=example,dc=com", "dc=exampletest", true, null);
    examineIncompleteOperation(modifyDNOperation, UNWILLING_TO_PERFORM);
  }
@@ -644,12 +645,12 @@
    String newEntryDN = "uid=user.test0,ou=People,dc=example,dc=com";
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = runModifyDNOperationRaw(oldEntryDN, "uid=user.test0", false, null, authV1Control);
    ModifyDNOperation modifyDNOperation = runModifyDNOpRaw(oldEntryDN, "uid=user.test0", false, null, authV1Control);
    assertSuccessAndEntryExists(modifyDNOperation, newEntryDN, true, true);
    examineCompletedOperation(modifyDNOperation);
    InvocationCounterPlugin.resetAllCounters();
    modifyDNOperation = runModifyDNOperationRaw(newEntryDN, "uid=user.0", true, null, authV1Control);
    modifyDNOperation = runModifyDNOpRaw(newEntryDN, "uid=user.0", true, null, authV1Control);
    assertSuccessAndEntryExists(modifyDNOperation, oldEntryDN, true, false);
    examineCompletedOperation(modifyDNOperation);
  }
@@ -663,12 +664,12 @@
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation =
        runModifyDNOperation(proxyUserConn, oldEntryDN, "uid=user.test0", false, authV1Control);
        runModifyDNOp(proxyUserConn, oldEntryDN, "uid=user.test0", false, authV1Control);
    assertSuccessAndEntryExists(modifyDNOperation, newEntryDN, true, true);
    examineCompletedOperation(modifyDNOperation);
    InvocationCounterPlugin.resetAllCounters();
    modifyDNOperation = runModifyDNOperation(proxyUserConn, newEntryDN, "uid=user.0", true, authV1Control);
    modifyDNOperation = runModifyDNOp(proxyUserConn, newEntryDN, "uid=user.0", true, authV1Control);
    assertSuccessAndEntryExists(modifyDNOperation, oldEntryDN, true, false);
    examineCompletedOperation(modifyDNOperation);
  }
@@ -680,7 +681,7 @@
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation =
        runModifyDNOperation(proxyUserConn, "uid=user.0,ou=People,dc=example,dc=com", "uid=user.test0", false, authV1Control);
        runModifyDNOp(proxyUserConn, "uid=user.0,ou=People,dc=example,dc=com", "uid=user.test0", false, authV1Control);
    examineIncompleteOperation(modifyDNOperation, AUTHORIZATION_DENIED);
  }
@@ -693,12 +694,12 @@
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation =
        runModifyDNOperation(proxyUserConn, oldEntryDN, "uid=user.test0", false, authV2Control);
        runModifyDNOp(proxyUserConn, oldEntryDN, "uid=user.test0", false, authV2Control);
    assertSuccessAndEntryExists(modifyDNOperation, newEntryDN, true, true);
    examineCompletedOperation(modifyDNOperation);
    InvocationCounterPlugin.resetAllCounters();
    modifyDNOperation = runModifyDNOperation(proxyUserConn, newEntryDN, "uid=user.0", true, authV2Control);
    modifyDNOperation = runModifyDNOp(proxyUserConn, newEntryDN, "uid=user.0", true, authV2Control);
    assertSuccessAndEntryExists(modifyDNOperation, oldEntryDN, true, false);
    examineCompletedOperation(modifyDNOperation);
  }
@@ -710,7 +711,7 @@
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation =
        runModifyDNOperation(proxyUserConn, "uid=user.0,ou=People,dc=example,dc=com", "uid=user.test0", false, authV2Control);
        runModifyDNOp(proxyUserConn, "uid=user.0,ou=People,dc=example,dc=com", "uid=user.test0", false, authV2Control);
    examineIncompleteOperation(modifyDNOperation, AUTHORIZATION_DENIED);
  }
@@ -721,7 +722,7 @@
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation =
        runModifyDNOperation(proxyUserConn, "uid=user.0,ou=People,dc=example,dc=com", "uid=user.test0", false, authV2Control);
        runModifyDNOp(proxyUserConn, "uid=user.0,ou=People,dc=example,dc=com", "uid=user.test0", false, authV2Control);
    examineIncompleteOperation(modifyDNOperation, PROTOCOL_ERROR);
  }
@@ -731,7 +732,8 @@
    LDAPControl assertControl = new LDAPControl("1.1.1.1.1.1", true);
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = runModifyDNOperation(getRootConnection(), "uid=user.0,ou=People,dc=example,dc=com", "uid=user.test0", false, assertControl);
    ModifyDNOperation modifyDNOperation = runModifyDNOp(
        getRootConnection(), "uid=user.0,ou=People,dc=example,dc=com", "uid=user.test0", false, assertControl);
    examineIncompleteOperation(modifyDNOperation, UNAVAILABLE_CRITICAL_EXTENSION);
  }
@@ -1021,7 +1023,7 @@
  {
    InvocationCounterPlugin.resetAllCounters();
    ModifyDNOperation modifyDNOperation = newModifyDNOperation(
    ModifyDNOperation modifyDNOperation = newModifyDNOp(
        "uid=user.invalid,ou=People,dc=example,dc=com", "uid=user.test0", true, "dc=example,dc=com");
    CancelRequest cancelRequest = new CancelRequest(false,
opendj-server-legacy/src/test/java/org/opends/server/crypto/CryptoManagerTestCase.java
@@ -348,7 +348,12 @@
    final String FILTER_CIPHER_KEY_LENGTH =
        "(" + ATTR_CRYPTO_KEY_LENGTH_BITS + "=" + cipherKeyLength + ")";
    final String searchFilter =
        "(&" + FILTER_OC_INSTANCE_KEY + FILTER_NOT_COMPROMISED + FILTER_CIPHER_TRANSFORMATION_NAME + FILTER_CIPHER_KEY_LENGTH + ")";
        "(&"
        + FILTER_OC_INSTANCE_KEY
        + FILTER_NOT_COMPROMISED
        + FILTER_CIPHER_TRANSFORMATION_NAME
        + FILTER_CIPHER_KEY_LENGTH
        + ")";
    final SearchRequest request = newSearchRequest(baseDN, SearchScope.SINGLE_LEVEL, searchFilter).addAttribute("dn");
    InternalSearchOperation searchOp = getRootConnection().processSearch(request);
    assertFalse(searchOp.getSearchEntries().isEmpty());
opendj-server-legacy/src/test/java/org/opends/server/crypto/GetSymmetricKeyExtendedOperationTestCase.java
@@ -17,6 +17,7 @@
package org.opends.server.crypto;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.opends.admin.ads.ADSContext;
@@ -27,8 +28,6 @@
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import static org.opends.server.protocols.internal.Requests.*;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.util.ServerConstants;
import org.testng.annotations.BeforeClass;
@@ -37,11 +36,13 @@
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.testng.Assert.*;
/**
 * A set of test cases for the symmetric key extended operation.
 */
@SuppressWarnings("javadoc")
public class GetSymmetricKeyExtendedOperationTestCase
     extends CryptoTestCase {
  /**
@@ -79,10 +80,16 @@
    final DN baseDN = DN.valueOf(baseDNStr);
    final String FILTER_OC_INSTANCE_KEY = "(objectclass=" + OC_CRYPTO_CIPHER_KEY + ")";
    final String FILTER_NOT_COMPROMISED = "(!(" + ATTR_CRYPTO_KEY_COMPROMISED_TIME + "=*))";
    final String FILTER_CIPHER_TRANSFORMATION_NAME = "(" + ATTR_CRYPTO_CIPHER_TRANSFORMATION_NAME + "=" + cipherTransformationName + ")";
    final String FILTER_CIPHER_TRANSFORMATION_NAME =
        "(" + ATTR_CRYPTO_CIPHER_TRANSFORMATION_NAME + "=" + cipherTransformationName + ")";
    final String FILTER_CIPHER_KEY_LENGTH = "(" + ATTR_CRYPTO_KEY_LENGTH_BITS + "=" + cipherKeyLength + ")";
    final String searchFilter =
        "(&" + FILTER_OC_INSTANCE_KEY + FILTER_NOT_COMPROMISED + FILTER_CIPHER_TRANSFORMATION_NAME + FILTER_CIPHER_KEY_LENGTH + ")";
        "(&"
        + FILTER_OC_INSTANCE_KEY
        + FILTER_NOT_COMPROMISED
        + FILTER_CIPHER_TRANSFORMATION_NAME
        + FILTER_CIPHER_KEY_LENGTH
        + ")";
    final SearchRequest request = newSearchRequest(baseDN, SearchScope.SINGLE_LEVEL, searchFilter)
        .addAttribute(ConfigConstants.ATTR_CRYPTO_SYMMETRIC_KEY);
    InternalSearchOperation searchOp = getRootConnection().processSearch(request);
opendj-server-legacy/src/test/java/org/opends/server/extensions/AnonymousSASLMechanismHandlerTestCase.java
@@ -16,31 +16,23 @@
 */
package org.opends.server.extensions;
import java.util.ArrayList;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.BindOperationBasis;
import org.opends.server.tools.LDAPSearch;
import org.opends.server.types.Control;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.BindOperationBasis;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.tools.LDAPSearch;
import org.opends.server.types.Control;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.ByteString;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.util.ServerConstants.*;
import static org.testng.Assert.*;
import static org.opends.server.util.ServerConstants.*;
/**
 * A set of test cases for the ANONYMOUS SASL mechanism handler.
 */
/** A set of test cases for the ANONYMOUS SASL mechanism handler. */
public class AnonymousSASLMechanismHandlerTestCase
       extends ExtensionsTestCase
{
@@ -56,8 +48,6 @@
    TestCaseUtils.startServer();
  }
  /**
   * Tests the process of initializing and finalizing the ANONYMOUS SASL
   * mechanism handler.
@@ -73,8 +63,6 @@
    handler.finalizeSASLMechanismHandler();
  }
  /**
   * Tests the <CODE>isPasswordBased</CODE> method.
   *
@@ -92,8 +80,6 @@
    handler.finalizeSASLMechanismHandler();
  }
  /**
   * Tests the <CODE>isSecure</CODE> method.
   *
@@ -111,8 +97,6 @@
    handler.finalizeSASLMechanismHandler();
  }
  /**
   * Tests the <CODE>processSASLBind</CODE> method with no credentials.
   *
@@ -125,10 +109,8 @@
    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
    handler.initializeSASLMechanismHandler(null);
    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
    BindOperationBasis bindOperation =
         new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
         new BindOperationBasis(getRootConnection(), nextOperationID(), nextMessageID(),
                           new ArrayList<Control>(), "3", DN.rootDN(),
                           SASL_MECHANISM_ANONYMOUS, null);
    handler.processSASLBind(bindOperation);
@@ -137,8 +119,6 @@
    handler.finalizeSASLMechanismHandler();
  }
  /**
   * Tests the <CODE>processSASLBind</CODE> method with an empty set of
   * credentials.
@@ -152,10 +132,8 @@
    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
    handler.initializeSASLMechanismHandler(null);
    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
    BindOperationBasis bindOperation =
         new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
         new BindOperationBasis(getRootConnection(), nextOperationID(), nextMessageID(),
                           new ArrayList<Control>(), "3", DN.rootDN(),
                           SASL_MECHANISM_ANONYMOUS, ByteString.empty());
    handler.processSASLBind(bindOperation);
@@ -164,8 +142,6 @@
    handler.finalizeSASLMechanismHandler();
  }
  /**
   * Tests the <CODE>processSASLBind</CODE> method with trace information.
   *
@@ -178,10 +154,8 @@
    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
    handler.initializeSASLMechanismHandler(null);
    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
    BindOperationBasis bindOperation =
         new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
         new BindOperationBasis(getRootConnection(), nextOperationID(), nextMessageID(),
                           new ArrayList<Control>(), "3", DN.rootDN(),
                           SASL_MECHANISM_ANONYMOUS,
                           ByteString.valueOfUtf8("Internal Trace String"));
@@ -191,8 +165,6 @@
    handler.finalizeSASLMechanismHandler();
  }
  /**
   * Performs a SASL ANONYMOUS bind over LDAP with no credentials.
   *
@@ -220,8 +192,6 @@
    handler.finalizeSASLMechanismHandler();
  }
  /**
   * Performs a SASL ANONYMOUS bind over LDAP with trace information.
   *
@@ -250,4 +220,3 @@
    handler.finalizeSASLMechanismHandler();
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/AttributeValuePasswordValidatorTestCase.java
@@ -26,14 +26,13 @@
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ModificationType;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.server.config.meta.AttributeValuePasswordValidatorCfgDefn;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.types.Attributes;
import org.opends.server.types.Control;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.types.Modification;
@@ -407,9 +406,8 @@
    ArrayList<Modification> mods = CollectionUtils.newArrayList(
        new Modification(ModificationType.REPLACE, Attributes.create("userpassword", password)));
    InternalClientConnection conn = getRootConnection();
    ModifyOperationBasis modifyOperation =
         new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
         new ModifyOperationBasis(getRootConnection(), nextOperationID(), nextMessageID(),
                             new ArrayList<Control>(),
                             DN.valueOf("uid=test.user,o=test"), mods);
@@ -422,7 +420,7 @@
    validator.finalizePasswordValidator();
  }
  private AttributeValuePasswordValidator initializePasswordValidator(Entry configEntry) throws ConfigException, InitializationException {
  private AttributeValuePasswordValidator initializePasswordValidator(Entry configEntry) throws Exception {
    return InitializationUtils.initializePasswordValidator(
        new AttributeValuePasswordValidator(), configEntry, AttributeValuePasswordValidatorCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/BcryptPasswordStorageSchemeTestCase.java
@@ -20,9 +20,7 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
 * A set of test cases for the Bcrypt password storage scheme.
 */
/** A set of test cases for the Bcrypt password storage scheme. */
@SuppressWarnings("javadoc")
public class BcryptPasswordStorageSchemeTestCase
       extends PasswordStorageSchemeTestCase
@@ -48,25 +46,21 @@
  /**
   * Retrieves a set of passwords (plain and bcrypt encrypted) that may
   * be used to test the compatibility of bcrypt passwords.
   * The encrypted versions have been provided by external tools or
   * users
   * The encrypted versions have been provided by external tools or users
   *
   * @return  A set of couple (cleartext, encrypted) passwords that
   *          may be used to test the bcrypt password storage scheme
   */
  @DataProvider(name = "testBcryptPasswords")
  public Object[][] getTestBcryptPasswords()
      throws Exception
  public Object[][] getTestBcryptPasswords() throws Exception
  {
    return new Object[][]
        {
            new Object[] { "secret", "{BCRYPT}$2a$08$sxnezK9Dp9cQvU56LHRwIeI0RvfNn//fFzGnOgQ2l7TOZcZ1wbOVO" },
            new Object[] { "5[g&f:\"U;#99]!_T", "{BCRYPT}$2a$08$Ttmg4fCbAcq2636pT83d1eM8weXLHbn8OFyVRanP2Tjej5hiZBnyu" },
            new Object[] { "password", "{BCRYPT}$2a$05$bvIG6Nmid91Mu9RcmmWZfO5HJIMCT8riNW0hEp8f6/FuA2/mHZFpe"},
            new Object[] { "Secret12!", "{BCRYPT}$2a$10$UOYhwLcHwGYdwWCYq1Xd2.66aPGYq8Q7HDzm8jzTRkdJyAjt/gfhO" },
            new Object[] { "correctbatteryhorsestapler", "{BCRYPT}$2a$12$mACnM5lzNigHMaf7O1py1O3vlf6.BA8k8x3IoJ.Tq3IB/2e7g61Km"},
            new Object[] { "TestingWith12%", "{BCRYPT}$2a$12$2nTgfUEOupc7Eb5PyGCnIOzoDG/VMEhIOTKTjIjY3UPjtTI..NoLO" }
    return new Object[][] {
      { "secret", "{BCRYPT}$2a$08$sxnezK9Dp9cQvU56LHRwIeI0RvfNn//fFzGnOgQ2l7TOZcZ1wbOVO" },
      { "5[g&f:\"U;#99]!_T", "{BCRYPT}$2a$08$Ttmg4fCbAcq2636pT83d1eM8weXLHbn8OFyVRanP2Tjej5hiZBnyu" },
      { "password", "{BCRYPT}$2a$05$bvIG6Nmid91Mu9RcmmWZfO5HJIMCT8riNW0hEp8f6/FuA2/mHZFpe"},
      { "Secret12!", "{BCRYPT}$2a$10$UOYhwLcHwGYdwWCYq1Xd2.66aPGYq8Q7HDzm8jzTRkdJyAjt/gfhO" },
      { "correctbatteryhorsestapler", "{BCRYPT}$2a$12$mACnM5lzNigHMaf7O1py1O3vlf6.BA8k8x3IoJ.Tq3IB/2e7g61Km"},
      { "TestingWith12%", "{BCRYPT}$2a$12$2nTgfUEOupc7Eb5PyGCnIOzoDG/VMEhIOTKTjIjY3UPjtTI..NoLO" }
        };
  }
@@ -77,5 +71,4 @@
  {
    testAuthPasswords("TestBCrypt", plaintextPassword, encodedPassword);
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/CharacterSetPasswordValidatorTestCase.java
@@ -20,31 +20,28 @@
import java.util.HashSet;
import java.util.List;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.server.config.meta.CharacterSetPasswordValidatorCfgDefn;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.types.Attributes;
import org.opends.server.types.Control;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.types.Modification;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.opends.server.TestCaseUtils;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.opendj.server.config.meta.CharacterSetPasswordValidatorCfgDefn;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.types.Attributes;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.Control;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.types.Modification;
import static org.forgerock.opendj.ldap.ModificationType.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.testng.Assert.*;
/**
 * A set of test cases for the character set password validator.
 */
/** A set of test cases for the character set password validator. */
public class CharacterSetPasswordValidatorTestCase
       extends ExtensionsTestCase
{
@@ -60,8 +57,6 @@
    TestCaseUtils.startServer();
  }
  /**
   * Retrieves a set of valid configuration entries that may be used to
   * initialize the validator.
@@ -174,8 +169,6 @@
    return array;
  }
  /**
   * Tests the process of initializing the server with valid configurations.
   *
@@ -183,7 +176,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test(dataProvider = "validConfigs", groups= { "slow" })
  @Test(dataProvider = "validConfigs", groups = "slow")
  public void testInitializeWithValidConfigs(Entry e)
         throws Exception
  {
@@ -191,7 +184,7 @@
    validator.finalizePasswordValidator();
  }
  private CharacterSetPasswordValidator initializePasswordValidator(Entry e) throws ConfigException, InitializationException {
  private CharacterSetPasswordValidator initializePasswordValidator(Entry e) throws Exception {
    return InitializationUtils.initializePasswordValidator(
        new CharacterSetPasswordValidator(), e, CharacterSetPasswordValidatorCfgDefn.getInstance());
  }
@@ -466,8 +459,6 @@
    return array;
  }
  /**
   * Tests the process of initializing the server with invalid configurations.
   *
@@ -492,8 +483,6 @@
    fail(buffer.toString());
  }
  /**
   * Retrieves a set of data to use when testing a given password with a
   * provided configuration.  Each element of the returned array should be an
@@ -928,8 +917,6 @@
    };
  }
  /**
   * Tests the {@code passwordIsAcceptable} method using the provided
   * information.
@@ -966,10 +953,8 @@
    ArrayList<Modification> mods = newArrayList(
        new Modification(REPLACE, Attributes.create("userpassword", password)));
    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
    ModifyOperationBasis modifyOperation =
         new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
         new ModifyOperationBasis(getRootConnection(), nextOperationID(), nextMessageID(),
                             new ArrayList<Control>(),
                             DN.valueOf("uid=test.user,o=test"), mods);
@@ -982,4 +967,3 @@
    validator.finalizePasswordValidator();
  }
}
opendj-server-legacy/src/test/java/org/opends/server/extensions/CryptPasswordStorageSchemeTestCase.java
@@ -131,15 +131,18 @@
  {
    return new Object[][]
    {
      new Object[] { "secret12", "{CRYPT}$1$X40CcMaA$dd3ndknBLcpkED4/RciyD1" },
      new Object[] { "#1 Strong Password!", "{CRYPT}$1$7jHbWKyy$gAmpOSdaYVap55MwsQnK5/" },
      new Object[] { "foo", "{CRYPT}$1$ac/Z7Q3s$5kTVLqMSq9KMqUVyEBfiw0" },
      new Object[] { "secret12", "{CRYPT}$5$miWe9yahchas7aiy$b/6oTh5QF3bqbdIDWmjtdOxD8df75426zTHwF.MJuyB" },
      new Object[] { "foo", "{CRYPT}$5$aZoothaeDai0nooG$5LDMuhK6gWtH6/mrrqZbRc5aIRROfrKri4Tvl/D6Z.0"},
      new Object[] { "#1 Strong Password!", "{CRYPT}$5$aZoothaeDai0nooG$6o0Sbx/RtTA4K/A8uflMsSCid3i7TYktcwWxIp5NFy2"},
      new Object[] { "secret12", "{CRYPT}$6$miWe9yahchas7aiy$RQASn5qZMCu2FDsR69RHk1RoLVi3skFUhS0qGNCo.MymgkYoWAedMji09UzxMFzOj8fW2GnzsXT4RVn9gcNmf0" },
      new Object[] { "#1 Strong Password!", "{CRYPT}$6$p0NJY6r4$VV2JfNtRaTmy8hBtVpdgeIUYQIAUyfdLyhiH6VxzsDIw.28oCsVeMQ5ARiL/PoOambM9dAU3vk4ll8uEB/nnx0"},
      new Object[] { "foo", "{CRYPT}$6$aZoothaeDai0nooG$1K9ePro8ujsqRy/Ag77OVuev8Y8hyN1Jp10S2t9S.1RMtkKn/SbxQbl2MezoL0UJFYjrEzL0zVdO8PcfT3yXS."}
      { "secret12", "{CRYPT}$1$X40CcMaA$dd3ndknBLcpkED4/RciyD1" },
      { "#1 Strong Password!", "{CRYPT}$1$7jHbWKyy$gAmpOSdaYVap55MwsQnK5/" },
      { "foo", "{CRYPT}$1$ac/Z7Q3s$5kTVLqMSq9KMqUVyEBfiw0" },
      { "secret12", "{CRYPT}$5$miWe9yahchas7aiy$b/6oTh5QF3bqbdIDWmjtdOxD8df75426zTHwF.MJuyB" },
      { "foo", "{CRYPT}$5$aZoothaeDai0nooG$5LDMuhK6gWtH6/mrrqZbRc5aIRROfrKri4Tvl/D6Z.0"},
      { "#1 Strong Password!", "{CRYPT}$5$aZoothaeDai0nooG$6o0Sbx/RtTA4K/A8uflMsSCid3i7TYktcwWxIp5NFy2"},
      { "secret12",
 "{CRYPT}$6$miWe9yahchas7aiy$RQASn5qZMCu2FDsR69RHk1RoLVi3skFUhS0qGNCo.MymgkYoWAedMji09UzxMFzOj8fW2GnzsXT4RVn9gcNmf0" },
      { "#1 Strong Password!",
 "{CRYPT}$6$p0NJY6r4$VV2JfNtRaTmy8hBtVpdgeIUYQIAUyfdLyhiH6VxzsDIw.28oCsVeMQ5ARiL/PoOambM9dAU3vk4ll8uEB/nnx0"},
      { "foo",
 "{CRYPT}$6$aZoothaeDai0nooG$1K9ePro8ujsqRy/Ag77OVuev8Y8hyN1Jp10S2t9S.1RMtkKn/SbxQbl2MezoL0UJFYjrEzL0zVdO8PcfT3yXS."}
    };
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/DictionaryPasswordValidatorTestCase.java
@@ -21,26 +21,26 @@
import java.util.HashSet;
import java.util.List;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.annotations.AfterClass;
import org.opends.server.TestCaseUtils;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.opendj.server.config.meta.DictionaryPasswordValidatorCfgDefn;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.types.Attributes;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.Control;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.server.config.meta.DictionaryPasswordValidatorCfgDefn;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.types.Attributes;
import org.opends.server.types.Control;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.types.Modification;
import static org.forgerock.opendj.ldap.ModificationType.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.testng.Assert.*;
@@ -644,10 +644,8 @@
    ArrayList<Modification> mods = newArrayList(
        new Modification(REPLACE, Attributes.create("userpassword", password)));
    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
    ModifyOperationBasis modifyOperation =
         new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
         new ModifyOperationBasis(getRootConnection(), nextOperationID(), nextMessageID(),
                             new ArrayList<Control>(),
                             DN.valueOf("uid=test.user,o=test"), mods);
@@ -660,8 +658,7 @@
    validator.finalizePasswordValidator();
  }
  private DictionaryPasswordValidator initializePasswordValidator(Entry configEntry)
      throws ConfigException, InitializationException {
  private DictionaryPasswordValidator initializePasswordValidator(Entry configEntry) throws Exception {
    return InitializationUtils.initializePasswordValidator(
        new DictionaryPasswordValidator(), configEntry, DictionaryPasswordValidatorCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/ErrorLogAccountStatusNotificationHandlerTestCase.java
@@ -138,7 +138,9 @@
         throws Exception
  {
    InitializationUtils.initializeStatusNotificationHandler(
        new ErrorLogAccountStatusNotificationHandler(), configEntry, ErrorLogAccountStatusNotificationHandlerCfgDefn.getInstance());
        new ErrorLogAccountStatusNotificationHandler(),
        configEntry,
        ErrorLogAccountStatusNotificationHandlerCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java
@@ -702,8 +702,7 @@
    mapper.finalizeIdentityMapper();
  }
  private ExactMatchIdentityMapper initializeIdentityMapper(Entry mapperEntry)
      throws ConfigException, InitializationException {
  private ExactMatchIdentityMapper initializeIdentityMapper(Entry mapperEntry) throws Exception {
    return InitializationUtils.initializeIdentityMapper(
        new ExactMatchIdentityMapper(), mapperEntry, ExactMatchIdentityMapperCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/FileBasedKeyManagerProviderTestCase.java
@@ -289,7 +289,7 @@
    initializeKeyManagerProvider(e);
  }
  private FileBasedKeyManagerProvider initializeKeyManagerProvider(Entry e) throws ConfigException, InitializationException {
  private FileBasedKeyManagerProvider initializeKeyManagerProvider(Entry e) throws Exception {
    return InitializationUtils.initializeKeyManagerProvider(
        new FileBasedKeyManagerProvider(), e, FileBasedKeyManagerProviderCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/FileBasedTrustManagerProviderTestCase.java
@@ -19,16 +19,16 @@
import java.io.File;
import java.io.FileWriter;
import java.util.List;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.server.config.meta.FileBasedTrustManagerProviderCfgDefn;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.server.config.meta.FileBasedTrustManagerProviderCfgDefn;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
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;
import static org.opends.server.util.ServerConstants.*;
@@ -281,7 +281,7 @@
    }
  }
  private FileBasedTrustManagerProvider initializeTrustManagerProvider(Entry e) throws ConfigException, InitializationException {
  private FileBasedTrustManagerProvider initializeTrustManagerProvider(Entry e) throws Exception {
    return InitializationUtils.initializeTrustManagerProvider(
        new FileBasedTrustManagerProvider(), e, FileBasedTrustManagerProviderCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java
@@ -37,6 +37,7 @@
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.forgerock.opendj.ldap.SearchScope.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.util.ServerConstants.*;
@@ -343,7 +344,7 @@
  public void testSearchhasSubordinatesAttrInMatchingFilter(DN entryDN, boolean hasSubs)
         throws Exception
  {
    final SearchRequest request = newSearchRequest(entryDN, SearchScope.BASE_OBJECT, "(hasSubordinates=" + hasSubs + ")")
    final SearchRequest request = newSearchRequest(entryDN, BASE_OBJECT, "(hasSubordinates=" + hasSubs + ")")
        .addAttribute("hasSubordinates");
    InternalSearchOperation searchOperation = getRootConnection().processSearch(request);
    assertEquals(searchOperation.getSearchEntries().size(), 1);
@@ -366,8 +367,8 @@
  public void testSearchhasSubordinatesAttrInNonMatchingFilter(DN entryDN, boolean hasSubs)
         throws Exception
  {
    final SearchRequest request =
        newSearchRequest(entryDN, SearchScope.BASE_OBJECT, "(hasSubordinates=wrong)").addAttribute("hasSubordinates");
    final SearchRequest request = newSearchRequest(entryDN, BASE_OBJECT, "(hasSubordinates=wrong)")
        .addAttribute("hasSubordinates");
    InternalSearchOperation searchOperation = getRootConnection().processSearch(request);
    assertEquals(searchOperation.getSearchEntries().size(), 0);
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/InitializationUtils.java
@@ -61,7 +61,8 @@
    return mapper;
  }
  public static <H extends ExtendedOperationHandler<C>, C extends ExtendedOperationHandlerCfg> H initializeExtendedOperationHandler(
  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;
opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java
@@ -81,6 +81,7 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.forgerock.opendj.server.config.meta.LDAPPassThroughAuthenticationPolicyCfgDefn.MappingPolicy.*;
import static org.opends.server.extensions.LDAPPassThroughAuthenticationPolicyFactory.*;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
import static org.testng.Assert.*;
@@ -522,7 +523,7 @@
      return this;
    }
    MockPolicyCfg withMappedSearchBindPasswordEnvironmentVariable(final String value)
    MockPolicyCfg withMappedSearchBindPasswordEnvVariable(final String value)
    {
      this.mappedSearchBindPasswordEnvVar = value;
      return this;
@@ -1811,19 +1812,24 @@
        { mockCfg().withSecondaryServer("test:1000000"), false },
        // Test mapped search parameters.
        { mockCfg().withMappingPolicy(MappingPolicy.MAPPED_SEARCH), true },
        { mockCfg().withMappingPolicy(MappingPolicy.MAPPED_SEARCH).withMappedSearchBindDN(null).withMappedSearchBindPassword(null), true },
        { mockCfg().withMappingPolicy(MappingPolicy.MAPPED_SEARCH).withMappedSearchBindPassword(null), false },
        { mockCfg().withMappingPolicy(MappingPolicy.MAPPED_SEARCH).withMappedSearchBindPasswordProperty("org.opendj.dummy.property"), false },
        { mockCfg().withMappingPolicy(MappingPolicy.MAPPED_SEARCH).withMappedSearchBindPasswordProperty("java.version"), true },
        { mockCfg().withMappingPolicy(MappingPolicy.MAPPED_SEARCH).withMappedSearchBindPasswordEnvironmentVariable("ORG_OPENDJ_DUMMY_ENVVAR"), false },
        { mockCfg().withMappingPolicy(MappingPolicy.MAPPED_SEARCH).withMappedSearchBindPasswordFile("dummy_file.txt"), false },
        { mockCfg().withMappingPolicy(MappingPolicy.MAPPED_SEARCH).withMappedSearchBindPasswordFile("config/admin-keystore.pin"), true },
        { mockCfgWithPolicy(MAPPED_SEARCH), true },
        { mockCfgWithPolicy(MAPPED_SEARCH).withMappedSearchBindDN(null).withMappedSearchBindPassword(null), true },
        { mockCfgWithPolicy(MAPPED_SEARCH).withMappedSearchBindPassword(null), false },
        { mockCfgWithPolicy(MAPPED_SEARCH).withMappedSearchBindPasswordProperty("org.opendj.dummy.property"), false },
        { mockCfgWithPolicy(MAPPED_SEARCH).withMappedSearchBindPasswordProperty("java.version"), true },
        { mockCfgWithPolicy(MAPPED_SEARCH).withMappedSearchBindPasswordEnvVariable("ORG_OPENDJ_DUMMY_ENVVAR"), false },
        { mockCfgWithPolicy(MAPPED_SEARCH).withMappedSearchBindPasswordFile("dummy_file.txt"), false },
        { mockCfgWithPolicy(MAPPED_SEARCH).withMappedSearchBindPasswordFile("config/admin-keystore.pin"), true },
    };
    // @formatter:on
  }
  private MockPolicyCfg mockCfgWithPolicy(MappingPolicy mappingPolicy)
  {
    return mockCfg().withMappingPolicy(mappingPolicy);
  }
  /**
   * Tests that searches which fail on one server are automatically retried on
   * another within the same LB.
opendj-server-legacy/src/test/java/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java
@@ -341,7 +341,7 @@
    validator.finalizePasswordValidator();
  }
  private LengthBasedPasswordValidator initializePasswordValidator(Entry validatorEntry) throws ConfigException, InitializationException {
  private LengthBasedPasswordValidator initializePasswordValidator(Entry validatorEntry) throws Exception {
    return InitializationUtils.initializePasswordValidator(
        new LengthBasedPasswordValidator(), validatorEntry, LengthBasedPasswordValidatorCfgDefn.getInstance());
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordStorageSchemeTestCase.java
@@ -20,7 +20,6 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.requests.ModifyRequest;
import org.forgerock.opendj.ldap.requests.Requests;
import org.opends.server.TestCaseUtils;
import org.opends.server.api.PasswordStorageScheme;
import org.opends.server.types.Entry;
@@ -35,6 +34,7 @@
import org.testng.annotations.Test;
import static org.forgerock.opendj.ldap.ModificationType.*;
import static org.forgerock.opendj.ldap.requests.Requests.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.testng.Assert.*;
@@ -301,7 +301,7 @@
      PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn);
      final boolean previousValue = p.isAllowPreEncodedPasswords();
      ModifyRequest modifyRequest = Requests.newModifyRequest("cn=Default Password Policy,cn=Password Policies,cn=config")
      ModifyRequest modifyRequest = newModifyRequest("cn=Default Password Policy,cn=Password Policies,cn=config")
          .addModification(REPLACE, "ds-cfg-allow-pre-encoded-passwords", allowPreencoded);
      ModifyOperation modifyOperation = getRootConnection().processModify(modifyRequest);
      assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
opendj-server-legacy/src/test/java/org/opends/server/extensions/RegularExpressionIdentityMapperTestCase.java
@@ -143,8 +143,7 @@
    mapper.initializeIdentityMapper(configuration);
  }
  private RegularExpressionIdentityMapper initializeIdentityMapper(Entry mapperEntry)
      throws ConfigException, InitializationException {
  private RegularExpressionIdentityMapper initializeIdentityMapper(Entry mapperEntry) throws Exception {
    RegularExpressionIdentityMapperCfg configuration = getConfiguration(mapperEntry);
    RegularExpressionIdentityMapper mapper = new RegularExpressionIdentityMapper();
    assertTrue(mapper.isConfigurationAcceptable(configuration, new LinkedList<LocalizableMessage>()));
opendj-server-legacy/src/test/java/org/opends/server/extensions/RepeatedCharactersPasswordValidatorTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/extensions/SaltedSHA512PasswordStorageSchemeTestCase.java
@@ -56,7 +56,8 @@
  {
    return new Object[][]
    {
      new Object[] { "secret", "{SSHA512}8gRXO3lD2fGN3JIhbNJOsh31IRFKnWbDNl+cPH3HoJCkUpxZPG617TnN6Nvl2mVMSBLlzPu2eMpOhCDKoolNG6QCsYf2hppQTAVaqfx25PUJ1ngbuBiNDCpK6Xj5PYZiFwa+cpkY/Pzs77bLn3VMxmHhwa+vowfGhy5RRW+6npQ=" }
      { "secret", "{SSHA512}8gRXO3lD2fGN3JIhbNJOsh31IRFKnWbDNl+cPH3HoJCkUpxZPG617TnN6Nvl2mVMSBLlzPu2eMpOhCD"
                  + "KoolNG6QCsYf2hppQTAVaqfx25PUJ1ngbuBiNDCpK6Xj5PYZiFwa+cpkY/Pzs77bLn3VMxmHhwa+vowfGhy5RRW+6npQ=" }
    };
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java
@@ -27,8 +27,8 @@
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.requests.ModifyRequest;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.server.config.meta.SubjectDNToUserAttributeCertificateMapperCfgDefn;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyOperation;
import org.opends.server.tools.LDAPSearch;
opendj-server-legacy/src/test/java/org/opends/server/extensions/UniqueCharactersPasswordValidatorTestCase.java
@@ -137,9 +137,12 @@
    validator.finalizePasswordValidator();
  }
  private static UniqueCharactersPasswordValidator initializePasswordValidator0(Entry validatorEntry) throws ConfigException, InitializationException {
  private static UniqueCharactersPasswordValidator initializePasswordValidator0(Entry validatorEntry)
        throws ConfigException, InitializationException {
    return initializePasswordValidator(
        new UniqueCharactersPasswordValidator(), validatorEntry, UniqueCharactersPasswordValidatorCfgDefn.getInstance());
        new UniqueCharactersPasswordValidator(),
        validatorEntry,
        UniqueCharactersPasswordValidatorCfgDefn.getInstance());
  }
  /**
opendj-server-legacy/src/test/java/org/opends/server/plugins/AttributeCleanupPluginTestCase.java
@@ -396,7 +396,8 @@
  private ModifyOperationBasis modify(String entryDN, RawModification... rawMods)
  {
    return new ModifyOperationBasis(getRootConnection(), 1, 1, null, ByteString.valueOfUtf8(entryDN), newArrayList(rawMods));
    return new ModifyOperationBasis(
        getRootConnection(), 1, 1, null, ByteString.valueOfUtf8(entryDN), newArrayList(rawMods));
  }
  /**
opendj-server-legacy/src/test/java/org/opends/server/plugins/LDAPADListPluginTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/plugins/PasswordPolicyImportPluginTestCase.java
opendj-server-legacy/src/test/java/org/opends/server/protocols/asn1/GSERParserTestCase.java
@@ -12,38 +12,27 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2013-2014 Manuel Gaupp
 * Portions Copyright 2014-2015 ForgeRock AS.
 * Portions Copyright 2014-2016 ForgeRock AS.
 */
package org.opends.server.protocols.asn1;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
import org.opends.server.protocols.asn1.GSERParser;
import org.opends.server.protocols.asn1.GSERException;
import org.opends.server.DirectoryServerTestCase;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
 * This class tests the GSERParser.
 */
/** This class tests the GSERParser. */
public class GSERParserTestCase extends DirectoryServerTestCase
{
  /**
   * Try to create a GSER Parser with <CODE>null</CODE> as parameter.
   */
  @Test(expectedExceptions = { NullPointerException.class })
  /** Try to create a GSER Parser with <CODE>null</CODE> as parameter. */
  @Test(expectedExceptions = NullPointerException.class)
  public void testGSERParserInitWithNull () throws Exception
  {
    GSERParser parser = new GSERParser(null);
    new GSERParser(null);
  }
  /**
   * Test the <CODE>hasNext</CODE> method.
   */
  /** Test the <CODE>hasNext</CODE> method. */
  @Test
  public void testHasNext() throws Exception
  {
@@ -53,11 +42,7 @@
    assertFalse(parser.hasNext());
  }
  /**
   * Test the <CODE>skipSP</CODE> method.
   */
  /** Test the <CODE>skipSP</CODE> method. */
  @Test
  public void testSkipSP() throws Exception
  {
@@ -70,11 +55,7 @@
    }
  }
  /**
   * Test the <CODE>skipMSP</CODE> method.
   */
  /** Test the <CODE>skipMSP</CODE> method. */
  @Test
  public void testSkipMSP() throws Exception
  {
@@ -87,23 +68,15 @@
    }
  }
  /**
   * Verify that <CODE>skipMSP</CODE> requires at least one space.
   */
  @Test(expectedExceptions = { GSERException.class })
  /** Verify that <CODE>skipMSP</CODE> requires at least one space. */
  @Test(expectedExceptions = GSERException.class)
  public void testSkipMSPwithZeroSpaces() throws Exception
  {
    GSERParser parser = new GSERParser("42");
    parser.skipMSP();
  }
  /**
   * Create data for the <CODE>testSequence</CODE> test case.
   */
  /** Create data for the <CODE>testSequence</CODE> test case. */
  @DataProvider(name="sequenceValues")
  public Object[][] createSequenceValues()
  {
@@ -119,11 +92,7 @@
    };
  }
  /**
   * Test sequence parsing.
   */
  /** Test sequence parsing. */
  @Test(dataProvider="sequenceValues")
  public void testSequence(String value, boolean expectedResult) throws Exception
  {
@@ -148,11 +117,7 @@
    assertEquals(expectedResult,result);
  }
  /**
   * Create data for the <CODE>testString</CODE> test case.
   */
  /** Create data for the <CODE>testString</CODE> test case. */
  @DataProvider(name="stringValues")
  public Object[][] createStringValues()
  {
@@ -167,11 +132,7 @@
    };
  }
  /**
   * Test the parsing of String values.
   */
  /** Test the parsing of String values. */
  @Test(dataProvider="stringValues")
  public void testString(String value, boolean expectedResult) throws Exception
  {
@@ -192,11 +153,7 @@
    assertEquals(expectedResult,result);
  }
  /**
   * Create data for the <CODE>testInteger</CODE> test case.
   */
  /** Create data for the <CODE>testInteger</CODE> test case. */
  @DataProvider(name="integerValues")
  public Object[][] createIntegerValues()
  {
@@ -211,11 +168,7 @@
    };
  }
  /**
   * Create data for the <CODE>testBigInteger</CODE> test case.
   */
  /** Create data for the <CODE>testBigInteger</CODE> test case. */
  @DataProvider(name="bigIntegerValues")
  public Object[][] createBigIntegerValues()
  {
@@ -231,11 +184,7 @@
    };
  }
  /**
   * Test the parsing of Integer values.
   */
  /** Test the parsing of Integer values. */
  @Test(dataProvider="integerValues")
  public void testInteger(String value, boolean expectedResult) throws Exception
  {
@@ -256,11 +205,7 @@
    assertEquals(expectedResult,result);
  }
  /**
   * Test the parsing of BigInteger values.
   */
  /** Test the parsing of BigInteger values. */
  @Test(dataProvider="bigIntegerValues")
  public void testBigInteger(String value, boolean expectedResult) throws Exception
  {
@@ -281,11 +226,7 @@
    assertEquals(expectedResult,result);
  }
  /**
   * Create data for the <CODE>testNamedValueIdentifier</CODE> test case.
   */
  /** Create data for the <CODE>testNamedValueIdentifier</CODE> test case. */
  @DataProvider(name="namedValueIdentifierValues")
  public Object[][] createNamedValueIdentifierValues()
  {
@@ -299,11 +240,7 @@
    };
  }
  /**
   * Test the parsing of NamedValue identifiers.
   */
  /** Test the parsing of NamedValue identifiers. */
  @Test(dataProvider="namedValueIdentifierValues")
  public void testNamedValueIdentifier(String value, boolean expectedResult) throws Exception
  {
@@ -324,11 +261,7 @@
    assertEquals(expectedResult,result);
  }
  /**
   * Create data for the <CODE>testIdentifiedChoiceIdentifier</CODE> test case.
   */
  /** Create data for the <CODE>testIdentifiedChoiceIdentifier</CODE> test case. */
  @DataProvider(name="identifiedChoicdeIdentifierValues")
  public Object[][] createIdentifiedChoicdeIdentifierValues()
  {
@@ -342,11 +275,7 @@
    };
  }
  /**
   * Test the parsing of IdentifiedChoice identifiers.
   */
  /** Test the parsing of IdentifiedChoice identifiers. */
  @Test(dataProvider="identifiedChoicdeIdentifierValues")
  public void testIdentifiedChoicdeIdentifier(String value, boolean expectedResult) throws Exception
  {
opendj-server-legacy/src/test/java/org/opends/server/protocols/internal/InternalSearchOperationTestCase.java
@@ -76,7 +76,8 @@
  public void testConstructor1WithListener() throws Exception
  {
    SearchRequest request = newSearchRequest(DN.rootDN(), SearchScope.BASE_OBJECT);
    new InternalSearchOperation(getRootConnection(), nextOperationID(), nextMessageID(), request, new TestInternalSearchListener());
    new InternalSearchOperation(getRootConnection(), nextOperationID(), nextMessageID(),
        request, new TestInternalSearchListener());
  }
opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/ASN1ByteChannelReaderTestCase.java
@@ -12,22 +12,19 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2006-2009 Sun Microsystems, Inc.
 * Portions Copyright 2014-2015 ForgeRock AS.
 * Portions Copyright 2014-2016 ForgeRock AS.
 */
package org.opends.server.protocols.ldap;
import org.forgerock.opendj.io.ASN1Reader;
import org.opends.server.protocols.ldap.ASN1ByteChannelReader;
import org.testng.annotations.Test;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.channels.Channels;
import java.nio.channels.IllegalBlockingModeException;
/**
 * Test class for ASN1ByteChannelReader.
 */
import org.forgerock.opendj.io.ASN1Reader;
import org.testng.annotations.Test;
/** Test class for ASN1ByteChannelReader. */
public class ASN1ByteChannelReaderTestCase extends ASN1ReaderTestCase
{
  @Override
@@ -48,7 +45,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeShortArrayAsNull()
      throws Exception
  {
@@ -62,7 +59,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeShortArrayAsInteger()
      throws Exception
  {
@@ -76,7 +73,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeShortArrayAsEnumerated()
      throws Exception
  {
@@ -90,7 +87,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeShortArrayAsBoolean()
      throws Exception
  {
@@ -104,7 +101,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions  = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeShortArrayAsOctetString()
      throws Exception
  {
@@ -118,7 +115,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeShortArrayAsSequence()
      throws Exception
  {
@@ -132,7 +129,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeLengthMismatchArrayAsBoolean()
      throws Exception
  {
@@ -146,7 +143,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeLengthMismatchArrayAsInteger()
      throws Exception
  {
@@ -160,7 +157,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeLengthMismatchArrayAsEnumerated()
      throws Exception
  {
@@ -174,7 +171,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions  = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeLengthMismatchArrayAsOctetString()
      throws Exception
  {
@@ -188,7 +185,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeTruncatedLengthArrayAsBoolean()
      throws Exception
  {
@@ -202,7 +199,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeTruncatedLengthArrayAsInteger()
      throws Exception
  {
@@ -216,7 +213,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeTruncatedLengthArrayAsEnumerated()
      throws Exception
  {
@@ -230,7 +227,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeTruncatedLengthArrayAsNull()
      throws Exception
  {
@@ -244,7 +241,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions  = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeTruncatedLengthArrayAsOctetString()
      throws Exception
  {
@@ -258,7 +255,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeTruncatedLengthArrayAsSequence()
      throws Exception
  {
@@ -272,7 +269,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testDecodeSequencePrematureEof()
      throws Exception
  {
@@ -285,7 +282,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Override
  @Test(expectedExceptions = { IllegalBlockingModeException.class })
  @Test(expectedExceptions = IllegalBlockingModeException.class)
  public void testSkipElementIncompleteRead()
      throws Exception
  {
opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LdapTestCase.java
@@ -23,13 +23,13 @@
import java.util.Iterator;
import java.util.List;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.server.config.meta.LDAPConnectionHandlerCfgDefn;
import org.forgerock.opendj.server.config.server.LDAPConnectionHandlerCfg;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
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;
import org.opends.server.types.Entry;
opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestModifyDNRequestProtocolOp.java
@@ -12,71 +12,44 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2006-2008 Sun Microsystems, Inc.
 * Portions Copyright 2014-2015 ForgeRock AS.
 * Portions Copyright 2014-2016 ForgeRock AS.
 */
package org.opends.server.protocols.ldap;
import org.forgerock.opendj.io.*;
import org.opends.server.types.LDAPException;
import static org.opends.server.util.ServerConstants.*;
import static org.testng.Assert.*;
import org.forgerock.opendj.io.ASN1;
import org.forgerock.opendj.io.ASN1Reader;
import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ByteStringBuilder;
import static org.opends.server.util.ServerConstants.EOL;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.types.LDAPException;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
/**
 * This class defines a set of tests for the
 * org.opends.server.protocol.ldap.ModifyDNRequestProtocolOp class.
 */
public class TestModifyDNRequestProtocolOp extends DirectoryServerTestCase {
  /**
   * The protocol op type for modify DN requests.
   */
  /** The protocol op type for modify DN requests. */
  public static final byte OP_TYPE_MODIFY_DN_REQUEST = 0x6C;
  /**
   * The protocol op type for modify DN responses.
   */
  /** The protocol op type for modify DN responses. */
  public static final byte OP_TYPE_MODIFY_DN_RESPONSE = 0x6D;
  /**
   * The DN for modify DN requests in this test case.
   */
  private static final ByteString dn =
      ByteString.valueOfUtf8("dc=example,dc=com");
  /**
   * The alt DN for modify DN requests in this test case.
   */
  private static final ByteString altDn =
      ByteString.valueOfUtf8("dc=alt,dc=example,dc=com");
  /**
   * The new DN for modify DN requests in this test case.
   */
  private static final ByteString newRdn =
      ByteString.valueOfUtf8("dc=example-new");
  /**
   * The alt new DN for modify DN requests in this test case.
   */
  private static final ByteString altNewRdn =
      ByteString.valueOfUtf8("ou=alt,dc=example-new");
  /**
   * The new superiour DN for modify DN requests in this test case.
   */
  private static final ByteString newSuperiorDn =
      ByteString.valueOfUtf8("dc=widget,dc=com");
  /**
   * The alt new superiour DN for modify DN requests in this test case.
   */
  private static final ByteString altNewSuperiorDn =
      ByteString.valueOfUtf8("dc=alt,dc=widget,dc=com");
  /** The DN for modify DN requests in this test case. */
  private static final ByteString dn = ByteString.valueOfUtf8("dc=example,dc=com");
  /** The alt DN for modify DN requests in this test case. */
  private static final ByteString altDn = ByteString.valueOfUtf8("dc=alt,dc=example,dc=com");
  /** The new DN for modify DN requests in this test case. */
  private static final ByteString newRdn = ByteString.valueOfUtf8("dc=example-new");
  /** The alt new DN for modify DN requests in this test case. */
  private static final ByteString altNewRdn = ByteString.valueOfUtf8("ou=alt,dc=example-new");
  /** The new superiour DN for modify DN requests in this test case. */
  private static final ByteString newSuperiorDn = ByteString.valueOfUtf8("dc=widget,dc=com");
  /** The alt new superiour DN for modify DN requests in this test case. */
  private static final ByteString altNewSuperiorDn = ByteString.valueOfUtf8("dc=alt,dc=widget,dc=com");
  /**
   * Test to make sure the class processes the right LDAP op type.
@@ -283,16 +256,15 @@
  {
    ModifyDNRequestProtocolOp modifyRequest;
    StringBuilder buffer = new StringBuilder();
    StringBuilder key = new StringBuilder();
    modifyRequest = new ModifyDNRequestProtocolOp(dn, newRdn, true,
                                                  newSuperiorDn);
    modifyRequest = new ModifyDNRequestProtocolOp(dn, newRdn, true, newSuperiorDn);
    modifyRequest.toString(buffer);
    key.append("ModifyDNRequest(dn=").append(dn).append(", newRDN=").append(newRdn).append(", ").append("deleteOldRDN=").append(true).append(", newSuperior=")
        .append(newSuperiorDn).append(")");
    String expected =
        "ModifyDNRequest(dn=" + dn + ", newRDN=" + newRdn + ", " + "deleteOldRDN=" + true + ", newSuperior="
            + newSuperiorDn + ")";
    assertEquals(buffer.toString(), key.toString());
    assertEquals(buffer.toString(), expected);
  }
  /**
opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java
@@ -120,7 +120,8 @@
          "objectClass: organization",
          "entryuuid: " + stringUID(1));
      replServer = newReplicationServer(replServerId, addSequenceLength * 5 + 100, "dependencyTestAddModDelDependencyTestDb");
      replServer = newReplicationServer(
          replServerId, addSequenceLength * 5 + 100, "dependencyTestAddModDelDependencyTestDb");
      ReplicationBroker broker = openReplicationSession(
          baseDN, brokerId, 1000, replServer.getReplicationPort(), 1000, CLEAN_DB_GENERATION_ID);
@@ -348,7 +349,8 @@
          "objectClass: top",
          "objectClass: organization");
      replServer = newReplicationServer(replServerId, 5 * addSequenceLength + 100, "dependencyTestAddDelAddDependencyTestDb");
      replServer = newReplicationServer(
          replServerId, 5 * addSequenceLength + 100, "dependencyTestAddDelAddDependencyTestDb");
      ReplicationBroker broker = openReplicationSession(
          baseDN, brokerId, 100, replServer.getReplicationPort(), 1000, CLEAN_DB_GENERATION_ID);
@@ -452,7 +454,8 @@
          "objectClass: top",
          "objectClass: organization");
      replServer = newReplicationServer(replServerId, 5 * addSequenceLength + 100, "dependencyTestAddModdnDependencyTestDb");
      replServer = newReplicationServer(
          replServerId, 5 * addSequenceLength + 100, "dependencyTestAddModdnDependencyTestDb");
      ReplicationBroker broker = openReplicationSession(
          baseDN, brokerId, 100, replServer.getReplicationPort(), 1000, CLEAN_DB_GENERATION_ID);
opendj-server-legacy/src/test/java/org/opends/server/replication/ProtocolWindowTest.java
@@ -136,7 +136,8 @@
      AddMsg addMsg =  (AddMsg) msg;
      Operation receivedOp = addMsg.createOperation(connection);
      assertEquals(OperationType.ADD.compareTo(receivedOp.getOperationType()), 0, "The received Replication message is not an ADD msg");
      assertEquals(OperationType.ADD.compareTo(receivedOp.getOperationType()), 0,
          "The received Replication message is not an ADD msg");
      assertEquals(addMsg.getDN(), personEntry.getName(),
        "The received ADD Replication message is not for the excepted DN");
opendj-server-legacy/src/test/java/org/opends/server/replication/ReplicationTestCase.java
@@ -850,8 +850,10 @@
  private static ReplicationMsg waitForSpecificMsgs(Session session, ReplicationBroker broker, Class<?>... msgTypes)
      throws Exception
  {
    assertTrue(session != null || broker != null, "One of Session or ReplicationBroker parameter must not be null");
    assertTrue(session == null || broker == null, "Only one of Session or ReplicationBroker parameter must not be null");
    assertTrue(session != null || broker != null,
        "One of Session or ReplicationBroker parameter must not be null");
    assertTrue(session == null || broker == null,
        "Only one of Session or ReplicationBroker parameter must not be null");
    List<Class<?>> msgTypes2 = Arrays.asList(msgTypes);
@@ -913,7 +915,8 @@
    });
  }
  protected void waitConnected(int dsId, int rsId, int rsPort, LDAPReplicationDomain rd, String msg) throws InterruptedException
  protected void waitConnected(int dsId, int rsId, int rsPort, LDAPReplicationDomain rd, String msg)
      throws InterruptedException
  {
    final int secTimeout = 30;
    int nSec = 0;
opendj-server-legacy/src/test/java/org/opends/server/replication/common/CSNTest.java
@@ -12,7 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2006-2009 Sun Microsystems, Inc.
 * Portions Copyright 2013-2015 ForgeRock AS.
 * Portions Copyright 2013-2016 ForgeRock AS.
 */
package org.opends.server.replication.common;
@@ -28,16 +28,11 @@
import static org.testng.Assert.*;
/**
 * Test {@link CSN} and {@link CSNGenerator}.
 */
/** Test {@link CSN} and {@link CSNGenerator}. */
@SuppressWarnings("javadoc")
public class CSNTest extends ReplicationTestCase
{
  /**
   * Create CSN Data.
   */
  /** Create CSN Data. */
  @DataProvider(name = "csnData")
  public Object[][] createConstructorData() {
    long time = 0x12ABC;
@@ -64,9 +59,7 @@
    new CSN(time,   seq,   id+1);
  }
  /**
   * Test toString and constructor from String.
   */
  /** Test toString and constructor from String. */
 @Test(dataProvider = "csnData")
 public void csnEncodeDecode(long time, int seq, int id, String str) throws Exception
 {
@@ -80,9 +73,7 @@
       "The encoding/decoding of CSN is not reversible for toString()");
 }
  /**
   * Create CSN.
   */
  /** Create CSN. */
  @DataProvider(name = "createCSN")
  public Object[][] createCSNData()
  {
@@ -137,10 +128,10 @@
  @Test(dataProvider = "createCSN")
  public void csnCompare(CSN csn1, CSN csn2, CSN csn3, CSN csn4, CSN csn5) throws Exception
  {
    assertTrue(CSN.compare(null, null) == 0);
    assertEquals(CSN.compare(null, null), 0);
    assertTrue(CSN.compare(null, csn2) < 0);
    assertTrue(CSN.compare(csn1, null) > 0);
    assertTrue(CSN.compare(csn1, csn2) == 0);
    assertEquals(CSN.compare(csn1, csn2), 0);
    assertTrue(CSN.compare(csn1, csn3) < 0);
    assertTrue(CSN.compare(csn3, csn1) > 0);
    assertTrue(CSN.compare(csn1, csn4) < 0);
@@ -193,7 +184,6 @@
    assertFalse(csn1.isNewerThanOrEqualTo(csn5));
  }
  /**
   * Create a {@link CSNGenerator}, then call {@link CSNGenerator#newCSN()} and
   * {@link CSNGenerator#adjust()}
@@ -258,9 +248,7 @@
    assertTrue(csn1.compareTo(csn2) != 0 );
  }
  /**
   * Test the difference in seq num between 2 CSNs.
   */
  /** Test the difference in seq num between 2 CSNs. */
  @Test
  public void csnDiffSeqNum() throws Exception
  {
@@ -368,5 +356,4 @@
      assertEquals(csn1.hashCode(), csn2.hashCode());
    }
  }
}
opendj-server-legacy/src/test/java/org/opends/server/replication/common/MultiDomainServerStateTest.java
@@ -54,7 +54,8 @@
      { "o=test1:", "o=test1:;" },
      { ";;o=test1:;;", ":;o=test1:;" },
      { cookie, cookie + ";" },
      { "o=test1:" + csn1 + ";o=test2:" + csn2 + ";;o=test6:", ":;o=test1:" + csn1 + ";o=test2:" + csn2 + ";o=test6:;" },
      { "o=test1:" + csn1 + ";o=test2:" + csn2 + ";;o=test6:",
        ":;o=test1:" + csn1 + ";o=test2:" + csn2 + ";o=test6:;" },
    };
  }
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java
@@ -824,7 +824,9 @@
    List<Modification> mods2 = new LinkedList<>(mods);
    replayModifies(entry, hist, 12, mods);
    assertEquals(hist.encodeAndPurge(), attrDel);
    assertThat(mods).as("DEL one value, del by Replace of the same attribute was not correct").containsExactly(mod1, mod2);
    assertThat(mods)
      .as("DEL one value, del by Replace of the same attribute was not correct")
      .containsExactly(mod1, mod2);
    // Replay the same modifs again
    replayModifies(entry, hist, 12, mods2);
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java
@@ -536,7 +536,9 @@
       * DS2 sends reset gen id order with bad gen id: DS1 should go in bad gen id status
       * (from degraded status this time)
       */
      resetGenId(ds2, -1); // -1 to allow next step full update and flush RS db so that DS1 can reconnect after full update
      // -1 to allow next step full update and flush RS db so that DS1 can reconnect after full
      // update
      resetGenId(ds2, -1);
      waitUntilStatusEquals(ds1, ServerStatus.BAD_GEN_ID_STATUS);
      bw.pause();
@@ -1120,7 +1122,8 @@
   * @param domain The domain whose status we want to test
   * @param expectedStatus The expected domain status
   */
  private void waitUntilStatusEquals(final LDAPReplicationDomain domain, final ServerStatus expectedStatus) throws Exception
  private void waitUntilStatusEquals(final LDAPReplicationDomain domain, final ServerStatus expectedStatus)
      throws Exception
  {
    assertNotNull(domain);
    assertNotNull(expectedStatus);
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
@@ -55,6 +55,7 @@
import static org.assertj.core.api.Assertions.*;
import static org.opends.messages.ReplicationMessages.*;
import static org.opends.server.replication.common.AssuredMode.*;
import static org.opends.server.replication.protocol.OperationContext.*;
import static org.opends.server.replication.protocol.ProtocolVersion.*;
import static org.opends.server.util.CollectionUtils.*;
@@ -480,6 +481,7 @@
    Attribute eattr2 = Attributes.create("namingcontexts", "eav naming contexts");
    List<Attribute> entryAttrList = newArrayList(eattr1, eattr2);
    // @Checkstyle:off
    return new Object[][] {
        { csn1, "dc=test", mods1, false, AssuredMode.SAFE_DATA_MODE, (byte) 0, null },
        { csn2, "dc=cn2", mods1, true, AssuredMode.SAFE_READ_MODE, (byte) 1, entryAttrList },
@@ -492,6 +494,7 @@
        { csn2, "dc=test with long mod", mods4, true, AssuredMode.SAFE_READ_MODE, (byte) 120, entryAttrList },
        { csn2, "dc=testDsaOperation", mods5, true, AssuredMode.SAFE_DATA_MODE, (byte) 99, null },
        };
    // @Checkstyle:on
  }
  /**
@@ -652,6 +655,7 @@
    Attribute eattr2 = Attributes.create("namingcontexts", "eav naming contexts");
    List<Attribute> entryAttrList = newArrayList(eattr1, eattr2);
    // @Checkstyle:off
    return new Object[][] {
        {"dc=test,dc=com", "dc=new", "11111111-1111-1111-1111-111111111111", "22222222-2222-2222-2222-222222222222", false, "dc=change", mods1, false, AssuredMode.SAFE_DATA_MODE, (byte)0, null},
        {"dc=test,dc=com", "dc=new", "33333333-3333-3333-3333-333333333333", "44444444-4444-4444-4444-444444444444", true, "dc=change", mods2, true, AssuredMode.SAFE_READ_MODE, (byte)1, entryAttrList},
@@ -659,6 +663,7 @@
        {"dc=delete,dc=an,dc=entry,dc=with,dc=a,dc=long dn",
                   "dc=new", "77777777-7777-7777-7777-777777777777", "88888888-8888-8888-8888-888888888888",true, null, mods4, true, AssuredMode.SAFE_DATA_MODE, (byte)99, entryAttrList},
        };
    // @Checkstyle:on
  }
  /**
@@ -985,16 +990,13 @@
        "ldaps://host:port/dc=foobar2??sub?(sn=Another Entry 2)");
    DSInfo dsInfo1 = new DSInfo(13, "", 26, 154631, ServerStatus.FULL_UPDATE_STATUS,
      false, AssuredMode.SAFE_DATA_MODE, (byte)12, (byte)132, urls1, new HashSet<String>(), new HashSet<String>(), (short)-1);
      false, SAFE_DATA_MODE, (byte)12, (byte)132, urls1, new HashSet<String>(), new HashSet<String>(), (short)-1);
    DSInfo dsInfo2 = new DSInfo(-436, "", 493, -227896, ServerStatus.DEGRADED_STATUS,
      true, AssuredMode.SAFE_READ_MODE, (byte)-7, (byte)-265, urls2, new HashSet<String>(), new HashSet<String>(), (short)-1);
      true,  SAFE_READ_MODE, (byte)-7, (byte)-265, urls2, new HashSet<String>(), new HashSet<String>(), (short)-1);
    DSInfo dsInfo3 = new DSInfo(2436, "", 591, 0, ServerStatus.NORMAL_STATUS,
      false, AssuredMode.SAFE_READ_MODE, (byte)17, (byte)0, urls3, new HashSet<String>(), new HashSet<String>(), (short)-1);
      false, SAFE_READ_MODE, (byte)17, (byte)0, urls3, new HashSet<String>(), new HashSet<String>(), (short)-1);
    DSInfo dsInfo4 = new DSInfo(415, "", 146, 0, ServerStatus.BAD_GEN_ID_STATUS,
      true, AssuredMode.SAFE_DATA_MODE, (byte)2, (byte)15, urls4, new HashSet<String>(), new HashSet<String>(), (short)-1);
      true,  SAFE_DATA_MODE, (byte)2, (byte)15, urls4, new HashSet<String>(), new HashSet<String>(), (short)-1);
    Set<DSInfo> dsList1 = newHashSet(dsInfo1);
    Set<DSInfo> dsList2 = newHashSet();
@@ -1264,9 +1266,11 @@
  @DataProvider(name = "createEntryMsgV3")
  public Object[][] createEntryMsgV3()
  {
    // @Checkstyle:off
    return new Object[][] {
        {"0c32003100646e3a206f753d50656f706c652c64633d6578616d706c652c64633d636f6d0a6f626a656374436c6173733a20746f700a6f626a656374436c6173733a206f7267616e697a6174696f6e616c556e69740a6f753a2050656f706c650a656e747279555549443a2032313131313131312d313131312d313131312d313131312d3131313131313131313131320a0a00",
          1, 2}};
    // @Checkstyle:on
  }
  @Test(dataProvider = "createEntryMsgV3")
  public void entryMsgPDUV3(String pduV3, int dest, int sender) throws Exception
@@ -1284,9 +1288,11 @@
  @DataProvider(name = "createErrorMsgV3")
  public Object[][] createErrorMsgV3()
  {
    // @Checkstyle:off
    return new Object[][] {
        {"0e380039003135313338383933004f6e207375666669782064633d6578616d706c652c64633d636f6d2c207265706c69636174696f6e2073657276657220392070726573656e7465642067656e65726174696f6e2049443d2d31207768656e2065787065637465642067656e65726174696f6e2049443d343800",
          9, 8, "On suffix dc=example,dc=com, replication server 9 presented generation ID=-1 when expected generation ID=48"}};
    // @Checkstyle:on
  }
  @Test(dataProvider = "createErrorMsgV3")
  public void errorMsgPDUV3(
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java
@@ -66,6 +66,7 @@
import static org.forgerock.opendj.ldap.requests.Requests.*;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.replication.common.AssuredMode.*;
import static org.opends.server.replication.protocol.OperationContext.*;
import static org.opends.server.replication.protocol.ProtocolVersion.*;
import static org.opends.server.util.CollectionUtils.*;
@@ -136,17 +137,17 @@
    List<Attribute> eclIncludes = getEntryAttributes();
    return new Object[][] {
        { csn1, "dc=test", mods1, false, AssuredMode.SAFE_DATA_MODE, (byte)0, null},
        { csn2, "dc=cn2", mods1, true, AssuredMode.SAFE_READ_MODE, (byte)1, eclIncludes},
        { csn1, "dc=test", mods1, false, SAFE_DATA_MODE, (byte)0, null},
        { csn2, "dc=cn2", mods1, true, SAFE_READ_MODE, (byte)1, eclIncludes},
        { csn2, "dc=test with a much longer dn in case this would "
               + "make a difference", mods1, true, AssuredMode.SAFE_READ_MODE, (byte)3, null},
        { csn2, "dc=test, cn=with a, o=more complex, ou=dn", mods1, false, AssuredMode.SAFE_READ_MODE, (byte)5, eclIncludes},
        { csn2, "cn=use\\, backslash", mods1, true, AssuredMode.SAFE_READ_MODE, (byte)3, null},
        { csn2, "dc=test with several mod", mods2, false, AssuredMode.SAFE_DATA_MODE, (byte)16, eclIncludes},
        { csn2, "dc=test with several values", mods3, false, AssuredMode.SAFE_READ_MODE, (byte)3, null},
        { csn2, "dc=test with long mod", mods4, true, AssuredMode.SAFE_READ_MODE, (byte)120, eclIncludes},
        { csn2, "dc=testDsaOperation", mods5, true, AssuredMode.SAFE_DATA_MODE, (byte)99, null},
        { csn3, "dc=serverIdLargerThan32767", mods1, true, AssuredMode.SAFE_READ_MODE, (byte)1, null},
               + "make a difference", mods1, true, SAFE_READ_MODE, (byte)3, null},
        { csn2, "dc=test, cn=with a, o=more complex, ou=dn", mods1, false, SAFE_READ_MODE, (byte)5, eclIncludes},
        { csn2, "cn=use\\, backslash", mods1, true, SAFE_READ_MODE, (byte)3, null},
        { csn2, "dc=test with several mod", mods2, false, SAFE_DATA_MODE, (byte)16, eclIncludes},
        { csn2, "dc=test with several values", mods3, false, SAFE_READ_MODE, (byte)3, null},
        { csn2, "dc=test with long mod", mods4, true, SAFE_READ_MODE, (byte)120, eclIncludes},
        { csn2, "dc=testDsaOperation", mods5, true, SAFE_DATA_MODE, (byte)99, null},
        { csn3, "dc=serverIdLargerThan32767", mods1, true, SAFE_READ_MODE, (byte)1, null},
        };
  }
@@ -221,7 +222,7 @@
    assertEquals(msg.isAssured(), isAssured);
    // Check assured mode
    assertEquals(msg.getAssuredMode(), AssuredMode.SAFE_DATA_MODE);
    assertEquals(msg.getAssuredMode(), SAFE_DATA_MODE);
    msg.setAssuredMode(assuredMode);
    assertEquals(msg.getAssuredMode(), assuredMode);
@@ -364,12 +365,12 @@
    List<Attribute> entryAttrList = getEntryAttributes();
    return new Object[][] {
        {"dc=test,dc=com", "dc=new", false, "dc=change", mods1, false, AssuredMode.SAFE_DATA_MODE, (byte)0, entryAttrList},
        {"dc=test,dc=com", "dc=new", true, "dc=change", mods2, true, AssuredMode.SAFE_READ_MODE, (byte)1, null},
        {"dc=test,dc=com", "dc=new", false, "dc=change", mods1, false, SAFE_DATA_MODE, (byte)0, entryAttrList},
        {"dc=test,dc=com", "dc=new", true, "dc=change", mods2, true, SAFE_READ_MODE, (byte)1, null},
        // testNG does not like null argument so use "" for the newSuperior instead of null
        {"dc=test,dc=com", "dc=new", false, "", mods3, true, AssuredMode.SAFE_READ_MODE, (byte)3, entryAttrList},
        {"dc=test,dc=com", "dc=new", false, "", mods3, true, SAFE_READ_MODE, (byte)3, entryAttrList},
        {"dc=delete,dc=an,dc=entry,dc=with,dc=a,dc=long dn",
                   "dc=new", true, "", mods4, true, AssuredMode.SAFE_DATA_MODE, (byte)99, null},
                   "dc=new", true, "", mods4, true, SAFE_DATA_MODE, (byte)99, null},
        };
  }
@@ -441,9 +442,9 @@
  {
    List<Attribute> entryAttrList = getEntryAttributes();
    return new Object[][] {
        {"dc=example,dc=com", false, AssuredMode.SAFE_DATA_MODE, (byte)0, entryAttrList},
        {"o=test", true, AssuredMode.SAFE_READ_MODE, (byte)1, null},
        {"o=group,dc=example,dc=com", true, AssuredMode.SAFE_READ_MODE, (byte)3, entryAttrList}};
        {"dc=example,dc=com", false, SAFE_DATA_MODE, (byte)0, entryAttrList},
        {"o=test", true, SAFE_READ_MODE, (byte)1, null},
        {"o=group,dc=example,dc=com", true, SAFE_READ_MODE, (byte)3, entryAttrList}};
  }
  @Test(enabled=true,dataProvider = "createAddData")
@@ -810,15 +811,15 @@
    Set<String> a4 = newHashSet();
    DSInfo dsInfo1 = new DSInfo(13, "dsHost1:111", 26, 154631, ServerStatus.FULL_UPDATE_STATUS,
      false, AssuredMode.SAFE_DATA_MODE, (byte)12, (byte)132, urls1, a1, a1, (short)1);
      false, SAFE_DATA_MODE, (byte)12, (byte)132, urls1, a1, a1, (short)1);
    DSInfo dsInfo2 = new DSInfo(-436, "dsHost2:222", 493, -227896, ServerStatus.DEGRADED_STATUS,
      true, AssuredMode.SAFE_READ_MODE, (byte)-7, (byte)-265, urls2, a2, a2, (short)2);
      true, SAFE_READ_MODE, (byte)-7, (byte)-265, urls2, a2, a2, (short)2);
    DSInfo dsInfo3 = new DSInfo(2436, "dsHost3:333", 591, 0, ServerStatus.NORMAL_STATUS,
      false, AssuredMode.SAFE_READ_MODE, (byte)17, (byte)0, urls3, a3, a3, (short)3);
      false, SAFE_READ_MODE, (byte)17, (byte)0, urls3, a3, a3, (short)3);
    DSInfo dsInfo4 = new DSInfo(415, "dsHost4:444", 146, 0, ServerStatus.BAD_GEN_ID_STATUS,
      true, AssuredMode.SAFE_DATA_MODE, (byte)2, (byte)15, urls4, a4, a4, (short)4);
      true, SAFE_DATA_MODE, (byte)2, (byte)15, urls4, a4, a4, (short)4);
    DSInfo dsInfo5 = new DSInfo(452436, "dsHost5:555", 45591, 0, ServerStatus.NORMAL_STATUS,
      false, AssuredMode.SAFE_READ_MODE, (byte)17, (byte)0, urls3, a1, a1, (short)5);
      false, SAFE_READ_MODE, (byte)17, (byte)0, urls3, a1, a1, (short)5);
    List<DSInfo> dsList1 = newArrayList(dsInfo1);
    List<DSInfo> dsList2 = newArrayList();
@@ -894,12 +895,12 @@
    Set<String> a3 = newHashSet("dc", "uid");
    return new Object[][]{
      {ServerStatus.NORMAL_STATUS, urls1, true, AssuredMode.SAFE_DATA_MODE, (byte)1, a1},
      {ServerStatus.DEGRADED_STATUS, urls2, false, AssuredMode.SAFE_READ_MODE, (byte)123, a2},
      {ServerStatus.FULL_UPDATE_STATUS, urls3, false, AssuredMode.SAFE_DATA_MODE, (byte)111, a3},
      {ServerStatus.NORMAL_STATUS, urls4, true, AssuredMode.SAFE_READ_MODE, (byte)-1, a1},
      {ServerStatus.DEGRADED_STATUS, urls5, true, AssuredMode.SAFE_DATA_MODE, (byte)97, a2},
      {ServerStatus.FULL_UPDATE_STATUS, urls6, false, AssuredMode.SAFE_READ_MODE, (byte)-13, a3}
      {ServerStatus.NORMAL_STATUS, urls1, true, SAFE_DATA_MODE, (byte)1, a1},
      {ServerStatus.DEGRADED_STATUS, urls2, false, SAFE_READ_MODE, (byte)123, a2},
      {ServerStatus.FULL_UPDATE_STATUS, urls3, false, SAFE_DATA_MODE, (byte)111, a3},
      {ServerStatus.NORMAL_STATUS, urls4, true, SAFE_READ_MODE, (byte)-1, a1},
      {ServerStatus.DEGRADED_STATUS, urls5, true, SAFE_DATA_MODE, (byte)97, a2},
      {ServerStatus.FULL_UPDATE_STATUS, urls6, false, SAFE_READ_MODE, (byte)-13, a3}
    };
  }
opendj-server-legacy/src/test/java/org/opends/server/replication/server/AssuredReplicationServerTest.java
@@ -16,35 +16,6 @@
 */
package org.opends.server.replication.server;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.*;
import java.util.concurrent.TimeoutException;
import org.assertj.core.api.SoftAssertions;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.server.config.meta.ReplicationDomainCfgDefn.AssuredType;
import org.forgerock.opendj.server.config.server.ReplicationDomainCfg;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.replication.ReplicationTestCase;
import org.opends.server.replication.common.*;
import org.opends.server.replication.plugin.DomainFakeCfg;
import org.opends.server.replication.plugin.MultimasterReplication;
import org.opends.server.replication.protocol.*;
import org.opends.server.replication.service.ReplicationDomain;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.HostPort;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static java.util.Arrays.*;
import static org.assertj.core.api.Assertions.*;
@@ -52,6 +23,57 @@
import static org.opends.server.util.CollectionUtils.*;
import static org.testng.Assert.*;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.UUID;
import java.util.concurrent.TimeoutException;
import org.assertj.core.api.SoftAssertions;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.server.config.meta.ReplicationDomainCfgDefn.AssuredType;
import org.forgerock.opendj.server.config.server.ReplicationDomainCfg;
import org.opends.server.TestCaseUtils;
import org.opends.server.replication.ReplicationTestCase;
import org.opends.server.replication.common.AssuredMode;
import org.opends.server.replication.common.CSNGenerator;
import org.opends.server.replication.common.DSInfo;
import org.opends.server.replication.common.RSInfo;
import org.opends.server.replication.common.ServerState;
import org.opends.server.replication.common.ServerStatus;
import org.opends.server.replication.plugin.DomainFakeCfg;
import org.opends.server.replication.plugin.MultimasterReplication;
import org.opends.server.replication.protocol.AckMsg;
import org.opends.server.replication.protocol.DeleteMsg;
import org.opends.server.replication.protocol.ErrorMsg;
import org.opends.server.replication.protocol.ReplServerStartMsg;
import org.opends.server.replication.protocol.ReplSessionSecurity;
import org.opends.server.replication.protocol.ReplicationMsg;
import org.opends.server.replication.protocol.Session;
import org.opends.server.replication.protocol.TopologyMsg;
import org.opends.server.replication.protocol.UpdateMsg;
import org.opends.server.replication.service.ReplicationDomain;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.HostPort;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
 * Test Server part of the assured feature in both safe data and
 * safe read modes.
@@ -614,17 +636,26 @@
    public void runAsserts()
    {
      final SoftAssertions softly = new SoftAssertions();
      softly.assertThat(domain.getAssuredSrSentUpdates()).as("sentUpdates").isEqualTo(sentUpdates);
      softly.assertThat(domain.getAssuredSrAcknowledgedUpdates()).as("acknowledgedUpdates").isEqualTo(acknowledgedUpdates);
      softly.assertThat(domain.getAssuredSrNotAcknowledgedUpdates()).as("notAcknowledgedUpdates").isEqualTo(notAcknowledgedUpdates);
      softly.assertThat(domain.getAssuredSrTimeoutUpdates()).as("timeoutUpdates").isEqualTo(timeoutUpdates);
      softly.assertThat(domain.getAssuredSrWrongStatusUpdates()).as("wrongStatusUpdates").isEqualTo(wrongStatusUpdates);
      softly.assertThat(domain.getAssuredSrReplayErrorUpdates()).as("replayErrorUpdates").isEqualTo(replayErrorUpdates);
      softly.assertThat(domain.getAssuredSrServerNotAcknowledgedUpdates()).as("serverNotAcknowledgedUpdates").isEqualTo(
          serverNotAcknowledgedUpdates);
      softly.assertThat(domain.getAssuredSrReceivedUpdates()).as("receivedUpdates").isEqualTo(receivedUpdates);
      softly.assertThat(domain.getAssuredSrReceivedUpdatesAcked()).as("receivedUpdatesAcked").isEqualTo(receivedUpdatesAcked);
      softly.assertThat(domain.getAssuredSrReceivedUpdatesNotAcked()).as("receivedUpdatesNotAcked").isEqualTo(receivedUpdatesNotAcked);
      softly.assertThat(domain.getAssuredSrSentUpdates())
          .as("sentUpdates").isEqualTo(sentUpdates);
      softly.assertThat(domain.getAssuredSrAcknowledgedUpdates())
          .as("acknowledgedUpdates").isEqualTo(acknowledgedUpdates);
      softly.assertThat(domain.getAssuredSrNotAcknowledgedUpdates())
          .as("notAcknowledgedUpdates").isEqualTo(notAcknowledgedUpdates);
      softly.assertThat(domain.getAssuredSrTimeoutUpdates())
          .as("timeoutUpdates").isEqualTo(timeoutUpdates);
      softly.assertThat(domain.getAssuredSrWrongStatusUpdates())
          .as("wrongStatusUpdates").isEqualTo(wrongStatusUpdates);
      softly.assertThat(domain.getAssuredSrReplayErrorUpdates())
          .as("replayErrorUpdates").isEqualTo(replayErrorUpdates);
      softly.assertThat(domain.getAssuredSrServerNotAcknowledgedUpdates())
          .as("serverNotAcknowledgedUpdates").isEqualTo(serverNotAcknowledgedUpdates);
      softly.assertThat(domain.getAssuredSrReceivedUpdates())
          .as("receivedUpdates").isEqualTo(receivedUpdates);
      softly.assertThat(domain.getAssuredSrReceivedUpdatesAcked())
          .as("receivedUpdatesAcked").isEqualTo(receivedUpdatesAcked);
      softly.assertThat(domain.getAssuredSrReceivedUpdatesNotAcked())
          .as("receivedUpdatesNotAcked").isEqualTo(receivedUpdatesNotAcked);
      softly.assertAll();
    }
@@ -1170,7 +1201,7 @@
      long sendUpdateTime = System.currentTimeMillis() - startTime;
      assertThat(sendUpdateTime).isLessThan(MAX_SEND_UPDATE_TIME);
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
      sleepWhileUpdatePropagates(500);
      if (mainDsGid == DEFAULT_GID)
      {
        // Check monitoring values (check that ack has been correctly received)
@@ -1188,7 +1219,7 @@
      assertEquals(fakeRd1.getAssuredSdServerTimeoutUpdates().size(), 0);
      // Sanity check
      Thread.sleep(500);           // Let time to update to reach other servers
      sleepWhileUpdatePropagates(500);
      fakeRd1.assertReceivedUpdates(0);
      if (otherFakeDS)
      {
@@ -1212,16 +1243,36 @@
  {
    return new Object[][]
    {
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO}
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO,
                                             OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO,
                                             DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO,
                                             OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO,
                                             DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO,
                                             DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO}
    };
  }
@@ -1229,8 +1280,10 @@
   * See testSafeDataLevelHigh comment.
   */
  @Test(dataProvider = "testSafeDataLevelHighPrecommitProvider", groups = "slow", enabled = true)
  public void testSafeDataLevelHighPrecommit(int sdLevel, boolean otherFakeDS, int otherFakeDsGid, long otherFakeDsGenId,
    int fakeRs1Gid, long fakeRs1GenId, int fakeRs1Scen, int fakeRs2Gid, long fakeRs2GenId, int fakeRs2Scen,
  public void testSafeDataLevelHighPrecommit(int sdLevel,
      boolean otherFakeDS, int otherFakeDsGid, long otherFakeDsGenId,
      int fakeRs1Gid, long fakeRs1GenId, int fakeRs1Scen,
      int fakeRs2Gid, long fakeRs2GenId, int fakeRs2Scen,
    int fakeRs3Gid, long fakeRs3GenId, int fakeRs3Scen) throws Exception
  {
    testSafeDataLevelHigh(sdLevel, otherFakeDS, otherFakeDsGid, otherFakeDsGenId,
@@ -1246,35 +1299,90 @@
  {
    return new Object[][]
    {
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, OTHER_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, TIMEOUT_RS_SCENARIO, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, OTHER_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, TIMEOUT_RS_SCENARIO, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO}
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID,
                                                          DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID,
                                                          DEFAULT_GENID, TIMEOUT_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                          DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                          OTHER_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                          DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                          DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, OTHER_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, OTHER_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, OTHER_GID,
                                                        OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, OTHER_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, TIMEOUT_RS_SCENARIO, OTHER_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 2, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                          OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                          DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID,
                                                          DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID,
                                                          DEFAULT_GENID, TIMEOUT_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                          DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                          OTHER_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                          DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                          DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, TIMEOUT_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, OTHER_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, OTHER_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, REPLY_OK_RS_SCENARIO, OTHER_GID,
                                                        OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, DEFAULT_GENID, TIMEOUT_RS_SCENARIO, OTHER_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, OTHER_GID, OTHER_GENID, TIMEOUT_RS_SCENARIO, OTHER_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                        DEFAULT_GENID, REPLY_OK_RS_SCENARIO},
      { 3, true, DEFAULT_GID, DEFAULT_GENID, DEFAULT_GID, OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                          OTHER_GENID, REPLY_OK_RS_SCENARIO, DEFAULT_GID,
                                                          DEFAULT_GENID, REPLY_OK_RS_SCENARIO}
    };
  }
@@ -1282,8 +1390,10 @@
   * See testSafeDataLevelHigh comment.
   */
  @Test(dataProvider = "testSafeDataLevelHighNightlyProvider", groups = "slow", enabled = true)
  public void testSafeDataLevelHighNightly(int sdLevel, boolean otherFakeDS, int otherFakeDsGid, long otherFakeDsGenId,
    int fakeRs1Gid, long fakeRs1GenId, int fakeRs1Scen, int fakeRs2Gid, long fakeRs2GenId, int fakeRs2Scen,
  public void testSafeDataLevelHighNightly(int sdLevel,
      boolean otherFakeDS, int otherFakeDsGid, long otherFakeDsGenId,
      int fakeRs1Gid, long fakeRs1GenId, int fakeRs1Scen,
      int fakeRs2Gid, long fakeRs2GenId, int fakeRs2Scen,
    int fakeRs3Gid, long fakeRs3GenId, int fakeRs3Scen) throws Exception
  {
    testSafeDataLevelHigh(sdLevel, otherFakeDS, otherFakeDsGid, otherFakeDsGenId,
@@ -1486,20 +1596,23 @@
      int acknowledgedUpdates = fakeRd1.getAssuredSdAcknowledgedUpdates();
      int timeoutUpdates = fakeRd1.getAssuredSdTimeoutUpdates();
      Map<Integer,Integer> serverErrors = fakeRd1.getAssuredSdServerTimeoutUpdates();
      // Compute the list of servers that are eligible for receiving an assured update
      List<Integer> eligibleServers = computeEligibleServersSafeData(fakeRs1Gid, fakeRs1GenId, fakeRs2Gid, fakeRs2GenId, fakeRs3Gid, fakeRs3GenId);
      // Compute the list of servers that are eligible for receiving an assured update and that are expected to effectively ack the update
      List<Integer> expectedServers = computeExpectedServersSafeData(fakeRs1Gid, fakeRs1GenId, fakeRs1Scen, fakeRs2Gid, fakeRs2GenId, fakeRs2Scen, fakeRs3Gid, fakeRs3GenId, fakeRs3Scen);
      List<Integer> eligibleServers = computeEligibleServersSafeData(
          fakeRs1Gid, fakeRs1GenId, fakeRs2Gid, fakeRs2GenId, fakeRs3Gid, fakeRs3GenId);
      List<Integer> expectedServers = computeExpectedServersSafeData(fakeRs1Gid, fakeRs1GenId, fakeRs1Scen,
                                                                     fakeRs2Gid, fakeRs2GenId, fakeRs2Scen,
                                                                     fakeRs3Gid, fakeRs3GenId, fakeRs3Scen);
      // Send update
      long startTime = System.currentTimeMillis();
      fakeRd1.sendNewFakeUpdate();
      long sendUpdateTime = System.currentTimeMillis() - startTime;
      sleepWhileUpdatePropagates(500);
      // Check
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked and let time the update to reach other servers
      checkTimeAndMonitoringSafeData(1, acknowledgedUpdates, timeoutUpdates, serverErrors, sendUpdateTime, nWishedServers, eligibleServers, expectedServers);
      checkWhatHasBeenReceivedSafeData(1, otherFakeDS, otherFakeDsGenId, fakeRs1GenId, fakeRs2GenId, fakeRs3GenId, expectedServers);
      checkTimeAndMonitoringSafeData(1, acknowledgedUpdates, timeoutUpdates, serverErrors,
          sendUpdateTime, nWishedServers, eligibleServers, expectedServers);
      checkWhatHasBeenReceivedSafeData(1, otherFakeDS, otherFakeDsGenId,
          fakeRs1GenId, fakeRs2GenId, fakeRs3GenId, expectedServers);
      /***********************************************************************
       * Send update from DS 1 (2 fake RSs available) and check what happened
@@ -1517,20 +1630,22 @@
      acknowledgedUpdates = fakeRd1.getAssuredSdAcknowledgedUpdates();
      timeoutUpdates = fakeRd1.getAssuredSdTimeoutUpdates();
      serverErrors = fakeRd1.getAssuredSdServerTimeoutUpdates();
      // Compute the list of servers that are eligible for receiving an assured update
      eligibleServers = computeEligibleServersSafeData(fakeRs1Gid, fakeRs1GenId, fakeRs2Gid, fakeRs2GenId, -1, -1L);
      // Compute the list of servers that are eligible for receiving an assured update and that are expected to effectively ack the update
      expectedServers = computeExpectedServersSafeData(fakeRs1Gid, fakeRs1GenId, fakeRs1Scen, fakeRs2Gid, fakeRs2GenId, fakeRs2Scen, -1, -1L, -1);
      expectedServers = computeExpectedServersSafeData(fakeRs1Gid, fakeRs1GenId, fakeRs1Scen,
                                                       fakeRs2Gid, fakeRs2GenId, fakeRs2Scen,
                                                       -1, -1L, -1);
      // Send update
      startTime = System.currentTimeMillis();
      fakeRd1.sendNewFakeUpdate();
      sendUpdateTime = System.currentTimeMillis() - startTime;
      sleepWhileUpdatePropagates(500);
      // Check
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked and let time the update to reach other servers
      checkTimeAndMonitoringSafeData(2, acknowledgedUpdates, timeoutUpdates, serverErrors, sendUpdateTime, nWishedServers, eligibleServers, expectedServers);
      checkWhatHasBeenReceivedSafeData(2, otherFakeDS, otherFakeDsGenId, fakeRs1GenId, fakeRs2GenId, -1L, expectedServers);
      checkTimeAndMonitoringSafeData(2, acknowledgedUpdates, timeoutUpdates, serverErrors, sendUpdateTime,
          nWishedServers, eligibleServers, expectedServers);
      checkWhatHasBeenReceivedSafeData(2, otherFakeDS, otherFakeDsGenId,
          fakeRs1GenId, fakeRs2GenId, -1L, expectedServers);
      /***********************************************************************
       * Send update from DS 1 (1 fake RS available) and check what happened
@@ -1548,10 +1663,9 @@
      acknowledgedUpdates = fakeRd1.getAssuredSdAcknowledgedUpdates();
      timeoutUpdates = fakeRd1.getAssuredSdTimeoutUpdates();
      serverErrors = fakeRd1.getAssuredSdServerTimeoutUpdates();
      // Compute the list of servers that are eligible for receiving an assured update
      eligibleServers = computeEligibleServersSafeData(fakeRs1Gid, fakeRs1GenId, -1, -1L, -1, -1L);
      // Compute the list of servers that are eligible for receiving an assured update and that are expected to effectively ack the update
      expectedServers = computeExpectedServersSafeData(fakeRs1Gid, fakeRs1GenId, fakeRs1Scen, -1, -1L, -1, -1, -1L, -1);
      expectedServers = computeExpectedServersSafeData(
          fakeRs1Gid, fakeRs1GenId, fakeRs1Scen, -1, -1L, -1, -1, -1L, -1);
      // Send update
      startTime = System.currentTimeMillis();
@@ -1559,8 +1673,9 @@
      sendUpdateTime = System.currentTimeMillis() - startTime;
      // Check
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked and let time the update to reach other servers
      checkTimeAndMonitoringSafeData(3, acknowledgedUpdates, timeoutUpdates, serverErrors, sendUpdateTime, nWishedServers, eligibleServers, expectedServers);
      sleepWhileUpdatePropagates(500);
      checkTimeAndMonitoringSafeData(3, acknowledgedUpdates, timeoutUpdates, serverErrors, sendUpdateTime,
          nWishedServers, eligibleServers, expectedServers);
      checkWhatHasBeenReceivedSafeData(3, otherFakeDS, otherFakeDsGenId, fakeRs1GenId, -1L, -1L, expectedServers);
      /***********************************************************************
@@ -1579,9 +1694,7 @@
      acknowledgedUpdates = fakeRd1.getAssuredSdAcknowledgedUpdates();
      timeoutUpdates = fakeRd1.getAssuredSdTimeoutUpdates();
      serverErrors = fakeRd1.getAssuredSdServerTimeoutUpdates();
      // Compute the list of servers that are eligible for receiving an assured update
      eligibleServers = computeEligibleServersSafeData(-1, -1L, -1, -1L, -1, -1L);
      // Compute the list of servers that are eligible for receiving an assured update and that are expected to effectively ack the update
      expectedServers = computeExpectedServersSafeData(-1, -1L, -1, -1, -1L, -1, -1, -1L, -1);
      // Send update
@@ -1590,8 +1703,9 @@
      sendUpdateTime = System.currentTimeMillis() - startTime;
      // Check
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked and let time the update to reach other servers
      checkTimeAndMonitoringSafeData(4, acknowledgedUpdates, timeoutUpdates, serverErrors, sendUpdateTime, nWishedServers, eligibleServers, expectedServers);
      sleepWhileUpdatePropagates(500);
      checkTimeAndMonitoringSafeData(4, acknowledgedUpdates, timeoutUpdates, serverErrors, sendUpdateTime,
          nWishedServers, eligibleServers, expectedServers);
      checkWhatHasBeenReceivedSafeData(4, otherFakeDS, otherFakeDsGenId, -1L, -1L, -1L, expectedServers);
    } finally
    {
@@ -1600,11 +1714,22 @@
  }
  /**
   * Sleep a while:
   * counters are updated just after sending thread is unblocked
   * and let time for the update to reach other servers.
   */
  private void sleepWhileUpdatePropagates(int millis) throws InterruptedException
  {
    Thread.sleep(millis);
  }
  /**
   * Check that the DSs and the fake RSs of the topology have received/acked
   * what is expected according to the test step (the number of updates).
   * -1 for a gen id means no need to test the matching fake RS
   */
  private void checkWhatHasBeenReceivedSafeData(int nSentUpdates, boolean otherFakeDS, long otherFakeDsGenId, long fakeRs1GenId, long fakeRs2GenId, long fakeRs3GenId, List<Integer> expectedServers)
  private void checkWhatHasBeenReceivedSafeData(int nSentUpdates, boolean otherFakeDS, long otherFakeDsGenId,
      long fakeRs1GenId, long fakeRs2GenId, long fakeRs3GenId, List<Integer> expectedServers)
  {
    final FakeReplicationDomain fakeRd1 = fakeRDs[1];
    final FakeReplicationDomain fakeRd2 = fakeRDs[2];
@@ -1642,8 +1767,9 @@
   * Check the time the sending of the safe data assured update took and the monitoring
   * values according to the test configuration.
   */
  private void checkTimeAndMonitoringSafeData(int nSentUpdates, int prevNAckUpdates, int prevNTimeoutUpdates, Map<Integer,Integer> prevNServerErrors, long sendUpdateTime,
    int nWishedServers, List<Integer> eligibleServers, List<Integer> expectedServers)
  private void checkTimeAndMonitoringSafeData(int nSentUpdates, int prevNAckUpdates, int prevNTimeoutUpdates,
      Map<Integer, Integer> prevNServerErrors, long sendUpdateTime, int nWishedServers,
      List<Integer> eligibleServers, List<Integer> expectedServers)
  {
    final FakeReplicationDomain fakeRd1 = fakeRDs[1];
    assertEquals(fakeRd1.getAssuredSdSentUpdates(), nSentUpdates);
@@ -1687,7 +1813,8 @@
    // Check monitoring values (check that ack has been correctly received)
    assertEquals(fakeRd1.getAssuredSdAcknowledgedUpdates(), prevNAckUpdates + 1);
    assertEquals(fakeRd1.getAssuredSdTimeoutUpdates(), prevNTimeoutUpdates);
    checkServerErrors(fakeRd1.getAssuredSdServerTimeoutUpdates(), prevNServerErrors, null); // Should have same value as previous one
    // Should have same value as previous one
    checkServerErrors(fakeRd1.getAssuredSdServerTimeoutUpdates(), prevNServerErrors, null);
  }
  private void checkTimeOutOccured(long sendUpdateTime, int prevNAckUpdates,
@@ -1723,7 +1850,10 @@
   * <li>if expectedServersInError is null or empty, both map should be equal</li>
   * </ul>
   */
  private void checkServerErrors(Map<Integer,Integer> measuredServerErrors, Map<Integer,Integer> prevServerErrors, Set<Integer> expectedServersInError)
  private void checkServerErrors(
      Map<Integer, Integer> measuredServerErrors,
      Map<Integer, Integer> prevServerErrors,
      Set<Integer> expectedServersInError)
  {
    if (expectedServersInError != null)
    {
@@ -1776,11 +1906,13 @@
  }
  /**
   * Compute the list of servers that are eligible for receiving a safe data
   * assured update according to their group id and generation id. If -1 is
   * used, the server is out of scope
   * Compute the list of servers that are eligible for receiving a safe data assured update
   * according to their group id and generation id.
   * <p>
   * If -1 is used, the server is out of scope
   */
  private List<Integer> computeEligibleServersSafeData(int fakeRs1Gid, long fakeRs1GenId, int fakeRs2Gid, long fakeRs2GenId, int fakeRs3Gid, long fakeRs3GenId)
  private List<Integer> computeEligibleServersSafeData(
      int fakeRs1Gid, long fakeRs1GenId, int fakeRs2Gid, long fakeRs2GenId, int fakeRs3Gid, long fakeRs3GenId)
  {
    List<Integer> eligibleServers = new ArrayList<>(3);
    if (areGroupAndGenerationIdOk(fakeRs1Gid, fakeRs1GenId))
@@ -1811,9 +1943,10 @@
  }
  /**
   * Compute the list of fake servers that are eligible for receiving a safe
   * data assured update and that are expected to effectively ack the update. If
   * -1 is used, the server is out of scope
   * Compute the list of fake servers that are eligible for receiving a safe data assured update
   * and that are expected to effectively ack the update.
   * <p>
   * If -1 is used, the server is out of scope.
   */
  private List<Integer> computeExpectedServersSafeData(
      int rs1Gid, long rs1GenId, int rs1Scen,
@@ -2028,7 +2161,7 @@
      assertThat(sendUpdateTime).isLessThan(MAX_SEND_UPDATE_TIME);
      // Check monitoring values (check that ack has been correctly received)
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
      sleepWhileUpdatePropagates(500);
      assertEquals(fakeRd1.getAssuredSdSentUpdates(), 1);
      assertEquals(fakeRd1.getAssuredSdAcknowledgedUpdates(), 1);
      assertEquals(fakeRd1.getAssuredSdTimeoutUpdates(), 0);
@@ -2083,7 +2216,7 @@
      assertThat(sendUpdateTime).isLessThan(MAX_SEND_UPDATE_TIME);
      // Check monitoring values (check that ack has been correctly received)
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
      sleepWhileUpdatePropagates(500);
      checkDSSentAndAcked(fakeRd1, 1);
      fakeRd1.assertReceivedUpdates(0);
@@ -2113,7 +2246,7 @@
      assertThat(sendUpdateTime).isLessThan(MAX_SEND_UPDATE_TIME);
      // Check monitoring values (check that ack has been correctly received)
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
      sleepWhileUpdatePropagates(500);
      final FakeReplicationDomain fakeRd2 = fakeRDs[2];
      checkDSSentAndAcked(fakeRd1, 2);
@@ -2143,7 +2276,7 @@
      assertThat(sendUpdateTime).isLessThan(MAX_SEND_UPDATE_TIME);
      // Check monitoring values (check that ack has been correctly received)
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
      sleepWhileUpdatePropagates(500);
      checkDSSentAndAcked(fakeRd1, 3);
      checkDSReceivedAndAcked(fakeRd2, 2);
@@ -2173,7 +2306,7 @@
      assertThat(sendUpdateTime).isLessThan(MAX_SEND_UPDATE_TIME);
      // Check monitoring values (check that ack has been correctly received)
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
      sleepWhileUpdatePropagates(500);
      checkDSSentAndAcked(fakeRd1, 4);
      // Sanity check
@@ -2202,7 +2335,7 @@
      assertThat(sendUpdateTime).isLessThan(MAX_SEND_UPDATE_TIME);
      // Check monitoring values (check that ack has been correctly received)
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
      sleepWhileUpdatePropagates(500);
      checkDSSentAndAcked(fakeRd1, 5);
      fakeRd1.assertReceivedUpdates(0);
@@ -2256,30 +2389,39 @@
    // Other additional DS generation id
    objectArrayList = addPossibleParameters(objectArrayList, DEFAULT_GENID, OTHER_GENID);
    // Other additional DS scenario
    objectArrayList = addPossibleParameters(objectArrayList, REPLY_OK_DS_SCENARIO, TIMEOUT_DS_SCENARIO, REPLAY_ERROR_DS_SCENARIO);
    objectArrayList = addPossibleParameters(objectArrayList,
        REPLY_OK_DS_SCENARIO, TIMEOUT_DS_SCENARIO, REPLAY_ERROR_DS_SCENARIO);
    // Other additional RS group id
    objectArrayList = addPossibleParameters(objectArrayList, DEFAULT_GID, OTHER_GID);
    // Other additional RS generation id
    objectArrayList = addPossibleParameters(objectArrayList, DEFAULT_GENID, OTHER_GENID);
    // Other additional RS scenario
    objectArrayList = addPossibleParameters(objectArrayList, REPLY_OK_RS_SCENARIO, TIMEOUT_RS_SCENARIO, DS_TIMEOUT_RS_SCENARIO_SAFE_READ, DS_WRONG_STATUS_RS_SCENARIO_SAFE_READ, DS_REPLAY_ERROR_RS_SCENARIO_SAFE_READ);
    objectArrayList = addPossibleParameters(objectArrayList,
        REPLY_OK_RS_SCENARIO, TIMEOUT_RS_SCENARIO, DS_TIMEOUT_RS_SCENARIO_SAFE_READ,
        DS_WRONG_STATUS_RS_SCENARIO_SAFE_READ, DS_REPLAY_ERROR_RS_SCENARIO_SAFE_READ);
    return toDataProvider(objectArrayList);
  }
  /**
   * Test safe read mode with only one real RS deployment.
   * Test that the RS is able to acknowledge SR updates with level higher than 1
   * and also to return errors is some errors occur.
   * - 1 main fake DS connected to the RS
   * - 1 other fake DS connected to the RS, with same GID as RS and same GENID as RS and always acking without error
   * - 1 other fake DS connected to the RS, with GID, GENID, scenario...changed through the provider
   * - 1 fake RS connected to the RS (emulating one fake DS connected to it), with same GID as RS and always acking without error
   * - 1 other fake RS connected to the RS (emulating one fake DS connected to it), with GID scenario...changed through the provider
   *
   * Test safe read mode with only one real RS deployment. Test that the RS is able to acknowledge
   * SR updates with level higher than 1 and also to return errors is some errors occur.
   * <ul>
   * <li>1 main fake DS connected to the RS</li>
   * <li>1 other fake DS connected to the RS, with same GID as RS and same GENID as RS and always
   * acking without error</li>
   * <li>1 other fake DS connected to the RS, with GID, GENID, scenario...changed through the
   * provider</li>
   * <li>1 fake RS connected to the RS (emulating one fake DS connected to it), with same GID as RS
   * and always acking without error</li>
   * <li>1 other fake RS connected to the RS (emulating one fake DS connected to it), with GID
   * scenario...changed through the provider</li>
   * <ul>
   * All possible combinations tested thanks to the provider.
   * <p>
   * Note: it is working but disabled as 17.5 minutes to run
   */
  @Test(dataProvider = "testSafeReadOneRSComplexProvider", groups = "slow", enabled = false) // Working but disabled as 17.5 minutes to run
  @Test(dataProvider = "testSafeReadOneRSComplexProvider", groups = "slow", enabled = false)
  public void testSafeReadOneRSComplex(int otherFakeDsGid, long otherFakeDsGenId, int otherFakeDsScen,
    int otherFakeRsGid, long otherFakeRsGenId, int otherFakeRsScen) throws Exception
  {
@@ -2352,7 +2494,8 @@
      boolean shouldSeeTimeout = false;
      boolean shouldSeeWrongStatus = false;
      boolean shouldSeeReplayError = false;
      // Booleans to tell if we expect to see the ds, rs and virtual ds connected to fake rs in server id error list
      // Booleans to tell if we expect to see the ds, rs and virtual ds connected to fake rs
      // in server id error list
      boolean shouldSeeDsIdInError = false;
      boolean shouldSeeRsIdInError = false;
      boolean shouldSeeDsRsIdInError = false;
@@ -2416,13 +2559,14 @@
        assertBetweenInclusive(sendUpdateTime, SMALL_TIMEOUT, LONG_TIMEOUT);
      }
      // Sleep a while as counters are updated just after sending thread is unblocked
      Thread.sleep(500);
      sleepWhileUpdatePropagates(500);
      // Check monitoring values in DS 1
      final SafeReadAssertions srAssertsRD1 = fakeRd1.newSafeReadAssertions().sentUpdates(1);
      if ((otherFakeDsGid == DEFAULT_GID && otherFakeDsGenId == DEFAULT_GENID && otherFakeDsScen != REPLY_OK_DS_SCENARIO)
         || (otherFakeRsGid == DEFAULT_GID && otherFakeRsGenId == DEFAULT_GENID && otherFakeRsScen != REPLY_OK_RS_SCENARIO))
      if ((otherFakeDsGid == DEFAULT_GID && otherFakeDsGenId == DEFAULT_GENID
                                         && otherFakeDsScen != REPLY_OK_DS_SCENARIO)
         || (otherFakeRsGid == DEFAULT_GID && otherFakeRsGenId == DEFAULT_GENID
                                           && otherFakeRsScen != REPLY_OK_RS_SCENARIO))
      {
        srAssertsRD1.notAcknowledgedUpdates(1);
      }
@@ -2478,7 +2622,8 @@
        + "> inclusive");
  }
  private void addExpectedErrors(SafeReadAssertions srAsserts, boolean dsInError, boolean rsInError, boolean dsRsInError)
  private void addExpectedErrors(
      SafeReadAssertions srAsserts, boolean dsInError, boolean rsInError, boolean dsRsInError)
  {
    if (dsInError)
    {
@@ -2537,16 +2682,12 @@
      int numberOfRealRSs = 4;
      // Create real RS 1, 2, 3
      rs1 = createReplicationServer(RS1_ID, DEFAULT_GID, SMALL_TIMEOUT,
        testCase, numberOfRealRSs);
      rs2 = createReplicationServer(RS2_ID, DEFAULT_GID, SMALL_TIMEOUT,
        testCase, numberOfRealRSs);
      rs3 = createReplicationServer(RS3_ID, DEFAULT_GID, SMALL_TIMEOUT,
        testCase, numberOfRealRSs);
      rs1 = createReplicationServer(RS1_ID, DEFAULT_GID, SMALL_TIMEOUT, testCase, numberOfRealRSs);
      rs2 = createReplicationServer(RS2_ID, DEFAULT_GID, SMALL_TIMEOUT, testCase, numberOfRealRSs);
      rs3 = createReplicationServer(RS3_ID, DEFAULT_GID, SMALL_TIMEOUT, testCase, numberOfRealRSs);
      // Create real RS 4 (different GID 2)
      rs4 = createReplicationServer(RS4_ID, OTHER_GID_BIS, SMALL_TIMEOUT,
        testCase, numberOfRealRSs);
      rs4 = createReplicationServer(RS4_ID, OTHER_GID_BIS, SMALL_TIMEOUT, testCase, numberOfRealRSs);
      /*
       * Start DS 1 that will send assured updates
@@ -2649,7 +2790,7 @@
      assertThat(sendUpdateTime).isLessThan(MAX_SEND_UPDATE_TIME);
      // Check monitoring values (check that ack has been correctly received)
      Thread.sleep(1000); // Sleep a while as counters are updated just after sending thread is unblocked
      sleepWhileUpdatePropagates(1000);
      checkDSSentAndAcked(fakeRd1, 1);
@@ -2678,7 +2819,7 @@
      assertThat(sendUpdateTime).isLessThan(MAX_SEND_UPDATE_TIME);
      // Check monitoring values (check that ack has been correctly received)
      Thread.sleep(1000); // Sleep a while as counters are updated just after sending thread is unblocked
      sleepWhileUpdatePropagates(1000);
      checkDSSentAndAcked(fakeRd1, 2);
@@ -2764,10 +2905,8 @@
      int numberOfRealRSs = 2;
      // Create real RS 1, 2
      rs1 = createReplicationServer(RS1_ID, DEFAULT_GID, SMALL_TIMEOUT,
        testCase, numberOfRealRSs);
      rs2 = createReplicationServer(RS2_ID, OTHER_GID, SMALL_TIMEOUT,
        testCase, numberOfRealRSs);
      rs1 = createReplicationServer(RS1_ID, DEFAULT_GID, SMALL_TIMEOUT, testCase, numberOfRealRSs);
      rs2 = createReplicationServer(RS2_ID, OTHER_GID, SMALL_TIMEOUT, testCase, numberOfRealRSs);
      /*
       * Start DSs with GID=DEFAULT_GID, connected to RS1
@@ -2808,7 +2947,7 @@
      assertThat(sendUpdateTime).isLessThan(MAX_SEND_UPDATE_TIME);
      // Check monitoring values (check that ack has been correctly received)
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
      sleepWhileUpdatePropagates(500);
      checkDSSentAndAcked(fakeRDs[1], 1);
      checkDSReceivedAndAcked(fakeRDs[2], 1);
@@ -2865,7 +3004,8 @@
      int numberOfRealRSs = 2;
      // Create real RS 1, 2
      rs1 = createReplicationServer(RS1_ID, DEFAULT_GID, SMALL_TIMEOUT + 1000, // Be sure DS2 timeout is seen from DS1
      // Be sure DS2 timeout is seen from DS1
      rs1 = createReplicationServer(RS1_ID, DEFAULT_GID, SMALL_TIMEOUT + 1000,
        testCase, numberOfRealRSs);
      rs2 = createReplicationServer(RS2_ID, DEFAULT_GID, SMALL_TIMEOUT,
        testCase, numberOfRealRSs);
@@ -2908,7 +3048,7 @@
      }
      // Check monitoring values (check that ack has been correctly received)
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
      sleepWhileUpdatePropagates(500);
      final FakeReplicationDomain fakeRd2 = fakeRDs[2];
      if (fakeDsIsEligible)
@@ -3027,7 +3167,7 @@
      // Wait for DS2 being degraded
      expectStatusForDS(fakeRd1, ServerStatus.DEGRADED_STATUS, FDS2_ID);
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
      sleepWhileUpdatePropagates(500);
      fakeRd1.newSafeReadAssertions()
          .sentUpdates(4)
          .notAcknowledgedUpdates(4)
@@ -3051,7 +3191,7 @@
      // RS should ack quickly as DS2 degraded and not eligible for assured
      assertThat(sendUpdateTime).isLessThan(MAX_SEND_UPDATE_TIME);
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
      sleepWhileUpdatePropagates(500);
      fakeRd1.newSafeReadAssertions()
          .sentUpdates(5)
          .acknowledgedUpdates(1)
@@ -3102,7 +3242,7 @@
      // RS should ack quickly as DS2 degraded and not eligible for assured
      assertThat(sendUpdateTime).isLessThan(MAX_SEND_UPDATE_TIME);
      Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
      sleepWhileUpdatePropagates(500);
      fakeRd1.newSafeReadAssertions()
          .sentUpdates(6)
          .acknowledgedUpdates(2)
opendj-server-legacy/src/test/java/org/opends/server/replication/server/MonitorTest.java
@@ -169,7 +169,8 @@
    String chDir = "monitorTest" + changelogId + suffix + "Db";
    ReplServerFakeConfiguration conf = new ReplServerFakeConfiguration(chPort, chDir, 0, changelogId, 0, 100, servers);
    final DN testBaseDN = this.baseDN;
    ReplicationServer replicationServer = new ReplicationServer(conf, new DSRSShutdownSync(), new ECLEnabledDomainPredicate()
    ReplicationServer replicationServer = new ReplicationServer(conf, new DSRSShutdownSync(),
        new ECLEnabledDomainPredicate()
    {
      @Override
      public boolean isECLEnabledDomain(DN baseDN)
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/CompositeDBCursorTest.java
@@ -11,7 +11,7 @@
 * Header, with the fields enclosed by brackets [] replaced by your own identifying
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2013-2015 ForgeRock AS.
 * Copyright 2013-2016 ForgeRock AS.
 */
package org.opends.server.replication.server.changelog.file;
@@ -23,14 +23,12 @@
import org.opends.server.replication.protocol.UpdateMsg;
import org.opends.server.replication.server.changelog.api.ChangelogException;
import org.opends.server.replication.server.changelog.api.DBCursor;
import org.opends.server.replication.server.changelog.file.CompositeDBCursor;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@SuppressWarnings({ "javadoc", "unchecked" })
public class CompositeDBCursorTest extends DirectoryServerTestCase
{
  private final class ConcreteCompositeDBCursor extends CompositeDBCursor<String>
  {
    @Override
@@ -245,5 +243,4 @@
    assertSame(compCursor.getRecord(), expected.getFirst());
    assertSame(compCursor.getData(), expected.getSecond());
  }
}
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/ECLMultiDomainDBCursorTest.java
@@ -18,6 +18,7 @@
import java.util.HashSet;
import java.util.Set;
import org.forgerock.opendj.ldap.DN;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.opends.server.DirectoryServerTestCase;
@@ -25,25 +26,20 @@
import org.opends.server.replication.common.ServerState;
import org.opends.server.replication.protocol.UpdateMsg;
import org.opends.server.replication.server.changelog.api.ChangelogException;
import org.opends.server.replication.server.changelog.api.ReplicationDomainDB;
import org.opends.server.replication.server.changelog.api.DBCursor.CursorOptions;
import org.opends.server.replication.server.changelog.file.ECLEnabledDomainPredicate;
import org.opends.server.replication.server.changelog.file.ECLMultiDomainDBCursor;
import org.opends.server.replication.server.changelog.file.MultiDomainDBCursor;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.replication.server.changelog.api.ReplicationDomainDB;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static org.opends.server.replication.server.changelog.api.DBCursor.KeyMatchingStrategy.*;
import static org.opends.server.replication.server.changelog.api.DBCursor.PositionStrategy.*;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;
import static org.opends.server.replication.server.changelog.api.DBCursor.KeyMatchingStrategy.*;
import static org.opends.server.replication.server.changelog.api.DBCursor.PositionStrategy.*;
@SuppressWarnings("javadoc")
public class ECLMultiDomainDBCursorTest extends DirectoryServerTestCase
{
  @Mock
  private ReplicationDomainDB domainDB;
  private CursorOptions options;
@@ -59,7 +55,6 @@
    }
  };
  @BeforeMethod
  public void setup() throws Exception
  {
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/ReplicaCursorTest.java
@@ -11,28 +11,24 @@
 * Header, with the fields enclosed by brackets [] replaced by your own identifying
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2014-2015 ForgeRock AS.
 * Copyright 2014-2016 ForgeRock AS.
 */
package org.opends.server.replication.server.changelog.file;
import static org.assertj.core.api.Assertions.*;
import org.opends.server.replication.ReplicationTestCase;
import org.opends.server.replication.common.CSN;
import org.opends.server.replication.protocol.ReplicaOfflineMsg;
import org.opends.server.replication.protocol.UpdateMsg;
import org.opends.server.replication.server.changelog.api.DBCursor;
import org.opends.server.replication.server.changelog.file.ReplicaCursor;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
/**
 * Test the {@link ReplicaCursor} class.
 */
/** Test the {@link ReplicaCursor} class. */
@SuppressWarnings("javadoc")
public class ReplicaCursorTest extends ReplicationTestCase
{
  private int timestamp;
  private DBCursor<UpdateMsg> delegateCursor;
@@ -122,5 +118,4 @@
  {
    return new ReplicaCursor(delegateCursor, offlineCSN, null, null);
  }
}
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/ReplicationEnvironmentTest.java
@@ -114,7 +114,8 @@
    try
    {
      File rootPath = new File(TEST_DIRECTORY_CHANGELOG);
      List<DN> domainDNs = Arrays.asList(DN.valueOf(DN1_AS_STRING), DN.valueOf(DN2_AS_STRING), DN.valueOf(DN3_AS_STRING));
      List<DN> domainDNs = Arrays.asList(
          DN.valueOf(DN1_AS_STRING), DN.valueOf(DN2_AS_STRING), DN.valueOf(DN3_AS_STRING));
      ReplicationEnvironment environment = createReplicationEnv(rootPath);
      cnDB = environment.getOrCreateCNIndexDB();
      for (int i = 0; i <= 2 ; i++)
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/SequentialDBCursor.java
@@ -11,7 +11,7 @@
 * Header, with the fields enclosed by brackets [] replaced by your own identifying
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2013-2015 ForgeRock AS.
 * Copyright 2013-2016 ForgeRock AS.
 */
package org.opends.server.replication.server.changelog.file;
@@ -24,7 +24,6 @@
@SuppressWarnings("javadoc")
class SequentialDBCursor implements DBCursor<UpdateMsg>
{
  private final List<UpdateMsg> msgs;
  private UpdateMsg current;
@@ -45,14 +44,12 @@
    this.msgs.add(msg);
  }
  /** {@inheritDoc} */
  @Override
  public UpdateMsg getRecord()
  {
    return current;
  }
  /** {@inheritDoc} */
  @Override
  public boolean next()
  {
@@ -65,19 +62,15 @@
    return false;
  }
  /** {@inheritDoc} */
  @Override
  public void close()
  {
    // nothing to do
  }
  /** {@inheritDoc} */
  @Override
  public String toString()
  {
        return getClass().getSimpleName() + "(currentRecord=" + current
                + " nextMessages=" + msgs + ")";
    return getClass().getSimpleName() + "(currentRecord=" + current + " nextMessages=" + msgs + ")";
  }
}
opendj-server-legacy/src/test/java/org/opends/server/schema/JPEGSyntaxTest.java
@@ -11,7 +11,7 @@
 * Header, with the fields enclosed by brackets [] replaced by your own identifying
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Portions Copyright 2012-2015 ForgeRock AS.
 * Portions Copyright 2012-2016 ForgeRock AS.
 */
package org.opends.server.schema;
@@ -22,22 +22,17 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
 * Test the JPEGSyntax.
 */
/** Test the JPEGSyntax. */
@RemoveOnceSDKSchemaIsUsed
@Test
public class JPEGSyntaxTest extends BinaryAttributeSyntaxTest
{
  /** {@inheritDoc} */
  @Override
  protected AttributeSyntax<?> getRule()
  {
    return new JPEGSyntax();
  }
  /** {@inheritDoc} */
  @Override
  @DataProvider(name="acceptableValues")
  public Object[][] createAcceptableValues()
@@ -68,5 +63,4 @@
        return new Object[][] {};
      }
  }
}
opendj-server-legacy/src/test/java/org/opends/server/schema/LDAPSyntaxTest.java
@@ -20,6 +20,7 @@
import java.util.List;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.opends.server.TestCaseUtils;
@@ -28,7 +29,6 @@
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.types.Attribute;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.SearchResultEntry;
import org.opends.server.util.RemoveOnceSDKSchemaIsUsed;
@@ -120,8 +120,10 @@
              {"   (    2.5.4.3    DESC  ' syntax description'    )", true},
              {"( 2.5.4.3 DESC 'Test syntax' X-SCHEMA-FILE '00-core.ldif' )", true},
              {"( 2.5.4.3 DESC 'Test X-SUBST Extensions' X-SUBST '1.3.6.1.4.1.1466.115.121.1.15' )", true},
              {"( 2.5.4.3 DESC 'Test X-SUBST Extensions' X-SUBST '1.3.6.1.4.1.1466.115.121.1.15' X-SCHEMA-FILE '00-core.ldif' )", true},
              {"( 2.5.4.3 DESC 'Test X-SUBST Extensions' X-SCHEMA-FILE '00-core.ldif' X-SUBST '1.3.6.1.4.1.1466.115.121.1.15' )", true},
    {"( 2.5.4.3 DESC 'Test X-SUBST Extensions' X-SUBST '1.3.6.1.4.1.1466.115.121.1.15' X-SCHEMA-FILE '00-core.ldif' )",
                  true},
    {"( 2.5.4.3 DESC 'Test X-SUBST Extensions' X-SCHEMA-FILE '00-core.ldif' X-SUBST '1.3.6.1.4.1.1466.115.121.1.15' )",
                  true},
              {"( 2.5.4.3 DESC 'Test X-PATTERN Extensions' X-PATTERN '[0-9]+' )", true},
              {"( 2.5.4.3 DESC 'Test X-PATTERN Extensions' X-PATTERN '[0-9]+' X-SCHEMA-FILE '00-core.ldif' )", true},
              {"( 2.5.4.3 DESC 'Test X-ENUM Extensions' X-ENUM ( 'black' 'white' ) )", true},
opendj-server-legacy/src/test/java/org/opends/server/snmp/SNMPSyncManagerV2AccessTest.java
@@ -25,21 +25,6 @@
import com.sun.management.snmp.manager.SnmpRequest;
import com.sun.management.snmp.manager.SnmpSession;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Map.Entry;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.config.AbstractManagedObjectDefinition;
import org.forgerock.opendj.config.server.AdminTestCaseUtils;
import org.forgerock.opendj.server.config.meta.SNMPConnectionHandlerCfgDefn;
import org.forgerock.opendj.server.config.server.SNMPConnectionHandlerCfg;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.opends.server.types.Control;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Modification;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.ResultCode;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
opendj-server-legacy/src/test/java/org/opends/server/snmp/SNMPTrapManagerTest.java
@@ -12,6 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2008 Sun Microsystems, Inc.
 * Portions Copyright 2016 ForgeRock AS.
 */
package org.opends.server.snmp;
opendj-server-legacy/src/test/java/org/opends/server/tools/RemoteConnection.java
@@ -101,26 +101,26 @@
    return socketFactory.createSocket(host, port);
  }
  public LDAPMessage bind(SimpleBindRequest bindRequest) throws IOException, LDAPException, LdapException
  public LDAPMessage bind(SimpleBindRequest bindRequest) throws IOException, LDAPException
  {
    return bind(bindRequest, true);
  }
  public LDAPMessage bind(SimpleBindRequest bindRequest, boolean throwOnExceptionalResultCode) throws IOException,
      LDAPException, LdapException
  public LDAPMessage bind(SimpleBindRequest bindRequest, boolean throwOnExceptionalResultCode)
      throws IOException, LDAPException
  {
    return bind(bindRequest.getName(), bindRequest.getPassword(), throwOnExceptionalResultCode, bindRequest
        .getControls());
    return bind(bindRequest.getName(), bindRequest.getPassword(),
        throwOnExceptionalResultCode, bindRequest.getControls());
  }
  public void bind(String bindDN, String bindPassword, Control... controls)
      throws IOException, LDAPException, LdapException
      throws IOException, LDAPException
  {
    bind(bindDN, bindPassword.getBytes(), true, Arrays.asList(controls));
  }
  private LDAPMessage bind(String bindDN, byte[] bindPassword, boolean throwOnExceptionalResultCode,
      List<Control> controls) throws IOException, LDAPException, LdapException
      List<Control> controls) throws IOException, LDAPException
  {
    writeMessage(new BindRequestProtocolOp(bs(bindDN), 3, bs(bindPassword)), to(controls));
    LDAPMessage message = r.readMessage();
@@ -132,18 +132,18 @@
    return message;
  }
  public void unbind() throws IOException, LDAPException, LdapException
  public void unbind() throws IOException, LDAPException
  {
    writeMessage(new UnbindRequestProtocolOp());
  }
  public LDAPMessage add(AddRequest addRequest) throws IOException, LDAPException, LdapException
  public LDAPMessage add(AddRequest addRequest) throws IOException, LDAPException
  {
    return add(addRequest, true);
  }
  public LDAPMessage add(AddRequest addRequest, boolean throwOnExceptionalResultCode) throws IOException,
      LDAPException, LdapException
  public LDAPMessage add(AddRequest addRequest, boolean throwOnExceptionalResultCode)
      throws IOException, LDAPException
  {
    writeMessage(addProtocolOp(addRequest), to(addRequest.getControls()));
    LDAPMessage message = r.readMessage();
@@ -160,13 +160,13 @@
    return new AddRequestProtocolOp(bs(add.getName()), to(add.getAllAttributes()));
  }
  public void search(String baseDN, SearchScope scope, String filterString, String... attributes) throws IOException,
      LDAPException
  public void search(String baseDN, SearchScope scope, String filterString, String... attributes)
      throws IOException, LDAPException
  {
    search(newSearchRequest(baseDN, scope, filterString, attributes));
  }
  public void search(SearchRequest searchRequest) throws IOException, LDAPException, LdapException
  public void search(SearchRequest searchRequest) throws IOException, LDAPException
  {
    writeMessage(searchProtocolOp(searchRequest), to(searchRequest.getControls()));
  }
@@ -174,7 +174,8 @@
  private SearchRequestProtocolOp searchProtocolOp(SearchRequest r) throws LDAPException
  {
    return new SearchRequestProtocolOp(bs(r.getName()), r.getScope(), r.getDereferenceAliasesPolicy(),
        r.getSizeLimit(), r.getTimeLimit(), r.isTypesOnly(), to(r.getFilter()), new LinkedHashSet<>(r.getAttributes()));
        r.getSizeLimit(), r.getTimeLimit(), r.isTypesOnly(), to(r.getFilter()),
        new LinkedHashSet<>(r.getAttributes()));
  }
  public List<SearchResultEntryProtocolOp> readEntries() throws LDAPException, IOException
@@ -202,13 +203,13 @@
    return entries;
  }
  public LDAPMessage modify(ModifyRequest modifyRequest) throws IOException, LDAPException, LdapException
  public LDAPMessage modify(ModifyRequest modifyRequest) throws IOException, LDAPException
  {
    return modify(modifyRequest, true);
  }
  public LDAPMessage modify(ModifyRequest modifyRequest, boolean throwOnExceptionalResultCode)
      throws IOException, LDAPException, LdapException
      throws IOException, LDAPException
  {
    writeMessage(modifyProtocolOp(modifyRequest), to(modifyRequest.getControls()));
    LDAPMessage message = r.readMessage();
@@ -226,19 +227,19 @@
  }
  public ModifyDNResponseProtocolOp modifyDN(String entryDN, String newRDN, boolean deleteOldRDN)
      throws IOException, LDAPException, LdapException
      throws IOException, LDAPException
  {
    writeMessage(new ModifyDNRequestProtocolOp(bs(entryDN), bs(newRDN), deleteOldRDN));
    return r.readMessage().getModifyDNResponseProtocolOp();
  }
  public LDAPMessage modifyDN(ModifyDNRequest modifyDNRequest) throws IOException, LDAPException, LdapException
  public LDAPMessage modifyDN(ModifyDNRequest modifyDNRequest) throws IOException, LDAPException
  {
    return modifyDN(modifyDNRequest, true);
  }
  public LDAPMessage modifyDN(ModifyDNRequest modifyDNRequest, boolean throwOnExceptionalResultCode)
      throws IOException, LDAPException, LdapException
      throws IOException, LDAPException
  {
    writeMessage(modDNProtocolOp(modifyDNRequest), to(modifyDNRequest.getControls()));
    LDAPMessage message = r.readMessage();
@@ -252,11 +253,12 @@
  private ModifyDNRequestProtocolOp modDNProtocolOp(ModifyDNRequest r)
  {
    return new ModifyDNRequestProtocolOp(bs(r.getName()), bs(r.getNewRDN()), r.isDeleteOldRDN(), bs(r.getNewSuperior()));
    return new ModifyDNRequestProtocolOp(
        bs(r.getName()), bs(r.getNewRDN()), r.isDeleteOldRDN(), bs(r.getNewSuperior()));
  }
  public LDAPMessage compare(CompareRequest compareRequest, boolean throwOnExceptionalResultCode) throws IOException,
      LDAPException, LdapException
  public LDAPMessage compare(CompareRequest compareRequest, boolean throwOnExceptionalResultCode)
      throws IOException, LDAPException
  {
    writeMessage(compareProtocolOp(compareRequest), to(compareRequest.getControls()));
    LDAPMessage message = r.readMessage();
@@ -273,13 +275,13 @@
    return new CompareRequestProtocolOp(bs(r.getName()), r.getAttributeDescription().toString(), r.getAssertionValue());
  }
  public LDAPMessage delete(DeleteRequest deleteRequest) throws IOException, LDAPException, LdapException
  public LDAPMessage delete(DeleteRequest deleteRequest) throws IOException, LDAPException
  {
    return delete(deleteRequest, true);
  }
  public LDAPMessage delete(DeleteRequest deleteRequest, boolean throwOnExceptionalResultCode)
      throws IOException, LDAPException, LdapException
      throws IOException, LDAPException
  {
    writeMessage(new DeleteRequestProtocolOp(bs(deleteRequest.getName())), to(deleteRequest.getControls()));
    LDAPMessage message = r.readMessage();
@@ -291,13 +293,13 @@
    return message;
  }
  public LDAPMessage extendedRequest(String oid) throws IOException, LDAPException, LdapException
  public LDAPMessage extendedRequest(String oid) throws IOException, LDAPException
  {
    return extendedRequest(oid, null);
  }
  public LDAPMessage extendedRequest(String oid, ByteString requestValue)
      throws IOException, LDAPException, LdapException
      throws IOException, LDAPException
  {
    writeMessage(new ExtendedRequestProtocolOp(oid, requestValue));
    return r.readMessage();
opendj-server-legacy/src/test/java/org/opends/server/tools/dsconfig/DsconfigLdapConnectionTestCase.java
@@ -12,7 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2006-2008 Sun Microsystems, Inc.
 * Portions Copyright 2014-2015 ForgeRock AS.
 * Portions Copyright 2014-2016 ForgeRock AS.
 */
package org.opends.server.tools.dsconfig;
opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java
@@ -21,7 +21,6 @@
import static org.testng.Assert.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
@@ -32,6 +31,7 @@
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.testng.Assert;
@@ -530,7 +530,7 @@
    cnType = DirectoryServer.getAttributeType("cn");
    Assert.assertNotNull(cnType);
    cnValue = ByteString.valueOfUtf8("john doe");
    cnValue = bs("john doe");
  }
@@ -554,8 +554,8 @@
    Attribute a = builder.toAttribute();
    Assert.assertEquals(a.size(), 2);
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value1")));
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value2")));
    Assert.assertTrue(a.contains(bs("value1")));
    Assert.assertTrue(a.contains(bs("value2")));
  }
@@ -569,17 +569,17 @@
    AttributeBuilder builder = new AttributeBuilder(cnType);
    // Note duplicate values.
    Assert.assertTrue(builder.addAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString.valueOfUtf8("value1"), ByteString.valueOfUtf8("value2"))));
    Assert.assertTrue(builder.addAll(Arrays.asList(bs("value1"), bs("value1"), bs("value2"))));
    Assert.assertEquals(builder.size(), 2);
    // Add same values.
    Assert.assertFalse(builder.addAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString.valueOfUtf8("value1"), ByteString.valueOfUtf8("value2"))));
    Assert.assertFalse(builder.addAll(Arrays.asList(bs("value1"), bs("value1"), bs("value2"))));
    Assert.assertEquals(builder.size(), 2);
    Attribute a = builder.toAttribute();
    Assert.assertEquals(a.size(), 2);
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value1")));
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value2")));
    Assert.assertTrue(a.contains(bs("value1")));
    Assert.assertTrue(a.contains(bs("value2")));
  }
@@ -598,13 +598,13 @@
    Assert.assertFalse(builder.add(cnValue));
    Assert.assertEquals(builder.size(), 1);
    Assert.assertTrue(builder.add(ByteString.valueOfUtf8("jane doe")));
    Assert.assertTrue(builder.add(bs("jane doe")));
    Assert.assertEquals(builder.size(), 2);
    Attribute a = builder.toAttribute();
    Assert.assertEquals(a.size(), 2);
    Assert.assertTrue(a.contains(cnValue));
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("jane doe")));
    Assert.assertTrue(a.contains(bs("jane doe")));
  }
@@ -628,8 +628,8 @@
    Attribute a = builder.toAttribute();
    Assert.assertEquals(a.size(), 2);
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value1")));
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value2")));
    Assert.assertTrue(a.contains(bs("value1")));
    Assert.assertTrue(a.contains(bs("value2")));
  }
@@ -642,19 +642,19 @@
  {
    AttributeBuilder builder = new AttributeBuilder(cnType);
    assertTrue(builder.add(ByteString.valueOfUtf8("value1")));
    assertTrue(builder.add(bs("value1")));
    assertEquals(builder.size(), 1);
    assertFalse(builder.add(ByteString.valueOfUtf8("value1")));
    assertFalse(builder.add(bs("value1")));
    assertEquals(builder.size(), 1);
    assertTrue(builder.add(ByteString.valueOfUtf8("value2")));
    assertTrue(builder.add(bs("value2")));
    assertEquals(builder.size(), 2);
    Attribute a = builder.toAttribute();
    assertEquals(a.size(), 2);
    assertTrue(a.contains(ByteString.valueOfUtf8("value1")));
    assertTrue(a.contains(ByteString.valueOfUtf8("value2")));
    assertTrue(a.contains(bs("value1")));
    assertTrue(a.contains(bs("value2")));
  }
@@ -688,9 +688,9 @@
    builder.addAll(createAttribute(cnType, "cn", noOptions, twoValues));
    Assert.assertTrue(builder.contains(ByteString.valueOfUtf8("value1")));
    Assert.assertTrue(builder.contains(ByteString.valueOfUtf8("value2")));
    Assert.assertFalse(builder.contains(ByteString.valueOfUtf8("value3")));
    Assert.assertTrue(builder.contains(bs("value1")));
    Assert.assertTrue(builder.contains(bs("value2")));
    Assert.assertFalse(builder.contains(bs("value3")));
  }
@@ -705,9 +705,9 @@
    builder.addAll(createAttribute(cnType, "cn", noOptions, twoValues));
    ByteString av1 = ByteString.valueOfUtf8("value1");
    ByteString av2 = ByteString.valueOfUtf8("value2");
    ByteString av3 = ByteString.valueOfUtf8("value3");
    ByteString av1 = bs("value1");
    ByteString av2 = bs("value2");
    ByteString av3 = bs("value3");
    Assert.assertTrue(builder.containsAll(Collections.<ByteString> emptySet()));
@@ -799,7 +799,7 @@
    builder.add("value1");
    Assert.assertTrue(builder.iterator().hasNext());
    Assert.assertEquals(builder.iterator().next(), ByteString.valueOfUtf8("value1"));
    Assert.assertEquals(builder.iterator().next(), bs("value1"));
  }
@@ -835,7 +835,7 @@
    Attribute a = builder.toAttribute();
    Assert.assertEquals(a.size(), 1);
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value3")));
    Assert.assertTrue(a.contains(bs("value3")));
  }
@@ -851,11 +851,11 @@
    builder.addAll(createAttribute(cnType, "cn", noOptions, threeValues));
    // Remove existing values.
    Assert.assertTrue(builder.removeAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString.valueOfUtf8("value2"))));
    Assert.assertTrue(builder.removeAll(Arrays.asList(bs("value1"), bs("value2"))));
    Assert.assertEquals(builder.size(), 1);
    // Remove removed values.
    Assert.assertFalse(builder.removeAll(Arrays.asList(ByteString.valueOfUtf8("value1"), ByteString.valueOfUtf8("value2"))));
    Assert.assertFalse(builder.removeAll(Arrays.asList(bs("value1"), bs("value2"))));
    Assert.assertEquals(builder.size(), 1);
    // Remove nothing.
@@ -864,12 +864,12 @@
    // Remove non existent value.
    Assert.assertFalse(builder.removeAll(Collections
        .singleton(ByteString.valueOfUtf8("value4"))));
        .singleton(bs("value4"))));
    Assert.assertEquals(builder.size(), 1);
    Attribute a = builder.toAttribute();
    Assert.assertEquals(a.size(), 1);
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value3")));
    Assert.assertTrue(a.contains(bs("value3")));
  }
@@ -884,21 +884,21 @@
    builder.addAll(createAttribute(cnType, "cn", noOptions, threeValues));
    Assert.assertTrue(builder.remove(ByteString.valueOfUtf8("value1")));
    Assert.assertTrue(builder.remove(bs("value1")));
    Assert.assertEquals(builder.size(), 2);
    // Already removed.
    Assert.assertFalse(builder.remove(ByteString.valueOfUtf8("value1")));
    Assert.assertFalse(builder.remove(bs("value1")));
    Assert.assertEquals(builder.size(), 2);
    // Non existent.
    Assert.assertFalse(builder.remove(ByteString.valueOfUtf8("value4")));
    Assert.assertFalse(builder.remove(bs("value4")));
    Assert.assertEquals(builder.size(), 2);
    Attribute a = builder.toAttribute();
    Assert.assertEquals(a.size(), 2);
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value2")));
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value3")));
    Assert.assertTrue(a.contains(bs("value2")));
    Assert.assertTrue(a.contains(bs("value3")));
  }
@@ -926,8 +926,8 @@
    Attribute a = builder.toAttribute();
    Assert.assertEquals(a.size(), 2);
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value2")));
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value3")));
    Assert.assertTrue(a.contains(bs("value2")));
    Assert.assertTrue(a.contains(bs("value3")));
  }
@@ -946,8 +946,8 @@
    Attribute a = builder.toAttribute();
    Assert.assertEquals(a.size(), 2);
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value2")));
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value4")));
    Assert.assertTrue(a.contains(bs("value2")));
    Assert.assertTrue(a.contains(bs("value4")));
  }
@@ -962,14 +962,14 @@
    builder.addAll(createAttribute(cnType, "cn", noOptions, threeValues));
    // Note duplicate values.
    builder.replaceAll(Arrays.asList(ByteString.valueOfUtf8("value2"),
        ByteString.valueOfUtf8("value2"), ByteString.valueOfUtf8("value4")));
    builder.replaceAll(Arrays.asList(bs("value2"),
        bs("value2"), bs("value4")));
    Assert.assertEquals(builder.size(), 2);
    Attribute a = builder.toAttribute();
    Assert.assertEquals(a.size(), 2);
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value2")));
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value4")));
    Assert.assertTrue(a.contains(bs("value2")));
    Assert.assertTrue(a.contains(bs("value4")));
  }
@@ -983,12 +983,12 @@
    AttributeBuilder builder = new AttributeBuilder(cnType);
    builder.addAll(createAttribute(cnType, "cn", noOptions, threeValues));
    builder.replace(ByteString.valueOfUtf8("value4"));
    builder.replace(bs("value4"));
    Assert.assertEquals(builder.size(), 1);
    Attribute a = builder.toAttribute();
    Assert.assertEquals(a.size(), 1);
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value4")));
    Assert.assertTrue(a.contains(bs("value4")));
  }
@@ -1007,7 +1007,7 @@
    Attribute a = builder.toAttribute();
    Assert.assertEquals(a.size(), 1);
    Assert.assertTrue(a.contains(ByteString.valueOfUtf8("value4")));
    Assert.assertTrue(a.contains(bs("value4")));
  }
  /**
@@ -1071,13 +1071,13 @@
    // Check contains().
    for (String value : values)
    {
      Assert.assertTrue(a.contains(ByteString.valueOfUtf8(value)));
      Assert.assertTrue(a.contains(bs(value)));
      // Assumes internal normalization to lower-case.
      Assert.assertTrue(a.contains(ByteString.valueOfUtf8(value.toUpperCase())));
      Assert.assertTrue(a.contains(bs(value.toUpperCase())));
    }
    Assert.assertFalse(a.contains(ByteString.valueOfUtf8("xxxx")));
    Assert.assertFalse(a.contains(bs("xxxx")));
  }
@@ -1107,7 +1107,7 @@
    Set<ByteString> expectedValues = new HashSet<>();
    for (String value : values)
    {
      expectedValues.add(ByteString.valueOfUtf8(value));
      expectedValues.add(bs(value));
    }
    Assert.assertTrue(a.containsAll(Collections.<ByteString> emptySet()));
@@ -1121,14 +1121,14 @@
    }
    Set<ByteString> bigSet = new HashSet<>(expectedValues);
    bigSet.add(ByteString.valueOfUtf8("xxxx"));
    bigSet.add(bs("xxxx"));
    Assert.assertFalse(a.containsAll(bigSet));
    expectedValues.clear();
    for (String value : values)
    {
      // Assumes internal normalization to lower-case.
      expectedValues.add(ByteString.valueOfUtf8(value.toUpperCase()));
      expectedValues.add(bs(value.toUpperCase()));
    }
    Assert.assertTrue(a.containsAll(expectedValues));
  }
@@ -1281,7 +1281,7 @@
  /**
   * Tests {@link Attribute#hasAllOptions(Collection)}.
   * Tests {@link Attribute#hasAllOptions(java.util.Collection)}.
   *
   * @param testCase
   *          Test case index (useful for debugging).
@@ -1515,8 +1515,9 @@
        Assert.assertTrue(i.hasNext());
        ByteString v = i.next();
        ByteString nv = a.getAttributeDescription().getAttributeType().getEqualityMatchingRule().normalizeAttributeValue(v);
        Assert.assertEquals(nv, ByteString.valueOfUtf8(value));
        MatchingRule equalityMatchingRule = a.getAttributeDescription().getAttributeType().getEqualityMatchingRule();
        ByteString nv = equalityMatchingRule.normalizeAttributeValue(v);
        Assert.assertEquals(nv, bs(value));
        try
        {
@@ -1660,11 +1661,11 @@
    assertThat(a3.isNormalized()).isTrue();
    // no normalization on contains for 0-element and 1-element set
    a1.contains(ByteString.valueOfUtf8("one"));
    a1.contains(bs("one"));
    assertThat(a1.isNormalized()).isFalse();
    // normalization on contains for 1-element set
    a2.contains(ByteString.valueOfUtf8("one"));
    a2.contains(bs("one"));
    assertThat(a2.isNormalized()).isTrue();
  }
@@ -1677,4 +1678,9 @@
    builder.addAllStrings(Arrays.asList(values));
    return builder.toAttribute();
  }
  private ByteString bs(String s)
  {
    return ByteString.valueOfUtf8(s);
  }
}
opendj-server-legacy/src/test/java/org/opends/server/types/LDAPURLTest.java
@@ -11,7 +11,7 @@
 * Header, with the fields enclosed by brackets [] replaced by your own identifying
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2013-2014 ForgeRock AS.
 * Copyright 2013-2016 ForgeRock AS.
 */
package org.opends.server.types;
@@ -242,8 +242,8 @@
  @Test
  public void decodeComplexSampleWithUrlDecode() throws Exception
  {
    final String sample =
        "ld%2Fap://ldap.netsca%2Fpe.com:1389/ou=Sa%2Fles,o=Netscape,c=US?c%2Fn,tel,mail?sub?(objectclass=per%2Fson)?ext%2F1,ext%2F2,ext%2F3";
    final String sample = "ld%2Fap://ldap.netsca%2Fpe.com:1389/ou=Sa%2Fles,o=Netscape,"
        + "c=US?c%2Fn,tel,mail?sub?(objectclass=per%2Fson)?ext%2F1,ext%2F2,ext%2F3";
    final LDAPURL ldapURL = LDAPURL.decode(sample, true);
    assertThat(ldapURL.getScheme()).isEqualTo("ld/ap");
    assertThat(ldapURL.getHost()).isEqualTo("ldap.netsca/pe.com");
opendj-server-legacy/src/test/java/org/opends/server/types/SearchFilterTests.java
@@ -17,8 +17,6 @@
 */
package org.opends.server.types;
import org.forgerock.opendj.ldap.schema.AttributeType;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
@@ -26,6 +24,7 @@
import java.util.List;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
@@ -97,12 +96,10 @@
    runRecreateFilterTest(originalFilter, expectedToStringFilter);
  }
  private void runRecreateFilterTest(
          String originalFilter,
          String expectedToStringFilter
  ) throws DirectoryException {
  private void runRecreateFilterTest(String originalFilter, String expectedToStringFilter) throws DirectoryException {
    String regenerated = SearchFilter.createFilterFromString(originalFilter).toString();
    Assert.assertEquals(regenerated, expectedToStringFilter, "original=" + originalFilter + ", expected=" + expectedToStringFilter);
    assertEquals(regenerated, expectedToStringFilter,
        "original=" + originalFilter + ", expected=" + expectedToStringFilter);
  }
  /** These are valid filters. */
@@ -974,7 +971,8 @@
  @Test(dataProvider = "equalsTest")
  public void testEquals(String stringFilter1, String stringFilter2, boolean expectEquals, boolean expectStringEquals) throws Exception {
  public void testEquals(String stringFilter1, String stringFilter2, boolean expectEquals, boolean expectStringEquals)
      throws Exception {
    SearchFilter filter1 = SearchFilter.createFilterFromString(stringFilter1);
    SearchFilter filter2 = SearchFilter.createFilterFromString(stringFilter2);
opendj-server-legacy/src/test/java/org/opends/server/util/BackupManagerTestCase.java
@@ -29,25 +29,22 @@
import java.util.List;
import java.util.ListIterator;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.opends.server.api.Backupable;
import org.opends.server.types.BackupConfig;
import org.opends.server.types.BackupDirectory;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.RestoreConfig;
import org.opends.server.util.StaticUtils;
import org.testng.Reporter;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@SuppressWarnings("javadoc")
@Test(groups = { "precommit" }, sequential = true)
@Test(groups = "precommit", sequential = true)
public class BackupManagerTestCase extends DirectoryServerTestCase
{
  private static final String ENTRY_DN = "dc=example,dc=com";
  private static final String FILE_NAME_PREFIX = "file_";
@@ -64,7 +61,6 @@
  @DataProvider
  Object[][] backupData() throws Exception {
    // For each case is provided
    // - a label identifying the case (not used in method but allow to identify easily the case in IDE)
    // - a mock of a backupable (building the mock also involves creating directory and files to backup)
@@ -169,7 +165,7 @@
   *
   * It allows to ensure that a backup can actually be restored.
   */
  @Test()
  @Test
  public void testCreateIncrementalBackupThenRestoreThenRemove() throws Exception
  {
    Path sourceDirectory = createSourceDirectory("incremental");
@@ -294,8 +290,7 @@
  {
    File backupDirectory = TestCaseUtils.createTemporaryDirectory("backupDirectory-" + label + "-");
    Reporter.log("Create backup directory:" + backupDirectory, true);
    BackupDirectory backupDir = new BackupDirectory(backupDirectory.getAbsolutePath(), DN.valueOf(ENTRY_DN));
    return backupDir;
    return new BackupDirectory(backupDirectory.getAbsolutePath(), DN.valueOf(ENTRY_DN));
  }
  private Backupable buildBackupable(Path sourceDirectory, int numberOfFiles) throws Exception
@@ -311,7 +306,7 @@
  }
  /**
   * Create files in source directory + additional files under a subdirectory of source directory
   * Create files in source directory + additional files under a subdirectory of source directory.
   */
  private Backupable buildBackupableForMultipleDirectoriesCase(Path sourceDirectory, int numberOfFiles)
      throws Exception
@@ -362,5 +357,4 @@
      close(output);
    }
  }
}
opendj-server-legacy/src/test/java/org/opends/server/util/TestCrypt.java
@@ -13,23 +13,25 @@
 *
 * Copyright 2008 Sun Microsystems, Inc.
 * Portions Copyright 2007 Brighton Consulting, Inc.
 * Portions Copyright 2014-2015 ForgeRock AS.
 * Portions Copyright 2014-2016 ForgeRock AS.
 */
package org.opends.server.util;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.opends.server.TestCaseUtils;
import java.io.File;
import java.util.List;
import org.opends.server.TestCaseUtils;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
 * This class defines a set of tests for the
 * {@link org.opends.server.util.Crypt} class.
 * This class defines a set of tests for the {@link org.opends.server.util.Crypt} class.
 * <p>
 * In the "slow" group, since they are unlikely to break and since there are 4K+ they can take a
 * while
 */
@Test(groups = { "slow" }, sequential = true)  // Make them slow, since they are unlikely to break and since there are 4K+ they can take a while
@Test(groups = { "slow" }, sequential = true)
public final class TestCrypt extends UtilTestCase {
  private Crypt crypt = new Crypt();
opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java
@@ -33,7 +33,6 @@
import java.util.LinkedList;
import java.util.List;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.TestCaseUtils;
import org.testng.Assert;
@@ -45,6 +44,7 @@
 * This class defines a set of tests for the
 * {@link org.opends.server.util.StaticUtils} class.
 */
@SuppressWarnings("javadoc")
public final class TestStaticUtils extends UtilTestCase {
  /** Lower case hex digit lookup table. */
  private static final char[] HEX_DIGITS_LOWER = new char[] { '0', '1',
@@ -579,7 +579,7 @@
  }
  /**
   * Tests the {@link StaticUtils#needsBase64Encoding(ByteSequence)} method.
   * Tests the {@link StaticUtils#needsBase64Encoding(org.forgerock.opendj.ldap.ByteSequence)} method.
   *
   * @param s
   *          The test string.
@@ -606,17 +606,10 @@
  public void testMoveFileNonExistentSrc() throws Exception {
    File src = File.createTempFile("src", null);
    File dst = TestCaseUtils.createTemporaryDirectory("dst");
    File newSrc = new File(dst, src.getName());
    src.delete();
    try {
      StaticUtils.moveFile(src, dst);
    } finally {
      src.delete();
      dst.delete();
      newSrc.delete();
    }
    moveFile(src, dst);
  }
  /**
@@ -630,17 +623,10 @@
  public void testMoveFileNonExistentDst() throws Exception {
    File src = File.createTempFile("src", null);
    File dst = TestCaseUtils.createTemporaryDirectory("dst");
    File newSrc = new File(dst, src.getName());
    dst.delete();
    try {
      StaticUtils.moveFile(src, dst);
    } finally {
      src.delete();
      dst.delete();
      newSrc.delete();
    }
    moveFile(src, dst);
  }
  /**
@@ -654,15 +640,8 @@
  public void testMoveFileSrcNotFile() throws Exception {
    File src = TestCaseUtils.createTemporaryDirectory("src");
    File dst = TestCaseUtils.createTemporaryDirectory("dst");
    File newSrc = new File(dst, src.getName());
    try {
      StaticUtils.moveFile(src, dst);
    } finally {
      src.delete();
      dst.delete();
      newSrc.delete();
    }
    moveFile(src, dst);
  }
  /**
@@ -676,8 +655,13 @@
  public void testMoveFileDstNotDirectory() throws Exception {
    File src = File.createTempFile("src", null);
    File dst = File.createTempFile("dst", null);
    File newSrc = new File(dst, src.getName());
    moveFile(src, dst);
  }
  private void moveFile(File src, File dst) throws IOException
  {
    File newSrc = new File(dst, src.getName());
    try {
      StaticUtils.moveFile(src, dst);
    } finally {
@@ -915,7 +899,7 @@
  /**
   * Tests the
   * {@link StaticUtils#toLowerCase(ByteSequence, StringBuilder, boolean)}
   * {@link StaticUtils#toLowerCase(org.forgerock.opendj.ldap.ByteSequence, StringBuilder, boolean)}
   * method.
   *
   * @param input
@@ -978,8 +962,9 @@
  }
  /**
   * Create test strings for the {@link StaticUtils#toLowerCase(ByteSequence, StringBuilder, boolean)} method
   * with trimming enabled.
   * Create test strings for the
   * {@link StaticUtils#toLowerCase(org.forgerock.opendj.ldap.ByteSequence, StringBuilder, boolean)}
   * method with trimming enabled.
   *
   * @return Returns an array of test data.
   */
@@ -1049,13 +1034,16 @@
  @Test
  public void testStackTraceHasCause() throws Exception
  {
    boolean hasCause = StaticUtils.stackTraceContainsCause(new RuntimeException(new ArithmeticException()), ArithmeticException.class);
    boolean hasCause = StaticUtils.stackTraceContainsCause(
        new RuntimeException(new ArithmeticException()), ArithmeticException.class);
    Assert.assertTrue(hasCause, "First case : ArithmeticException should be detected as a cause");
    hasCause = StaticUtils.stackTraceContainsCause(new RuntimeException(new RuntimeException()), ArithmeticException.class);
    hasCause = StaticUtils.stackTraceContainsCause(
        new RuntimeException(new RuntimeException()), ArithmeticException.class);
    Assert.assertFalse(hasCause, "Second case : ArithmeticException should not be detected as a cause");
    hasCause = StaticUtils.stackTraceContainsCause(new RuntimeException(new IllegalThreadStateException()), IllegalArgumentException.class);
    hasCause = StaticUtils.stackTraceContainsCause(
        new RuntimeException(new IllegalThreadStateException()), IllegalArgumentException.class);
    Assert.assertTrue(hasCause, "Third case : IllegalThreadStateException should be detected as a cause");
  }
}