From 754b6fe22c8138460bd93f2b0c9d725c627163c4 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 29 Oct 2014 16:33:54 +0000
Subject: [PATCH] OPENDJ-1571 Internal Error when doing REST operations on HTTP Connection Handler

---
 opends/src/server/org/opends/server/util/CollectionUtils.java                                                    |   42 ++++++++++++++
 opends/src/server/org/opends/server/replication/plugin/PersistentServerState.java                                |    7 +
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java  |    2 
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/StateMachineTest.java             |    2 
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationDomainTest.java       |    2 
 opends/tests/unit-tests-testng/src/server/org/opends/server/backends/ChangelogBackendTestCase.java               |   14 ++--
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/GenerationIdTest.java                    |    1 
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java    |    3 
 opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java                                   |   15 -----
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/AssuredReplicationServerTest.java |    1 
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/FractionalReplicationTest.java    |    1 
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java                 |    2 
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ComputeBestServerTest.java       |    2 
 opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestBackendImpl.java                    |    6 +-
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/protocol/SynchronizationMsgTest.java     |    1 
 opends/src/server/org/opends/server/plugins/UniqueAttributePlugin.java                                           |    2 
 opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java                             |   20 +++---
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationBrokerTest.java       |    2 
 opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java                                |   45 ++++----------
 opends/tests/unit-tests-testng/src/server/org/opends/server/controls/PersistentSearchControlTest.java            |    4 
 20 files changed, 95 insertions(+), 79 deletions(-)

diff --git a/opends/src/server/org/opends/server/plugins/UniqueAttributePlugin.java b/opends/src/server/org/opends/server/plugins/UniqueAttributePlugin.java
index 3040fa6..cb401ff 100644
--- a/opends/src/server/org/opends/server/plugins/UniqueAttributePlugin.java
+++ b/opends/src/server/org/opends/server/plugins/UniqueAttributePlugin.java
@@ -78,7 +78,7 @@
    * The set of attributes that will be requested when performing internal
    * search operations.  This indicates that no attributes should be returned.
    */
-  private static final Set<String> SEARCH_ATTRS = new LinkedHashSet<String>(1);
+  private static final LinkedHashSet<String> SEARCH_ATTRS = new LinkedHashSet<String>(1);
   static
   {
     SEARCH_ATTRS.add(SchemaConstants.NO_ATTRIBUTES);
diff --git a/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java b/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java
index c8fa85b..3a93f86 100644
--- a/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java
+++ b/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java
@@ -22,7 +22,7 @@
  *
  *
  *      Copyright 2006-2009 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2013 ForgeRock AS
+ *      Portions Copyright 2011-2014 ForgeRock AS
  */
 package org.opends.server.protocols.internal;
 
@@ -2079,7 +2079,7 @@
                             DereferencePolicy derefPolicy,
                             int sizeLimit, int timeLimit,
                             boolean typesOnly, String filterString,
-                            Set<String> attributes)
+                            LinkedHashSet<String> attributes)
          throws DirectoryException
   {
     return processSearch(rawBaseDN, scope, derefPolicy, sizeLimit,
@@ -2121,7 +2121,7 @@
                             DereferencePolicy derefPolicy,
                             int sizeLimit, int timeLimit,
                             boolean typesOnly, String filterString,
-                            Set<String> attributes,
+                            LinkedHashSet<String> attributes,
                             InternalSearchListener searchListener)
          throws DirectoryException
   {
@@ -2166,7 +2166,7 @@
                             DereferencePolicy derefPolicy,
                             int sizeLimit, int timeLimit,
                             boolean typesOnly, String filterString,
-                            Set<String> attributes,
+                            LinkedHashSet<String> attributes,
                             List<Control> controls,
                             InternalSearchListener searchListener)
          throws DirectoryException
@@ -2243,7 +2243,7 @@
                             DereferencePolicy derefPolicy,
                             int sizeLimit, int timeLimit,
                             boolean typesOnly, RawFilter filter,
-                            Set<String> attributes)
+                            LinkedHashSet<String> attributes)
   {
     return processSearch(rawBaseDN, scope, derefPolicy, sizeLimit,
                          timeLimit, typesOnly, filter, attributes,
@@ -2280,7 +2280,7 @@
                             DereferencePolicy derefPolicy,
                             int sizeLimit, int timeLimit,
                             boolean typesOnly, RawFilter filter,
-                            Set<String> attributes,
+                            LinkedHashSet<String> attributes,
                             InternalSearchListener searchListener)
   {
     return processSearch(rawBaseDN, scope, derefPolicy, sizeLimit,
@@ -2320,7 +2320,7 @@
                             DereferencePolicy derefPolicy,
                             int sizeLimit, int timeLimit,
                             boolean typesOnly, RawFilter filter,
-                            Set<String> attributes,
+                            LinkedHashSet<String> attributes,
                             List<Control> controls,
                             InternalSearchListener searchListener)
   {
@@ -2389,7 +2389,7 @@
                             DereferencePolicy derefPolicy,
                             int sizeLimit, int timeLimit,
                             boolean typesOnly, SearchFilter filter,
-                            Set<String> attributes)
+                            LinkedHashSet<String> attributes)
   {
     return processSearch(baseDN, scope, derefPolicy, sizeLimit,
                          timeLimit, typesOnly, filter, attributes,
@@ -2425,7 +2425,7 @@
                             DereferencePolicy derefPolicy,
                             int sizeLimit, int timeLimit,
                             boolean typesOnly, SearchFilter filter,
-                            Set<String> attributes,
+                            LinkedHashSet<String> attributes,
                             InternalSearchListener searchListener)
   {
     return processSearch(baseDN, scope, derefPolicy, sizeLimit,
@@ -2464,7 +2464,7 @@
                             DereferencePolicy derefPolicy,
                             int sizeLimit, int timeLimit,
                             boolean typesOnly, SearchFilter filter,
-                            Set<String> attributes,
+                            LinkedHashSet<String> attributes,
                             List<Control> controls,
                             InternalSearchListener searchListener)
   {
diff --git a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index 1477f0a..eb598a8 100644
--- a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -87,6 +87,7 @@
 import static org.opends.server.replication.protocol.OperationContext.*;
 import static org.opends.server.replication.service.ReplicationMonitor.*;
 import static org.opends.server.types.ResultCode.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
 
@@ -110,8 +111,8 @@
    * Set of attributes that will return all the user attributes and the
    * replication related operational attributes when used in a search operation.
    */
-  private static final Set<String> USER_AND_REPL_OPERATIONAL_ATTRS =
-      new HashSet<String>(Arrays.asList(
+  private static final LinkedHashSet<String> USER_AND_REPL_OPERATIONAL_ATTRS =
+      new LinkedHashSet<String>(Arrays.asList(
           HISTORICAL_ATTRIBUTE_NAME, ENTRYUUID_ATTRIBUTE_NAME, "*"));
 
   /**
@@ -659,7 +660,7 @@
 
     // Search the domain root entry that is used to save the generation id
     final ByteString asn1BaseDn = ByteString.valueOf(getBaseDNString());
-    final Set<String> attributes = newSet(
+    final LinkedHashSet<String> attributes = newLinkedHashSet(
         REPLICATION_GENERATION_ID,
         REPLICATION_FRACTIONAL_EXCLUDE,
         REPLICATION_FRACTIONAL_INCLUDE);
@@ -1270,7 +1271,7 @@
         {
           // Construct and store new attribute list
           newRdnAttrLists.add(
-              newList(Attributes.create(attributeType, sameAttrValue)));
+              newArrayList(Attributes.create(attributeType, sameAttrValue)));
           /*
           Store matching attribute type
           The mapping will be done using object from rdnAttrTypes as key
@@ -1296,23 +1297,6 @@
     return hasSomeAttributesToFilter;
   }
 
-  private static <T> ArrayList<T> newList(T elem)
-  {
-    final ArrayList<T> list = new ArrayList<T>(1);
-    list.add(elem);
-    return list;
-  }
-
-  private static <T> Set<T> newSet(T... elems)
-  {
-    final Set<T> list = new LinkedHashSet<T>(elems.length);
-    for (T elem : elems)
-    {
-      list.add(elem);
-    }
-    return list;
-  }
-
    private static boolean isMandatoryAttribute(Set<ObjectClass> entryClasses,
        AttributeType attributeType)
    {
@@ -2563,7 +2547,7 @@
     }
     try
     {
-      final Set<String> attrs = newSet(ENTRYUUID_ATTRIBUTE_NAME);
+      final LinkedHashSet<String> attrs = newLinkedHashSet(ENTRYUUID_ATTRIBUTE_NAME);
 
       final InternalSearchOperation search = getRootConnection().processSearch(
           dn, SearchScope.BASE_OBJECT, DereferencePolicy.NEVER_DEREF_ALIASES,
@@ -3018,8 +3002,7 @@
     // Find an rename child entries.
     try
     {
-      final Set<String> attrs =
-          newSet(ENTRYUUID_ATTRIBUTE_NAME, HISTORICAL_ATTRIBUTE_NAME);
+      final LinkedHashSet<String> attrs = newLinkedHashSet(ENTRYUUID_ATTRIBUTE_NAME, HISTORICAL_ATTRIBUTE_NAME);
 
       InternalSearchOperation op =
           conn.processSearch(entryDN, SearchScope.SINGLE_LEVEL,
@@ -3103,8 +3086,7 @@
         true);
     Attribute attr = Attributes.create(attrType, AttributeValues.create(
         attrType, conflictDN.toNormalizedString()));
-    List<Modification> mods =
-        newList(new Modification(ModificationType.REPLACE, attr));
+    List<Modification> mods = newArrayList(new Modification(ModificationType.REPLACE, attr));
 
     ModifyOperation newOp = new ModifyOperationBasis(
           conn, nextOperationID(), nextMessageID(), new ArrayList<Control>(0),
@@ -3287,7 +3269,7 @@
     // The generationId is stored in the root entry of the domain.
     final ByteString asn1BaseDn = ByteString.valueOf(entryDN.toString());
     final ArrayList<ByteString> values =
-        newList(ByteString.valueOf(Long.toString(generationId)));
+        newArrayList(ByteString.valueOf(Long.toString(generationId)));
 
     LDAPAttribute attr = new LDAPAttribute(REPLICATION_GENERATION_ID, values);
     List<RawModification> mods = new ArrayList<RawModification>(1);
@@ -3352,7 +3334,7 @@
      * Search the database entry that is used to periodically
      * save the generation id
      */
-    final Set<String> attributes = newSet(REPLICATION_GENERATION_ID);
+    final LinkedHashSet<String> attributes = newLinkedHashSet(REPLICATION_GENERATION_ID);
     final String filter = "(objectclass=*)";
     InternalSearchOperation search = conn.processSearch(getBaseDNString(),
         SearchScope.BASE_OBJECT,
@@ -3536,7 +3518,7 @@
 
     // baseDN branch is the only one included in the export
     LDIFExportConfig exportConfig = new LDIFExportConfig(os);
-    exportConfig.setIncludeBranches(newList(getBaseDN()));
+    exportConfig.setIncludeBranches(newArrayList(getBaseDN()));
 
     // For the checksum computing mode, only consider the 'stable' attributes
     if (checksumOutput)
@@ -3666,7 +3648,7 @@
       }
 
       importConfig = new LDIFImportConfig(input);
-      importConfig.setIncludeBranches(newList(getBaseDN()));
+      importConfig.setIncludeBranches(newArrayList(getBaseDN()));
       importConfig.setAppendToExistingData(false);
       importConfig.setSkipDNValidation(true);
       // We should not validate schema for replication
@@ -5121,8 +5103,7 @@
        entryHist.setPurgeDelay(getHistoricalPurgeDelay());
        Attribute attr = entryHist.encodeAndPurge();
        count += entryHist.getLastPurgedValuesCount();
-       List<Modification> mods =
-           newList(new Modification(ModificationType.REPLACE, attr));
+      List<Modification> mods = newArrayList(new Modification(ModificationType.REPLACE, attr));
 
        ModifyOperation newOp = new ModifyOperationBasis(
            conn, nextOperationID(), nextMessageID(), new ArrayList<Control>(0),
diff --git a/opends/src/server/org/opends/server/replication/plugin/PersistentServerState.java b/opends/src/server/org/opends/server/replication/plugin/PersistentServerState.java
index be0d9a6..18f0090 100644
--- a/opends/src/server/org/opends/server/replication/plugin/PersistentServerState.java
+++ b/opends/src/server/org/opends/server/replication/plugin/PersistentServerState.java
@@ -28,6 +28,7 @@
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -59,6 +60,8 @@
     * The attribute name used to store the state in the backend.
     */
    private static final String REPLICATION_STATE = "ds-sync-state";
+  private static final LinkedHashSet<String> REPLICATION_STATE_ATTRS =
+      new LinkedHashSet<String>(Collections.singleton(REPLICATION_STATE));
 
   /**
    * Create a new PersistentServerState based on an already existing
@@ -160,7 +163,7 @@
        */
       final InternalSearchOperation search = getRootConnection().processSearch(
           baseDN, SearchScope.BASE_OBJECT, DereferencePolicy.NEVER_DEREF_ALIASES,
-          0, 0, false, filter, Collections.singleton(REPLICATION_STATE));
+          0, 0, false, filter, REPLICATION_STATE_ATTRS);
       final ResultCode resultCode = search.getResultCode();
       if (resultCode != ResultCode.SUCCESS
           && resultCode != ResultCode.NO_SUCH_OBJECT)
@@ -197,7 +200,7 @@
           DN.decode("cn=config"),
           SearchScope.SUBORDINATE_SUBTREE,
           DereferencePolicy.NEVER_DEREF_ALIASES,
-          1, 0, false, filter, Collections.singleton(REPLICATION_STATE));
+          1, 0, false, filter, REPLICATION_STATE_ATTRS);
       return getFirstResult(op);
     }
     catch (DirectoryException e)
diff --git a/opends/src/server/org/opends/server/util/CollectionUtils.java b/opends/src/server/org/opends/server/util/CollectionUtils.java
index 175be36..6b2c938 100644
--- a/opends/src/server/org/opends/server/util/CollectionUtils.java
+++ b/opends/src/server/org/opends/server/util/CollectionUtils.java
@@ -66,6 +66,20 @@
   }
 
   /**
+   * Creates a new {@link List} with the provided elements.
+   *
+   * @param <E>
+   *          the elements' type
+   * @param elements
+   *          the elements to add to the new List
+   * @return a new ArrayList with the provided elements
+   */
+  public static <E> List<E> newList(E... elements)
+  {
+    return newArrayList(elements);
+  }
+
+  /**
    * Creates a new {@link HashSet} with the provided elements.
    *
    * @param <E>
@@ -106,4 +120,32 @@
   {
     return new TreeSet<E>(Arrays.asList(elements));
   }
+
+  /**
+   * Creates a new {@link SortedSet} with the provided elements.
+   *
+   * @param <E>
+   *          the elements' type
+   * @param elements
+   *          the elements to add to the new SortedSet
+   * @return a new TreeSet with the provided elements
+   */
+  public static <E> SortedSet<E> newSortedSet(E... elements)
+  {
+    return newTreeSet(elements);
+  }
+
+  /**
+   * Creates a new {@link Set} with the provided elements.
+   *
+   * @param <E>
+   *          the elements' type
+   * @param elements
+   *          the elements to add to the new Set
+   * @return a new TreeSet with the provided elements
+   */
+  public static <E> Set<E> newSet(E... elements)
+  {
+    return newHashSet(elements);
+  }
 }
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
index 54ea0c8..798c91a 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -1922,21 +1922,6 @@
              "--set", "enabled:" + enabled);
   }
 
-  public static <T> Set<T> newSet(T... elems)
-  {
-    return new HashSet<T>(Arrays.asList(elems));
-  }
-
-  public static <T> SortedSet<T> newSortedSet(T... elems)
-  {
-    return new TreeSet<T>(Arrays.asList(elems));
-  }
-
-  public static <T> List<T> newList(T... elems)
-  {
-    return new ArrayList<T>(Arrays.asList(elems));
-  }
-
   /** Saves a thread dump in a file with the provided id used in file prefix. */
   public static void generateThreadDump(String id)
   {
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/ChangelogBackendTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/ChangelogBackendTestCase.java
index 99b82c2..b371e88 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/ChangelogBackendTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/ChangelogBackendTestCase.java
@@ -146,7 +146,7 @@
    * When used in a search operation, it includes all attributes (user and
    * operational)
    */
-  private static final Set<String> ALL_ATTRIBUTES = newSet("*", "+");
+  private static final LinkedHashSet<String> ALL_ATTRIBUTES = newLinkedHashSet("*", "+");
   private static final List<Control> NO_CONTROL = null;
 
   @BeforeClass
@@ -776,8 +776,8 @@
     String testName = "attributesVisibleOutsideRootDSE";
     debugInfo(testName, "Starting test \n\n");
 
-    Set<String> attributes =
-        newSet("firstchangenumber", "lastchangenumber", "changelog", "lastExternalChangelogCookie");
+    LinkedHashSet<String> attributes =
+        newLinkedHashSet("firstchangenumber", "lastchangenumber", "changelog", "lastExternalChangelogCookie");
 
     InternalSearchOperation searchOp = searchDNWithBaseScope(TEST_ROOT_DN_STRING, attributes);
     waitForSearchOpResult(searchOp, ResultCode.SUCCESS);
@@ -849,7 +849,7 @@
     {
       try
       {
-        final Set<String> attributes = new LinkedHashSet<String>();
+        final LinkedHashSet<String> attributes = new LinkedHashSet<String>();
         if (expectedFirstChangeNumber > 0)
         {
           attributes.add("firstchangenumber");
@@ -900,7 +900,7 @@
     String cookie = "";
     LDIFWriter ldifWriter = getLDIFWriter();
 
-    InternalSearchOperation searchOp = searchDNWithBaseScope("", newSet("lastExternalChangelogCookie"));
+    InternalSearchOperation searchOp = searchDNWithBaseScope("", newLinkedHashSet("lastExternalChangelogCookie"));
     List<SearchResultEntry> entries = searchOp.getSearchEntries();
     if (entries != null)
     {
@@ -1108,7 +1108,7 @@
     return searchChangelog(filterString, ALL_ATTRIBUTES, NO_CONTROL, expectedNbEntries, expectedResultCode, testName);
   }
 
-  private InternalSearchOperation searchChangelog(String filterString, Set<String> attributes,
+  private InternalSearchOperation searchChangelog(String filterString, LinkedHashSet<String> attributes,
       List<Control> controls, int expectedNbEntries, ResultCode expectedResultCode, String testName) throws Exception
   {
     InternalSearchOperation searchOperation = null;
@@ -1134,7 +1134,7 @@
     return searchOperation;
   }
 
-  private InternalSearchOperation searchDNWithBaseScope(String dn, Set<String> attributes) throws Exception
+  private InternalSearchOperation searchDNWithBaseScope(String dn, LinkedHashSet<String> attributes) throws Exception
   {
     final InternalSearchOperation searchOp = connection.processSearch(
         dn,
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestBackendImpl.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestBackendImpl.java
index 70ad008..1043c64 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestBackendImpl.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestBackendImpl.java
@@ -634,7 +634,7 @@
   public void testSearchIndex() throws Exception {
     InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
-    Set<String> attribs = new LinkedHashSet<String>();
+    LinkedHashSet<String> attribs = new LinkedHashSet<String>();
 
     String debugString;
     int finalStartPos;
@@ -1288,7 +1288,7 @@
 
     InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
-    Set<String> attribs = new LinkedHashSet<String>();
+    LinkedHashSet<String> attribs = new LinkedHashSet<String>();
     attribs.add(ATTR_DEBUG_SEARCH_INDEX);
 
     InternalSearchOperation search =
@@ -1470,7 +1470,7 @@
 
     InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
-    Set<String> attribs = new LinkedHashSet<String>();
+    LinkedHashSet<String> attribs = new LinkedHashSet<String>();
     attribs.add(ATTR_DEBUG_SEARCH_INDEX);
 
     InternalSearchOperation search =
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/controls/PersistentSearchControlTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/controls/PersistentSearchControlTest.java
index 966a2c2..a42068c 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/controls/PersistentSearchControlTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/controls/PersistentSearchControlTest.java
@@ -45,6 +45,7 @@
 
 import static org.assertj.core.api.Assertions.*;
 import static org.opends.server.controls.PersistentSearchChangeType.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.testng.Assert.*;
 
@@ -539,8 +540,7 @@
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
 
     //Create a persistent search request.
-    Set<String> attributes = new LinkedHashSet<String>();
-    attributes.add("cn");
+    LinkedHashSet<String> attributes = newLinkedHashSet("cn");
     List<Control> controls = new LinkedList<Control>();
           // Creates psearch control
     Set<PersistentSearchChangeType> changeTypes =
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/GenerationIdTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/GenerationIdTest.java
index 38ec231..31f1a85 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/GenerationIdTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/GenerationIdTest.java
@@ -58,6 +58,7 @@
 import static org.opends.server.TestCaseUtils.*;
 import static org.opends.server.loggers.ErrorLogger.*;
 import static org.opends.server.loggers.debug.DebugLogger.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.StaticUtils.*;
 import static org.testng.Assert.*;
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java
index 64dedee..d76ce4d 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java
@@ -60,13 +60,13 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import static org.opends.server.TestCaseUtils.*;
 import static org.opends.server.config.ConfigConstants.*;
 import static org.opends.server.loggers.ErrorLogger.*;
 import static org.opends.server.loggers.debug.DebugLogger.*;
 import static org.opends.server.schema.DirectoryStringSyntax.*;
 import static org.opends.server.types.ResultCode.*;
 import static org.opends.server.types.SearchScope.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 /**
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/FractionalReplicationTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/FractionalReplicationTest.java
index 8513220..fe6ecad 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/FractionalReplicationTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/FractionalReplicationTest.java
@@ -53,6 +53,7 @@
 import static org.opends.server.TestCaseUtils.*;
 import static org.opends.server.loggers.ErrorLogger.*;
 import static org.opends.server.loggers.debug.DebugLogger.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 /**
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
index bccb061..7de47d5 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
@@ -46,6 +46,7 @@
 import org.opends.server.replication.server.ReplicationServer;
 import org.opends.server.replication.service.ReplicationBroker;
 import org.opends.server.types.*;
+import org.opends.server.util.CollectionUtils;
 import org.opends.server.util.TimeThread;
 import org.testng.annotations.Test;
 
@@ -70,7 +71,7 @@
     private TestBroker(List<ReplicationMsg> list)
     {
       super(new DummyReplicationDomain(0), null,
-          new DomainFakeCfg(null, 0, TestCaseUtils.<String> newSortedSet()), null);
+          new DomainFakeCfg(null, 0, CollectionUtils.<String> newSortedSet()), null);
       this.list = list;
     }
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/StateMachineTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/StateMachineTest.java
index 16497fb..6bfc9e2 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/StateMachineTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/StateMachineTest.java
@@ -59,9 +59,9 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-import static org.opends.server.TestCaseUtils.*;
 import static org.opends.server.loggers.ErrorLogger.*;
 import static org.opends.server.loggers.debug.DebugLogger.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 /**
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
index 279726f..13d9947 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
@@ -46,9 +46,9 @@
 
 import static org.assertj.core.api.Assertions.*;
 import static org.opends.messages.ReplicationMessages.*;
-import static org.opends.server.TestCaseUtils.*;
 import static org.opends.server.replication.protocol.OperationContext.*;
 import static org.opends.server.replication.protocol.ProtocolVersion.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.StaticUtils.*;
 import static org.testng.Assert.*;
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/protocol/SynchronizationMsgTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/protocol/SynchronizationMsgTest.java
index 5fc0de5..9e582de 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/protocol/SynchronizationMsgTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/protocol/SynchronizationMsgTest.java
@@ -49,6 +49,7 @@
 import static org.opends.server.TestCaseUtils.*;
 import static org.opends.server.replication.protocol.OperationContext.*;
 import static org.opends.server.replication.protocol.ProtocolVersion.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.StaticUtils.*;
 import static org.testng.Assert.*;
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/AssuredReplicationServerTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/AssuredReplicationServerTest.java
index 71184cf..afea8e7 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/AssuredReplicationServerTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/AssuredReplicationServerTest.java
@@ -63,6 +63,7 @@
 import static org.opends.server.TestCaseUtils.*;
 import static org.opends.server.loggers.ErrorLogger.*;
 import static org.opends.server.loggers.debug.DebugLogger.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 /**
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ComputeBestServerTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ComputeBestServerTest.java
index 37a3008..effbe30 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ComputeBestServerTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ComputeBestServerTest.java
@@ -51,10 +51,10 @@
 
 import static org.assertj.core.data.MapEntry.*;
 import static org.opends.messages.ReplicationMessages.*;
-import static org.opends.server.TestCaseUtils.*;
 import static org.opends.server.loggers.ErrorLogger.*;
 import static org.opends.server.loggers.debug.DebugLogger.*;
 import static org.opends.server.replication.service.ReplicationBroker.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 /**
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationBrokerTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationBrokerTest.java
index 1eace5c..0021f8d 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationBrokerTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationBrokerTest.java
@@ -39,7 +39,7 @@
 import static java.util.Collections.*;
 
 import static org.assertj.core.api.Assertions.*;
-import static org.opends.server.TestCaseUtils.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 @SuppressWarnings("javadoc")
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationDomainTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationDomainTest.java
index 15f9a12..540ee43 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationDomainTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationDomainTest.java
@@ -52,8 +52,8 @@
 import org.testng.annotations.Test;
 
 import static org.opends.messages.ReplicationMessages.*;
-import static org.opends.server.TestCaseUtils.*;
 import static org.opends.server.loggers.ErrorLogger.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 /**

--
Gitblit v1.10.0