From a599a26d6fe93f9d3b41ba028af54d808eb31d24 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 08 Aug 2016 07:31:25 +0000
Subject: [PATCH] Partial OPENDJ-3106 Migrate Entry

---
 opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestSearchResultEntryProtocolOp.java  |   29 ++++---
 opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java                    |    3 
 opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java                      |   12 +-
 opendj-server-legacy/src/test/java/org/opends/server/replication/server/MonitorTest.java                  |    4 
 opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java               |   11 +-
 opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java          |    4 
 opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java                    |    6 
 opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/AddMsg.java                     |    9 +-
 opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java    |    3 
 opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java         |    2 
 opendj-server-legacy/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java                  |    4 
 opendj-server-legacy/src/test/java/org/opends/server/tools/ImportLDIFTestCase.java                        |   10 +
 opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java                                  |    3 
 opendj-server-legacy/src/main/java/org/opends/server/util/CollectionUtils.java                            |   32 +++++++
 opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/NamingConflictTest.java           |   16 +--
 opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java                                     |   28 -------
 opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java             |    4 
 opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/TestDnKeyFormat.java              |    4 
 opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java                 |    7 -
 opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java |    2 
 opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java        |    2 
 opendj-server-legacy/src/main/java/org/opends/server/extensions/EntityTagVirtualAttributeProvider.java    |   10 +-
 opendj-server-legacy/src/test/java/org/opends/server/replication/server/ReplicationServerTest.java        |    3 
 23 files changed, 102 insertions(+), 106 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java b/opendj-server-legacy/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java
index 1eb037d..4625c11 100644
--- a/opendj-server-legacy/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java
+++ b/opendj-server-legacy/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java
@@ -483,7 +483,7 @@
 
         final SearchResultEntry searchResultEntry =
                 Responses.newSearchResultEntry(srvResultEntry.getName().toString());
-        for (org.opends.server.types.Attribute a : srvResultEntry.getAttributes()) {
+        for (org.opends.server.types.Attribute a : srvResultEntry.getAllAttributes()) {
             searchResultEntry.addAttribute(from(a));
         }
         for (org.opends.server.types.Control c : srvResultEntry.getControls()) {
@@ -506,7 +506,7 @@
 
         final org.forgerock.opendj.ldap.Entry entry = new LinkedHashMapEntry(srvResultEntry.getName().toString());
         entry.addAttribute(from(srvResultEntry.getObjectClassAttribute()));
-        for (org.opends.server.types.Attribute a : srvResultEntry.getAttributes()) {
+        for (org.opends.server.types.Attribute a : srvResultEntry.getAllAttributes()) {
             entry.addAttribute(from(a));
         }
         return entry;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/EntityTagVirtualAttributeProvider.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/EntityTagVirtualAttributeProvider.java
index 0280329..1427997 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/EntityTagVirtualAttributeProvider.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/EntityTagVirtualAttributeProvider.java
@@ -15,6 +15,10 @@
  */
 package org.opends.server.extensions;
 
+import static org.opends.messages.ExtensionMessages.*;
+import static org.opends.server.util.CollectionUtils.*;
+
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
@@ -26,10 +30,10 @@
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.config.server.ConfigChangeResult;
 import org.forgerock.opendj.config.server.ConfigException;
+import org.forgerock.opendj.config.server.ConfigurationChangeListener;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ConditionResult;
 import org.forgerock.opendj.ldap.ResultCode;
-import org.forgerock.opendj.config.server.ConfigurationChangeListener;
 import org.forgerock.opendj.server.config.server.EntityTagVirtualAttributeCfg;
 import org.opends.server.api.VirtualAttributeProvider;
 import org.opends.server.core.SearchOperation;
@@ -40,8 +44,6 @@
 import org.opends.server.types.VirtualAttributeRule;
 import org.opends.server.util.StaticUtils;
 
-import static org.opends.messages.ExtensionMessages.*;
-
 /**
  * This class implements a virtual attribute provider which ensures that all
  * entries contain an "entity tag" or "Etag" as defined in section 3.11 of RFC
@@ -263,7 +265,7 @@
 
     // The attribute order may vary between replicas so we need to make sure
     // that we always process them in the same order.
-    final List<Attribute> attributes = entry.getAttributes();
+    final List<Attribute> attributes = collect(entry.getAllAttributes(), new ArrayList<Attribute>());
     Collections.sort(attributes, ATTRIBUTE_COMPARATOR);
     for (final Attribute attribute : attributes)
     {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index 1fcd830..91d1d14 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -4411,7 +4411,7 @@
       final Set<String> expandedNames = getExpandedNames(names);
       final Entry filteredEntry =
           entry.filterEntry(expandedNames, false, false, false);
-      return filteredEntry.getAttributes();
+      return collect(filteredEntry.getAllAttributes(), new ArrayList<Attribute>());
     }
   }
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/AddMsg.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/AddMsg.java
index b0bc3df..fdbde7f6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/AddMsg.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/AddMsg.java
@@ -19,7 +19,6 @@
 import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
 import static org.opends.server.replication.protocol.OperationContext.*;
 
-import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.zip.DataFormatException;
@@ -121,8 +120,8 @@
                 String uniqueId,
                 String parentId,
                 Attribute objectClass,
-                Collection<Attribute> userAttributes,
-                Collection<Attribute> operationalAttributes)
+                Iterable<Attribute> userAttributes,
+                Iterable<Attribute> operationalAttributes)
   {
     super (csn, uniqueId, dn);
 
@@ -260,8 +259,8 @@
 
   private byte[] encodeAttributes(
       Attribute objectClass,
-      Collection<Attribute> userAttributes,
-      Collection<Attribute> operationalAttributes)
+      Iterable<Attribute> userAttributes,
+      Iterable<Attribute> operationalAttributes)
   {
     ByteStringBuilder byteBuilder = new ByteStringBuilder();
     ASN1Writer writer = ASN1.getWriter(byteBuilder);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
index 6869c99..4aabd51 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
@@ -296,34 +296,6 @@
 
 
 
-  /**
-   * Retrieves the entire set of attributes for this entry.  This will
-   * include both user and operational attributes.  The caller must
-   * not modify the contents of this list.  Also note that this method
-   * is less efficient than calling either (or both)
-   * <CODE>getUserAttributes</CODE> or
-   * <CODE>getOperationalAttributes</CODE>, so it should only be used
-   * when calls to those methods are not appropriate.
-   *
-   * @return  The entire set of attributes for this entry.
-   */
-  public List<Attribute> getAttributes()
-  {
-    // Estimate the size.
-    int size = userAttributes.size() + operationalAttributes.size();
-
-    final List<Attribute> attributes = new ArrayList<>(size);
-    for (List<Attribute> attrs : userAttributes.values())
-    {
-      attributes.addAll(attrs);
-    }
-    for (List<Attribute> attrs : operationalAttributes.values())
-    {
-      attributes.addAll(attrs);
-    }
-    return attributes;
-  }
-
   /** Iterator over a {@code Collection<List<Attribute>>}. */
   private static final class CollectionListIterator implements Iterator<Attribute>
   {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java b/opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java
index cd5a254..4a1841d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java
@@ -160,8 +160,7 @@
     // Process collective attributes.
     if (this.isCollective)
     {
-      List<Attribute> subAttrList = entry.getAttributes();
-      for (Attribute subAttr : subAttrList)
+      for (Attribute subAttr : entry.getAllAttributes())
       {
         AttributeType attrType = subAttr.getAttributeDescription().getAttributeType();
         if (attrType.isCollective())
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/CollectionUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/util/CollectionUtils.java
index 86de78d..6aea607 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/CollectionUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/CollectionUtils.java
@@ -11,11 +11,17 @@
  * 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.util;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.TreeSet;
 
 /**
  * Utility class for {@link Collection}s.
@@ -97,4 +103,26 @@
   {
     return new TreeSet<>(Arrays.asList(elements));
   }
+
+  /**
+   * Collects all the elements from the provided iterable into the provided collection.
+   *
+   * @param <C>
+   *          The type of the collection
+   * @param <E>
+   *          The type of the iterable's elements
+   * @param iterable
+   *          the iterable from which to read elements
+   * @param outputCollection
+   *          the collection where to add the iterable's elements
+   * @return the provided collection
+   */
+  public static <C extends Collection<E>, E> C collect(Iterable<E> iterable, C outputCollection)
+  {
+    for (E e : iterable)
+    {
+      outputCollection.add(e);
+    }
+    return outputCollection;
+  }
 }
diff --git a/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java b/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
index 547aa1f..55c7378 100644
--- a/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
@@ -118,7 +118,7 @@
         SearchResultEntry result = to(entry);
         assertThat(result.getName().toString()).isEqualTo(entry.getName().toString());
         assertThat(result.getControls()).hasSize(entry.getControls().size());
-        assertThat(result.getAttributes()).hasSize(2);
+        assertThat(result.getAllAttributes()).hasSize(2);
     }
 
     /**
@@ -134,7 +134,7 @@
 
         org.opends.server.types.Entry result = to(entry);
         assertThat(result.getName().toString()).isEqualTo(entry.getName().toString());
-        assertThat(result.getAttributes()).hasSize(2);
+        assertThat(result.getAllAttributes()).hasSize(2);
     }
 
     @Test
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java
index c7222c5..5eb0f34 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java
@@ -34,7 +34,6 @@
 
 import java.io.ByteArrayOutputStream;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
@@ -732,7 +731,7 @@
           if ("delete".equals(changeType))
           {
             // We are using "*" for deletes so should get back 4 attributes.
-            assertThat(targetEntry.getAttributes()).hasSize(4);
+            assertThat(targetEntry.getAllAttributes()).hasSize(4);
             assertAttributeValue(targetEntry, "uid", "robert");
             assertAttributeValue(targetEntry, "cn", "Robert Hue2");
             assertAttributeValue(targetEntry, "telephonenumber", "555555");
@@ -740,14 +739,14 @@
           }
           else
           {
-            assertThat(targetEntry.getAttributes()).isEmpty();
+            assertThat(targetEntry.getAllAttributes()).isEmpty();
           }
         }
         else if (targetdn.endsWith("cn=fiona jensen,o=" + backendId4))
         {
           Entry targetEntry = parseIncludedAttributes(resultEntry, targetdn);
 
-          assertThat(targetEntry.getAttributes()).hasSize(2);
+          assertThat(targetEntry.getAllAttributes()).hasSize(2);
           assertAttributeValue(targetEntry,"sn","jensen");
           assertAttributeValue(targetEntry,"cn","Fiona Jensen");
         }
@@ -1202,8 +1201,8 @@
         user1entryUUID,
         baseUUID,
         entry.getObjectClassAttribute(),
-        entry.getAttributes(),
-        Collections.<Attribute> emptyList());
+        entry.getAllAttributes(),
+        null);
   }
 
   private UpdateMsg generateModMsg(ReplicaId replicaId, CSN csn, String testName) throws Exception
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/TestDnKeyFormat.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/TestDnKeyFormat.java
index a6d49b6..923a4de 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/TestDnKeyFormat.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/TestDnKeyFormat.java
@@ -336,9 +336,7 @@
         entryAfter = id2entry.entryFromDatabase(bytes, DirectoryServer.getDefaultCompressedSchema());
 
         // check DN and number of attributes
-        assertEquals(entryBefore.getAttributes().size(), entryAfter
-            .getAttributes().size());
-
+        assertThat(entryBefore.getAllAttributes()).hasSameSizeAs(entryAfter.getAllAttributes());
         assertEquals(entryBefore.getName(), entryAfter.getName());
 
         // check the object classes were not changed
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java
index 48d0dc5..0927ec1 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java
@@ -31,6 +31,7 @@
 import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
 import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.SearchScope;
+import org.forgerock.opendj.ldap.schema.ObjectClass;
 import org.opends.server.TestCaseUtils;
 import org.opends.server.controls.MatchedValuesControl;
 import org.opends.server.controls.MatchedValuesFilter;
@@ -54,7 +55,6 @@
 import org.opends.server.types.Control;
 import org.opends.server.types.DirectoryException;
 import org.opends.server.types.Entry;
-import org.forgerock.opendj.ldap.schema.ObjectClass;
 import org.opends.server.types.Operation;
 import org.opends.server.types.SearchResultEntry;
 import org.opends.server.types.SearchResultReference;
@@ -133,7 +133,7 @@
 
     // Calculate the total number of LDAP attributes in this entry.
     ldapAttrCount = 1; // For the objectclass attribute.
-    for (Attribute a : testEntry.getAttributes())
+    for (Attribute a : testEntry.getAllAttributes())
     {
       ldapAttrCount += a.size();
     }
@@ -1160,7 +1160,7 @@
   private Set<String> getAttributeNames(Entry entry)
   {
     Set<String> actualNames = new HashSet<>();
-    for (Attribute attribute : entry.getAttributes())
+    for (Attribute attribute : entry.getAllAttributes())
     {
       actualNames.add(attribute.getAttributeDescription().toString());
     }
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java
index f22f8e2..6c516d2 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java
@@ -219,7 +219,7 @@
     List<SearchResultEntry> entries = searchOperation.getSearchEntries();
     SearchResultEntry e = entries.get(0);
     assertNotNull(e);
-    assertThat(e.getAttributes()).isEmpty();
+    assertThat(e.getAllAttributes()).isEmpty();
   }
 
 
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestSearchResultEntryProtocolOp.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestSearchResultEntryProtocolOp.java
index 5e0cd31..37f2e21 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestSearchResultEntryProtocolOp.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestSearchResultEntryProtocolOp.java
@@ -12,22 +12,27 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS.
+ * Portions Copyright 2014-2016 ForgeRock AS.
  */
 
 
 package org.opends.server.protocols.ldap;
 
-import org.opends.server.types.*;
+import static org.opends.server.protocols.ldap.LDAPConstants.*;
+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.ByteStringBuilder;
 import org.opends.server.TestCaseUtils;
-import org.forgerock.opendj.io.*;
-import static org.opends.server.protocols.ldap.LDAPConstants.
-     OP_TYPE_SEARCH_RESULT_ENTRY;
-import static org.testng.Assert.*;
-import org.testng.annotations.Test;
+import org.opends.server.types.Attribute;
+import org.opends.server.types.Entry;
+import org.opends.server.types.LDAPException;
+import org.opends.server.types.SearchResultEntry;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
 
 public class TestSearchResultEntryProtocolOp extends LdapTestCase
 {
@@ -115,7 +120,7 @@
   {
     SearchResultEntryProtocolOp protocolOp =
          new SearchResultEntryProtocolOp(new SearchResultEntry(from));
-    Entry to = protocolOp.toSearchResultEntry();
+    protocolOp.toSearchResultEntry();
 
     // FIXME Issue 660: Need to provide Entry.equals(Object)
 //    assertEquals(to, from);
@@ -138,7 +143,7 @@
          new SearchResultEntryProtocolOp(new SearchResultEntry(from));
     StringBuilder builder = new StringBuilder();
     protocolOp.toLDIF(builder, wrapColumn);
-    Entry to = TestCaseUtils.entryFromLdifString(builder.toString());
+    TestCaseUtils.entryFromLdifString(builder.toString());
 
     // FIXME Issue 660: Need to provide Entry.equals(Object)
 //    assertEquals(to, from);
@@ -164,7 +169,7 @@
       }
     }
 
-    Entry to = TestCaseUtils.entryFromLdifString(builder.toString());
+    TestCaseUtils.entryFromLdifString(builder.toString());
 
     // FIXME Issue 660: Need to provide Entry.equals(Object)
 //    assertEquals(to, from);
@@ -223,7 +228,7 @@
     writer.writeOctetString(entry.getName().toString());
 
     writer.writeStartSequence();
-    for(Attribute attr : entry.getAttributes())
+    for (Attribute attr : entry.getAllAttributes())
     {
       new LDAPAttribute(attr).write(writer);
     }
@@ -242,7 +247,7 @@
     writer.writeStartSequence(OP_TYPE_SEARCH_RESULT_ENTRY);
 
     writer.writeStartSequence();
-    for(Attribute attr : entry.getAttributes())
+    for (Attribute attr : entry.getAllAttributes())
     {
       new LDAPAttribute(attr).write(writer);
     }
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java
index 3f4a8ef..5022164 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java
@@ -16,6 +16,11 @@
  */
 package org.opends.server.replication;
 
+import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
+import static org.opends.server.TestCaseUtils.*;
+import static org.opends.server.util.CollectionUtils.*;
+import static org.testng.Assert.*;
+
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.LinkedList;
@@ -45,11 +50,6 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
-import static org.opends.server.TestCaseUtils.*;
-import static org.opends.server.util.CollectionUtils.*;
-import static org.testng.Assert.*;
-
 /**
  * Test that the dependencies are computed correctly when replaying
  * sequences of operations that requires to follow a given order
@@ -206,7 +206,7 @@
   private AddMsg addMsg(DN addDN, Entry entry, int uniqueId, int parentId, CSNGenerator gen)
   {
     return new AddMsg(gen.newCSN(), addDN, stringUID(uniqueId), stringUID(parentId),
-        entry.getObjectClassAttribute(), entry.getAttributes(), null);
+        entry.getObjectClassAttribute(), entry.getAllAttributes(), null);
   }
 
   private ModifyMsg modifyMsg(DN dn, int entryUUID, List<Modification> mods, CSNGenerator gen)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java
index b17c755..eec9342 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java
@@ -24,7 +24,6 @@
 
 import java.io.File;
 import java.net.SocketTimeoutException;
-import java.util.ArrayList;
 import java.util.SortedSet;
 import java.util.TreeSet;
 import java.util.UUID;
@@ -560,7 +559,7 @@
         user1entryUUID,
         null,
         personWithUUIDEntry.getObjectClassAttribute(),
-        personWithUUIDEntry.getAttributes(), new ArrayList<Attribute>());
+        personWithUUIDEntry.getAllAttributes(), null);
   }
 
   /** Check that the expected number of changes are in the replication server database. */
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java
index af219b0..1a770e7 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java
@@ -350,8 +350,7 @@
   private AddMsg addMsg(CSNGenerator gen, Entry entry, String uniqueId, String parentId)
   {
     return new AddMsg(gen.newCSN(), entry.getName(), uniqueId, parentId,
-        entry.getObjectClassAttribute(), entry.getAttributes(),
-        new ArrayList<Attribute>());
+        entry.getObjectClassAttribute(), entry.getAllAttributes(), null);
   }
 
   /**
@@ -722,7 +721,7 @@
         user1entryUUID,
         baseUUID,
         personWithUUIDEntry.getObjectClassAttribute(),
-        personWithUUIDEntry.getAttributes(), new ArrayList<Attribute>());
+        personWithUUIDEntry.getAllAttributes(), null);
     updateMonitorCount(baseDN, resolvedMonitorAttr);
       alertCount = DummyAlertHandler.getAlertCount();
     broker.publish(addMsg);
@@ -870,7 +869,7 @@
         user1entryUUID,
         getEntryUUID(baseDN1),
         personWithUUIDEntry.getObjectClassAttribute(),
-        personWithUUIDEntry.getAttributes(), new ArrayList<Attribute>());
+        personWithUUIDEntry.getAllAttributes(), null);
 
     // - MODDN parent entry 1 to baseDn2 in the LDAP server
     ModifyDNRequest modifyDNRequest = newModifyDNRequest(baseDN1.toString(), "ou=baseDn2")
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java
index 85aefb1..2f156ad 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java
@@ -579,7 +579,7 @@
     {
       AddMsg addMsg = new AddMsg(
           gen.newCSN(), entry.getName(), UUID.randomUUID().toString(),
-          parentUid, entry.getObjectClassAttribute(), entry.getAttributes(), null);
+          parentUid, entry.getObjectClassAttribute(), entry.getAllAttributes(), null);
 
       // Send add message in assured mode
       addMsg.setAssured(isAssured);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java
index 58edf32..4abebbe 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java
@@ -1444,7 +1444,8 @@
 
   private AddMsg newAddMsg(Entry e, String entryUUID)
   {
-    return new AddMsg(gen.newCSN(), e.getName(), entryUUID, null, e.getObjectClassAttribute(), e.getAttributes(), null);
+    return new AddMsg(gen.newCSN(), e.getName(), entryUUID, null,
+        e.getObjectClassAttribute(), e.getAllAttributes(), null);
   }
 
   /**
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/NamingConflictTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/NamingConflictTest.java
index 902e5db..c22be0a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/NamingConflictTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/NamingConflictTest.java
@@ -16,8 +16,12 @@
  */
 package org.opends.server.replication.plugin;
 
+import static org.assertj.core.api.Assertions.*;
+import static org.opends.server.TestCaseUtils.*;
+import static org.opends.server.core.DirectoryServer.*;
+import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.testng.Assert.*;
 
-import java.util.ArrayList;
 import java.util.TreeSet;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -36,18 +40,11 @@
 import org.opends.server.replication.protocol.LDAPUpdateMsg;
 import org.opends.server.replication.protocol.ModifyDNMsg;
 import org.opends.server.replication.protocol.UpdateMsg;
-import org.opends.server.types.Attribute;
 import org.opends.server.types.Entry;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import static org.assertj.core.api.Assertions.*;
-import static org.opends.server.TestCaseUtils.*;
-import static org.opends.server.core.DirectoryServer.*;
-import static org.opends.server.protocols.internal.InternalClientConnection.*;
-import static org.testng.Assert.*;
-
 /** Test the naming conflict resolution code. */
 @SuppressWarnings("javadoc")
 public class NamingConflictTest extends ReplicationTestCase
@@ -314,8 +311,7 @@
         childUUID,
         parentUUID,
         childEntry.getObjectClassAttribute(),
-        childEntry.getAttributes(),
-        new ArrayList<Attribute>());
+        childEntry.getAllAttributes(), null);
 
     // Put the message in the replay queue
     replayMsg(addMsg);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java
index da4a5e1..76bcb13 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java
@@ -24,7 +24,6 @@
 
 import java.io.IOException;
 import java.net.SocketTimeoutException;
-import java.util.ArrayList;
 import java.util.SortedSet;
 import java.util.TreeSet;
 import java.util.concurrent.Callable;
@@ -55,7 +54,6 @@
 import org.opends.server.replication.server.ReplServerFakeConfiguration;
 import org.opends.server.replication.server.ReplicationServer;
 import org.opends.server.replication.service.ReplicationBroker;
-import org.opends.server.types.Attribute;
 import org.opends.server.types.Entry;
 import org.opends.server.util.TestTimer;
 import org.testng.annotations.AfterClass;
@@ -1041,7 +1039,7 @@
         userEntryUUID,
         null,
         personWithUUIDEntry.getObjectClassAttribute(),
-        personWithUUIDEntry.getAttributes(), new ArrayList<Attribute>());
+        personWithUUIDEntry.getAllAttributes(), null);
     }
   }
 
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/MonitorTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/MonitorTest.java
index a78d178..80dc3e9 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/MonitorTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/MonitorTest.java
@@ -21,7 +21,6 @@
 
 import java.io.ByteArrayOutputStream;
 import java.net.SocketException;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.SortedSet;
 import java.util.TreeSet;
@@ -41,7 +40,6 @@
 import org.opends.server.replication.service.DSRSShutdownSync;
 import org.opends.server.replication.service.ReplicationBroker;
 import org.opends.server.tools.LDAPSearch;
-import org.opends.server.types.Attribute;
 import org.opends.server.types.Entry;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
@@ -303,7 +301,7 @@
         user1entryUUID,
         baseUUID,
         personWithUUIDEntry.getObjectClassAttribute(),
-        personWithUUIDEntry.getAttributes(), new ArrayList<Attribute>());
+        personWithUUIDEntry.getAllAttributes(), null);
   }
 
   @Test(enabled=true)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/ReplicationServerTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/ReplicationServerTest.java
index 6c93e43..c3d3157 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/ReplicationServerTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/ReplicationServerTest.java
@@ -59,7 +59,6 @@
 import org.opends.server.replication.protocol.WindowMsg;
 import org.opends.server.replication.protocol.WindowProbeMsg;
 import org.opends.server.replication.service.ReplicationBroker;
-import org.opends.server.types.Attribute;
 import org.opends.server.types.Attributes;
 import org.opends.server.types.DirectoryConfig;
 import org.opends.server.types.DirectoryException;
@@ -793,7 +792,7 @@
         "objectClass: domain",
         "entryUUID: " + user1entryUUID);
     return new AddMsg(csnGen.newCSN(), EXAMPLE_DN, user1entryUUID, baseUUID,
-        entry.getObjectClassAttribute(), entry.getAttributes(), new ArrayList<Attribute>());
+        entry.getObjectClassAttribute(), entry.getAllAttributes(), null);
   }
 
   private List<ReplicationMsg> receiveReplicationMsgs(ReplicationBroker broker2, int nbMessagesExpected)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tools/ImportLDIFTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/tools/ImportLDIFTestCase.java
index 74402f4..34d2560 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/tools/ImportLDIFTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/tools/ImportLDIFTestCase.java
@@ -17,19 +17,22 @@
 package org.opends.server.tools;
 
 import static org.opends.server.TestCaseUtils.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
 
-import org.opends.server.TestCaseUtils;
+import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.server.config.server.RootCfg;
+import org.opends.server.TestCaseUtils;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.tasks.TaskUtils;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.Attributes;
-import org.forgerock.opendj.ldap.DN;
 import org.opends.server.types.Entry;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
@@ -496,7 +499,8 @@
       assertNotNull(entry);
       for (Attribute a : attrs)
       {
-        assertEquals(entry.getAttributes().contains(a), attrsShouldExistInEntry);
+        final List<Attribute> attributes = collect(entry.getAllAttributes(), new ArrayList<Attribute>());
+        assertEquals(attributes.contains(a), attrsShouldExistInEntry);
       }
     }
   }

--
Gitblit v1.10.0