From da7eec061560d498abfb2eb261f59ca41e84a4bd Mon Sep 17 00:00:00 2001
From: Chris Ridd <chris.ridd@forgerock.com>
Date: Mon, 29 Apr 2013 17:07:14 +0000
Subject: [PATCH] CR-1620 Partial fix OPENDJ-888 Maintaining ds-sync-hist for a large group is inefficient

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/AttrInfoTest.java |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/AttrInfoTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/AttrInfoTest.java
index da52880..9a79ee5 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/AttrInfoTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/AttrInfoTest.java
@@ -23,10 +23,12 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
+ *      Portions Copyright 2013 ForgeRock, AS.
  */
 package org.opends.server.replication.plugin;
 
-import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.replication.ReplicationTestCase;
@@ -89,15 +91,15 @@
 
     // Check add(AttributeValue val, ChangeNumber CN)
     attrInfo1.add(att, updateTime);
-    ArrayList<AttrValueHistorical> values1 = attrInfo1.getValuesHistorical();
+    Map<AttrValueHistorical,AttrValueHistorical> values1 = attrInfo1.getValuesHistorical();
     assertTrue(values1.size() == 1);
     AttrValueHistorical valueInfo1 = new AttrValueHistorical(att, updateTime, null);
-    assertTrue(values1.get(0).equals(valueInfo1));
+    assertTrue(values1.containsKey(valueInfo1));
 
     // Check constructor with parameter
     AttrValueHistorical valueInfo2 = new AttrValueHistorical(att, updateTime, deleteTime);
-    ArrayList<AttrValueHistorical> values = new ArrayList<AttrValueHistorical>();
-    values.add(valueInfo2);
+    HashMap<AttrValueHistorical,AttrValueHistorical> values = new HashMap<AttrValueHistorical,AttrValueHistorical>();
+    values.put(valueInfo2, valueInfo2);
     AttrHistoricalMultiple attrInfo2 = new AttrHistoricalMultiple(deleteTime, updateTime, values);
 
     // Check equality
@@ -106,14 +108,14 @@
     //  Check constructor with time parameter and not Value
     AttrHistoricalMultiple attrInfo3 = new AttrHistoricalMultiple(deleteTime, updateTime, null);
     attrInfo3.add(att, updateTime);
-    ArrayList<AttrValueHistorical> values3 = attrInfo3.getValuesHistorical();
+    Map<AttrValueHistorical,AttrValueHistorical> values3 = attrInfo3.getValuesHistorical();
     assertTrue(values3.size() == 1);
     valueInfo1 = new AttrValueHistorical(att, updateTime, null);
-    assertTrue(values3.get(0).equals(valueInfo1));
+    assertTrue(values3.containsKey(valueInfo1));
 
     // Check duplicate
     AttrHistoricalMultiple attrInfo4 = attrInfo3.duplicate();
-    ArrayList<AttrValueHistorical> values4 = attrInfo4.getValuesHistorical();
+    Map<AttrValueHistorical,AttrValueHistorical> values4 = attrInfo4.getValuesHistorical();
     assertTrue(attrInfo4.getDeleteTime().compareTo(attrInfo3.getDeleteTime())==0);
     assertEquals(values4.size(), values3.size());
 

--
Gitblit v1.10.0