From f5e61220e9878f71165989bd9f21f1d0a568bb87 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Fri, 30 Jul 2010 13:23:20 +0000
Subject: [PATCH] Code refactoring, renaming and commenting only. No feature nor behavior change.
---
opends/src/server/org/opends/server/replication/plugin/AttrValueHistorical.java | 34 +-
opends/src/server/org/opends/server/replication/plugin/FakeModdnOperation.java | 4
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalTest.java | 14
opends/src/server/org/opends/server/replication/plugin/PersistentServerState.java | 5
opends/src/server/org/opends/server/replication/plugin/AttrHistorical.java | 34 -
opends/src/server/org/opends/server/replication/plugin/AttrHistoricalMultiple.java | 120 +++---
opends/src/server/org/opends/server/replication/protocol/OperationContext.java | 5
opends/src/server/org/opends/server/replication/protocol/AddMsg.java | 6
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java | 4
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ValueInfoTest.java | 12
opends/src/server/org/opends/server/replication/plugin/EntryHistorical.java | 351 +++++++++++++-------
opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java | 34 +
opends/src/server/org/opends/server/replication/plugin/AttrHistoricalSingle.java | 40 +-
opends/src/server/org/opends/server/replication/plugin/HistAttrModificationKey.java | 26 +
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ModifyConflictTest.java | 78 ++--
opends/src/server/org/opends/server/replication/plugin/HistoricalAttributeValue.java | 98 +++--
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java | 20
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/AttrInfoTest.java | 34 +-
opends/src/server/org/opends/server/replication/protocol/ModifyCommonMsg.java | 6
opends/src/server/org/opends/server/replication/plugin/FakeAddOperation.java | 6
opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java | 56 +-
opends/src/guitools/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java | 6
opends/src/server/org/opends/server/replication/plugin/AttrHistoricalWithOptions.java | 16
23 files changed, 580 insertions(+), 429 deletions(-)
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
index a1a7261..1f28788 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
@@ -53,7 +53,7 @@
import org.opends.guitools.controlpanel.util.Utilities;
import org.opends.messages.Message;
import org.opends.server.api.AttributeSyntax;
-import org.opends.server.replication.plugin.Historical;
+import org.opends.server.replication.plugin.EntryHistorical;
import org.opends.server.schema.SchemaConstants;
import org.opends.server.types.AttributeType;
import org.opends.server.types.AttributeValue;
@@ -644,7 +644,7 @@
{
CustomSearchResult filteredSr;
List<Object> values =
- sr.getAttributeValues(Historical.HISTORICALATTRIBUTENAME);
+ sr.getAttributeValues(EntryHistorical.HISTORICALATTRIBUTENAME);
if (values != null)
{
List<Object> newValues = new ArrayList<Object>();
@@ -659,7 +659,7 @@
else
{
filteredSr = sr.clone();
- filteredSr.set(Historical.HISTORICALATTRIBUTENAME, newValues);
+ filteredSr.set(EntryHistorical.HISTORICALATTRIBUTENAME, newValues);
}
}
else
diff --git a/opends/src/server/org/opends/server/replication/plugin/AttributeInfo.java b/opends/src/server/org/opends/server/replication/plugin/AttrHistorical.java
similarity index 77%
rename from opends/src/server/org/opends/server/replication/plugin/AttributeInfo.java
rename to opends/src/server/org/opends/server/replication/plugin/AttrHistorical.java
index 9cf3a08..29cb91c 100644
--- a/opends/src/server/org/opends/server/replication/plugin/AttributeInfo.java
+++ b/opends/src/server/org/opends/server/replication/plugin/AttrHistorical.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2008 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.plugin;
@@ -37,11 +37,9 @@
/**
- * This classes is used to store historical information.
- * One object of this type is created for each attribute that was changed in
- * the entry.
+ * This class store historical information for a provided attribute.
*/
-public abstract class AttributeInfo
+public abstract class AttrHistorical
{
/**
* This method will be called when replaying an operation.
@@ -76,18 +74,18 @@
ChangeNumber changeNumber, Modification mod);
/**
- * Create a new AttributeInfo object that will be used with the given type.
+ * Create a new object from a provided attribute type. Historical is empty.
*
- * @param type the AttrbuteType with which the ATtributeInfo is going to be
- * used.
+ * @param type the provided attribute type.
* @return a new AttributeInfo object.
*/
- public static AttributeInfo createAttributeInfo(AttributeType type)
+ public static AttrHistorical createAttributeHistorical(
+ AttributeType type)
{
if (type.isSingleValue())
- return new AttrInfoSingle();
+ return new AttrHistoricalSingle();
else
- return new AttrInfoMultiple();
+ return new AttrHistoricalMultiple();
}
/**
@@ -95,25 +93,25 @@
*
* @return the List of ValueInfo
*/
- public abstract ArrayList<ValueInfo> getValuesInfo();
+ public abstract ArrayList<AttrValueHistorical> getValuesHistorical();
/**
- * Returns the last time when the attribute was deleted.
+ * Returns the last time when this attribute was deleted.
*
- * @return the last time when the attribute was deleted
+ * @return the last time when this attribute was deleted
*/
public abstract ChangeNumber getDeleteTime();
/**
- * Load the provided information.
+ * Assign the provided information to this object.
*
- * @param histKey the key to load.
+ * @param histKey the key to assign.
* @param value the associated value or null if there is no value;
* @param cn the associated ChangeNumber.
*/
- public abstract void load(
- HistKey histKey, AttributeValue value, ChangeNumber cn);
+ public abstract void assign(
+ HistAttrModificationKey histKey, AttributeValue value, ChangeNumber cn);
}
diff --git a/opends/src/server/org/opends/server/replication/plugin/AttrInfoMultiple.java b/opends/src/server/org/opends/server/replication/plugin/AttrHistoricalMultiple.java
similarity index 84%
rename from opends/src/server/org/opends/server/replication/plugin/AttrInfoMultiple.java
rename to opends/src/server/org/opends/server/replication/plugin/AttrHistoricalMultiple.java
index d78bef1..06b0ed0 100644
--- a/opends/src/server/org/opends/server/replication/plugin/AttrInfoMultiple.java
+++ b/opends/src/server/org/opends/server/replication/plugin/AttrHistoricalMultiple.java
@@ -48,42 +48,43 @@
* time a given value was deleted and the last time the whole attribute was
* deleted.
*/
-public class AttrInfoMultiple extends AttributeInfo
+public class AttrHistoricalMultiple extends AttrHistorical
{
private ChangeNumber deleteTime, // last time when the attribute was deleted
lastUpdateTime; // last time the attribute was modified
- private ArrayList<ValueInfo> valuesInfo; // creation or deletion time for
- // given values
- /**
- * create a new AttrInfo object.
- * @param deleteTime the deletion time
- * @param updateTime the update time
- * @param valuesInfo of Value Info
+ private ArrayList<AttrValueHistorical> valuesHist;
+
+ /**
+ * Create a new object from the provided informations.
+ * @param deleteTime the last time this attribute was deleted
+ * @param updateTime the last time this attribute was updated
+ * @param valuesHist the new attribute values when updated.
*/
- public AttrInfoMultiple(ChangeNumber deleteTime, ChangeNumber updateTime,
- ArrayList<ValueInfo> valuesInfo)
+ public AttrHistoricalMultiple(ChangeNumber deleteTime,
+ ChangeNumber updateTime,
+ ArrayList<AttrValueHistorical> valuesHist)
{
this.deleteTime = deleteTime;
this.lastUpdateTime = updateTime;
- if (valuesInfo == null)
- this.valuesInfo = new ArrayList<ValueInfo>();
+ if (valuesHist == null)
+ this.valuesHist = new ArrayList<AttrValueHistorical>();
else
- this.valuesInfo = valuesInfo;
+ this.valuesHist = valuesHist;
}
/**
- * create a new empty AttrInfo object.
+ * Create a new object.
*/
- public AttrInfoMultiple()
+ public AttrHistoricalMultiple()
{
this.deleteTime = null;
this.lastUpdateTime = null;
- this.valuesInfo = new ArrayList<ValueInfo>();
+ this.valuesHist = new ArrayList<AttrValueHistorical>();
}
/**
- * Returns the last time when the entry was updated.
- * @return the last time when the entry was updated
+ * Returns the last time when the attribute was updated.
+ * @return the last time when the attribute was updated
*/
private ChangeNumber getLastUpdateTime()
{
@@ -92,7 +93,6 @@
/**
* Returns the last time when the attribute was deleted.
- *
* @return the last time when the attribute was deleted
*/
public ChangeNumber getDeleteTime()
@@ -101,15 +101,15 @@
}
/**
- * Duplicate an AttrInfo.
+ * Duplicate an object.
* ChangeNumber are duplicated by references
- * @return the duplicated AttrInfo
+ * @return the duplicated object.
*/
- AttrInfoMultiple duplicate()
+ AttrHistoricalMultiple duplicate()
{
- AttrInfoMultiple dup =
- new AttrInfoMultiple(this.deleteTime, this.lastUpdateTime,
- this.valuesInfo);
+ AttrHistoricalMultiple dup =
+ new AttrHistoricalMultiple(this.deleteTime, this.lastUpdateTime,
+ this.valuesHist);
return dup;
}
@@ -124,10 +124,10 @@
// iterate through the values in the valuesInfo
// and suppress all the values that have not been added
// after the date of this delete.
- Iterator<ValueInfo> it = this.valuesInfo.iterator();
+ Iterator<AttrValueHistorical> it = this.valuesHist.iterator();
while (it.hasNext())
{
- ValueInfo info = it.next();
+ AttrValueHistorical info = it.next();
if (CN.newerOrEquals(info.getValueUpdateTime()) &&
CN.newerOrEquals(info.getValueDeleteTime()))
it.remove();
@@ -145,15 +145,16 @@
}
/**
- * Change historical information after a delete value.
+ * Update the historical of this attribute after a delete value.
+ *
* @param val value that was deleted
* @param CN time when the delete was done
*/
protected void delete(AttributeValue val, ChangeNumber CN)
{
- ValueInfo info = new ValueInfo(val, null, CN);
- this.valuesInfo.remove(info);
- this.valuesInfo.add(info);
+ AttrValueHistorical info = new AttrValueHistorical(val, null, CN);
+ this.valuesHist.remove(info);
+ this.valuesHist.add(info);
if (CN.newer(lastUpdateTime))
{
lastUpdateTime = CN;
@@ -161,8 +162,7 @@
}
/**
- * Change historical information after a delete of a set of
- * values.
+ * Update the historical of this attribute after deleting a set of values.
*
* @param attr
* the attribute containing the set of values that were
@@ -174,9 +174,9 @@
{
for (AttributeValue val : attr)
{
- ValueInfo info = new ValueInfo(val, null, CN);
- this.valuesInfo.remove(info);
- this.valuesInfo.add(info);
+ AttrValueHistorical info = new AttrValueHistorical(val, null, CN);
+ this.valuesHist.remove(info);
+ this.valuesHist.add(info);
if (CN.newer(lastUpdateTime))
{
lastUpdateTime = CN;
@@ -187,16 +187,16 @@
/**
* Update the historical information when a value is added.
*
- * @param val
+ * @param addedValue
* values that was added
* @param CN
* time when the value was added
*/
- protected void add(AttributeValue val, ChangeNumber CN)
+ protected void add(AttributeValue addedValue, ChangeNumber CN)
{
- ValueInfo info = new ValueInfo(val, CN, null);
- this.valuesInfo.remove(info);
- valuesInfo.add(info);
+ AttrValueHistorical info = new AttrValueHistorical(addedValue, CN, null);
+ this.valuesHist.remove(info);
+ valuesHist.add(info);
if (CN.newer(lastUpdateTime))
{
lastUpdateTime = CN;
@@ -215,9 +215,9 @@
{
for (AttributeValue val : attr)
{
- ValueInfo info = new ValueInfo(val, CN, null);
- this.valuesInfo.remove(info);
- valuesInfo.add(info);
+ AttrValueHistorical info = new AttrValueHistorical(val, CN, null);
+ this.valuesHist.remove(info);
+ valuesHist.add(info);
if (CN.newer(lastUpdateTime))
{
lastUpdateTime = CN;
@@ -226,13 +226,13 @@
}
/**
- * Get the List of ValueInfo for this attribute Info.
+ * Get the list of historical informations for the values.
*
- * @return the List of ValueInfo
+ * @return the list of historical informations for the values.
*/
- public ArrayList<ValueInfo> getValuesInfo()
+ public ArrayList<AttrValueHistorical> getValuesHistorical()
{
- return valuesInfo;
+ return valuesHist;
}
/**
@@ -417,9 +417,10 @@
m.setModificationType(ModificationType.REPLACE);
AttributeBuilder builder = new AttributeBuilder(modAttr, true);
- for (Iterator<ValueInfo> it = getValuesInfo().iterator(); it.hasNext();)
+ for (Iterator<AttrValueHistorical> it = getValuesHistorical().iterator();
+ it.hasNext();)
{
- ValueInfo valInfo; valInfo = it.next();
+ AttrValueHistorical valInfo; valInfo = it.next();
if (changeNumber.older(valInfo.getValueUpdateTime()))
{
@@ -427,7 +428,7 @@
* this value has been updated after this delete, therefore
* this value must be kept
*/
- builder.add(valInfo.getValue());
+ builder.add(valInfo.getAttributeValue());
}
else
{
@@ -459,7 +460,7 @@
/*
* we are processing DELETE of some attribute values
*/
- ArrayList<ValueInfo> valuesInfo = getValuesInfo();
+ ArrayList<AttrValueHistorical> valuesInfo = getValuesHistorical();
AttributeBuilder builder = new AttributeBuilder(modAttr);
for (AttributeValue val : modAttr)
@@ -468,12 +469,13 @@
Boolean addedInCurrentOp = false;
/* update historical information */
- ValueInfo valInfo = new ValueInfo(val, null, changeNumber);
+ AttrValueHistorical valInfo =
+ new AttrValueHistorical(val, null, changeNumber);
int index = valuesInfo.indexOf(valInfo);
if (index != -1)
{
/* this value already exist in the historical information */
- ValueInfo oldValInfo = valuesInfo.get(index);
+ AttrValueHistorical oldValInfo = valuesInfo.get(index);
if (changeNumber.equals(oldValInfo.getValueUpdateTime()))
{
// This value was added earlier in the same operation
@@ -561,8 +563,9 @@
AttributeBuilder builder = new AttributeBuilder(m.getAttribute());
for (AttributeValue addVal : m.getAttribute())
{
- ArrayList<ValueInfo> valuesInfo = getValuesInfo();
- ValueInfo valInfo = new ValueInfo(addVal, changeNumber, null);
+ ArrayList<AttrValueHistorical> valuesInfo = getValuesHistorical();
+ AttrValueHistorical valInfo =
+ new AttrValueHistorical(addVal, changeNumber, null);
int index = valuesInfo.indexOf(valInfo);
if (index == -1)
{
@@ -574,7 +577,7 @@
}
else
{
- ValueInfo oldValueInfo = valuesInfo.get(index);
+ AttrValueHistorical oldValueInfo = valuesInfo.get(index);
if (oldValueInfo.isUpdate())
{
/* if the value is already present
@@ -637,7 +640,8 @@
* {@inheritDoc}
*/
@Override
- public void load(HistKey histKey, AttributeValue value, ChangeNumber cn)
+ public void assign(HistAttrModificationKey histKey, AttributeValue value,
+ ChangeNumber cn)
{
switch (histKey)
{
diff --git a/opends/src/server/org/opends/server/replication/plugin/AttrInfoSingle.java b/opends/src/server/org/opends/server/replication/plugin/AttrHistoricalSingle.java
similarity index 86%
rename from opends/src/server/org/opends/server/replication/plugin/AttrInfoSingle.java
rename to opends/src/server/org/opends/server/replication/plugin/AttrHistoricalSingle.java
index 3a28259..c61c6e9 100644
--- a/opends/src/server/org/opends/server/replication/plugin/AttrInfoSingle.java
+++ b/opends/src/server/org/opends/server/replication/plugin/AttrHistoricalSingle.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008 Sun Microsystems, Inc.
+ * Copyright 2008-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.plugin;
@@ -45,7 +45,7 @@
* It allows to record the last time a given value was added,
* and the last time the whole attribute was deleted.
*/
-public class AttrInfoSingle extends AttributeInfo
+public class AttrHistoricalSingle extends AttrHistorical
{
private ChangeNumber deleteTime = null; // last time when the attribute was
// deleted
@@ -58,23 +58,24 @@
@Override
public ChangeNumber getDeleteTime()
{
- return deleteTime;
+ return this.deleteTime;
}
/**
* {@inheritDoc}
*/
@Override
- public ArrayList<ValueInfo> getValuesInfo()
+ public ArrayList<AttrValueHistorical> getValuesHistorical()
{
if (addTime == null)
{
- return new ArrayList<ValueInfo>();
+ return new ArrayList<AttrValueHistorical>();
}
else
{
- ArrayList<ValueInfo> values = new ArrayList<ValueInfo>();
- values.add(new ValueInfo(value, addTime, null));
+ ArrayList<AttrValueHistorical> values =
+ new ArrayList<AttrValueHistorical>();
+ values.add(new AttrValueHistorical(value, addTime, null));
return values;
}
}
@@ -96,26 +97,26 @@
switch (mod.getModificationType())
{
case DELETE:
- deleteTime = changeNumber;
- value = newValue;
+ this.deleteTime = changeNumber;
+ this.value = newValue;
break;
case ADD:
- addTime = changeNumber;
- value = newValue;
+ this.addTime = changeNumber;
+ this.value = newValue;
break;
case REPLACE:
if (newValue == null)
{
// REPLACE with null value is actually a DELETE
- deleteTime = changeNumber;
+ this.deleteTime = changeNumber;
}
else
{
- deleteTime = addTime = changeNumber;
+ this.deleteTime = addTime = changeNumber;
}
- value = newValue;
+ this.value = newValue;
break;
case INCREMENT:
@@ -229,29 +230,30 @@
* {@inheritDoc}
*/
@Override
- public void load(HistKey histKey, AttributeValue value, ChangeNumber cn)
+ public void assign(HistAttrModificationKey histKey,
+ AttributeValue value, ChangeNumber cn)
{
switch (histKey)
{
case ADD:
- addTime = cn;
+ this.addTime = cn;
this.value = value;
break;
case DEL:
- deleteTime = cn;
+ this.deleteTime = cn;
if (value != null)
this.value = value;
break;
case REPL:
- addTime = deleteTime = cn;
+ this.addTime = this.deleteTime = cn;
if (value != null)
this.value = value;
break;
case DELATTR:
- deleteTime = cn;
+ this.deleteTime = cn;
break;
}
}
diff --git a/opends/src/server/org/opends/server/replication/plugin/AttrInfoWithOptions.java b/opends/src/server/org/opends/server/replication/plugin/AttrHistoricalWithOptions.java
similarity index 79%
rename from opends/src/server/org/opends/server/replication/plugin/AttrInfoWithOptions.java
rename to opends/src/server/org/opends/server/replication/plugin/AttrHistoricalWithOptions.java
index c16b8e5..f3f5864 100644
--- a/opends/src/server/org/opends/server/replication/plugin/AttrInfoWithOptions.java
+++ b/opends/src/server/org/opends/server/replication/plugin/AttrHistoricalWithOptions.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2008 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.plugin;
@@ -34,16 +34,16 @@
* Used to store historical information.
* Contain a map of AttrInfo for each options of a given attribute type.
*/
-public class AttrInfoWithOptions
+public class AttrHistoricalWithOptions
{
- private HashMap<Set<String> ,AttributeInfo> attributesInfo;
+ private HashMap<Set<String> ,AttrHistorical> attributesInfo;
/**
* creates a new AttrInfoWithOptions.
*/
- public AttrInfoWithOptions()
+ public AttrHistoricalWithOptions()
{
- attributesInfo = new HashMap<Set<String> ,AttributeInfo>();
+ attributesInfo = new HashMap<Set<String> ,AttrHistorical>();
}
/**
@@ -52,7 +52,7 @@
* @param options the options
* @return the information
*/
- public AttributeInfo get(Set<String> options)
+ public AttrHistorical get(Set<String> options)
{
return attributesInfo.get(options);
}
@@ -64,7 +64,7 @@
* @param attrInfo the info to associate
* @return the info to associate
*/
- public AttributeInfo put(Set<String> options, AttributeInfo attrInfo )
+ public AttrHistorical put(Set<String> options, AttrHistorical attrInfo )
{
return attributesInfo.put(options, attrInfo);
}
@@ -73,7 +73,7 @@
* get the Attributes information associated to this object.
* @return the set of informations
*/
- public HashMap<Set<String>, AttributeInfo> getAttributesInfo()
+ public HashMap<Set<String>, AttrHistorical> getAttributesInfo()
{
return attributesInfo;
}
diff --git a/opends/src/server/org/opends/server/replication/plugin/ValueInfo.java b/opends/src/server/org/opends/server/replication/plugin/AttrValueHistorical.java
similarity index 72%
rename from opends/src/server/org/opends/server/replication/plugin/ValueInfo.java
rename to opends/src/server/org/opends/server/replication/plugin/AttrValueHistorical.java
index 78b9bd2..bf3d14d 100644
--- a/opends/src/server/org/opends/server/replication/plugin/ValueInfo.java
+++ b/opends/src/server/org/opends/server/replication/plugin/AttrValueHistorical.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2008 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.plugin;
@@ -30,22 +30,22 @@
import org.opends.server.types.AttributeValue;
/**
- * Allows to store historical information about specific values
- * for a given attribute.
+ * Store historical information for an attribute value.
*/
-public class ValueInfo
+public class AttrValueHistorical
{
private AttributeValue value;
private ChangeNumber valueDeleteTime;
private ChangeNumber valueUpdateTime;
/**
- * Build a new ValueInfo.
- * @param value value for which ValueInfo is built
- * @param CNupdate last time when value was updated last
- * @param CNdelete last time when value for deleted
+ * Build an AttrValueHistorical for a provided AttributeValue, providing
+ * the last time the provided value is either updated or deleted.
+ * @param value the provided attributeValue
+ * @param CNupdate last time when this value was updated
+ * @param CNdelete last time when this value for deleted
*/
- public ValueInfo(AttributeValue value,
+ public AttrValueHistorical(AttributeValue value,
ChangeNumber CNupdate,
ChangeNumber CNdelete)
{
@@ -63,10 +63,10 @@
@Override
public boolean equals(Object obj)
{
- if (obj instanceof ValueInfo)
+ if (obj instanceof AttrValueHistorical)
{
- ValueInfo objVal = (ValueInfo) obj;
- return (value.equals(objVal.getValue()));
+ AttrValueHistorical objVal = (AttrValueHistorical) obj;
+ return (value.equals(objVal.getAttributeValue()));
}
else
{
@@ -104,17 +104,17 @@
}
/**
- * Get the value for which this ValueInfo was generated.
- * @return the value for which this ValueInfo was generated
+ * Get the attributeValue for which this object was generated.
+ * @return the value for which this object was generated
*/
- public AttributeValue getValue()
+ public AttributeValue getAttributeValue()
{
return value;
}
/**
- * Check if the value associated with this ValueInfo was updated.
- * @return true if the value associated with this ValueInfo was updated
+ * Check if the value associated with this object was updated.
+ * @return true if the value associated with this object was updated
*/
public boolean isUpdate()
{
diff --git a/opends/src/server/org/opends/server/replication/plugin/Historical.java b/opends/src/server/org/opends/server/replication/plugin/EntryHistorical.java
similarity index 62%
rename from opends/src/server/org/opends/server/replication/plugin/Historical.java
rename to opends/src/server/org/opends/server/replication/plugin/EntryHistorical.java
index 11ef740..408cc1c 100644
--- a/opends/src/server/org/opends/server/replication/plugin/Historical.java
+++ b/opends/src/server/org/opends/server/replication/plugin/EntryHistorical.java
@@ -64,36 +64,74 @@
* each Historical Object contains a list of attribute historical information
*/
-public class Historical
+public class EntryHistorical
{
/**
- * The name of the attribute used to store historical information.
+ * Name of the attribute used to store historical information.
*/
public static final String HISTORICALATTRIBUTENAME = "ds-sync-hist";
/**
* Name used to store attachment of historical information in the
- * operation.
+ * operation. This attachement allows to use in several different places
+ * the historical while reading/writing ONCE it from/to the entry.
*/
public static final String HISTORICAL = "ds-synch-historical";
/**
- * The name of the entryuuid attribute.
+ * Name of the entryuuid attribute.
*/
public static final String ENTRYUIDNAME = "entryuuid";
-
- /*
- * contains Historical information for each attribute sorted by attribute type
+ /**
+ * The in-memory historical information is made of.
+ *
+ * EntryHistorical ::= ADDDate MODDNDate attributesInfo
+ * ADDDate ::= ChangeNumber // the date the entry was added
+ * MODDNDate ::= ChangeNumber // the date the entry was last renamed
+ *
+ * attributesInfo ::= (AttrInfoWithOptions)*
+ * one AttrInfoWithOptions by attributeType
+ *
+ * AttrInfoWithOptions ::= (AttributeInfo)*
+ * one AttributeInfo by attributeType and option
+ *
+ * AttributeInfo ::= AttrInfoSingle | AttrInfoMultiple
+ *
+ * AttrInfoSingle ::= AddTime DeleteTime ValueInfo
+ *
+ * AttrInfoMultiple ::= AddTime DeleteTime ValuesInfo
+ *
+ * ValuesInfo ::= (AttrValueHistorical)*
+ * AttrValueHistorical is the historical of the
+ * the modification of one value
+ *
+ * AddTime ::= ChangeNumber // last time the attribute was added
+ * // to the entry
+ * DeleteTime ::= ChangeNumber // last time the attribute was deleted
+ * // from the entry
+ *
+ * AttrValueHistorical ::= AttributeValue valueDeleteTime valueUpdateTime
+ * valueDeleteTime ::= ChangeNumber
+ * valueUpdateTime ::= ChangeNumber
+ *
+ * - a list indexed on AttributeType of AttrInfoWithOptions :
+ * each value is the historical for this attribute
+ * an AttrInfoWithOptions is a set indexed on the optionValue(string) of
+ * AttributeInfo
+ *
*/
- private HashMap<AttributeType,AttrInfoWithOptions> attributesInfo
- = new HashMap<AttributeType,AttrInfoWithOptions>();
// The date when the entry was added.
- private ChangeNumber ADDDate = null;
+ private ChangeNumber entryADDDate = null;
// The date when the entry was last renamed.
- private ChangeNumber MODDNDate = null;
+ private ChangeNumber entryMODDNDate = null;
+
+ // contains Historical information for each attribute sorted by attribute type
+ // key:AttributeType value:AttrInfoWithOptions
+ private HashMap<AttributeType,AttrHistoricalWithOptions> attributesHistorical
+ = new HashMap<AttributeType,AttrHistoricalWithOptions>();
/**
* {@inheritDoc}
@@ -120,17 +158,20 @@
{
boolean bConflict = false;
List<Modification> mods = modifyOperation.getModifications();
- ChangeNumber changeNumber =
+ ChangeNumber modOpChangeNumber =
OperationContext.getChangeNumber(modifyOperation);
for (Iterator<Modification> modsIterator = mods.iterator();
modsIterator.hasNext(); )
{
+ // Traverse the mods of this MOD operation
Modification m = modsIterator.next();
- AttributeInfo attrInfo = getAttrInfo(m);
+ // Read or create the attr historical for the attribute type and option
+ // contained in the mod
+ AttrHistorical attrHist = getOrCreateAttrHistorical(m);
- if (attrInfo.replayOperation(modsIterator, changeNumber,
+ if (attrHist.replayOperation(modsIterator, modOpChangeNumber,
modifiedEntry, m))
{
bConflict = true;
@@ -141,11 +182,18 @@
}
/**
- * Append replacement of state information to a given modification.
+ * Update the historical information for the provided operation.
+ * Steps :
+ * - compute the historical attribute
+ * - update the mods in the provided operation by adding the update of the
+ * historical attribute
+ * - update the modifiedEntry, already computed by core since we are in the
+ * preOperation plugin, that is called just before commiting into the DB.
*
* @param modifyOperation the modification.
*/
- public void generateState(PreOperationModifyOperation modifyOperation)
+ public void setHistoricalAttrToOperation(
+ PreOperationModifyOperation modifyOperation)
{
List<Modification> mods = modifyOperation.getModifications();
Entry modifiedEntry = modifyOperation.getModifiedEntry();
@@ -153,8 +201,9 @@
OperationContext.getChangeNumber(modifyOperation);
/*
- * If this is a local operation we need first to update the historical
- * information, then update the entry with the historical information
+ * If this is a local operation we need :
+ * - first to update the historical information,
+ * - then update the entry with the historical information
* If this is a replicated operation the historical information has
* already been set in the resolveConflict phase and we only need
* to update the entry
@@ -163,29 +212,39 @@
{
for (Modification mod : mods)
{
- AttributeInfo attrInfo = getAttrInfo(mod);
- if (attrInfo != null)
- attrInfo.processLocalOrNonConflictModification(changeNumber, mod);
+ // Get the current historical for this attributeType/options
+ // (eventually read from the provided modification)
+ AttrHistorical attrHist = getOrCreateAttrHistorical(mod);
+ if (attrHist != null)
+ attrHist.processLocalOrNonConflictModification(changeNumber, mod);
}
}
+ // Now do the 2 updates required by the core to be consistent:
+ //
+ // - add the modification of the ds-sync-hist attribute,
+ // to the current modifications of the MOD operation
Attribute attr = encode();
Modification mod = new Modification(ModificationType.REPLACE, attr);
mods.add(mod);
+ // - update the already modified entry
modifiedEntry.replaceAttribute(attr);
}
/**
- * Add historical information for a MODRDN operation to existing
- * historical information.
+ * For a MODDN operation, add new or update existing historical information.
+ *
+ * This method is NOT static because it relies on this Historical object
+ * created in the HandleConflictResolution phase.
*
* @param modifyDNOperation the modification for which the historical
* information should be created.
*/
- public void generateState(PreOperationModifyDNOperation modifyDNOperation)
+ public void setHistoricalAttrToOperation(
+ PreOperationModifyDNOperation modifyDNOperation)
{
// Update this historical information with the operation ChangeNumber.
- this.MODDNDate = OperationContext.getChangeNumber(modifyDNOperation);
+ this.entryMODDNDate = OperationContext.getChangeNumber(modifyDNOperation);
// Update the operations mods and the modified entry so that the
// historical information gets stored in the DB and indexed accordingly.
@@ -193,49 +252,67 @@
List<Modification> mods = modifyDNOperation.getModifications();
Attribute attr = encode();
+
+ // Now do the 2 updates required by the core to be consistent:
+ //
+ // - add the modification of the ds-sync-hist attribute,
+ // to the current modifications of the operation
Modification mod;
mod = new Modification(ModificationType.REPLACE, attr);
mods.add(mod);
-
+ // - update the already modified entry
modifiedEntry.removeAttribute(attr.getAttributeType());
modifiedEntry.addAttribute(attr, null);
}
/**
- * Generate and add to the Operation the historical information for
- * the ADD Operation.
- * This historical information will be used to generate fake operation
- * in case a Directory Server can not find a Replication Server with
- * all its changes at connection time.
- * This should only happen if a Directory Server or a Replication Server
- * crashes.
+ * Generate an attribute containing the historical information
+ * from the replication context attached to the provided operation
+ * and set this attribute in the operation.
*
- * @param addOperation The Operation to process.
+ * For ADD, the historical is made of the changeNumber read from the
+ * synchronization context attached to the operation.
+ *
+ * Called for both local and synchronization ADD preOperation.
+ *
+ * This historical information will be used to generate fake operation
+ * in case a Directory Server can not find a Replication Server with
+ * all its changes at connection time.
+ * This should only happen if a Directory Server or a Replication Server
+ * crashes.
+ *
+ * This method is static because there is no Historical object creation
+ * required here or before(in the HandleConflictResolution phase)
+ *
+ * @param addOperation The Operation to which the historical attribute will
+ * be added.
*/
- public static void generateState(PreOperationAddOperation addOperation)
+ public static void setHistoricalAttrToOperation(
+ PreOperationAddOperation addOperation)
{
AttributeType historicalAttrType =
DirectoryServer.getSchema().getAttributeType(HISTORICALATTRIBUTENAME);
+ // Get the changeNumber from the attached synchronization context
+ // Create the attribute (encoded)
Attribute attr =
Attributes.create(historicalAttrType,
encodeAddHistorical(OperationContext.getChangeNumber(addOperation)));
+ // Set the created attribute to the operation
List<Attribute> attrList = new LinkedList<Attribute>();
attrList.add(attr);
addOperation.setAttribute(historicalAttrType, attrList);
}
/**
- * Generate historical information for an ADD Operation.
- * This historical information will be used to generate fake operation
- * in case a Directory Server can not find a Replication Server with
- * all its changes at connection time.
- * This should only happen if a Directory Server or a Replication Server
- * crashes.
+ * Encode in the returned attributeValue, this historical information for
+ * an ADD operation.
+ * For ADD Operation : "dn:changeNumber:add"
*
* @param cn The date when the ADD Operation happened.
- * @return The encoded historical information for the ADD Operation.
+ * @return The encoded attribute value containing the historical
+ * information for the Operation.
*/
private static AttributeValue encodeAddHistorical(ChangeNumber cn)
{
@@ -248,15 +325,13 @@
}
/**
- * Generate historical information for a MODDN Operation.
- * This historical information will be used to generate fake operation
- * in case a Directory Server can not find a Replication Server with
- * all its changes at connection time.
- * This should only happen if a Directory Server or a Replication Server
- * crashes.
+ * Encode in the returned attributeValue, the historical information for
+ * a MODDN operation.
+ * For MODDN Operation : "dn:changeNumber:moddn"
*
* @param cn The date when the MODDN Operation happened.
- * @return The encoded historical information for the MODDN Operation.
+ * @return The encoded attribute value containing the historical
+ * information for the Operation.
*/
private static AttributeValue encodeMODDNHistorical(ChangeNumber cn)
{
@@ -269,17 +344,21 @@
}
/**
- * Get the AttrInfo for a given Modification.
- * The AttrInfo is the object that is used to store the historical
- * information of a given attribute type.
- * If there is no historical information for this attribute yet, a new
- * empty AttrInfo is created and returned.
+ * Return an AttributeHistorical corresponding to the attribute type
+ * and options contained in the provided mod,
+ * The attributeHistorical is :
+ * - either read from this EntryHistorical object if one exist,
+ * - or created empty.
+ * Should never return null.
*
- * @param mod The Modification that must be used.
- * @return The AttrInfo corresponding to the given Modification.
+ * @param mod the provided mod from which we'll use attributeType
+ * and options to retrieve/create the attribute historical
+ * @return the attribute historical retrieved or created empty.
*/
- private AttributeInfo getAttrInfo(Modification mod)
+ private AttrHistorical getOrCreateAttrHistorical(Modification mod)
{
+
+ // Read the provided mod
Attribute modAttr = mod.getAttribute();
if (isHistoricalAttribute(modAttr))
{
@@ -287,31 +366,36 @@
// used to store the historical information.
return null;
}
- Set<String> options = modAttr.getOptions();
- AttributeType type = modAttr.getAttributeType();
- AttrInfoWithOptions attrInfoWithOptions = attributesInfo.get(type);
- AttributeInfo attrInfo;
- if (attrInfoWithOptions != null)
+ Set<String> modOptions = modAttr.getOptions();
+ AttributeType modAttrType = modAttr.getAttributeType();
+
+ // Read from this entryHistorical,
+ // Create one empty if none was existing in this entryHistorical.
+ AttrHistoricalWithOptions attrHistWithOptions =
+ attributesHistorical.get(modAttrType);
+ AttrHistorical attrHist;
+ if (attrHistWithOptions != null)
{
- attrInfo = attrInfoWithOptions.get(options);
+ attrHist = attrHistWithOptions.get(modOptions);
}
else
{
- attrInfoWithOptions = new AttrInfoWithOptions();
- attributesInfo.put(type, attrInfoWithOptions);
- attrInfo = null;
+ attrHistWithOptions = new AttrHistoricalWithOptions();
+ attributesHistorical.put(modAttrType, attrHistWithOptions);
+ attrHist = null;
}
- if (attrInfo == null)
+ if (attrHist == null)
{
- attrInfo = AttributeInfo.createAttributeInfo(type);
- attrInfoWithOptions.put(options, attrInfo);
+ attrHist = AttrHistorical.createAttributeHistorical(modAttrType);
+ attrHistWithOptions.put(modOptions, attrHist);
}
- return attrInfo;
+ return attrHist;
}
/**
- * Encode the historical information in an operational attribute.
+ * Encode this historical information object in an operational attribute.
+ *
* @return The historical information encoded in an operational attribute.
*/
public Attribute encode()
@@ -321,20 +405,20 @@
AttributeBuilder builder = new AttributeBuilder(historicalAttrType);
// Encode the historical information for modify operation.
- for (Map.Entry<AttributeType, AttrInfoWithOptions> entryWithOptions :
- attributesInfo.entrySet())
+ for (Map.Entry<AttributeType, AttrHistoricalWithOptions> entryWithOptions :
+ attributesHistorical.entrySet())
{
AttributeType type = entryWithOptions.getKey();
- HashMap<Set<String> , AttributeInfo> attrwithoptions =
+ HashMap<Set<String> , AttrHistorical> attrwithoptions =
entryWithOptions.getValue().getAttributesInfo();
- for (Map.Entry<Set<String>, AttributeInfo> entry :
+ for (Map.Entry<Set<String>, AttrHistorical> entry :
attrwithoptions.entrySet())
{
boolean delAttr = false;
Set<String> options = entry.getKey();
String optionsString = "";
- AttributeInfo info = entry.getValue();
+ AttrHistorical info = entry.getValue();
if (options != null)
@@ -356,14 +440,14 @@
}
/* generate the historical information for modified attribute values */
- for (ValueInfo valInfo : info.getValuesInfo())
+ for (AttrValueHistorical valInfo : info.getValuesHistorical())
{
String strValue;
if (valInfo.getValueDeleteTime() != null)
{
strValue = type.getNormalizedPrimaryName() + optionsString + ":" +
valInfo.getValueDeleteTime().toString() +
- ":del:" + valInfo.getValue().toString();
+ ":del:" + valInfo.getAttributeValue().toString();
AttributeValue val = AttributeValues.create(historicalAttrType,
strValue);
builder.add(val);
@@ -371,16 +455,16 @@
else if (valInfo.getValueUpdateTime() != null)
{
if ((delAttr && valInfo.getValueUpdateTime() == deleteTime)
- && (valInfo.getValue() != null))
+ && (valInfo.getAttributeValue() != null))
{
strValue = type.getNormalizedPrimaryName() + optionsString + ":" +
valInfo.getValueUpdateTime().toString() + ":repl:" +
- valInfo.getValue().toString();
+ valInfo.getAttributeValue().toString();
delAttr = false;
}
else
{
- if (valInfo.getValue() == null)
+ if (valInfo.getAttributeValue() == null)
{
strValue = type.getNormalizedPrimaryName() + optionsString
+ ":" + valInfo.getValueUpdateTime().toString() +
@@ -390,7 +474,7 @@
{
strValue = type.getNormalizedPrimaryName() + optionsString
+ ":" + valInfo.getValueUpdateTime().toString() +
- ":add:" + valInfo.getValue().toString();
+ ":add:" + valInfo.getAttributeValue().toString();
}
}
@@ -413,15 +497,15 @@
}
// Encode the historical information for the ADD Operation.
- if (ADDDate != null)
+ if (entryADDDate != null)
{
- builder.add(encodeAddHistorical(ADDDate));
+ builder.add(encodeAddHistorical(entryADDDate));
}
// Encode the historical information for the MODDN Operation.
- if (MODDNDate != null)
+ if (entryMODDNDate != null)
{
- builder.add(encodeMODDNHistorical(MODDNDate));
+ builder.add(encodeMODDNHistorical(entryMODDNDate));
}
return builder.toAttribute();
@@ -439,7 +523,7 @@
*/
public boolean AddedOrRenamedAfter(ChangeNumber cn)
{
- if (cn.older(ADDDate) || cn.older(MODDNDate))
+ if (cn.older(entryADDDate) || cn.older(entryMODDNDate))
{
return true;
}
@@ -455,58 +539,76 @@
*/
public ChangeNumber getDNDate()
{
- if (ADDDate == null)
- return MODDNDate;
+ if (entryADDDate == null)
+ return entryMODDNDate;
- if (MODDNDate == null)
- return ADDDate;
+ if (entryMODDNDate == null)
+ return entryADDDate;
- if (MODDNDate.older(ADDDate))
- return MODDNDate;
+ if (entryMODDNDate.older(entryADDDate))
+ return entryMODDNDate;
else
- return ADDDate;
+ return entryADDDate;
}
/**
- * read the historical information from the entry attribute and
- * load it into the Historical object attached to the entry.
+ * Construct an Historical object from the provided entry by reading the
+ * historical attribute.
+ * Return an empty object when the entry does not contain any
+ * historical attribute.
+ *
* @param entry The entry which historical information must be loaded
- * @return the generated Historical information
+ * @return The constructed Historical information object
+ *
*/
- public static Historical load(Entry entry)
+ public static EntryHistorical newInstanceFromEntry(Entry entry)
{
- List<Attribute> hist = getHistoricalAttr(entry);
- Historical histObj = new Historical();
AttributeType lastAttrType = null;
Set<String> lastOptions = new HashSet<String>();
- AttributeInfo attrInfo = null;
- AttrInfoWithOptions attrInfoWithOptions = null;
+ AttrHistorical attrInfo = null;
+ AttrHistoricalWithOptions attrInfoWithOptions = null;
- if (hist == null)
+ // Read the DB historical attribute from the entry
+ List<Attribute> histAttrWithOptionsFromEntry = getHistoricalAttr(entry);
+
+ // Now we'll build the Historical object we want to construct
+ EntryHistorical newHistorical = new EntryHistorical();
+
+ if (histAttrWithOptionsFromEntry == null)
{
- return histObj;
+ // No historical attribute in the entry, return empty object
+ return newHistorical;
}
try
{
- for (Attribute attr : hist)
+ // For each value of the historical attr read (mod. on a user attribute)
+ // build an AttrInfo subobject
+
+ // Traverse the Attributes (when several options for the hist attr)
+ // of the historical attribute read from the entry
+ for (Attribute histAttrFromEntry : histAttrWithOptionsFromEntry)
{
- for (AttributeValue val : attr)
+ // For each Attribute (option), traverse the values
+ for (AttributeValue histAttrValueFromEntry : histAttrFromEntry)
{
- HistVal histVal = new HistVal(val.getValue().toString());
+ // From each value of the hist attr, create an object
+ HistoricalAttributeValue histVal = new HistoricalAttributeValue(
+ histAttrValueFromEntry.getValue().toString());
+
AttributeType attrType = histVal.getAttrType();
Set<String> options = histVal.getOptions();
ChangeNumber cn = histVal.getCn();
AttributeValue value = histVal.getAttributeValue();
- HistKey histKey = histVal.getHistKey();
+ HistAttrModificationKey histKey = histVal.getHistKey();
if (histVal.isADDOperation())
{
- histObj.ADDDate = cn;
+ newHistorical.entryADDDate = cn;
}
else if (histVal.isMODDNOperation())
{
- histObj.MODDNDate = cn;
+ newHistorical.entryMODDNDate = cn;
}
else
{
@@ -533,10 +635,15 @@
*/
if (attrType != lastAttrType)
{
- attrInfo = AttributeInfo.createAttributeInfo(attrType);
- attrInfoWithOptions = new AttrInfoWithOptions();
+ attrInfo = AttrHistorical.createAttributeHistorical(attrType);
+
+ // Create attrInfoWithOptions and store inside the attrInfo
+ attrInfoWithOptions = new AttrHistoricalWithOptions();
attrInfoWithOptions.put(options, attrInfo);
- histObj.attributesInfo.put(attrType, attrInfoWithOptions);
+
+ // Store this attrInfoWithOptions in the newHistorical object
+ newHistorical.attributesHistorical.
+ put(attrType, attrInfoWithOptions);
lastAttrType = attrType;
lastOptions = options;
@@ -545,13 +652,13 @@
{
if (!options.equals(lastOptions))
{
- attrInfo = AttributeInfo.createAttributeInfo(attrType);
+ attrInfo = AttrHistorical.createAttributeHistorical(attrType);
attrInfoWithOptions.put(options, attrInfo);
lastOptions = options;
}
}
- attrInfo.load(histKey, value, cn);
+ attrInfo.assign(histKey, value, cn);
}
}
}
@@ -565,7 +672,7 @@
}
/* set the reference to the historical information in the entry */
- return histObj;
+ return newHistorical;
}
@@ -590,7 +697,8 @@
{
for (AttributeValue val : attr)
{
- HistVal histVal = new HistVal(val.getValue().toString());
+ HistoricalAttributeValue histVal =
+ new HistoricalAttributeValue(val.getValue().toString());
if (histVal.isADDOperation())
{
// Found some historical information indicating that this
@@ -643,12 +751,14 @@
}
/**
- * Get the Attribute used to store the historical information from
- * the given Entry.
+ * Get the attribute used to store the historical information from
+ * the provided Entry.
*
* @param entry The entry containing the historical information.
*
* @return The Attribute used to store the historical information.
+ * Several values on the list if several options for this attribute.
+ * Null if not present.
*/
public static List<Attribute> getHistoricalAttr(Entry entry)
{
@@ -721,7 +831,8 @@
public static boolean isHistoricalAttribute(Attribute attr)
{
AttributeType attrType = attr.getAttributeType();
- return attrType.getNameOrOID().equals(Historical.HISTORICALATTRIBUTENAME);
+ return
+ attrType.getNameOrOID().equals(EntryHistorical.HISTORICALATTRIBUTENAME);
}
}
diff --git a/opends/src/server/org/opends/server/replication/plugin/FakeAddOperation.java b/opends/src/server/org/opends/server/replication/plugin/FakeAddOperation.java
index 65dd36b..4781b73 100644
--- a/opends/src/server/org/opends/server/replication/plugin/FakeAddOperation.java
+++ b/opends/src/server/org/opends/server/replication/plugin/FakeAddOperation.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008 Sun Microsystems, Inc.
+ * Copyright 2008-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.plugin;
@@ -61,10 +61,10 @@
public AddMsg generateMessage()
{
return new AddMsg(getChangeNumber(), entry.getDN().toString(),
- Historical.getEntryUuid(entry),
+ EntryHistorical.getEntryUuid(entry),
LDAPReplicationDomain.findEntryId(
entry.getDN().getParentDNInSuffix()),
entry.getObjectClasses(),
entry.getUserAttributes(), entry.getOperationalAttributes());
}
-}
\ No newline at end of file
+}
diff --git a/opends/src/server/org/opends/server/replication/plugin/FakeModdnOperation.java b/opends/src/server/org/opends/server/replication/plugin/FakeModdnOperation.java
index b750cea..748f777 100644
--- a/opends/src/server/org/opends/server/replication/plugin/FakeModdnOperation.java
+++ b/opends/src/server/org/opends/server/replication/plugin/FakeModdnOperation.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008 Sun Microsystems, Inc.
+ * Copyright 2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.plugin;
@@ -65,7 +65,7 @@
{
DN dn = entry.getDN();
return new ModifyDNMsg(dn.toString(), this.getChangeNumber(),
- Historical.getEntryUuid(entry),
+ EntryHistorical.getEntryUuid(entry),
LDAPReplicationDomain.findEntryId(dn.getParent()),
false, dn.getParent().toString(), dn.getRDN().toString());
}
diff --git a/opends/src/server/org/opends/server/replication/plugin/HistKey.java b/opends/src/server/org/opends/server/replication/plugin/HistAttrModificationKey.java
similarity index 73%
rename from opends/src/server/org/opends/server/replication/plugin/HistKey.java
rename to opends/src/server/org/opends/server/replication/plugin/HistAttrModificationKey.java
index af7803e..7493a8a 100644
--- a/opends/src/server/org/opends/server/replication/plugin/HistKey.java
+++ b/opends/src/server/org/opends/server/replication/plugin/HistAttrModificationKey.java
@@ -22,14 +22,22 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2008 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.plugin;
/**
- * Enumeration used for storing type of historical information.
+ * Enumeration used for storing type of attribute modification
+ * in the value of the replication historical information.
+ *
+ * Example of ds-sync-hist values:
+ * ds-sync-hist: attrName1:changeNumber1:repl:newReplacingValue
+ * ds-sync-hist: attrName1:changeNumber2:del:deletedValue
+ * ds-sync-hist: attrName3:changeNumber3:add:newAddedvalue
+ * ds-sync-hist: attrName3:changeNumber4:attrDel
+ *
*/
-public enum HistKey
+public enum HistAttrModificationKey
{
/**
* The key for attribute value deletion.
@@ -59,7 +67,7 @@
*
* @param histkey The key string
*/
- private HistKey(String histkey)
+ private HistAttrModificationKey(String histkey)
{
this.key = histkey;
}
@@ -70,22 +78,22 @@
* @param histkey the String to decode
* @return the key from the enum type
*/
- public static HistKey decodeKey(String histkey)
+ public static HistAttrModificationKey decodeKey(String histkey)
{
if (histkey == null)
return null;
if (histkey.compareTo("repl") == 0)
- return HistKey.REPL;
+ return HistAttrModificationKey.REPL;
if (histkey.compareTo("add") == 0)
- return HistKey.ADD;
+ return HistAttrModificationKey.ADD;
if (histkey.compareTo("del") == 0)
- return HistKey.DEL;
+ return HistAttrModificationKey.DEL;
if (histkey.compareTo("attrDel") == 0)
- return HistKey.DELATTR;
+ return HistAttrModificationKey.DELATTR;
return null;
}
diff --git a/opends/src/server/org/opends/server/replication/plugin/HistVal.java b/opends/src/server/org/opends/server/replication/plugin/HistoricalAttributeValue.java
similarity index 69%
rename from opends/src/server/org/opends/server/replication/plugin/HistVal.java
rename to opends/src/server/org/opends/server/replication/plugin/HistoricalAttributeValue.java
index 7828821..8948cf4 100644
--- a/opends/src/server/org/opends/server/replication/plugin/HistVal.java
+++ b/opends/src/server/org/opends/server/replication/plugin/HistoricalAttributeValue.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2008 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.plugin;
@@ -35,56 +35,60 @@
/**
- * This Class is used to encode/decode historical information
- * from the String form to the internal usable form.
+ * This class stores an internal usable representation of the value of
+ * the historical related to an entry.
+ * It encodes/decodes from the String form stored in the DB attribute
+ * from/to the internal usable form.
+ *
+ *
+ * an historical attribute value looks like :
+ * description:00000108b3a6554100000001:add:added_value
+ * or
+ * description:00000108b3a6cbb800000001:del:deleted_value
+ * or
+ * description:00000108b3a6cbb800000001:repl:new_value
+ * or
+ * description:00000108b3a6cbb800000001:delAttr
+ * or
+ * description:00000108b3a6554100000001:add
+ * or
+ * dn:00000108b3a6554100000001:add (ADD operation)
+ * or
+ * dn:00000108b3a6554100000001:moddn (MODIFYDN operation)
+ *
+ * so after split
+ * token[0] will contain the attribute name
+ * token[1] will contain the change number
+ * token[2] will contain the type of historical information
+ * token[3] will contain the attribute value
+ *
+ * options are stored with the attribute names using; as a separator
+ * example :
+ * description;FR;France:00000108b3a6554100000001:add:added_value
+ *
+ *
*/
-public class HistVal
+public class HistoricalAttributeValue
{
private AttributeType attrType;
private String attrString;
private AttributeValue attributeValue;
private ChangeNumber cn;
private LinkedHashSet<String> options;
- private HistKey histKey;
+ private HistAttrModificationKey histKey;
private String stringValue;
- // This flag indicates that this HistVal was generated to store the last date
+ // This flag indicates that this value was generated to store the last date
// when the entry was renamed.
private boolean ismodDN = false;
/**
- * Create a new HistVal from the String encoded form.
+ * Create a new object from the String encoded form.
*
- * @param strVal The String encoded form of historical information.
+ * @param strVal The String encoded form of historical attribute value.
*/
- public HistVal(String strVal)
+ public HistoricalAttributeValue(String strVal)
{
- /*
- * an historical attribute value looks like :
- * description:00000108b3a6554100000001:add:added_value
- * or
- * description:00000108b3a6cbb800000001:del:deleted_value
- * or
- * description:00000108b3a6cbb800000001:repl:new_value
- * or
- * description:00000108b3a6cbb800000001:delAttr
- * or
- * description:00000108b3a6554100000001:add
- * or
- * dn:00000108b3a6554100000001:add (ADD operation)
- * or
- * dn:00000108b3a6554100000001:moddn (MODIFYDN operation)
- *
- * so after split
- * token[0] will contain the attribute name
- * token[1] will contain the change number
- * token[2] will contain the type of historical information
- * token[3] will contain the attribute value
- *
- * options are stored with the attribute names using; as a separator
- * example :
- * description;FR;France:00000108b3a6554100000001:add:added_value
- */
String[] token = strVal.split(":", 4);
options = new LinkedHashSet<String>();
@@ -124,9 +128,9 @@
}
cn = new ChangeNumber(token[1]);
- histKey = HistKey.decodeKey(token[2]);
+ histKey = HistAttrModificationKey.decodeKey(token[2]);
stringValue = null;
- if (histKey != HistKey.DELATTR)
+ if (histKey != HistAttrModificationKey.DELATTR)
{
if (token.length == 4)
{
@@ -177,7 +181,7 @@
* Get the HistKey.
* @return Returns the histKey.
*/
- public HistKey getHistKey()
+ public HistAttrModificationKey getHistKey()
{
return histKey;
}
@@ -210,16 +214,18 @@
}
/**
- * Generate a Modification equivalent to this HistVal.
+ * Generate a Modification equivalent to this value of the historical
+ * attribute.
*
- * @return A Modification equivalent to this HistVal.
+ * @return A modification equivalent to this value of the historical
+ * attribute.
*/
public Modification generateMod()
{
AttributeBuilder builder = new AttributeBuilder(attrType, attrString);
builder.setOptions(options);
- if (histKey != HistKey.DELATTR)
+ if (histKey != HistAttrModificationKey.DELATTR)
{
builder.add(attributeValue);
}
@@ -247,9 +253,10 @@
}
/**
- * Indicates if the HistVal was generated for a ADD operation.
+ * Indicates if this value of the historical attribute was generated
+ * for a ADD operation.
*
- * @return a boolean indicating if the HistVal was generated for a ADD
+ * @return a boolean indicating if this was generated for a ADD
* operation.
*/
public boolean isADDOperation()
@@ -258,9 +265,10 @@
}
/**
- * Indicates if the HistVal was generated for a MODDN operation.
+ * Indicates if this value of the historical attribute was generated
+ * for a MODDN operation.
*
- * @return a boolean indicating if the HistVal was generated for a ADDMODDN
+ * @return a boolean indicating if this was generated for a ADDMODDN
* operation.
*/
public boolean isMODDNOperation()
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 fd23888..7ad8093 100644
--- a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -31,7 +31,7 @@
import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.getTracer;
-import static org.opends.server.replication.plugin.Historical.ENTRYUIDNAME;
+import static org.opends.server.replication.plugin.EntryHistorical.ENTRYUIDNAME;
import static org.opends.server.replication.protocol.OperationContext.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.createEntry;
@@ -203,7 +203,7 @@
// after startingChangeNumber and before endChangeNumber and
// add them to the replayOperations list
Iterable<FakeOperation> updates =
- Historical.generateFakeOperations(searchEntry);
+ EntryHistorical.generateFakeOperations(searchEntry);
for (FakeOperation op : updates)
{
@@ -1842,7 +1842,7 @@
* as it was in the original message.
*/
String operationEntryUUID = ctx.getEntryUid();
- String modifiedEntryUUID = Historical.getEntryUuid(deletedEntry);
+ String modifiedEntryUUID = EntryHistorical.getEntryUuid(deletedEntry);
if (!operationEntryUUID.equals(modifiedEntryUUID))
{
/*
@@ -1865,7 +1865,7 @@
// There is no replication context attached to the operation
// so this is not a replication operation.
ChangeNumber changeNumber = generateChangeNumber(deleteOperation);
- String modifiedEntryUUID = Historical.getEntryUuid(deletedEntry);
+ String modifiedEntryUUID = EntryHistorical.getEntryUuid(deletedEntry);
ctx = new DeleteContext(changeNumber, modifiedEntryUUID);
deleteOperation.setAttachment(SYNCHROCONTEXT, ctx);
@@ -2084,7 +2084,7 @@
* as was in the original message.
*/
String modifiedEntryUUID =
- Historical.getEntryUuid(modifyDNOperation.getOriginalEntry());
+ EntryHistorical.getEntryUuid(modifyDNOperation.getOriginalEntry());
if (!modifiedEntryUUID.equals(ctx.getEntryUid()))
{
/*
@@ -2119,7 +2119,8 @@
* If the object has been renamed more recently than this
* operation, cancel the operation.
*/
- Historical hist = Historical.load(modifyDNOperation.getOriginalEntry());
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(
+ modifyDNOperation.getOriginalEntry());
if (hist.AddedOrRenamedAfter(ctx.getChangeNumber()))
{
return new SynchronizationProviderResult.StopProcessing(
@@ -2138,7 +2139,7 @@
}
Entry modifiedEntry = modifyDNOperation.getOriginalEntry();
- String modifiedEntryUUID = Historical.getEntryUuid(modifiedEntry);
+ String modifiedEntryUUID = EntryHistorical.getEntryUuid(modifiedEntry);
ctx = new ModifyDnContext(changeNumber, modifiedEntryUUID, newParentId);
modifyDNOperation.setAttachment(SYNCHROCONTEXT, ctx);
}
@@ -2214,22 +2215,26 @@
Entry modifiedEntry = modifyOperation.getModifiedEntry();
if (ctx == null)
{
- // There is no replication context attached to the operation
- // so this is not a replication operation.
+ // No replication ctxt attached => not a replicated operation
+ // - create a ctxt with : changeNumber, entryUUID
+ // - attach the context to the op
+
ChangeNumber changeNumber = generateChangeNumber(modifyOperation);
- String modifiedEntryUUID = Historical.getEntryUuid(modifiedEntry);
+ String modifiedEntryUUID = EntryHistorical.getEntryUuid(modifiedEntry);
if (modifiedEntryUUID == null)
modifiedEntryUUID = modifyOperation.getEntryDN().toString();
ctx = new ModifyContext(changeNumber, modifiedEntryUUID);
+
modifyOperation.setAttachment(SYNCHROCONTEXT, ctx);
}
else
{
- // This is a replayed operation, it is necessary to
+ // Replication ctxt attached => this is a replicated operation being
+ // replayed here, it is necessary to
// - check if the entry has been renamed
// - check for conflicts
String modifiedEntryUUID = ctx.getEntryUid();
- String currentEntryUUID = Historical.getEntryUuid(modifiedEntry);
+ String currentEntryUUID = EntryHistorical.getEntryUuid(modifiedEntry);
if ((currentEntryUUID != null) &&
(!currentEntryUUID.equals(modifiedEntryUUID)))
{
@@ -2251,8 +2256,9 @@
/*
* Solve the conflicts between modify operations
*/
- Historical historicalInformation = Historical.load(modifiedEntry);
- modifyOperation.setAttachment(Historical.HISTORICAL,
+ EntryHistorical historicalInformation =
+ EntryHistorical.newInstanceFromEntry(modifiedEntry);
+ modifyOperation.setAttachment(EntryHistorical.HISTORICAL,
historicalInformation);
if (historicalInformation.replayOperation(modifyOperation, modifiedEntry))
@@ -2276,7 +2282,7 @@
public void doPreOperation(PreOperationAddOperation addOperation)
{
AddContext ctx = new AddContext(generateChangeNumber(addOperation),
- Historical.getEntryUuid(addOperation),
+ EntryHistorical.getEntryUuid(addOperation),
findEntryId(addOperation.getEntryDN().getParentDNInSuffix()));
addOperation.setAttachment(SYNCHROCONTEXT, ctx);
@@ -2452,8 +2458,8 @@
}
LinkedHashSet<String> attrs = new LinkedHashSet<String>(1);
- attrs.add(Historical.HISTORICALATTRIBUTENAME);
- attrs.add(Historical.ENTRYUIDNAME);
+ attrs.add(EntryHistorical.HISTORICALATTRIBUTENAME);
+ attrs.add(EntryHistorical.ENTRYUIDNAME);
attrs.add("*");
InternalSearchOperation searchOp = conn.processSearch(
ByteString.valueOf(baseDn.toString()),
@@ -2467,7 +2473,7 @@
ChangeNumber entrytoRenameDate = null;
for (SearchResultEntry entry : entries)
{
- Historical history = Historical.load(entry);
+ EntryHistorical history = EntryHistorical.newInstanceFromEntry(entry);
if (entrytoRename == null)
{
entrytoRename = entry;
@@ -2848,7 +2854,7 @@
SearchResultEntry resultEntry = result.getFirst();
if (resultEntry != null)
{
- return Historical.getEntryUuid(resultEntry);
+ return EntryHistorical.getEntryUuid(resultEntry);
}
}
}
@@ -3306,7 +3312,7 @@
{
LinkedHashSet<String> attrs = new LinkedHashSet<String>(1);
attrs.add(ENTRYUIDNAME);
- attrs.add(Historical.HISTORICALATTRIBUTENAME);
+ attrs.add(EntryHistorical.HISTORICALATTRIBUTENAME);
SearchFilter ALLMATCH;
ALLMATCH = SearchFilter.createFilterFromString("(objectClass=*)");
@@ -3329,7 +3335,7 @@
*/
conflict = true;
renameConflictEntry(conflictOp, entry.getDN(),
- Historical.getEntryUuid(entry));
+ EntryHistorical.getEntryUuid(entry));
}
}
}
@@ -4849,13 +4855,13 @@
}
LDAPFilter filter = LDAPFilter.decode(
- "(&(" + Historical.HISTORICALATTRIBUTENAME + ">=dummy:"
- + fromChangeNumber + ")(" + Historical.HISTORICALATTRIBUTENAME +
+ "(&(" + EntryHistorical.HISTORICALATTRIBUTENAME + ">=dummy:"
+ + fromChangeNumber + ")(" + EntryHistorical.HISTORICALATTRIBUTENAME +
"<=dummy:" + maxValueForId + "))");
LinkedHashSet<String> attrs = new LinkedHashSet<String>(1);
- attrs.add(Historical.HISTORICALATTRIBUTENAME);
- attrs.add(Historical.ENTRYUIDNAME);
+ attrs.add(EntryHistorical.HISTORICALATTRIBUTENAME);
+ attrs.add(EntryHistorical.ENTRYUIDNAME);
attrs.add("*");
return conn.processSearch(
ByteString.valueOf(baseDn.toString()),
diff --git a/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java b/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
index 92c628a..ddc8b01 100644
--- a/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
+++ b/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
@@ -493,18 +493,17 @@
if ((domain == null) || (!domain.solveConflict()))
return new SynchronizationProviderResult.ContinueProcessing();
- Historical historicalInformation = (Historical)
- modifyOperation.getAttachment(
- Historical.HISTORICAL);
+ EntryHistorical historicalInformation = (EntryHistorical)
+ modifyOperation.getAttachment(EntryHistorical.HISTORICAL);
if (historicalInformation == null)
{
Entry entry = modifyOperation.getModifiedEntry();
- historicalInformation = Historical.load(entry);
- modifyOperation.setAttachment(Historical.HISTORICAL,
- historicalInformation);
+ historicalInformation = EntryHistorical.newInstanceFromEntry(entry);
+ modifyOperation.setAttachment(EntryHistorical.HISTORICAL,
+ historicalInformation);
}
- historicalInformation.generateState(modifyOperation);
+ historicalInformation.setHistoricalAttrToOperation(modifyOperation);
if (modifyOperation.getModifications().isEmpty())
{
@@ -543,18 +542,22 @@
if ((domain == null) || (!domain.solveConflict()))
return new SynchronizationProviderResult.ContinueProcessing();
- Historical historicalInformation = (Historical)
- modifyDNOperation.getAttachment(
- Historical.HISTORICAL);
+ // The historical object is retrieved from the attachment created
+ // in the HandleConflictResolution phase.
+ EntryHistorical historicalInformation = (EntryHistorical)
+ modifyDNOperation.getAttachment(EntryHistorical.HISTORICAL);
if (historicalInformation == null)
{
+ // When no Historical attached, create once by loading from the entry
+ // and attach it to the operation
Entry entry = modifyDNOperation.getUpdatedEntry();
- historicalInformation = Historical.load(entry);
- modifyDNOperation.setAttachment(Historical.HISTORICAL,
+ historicalInformation = EntryHistorical.newInstanceFromEntry(entry);
+ modifyDNOperation.setAttachment(EntryHistorical.HISTORICAL,
historicalInformation);
}
- historicalInformation.generateState(modifyDNOperation);
+ // Add to the operation the historical attribute : "dn:changeNumger:moddn"
+ historicalInformation.setHistoricalAttrToOperation(modifyDNOperation);
return new SynchronizationProviderResult.ContinueProcessing();
}
@@ -566,15 +569,18 @@
public SynchronizationProviderResult doPreOperation(
PreOperationAddOperation addOperation)
{
+ // Check replication domain
LDAPReplicationDomain domain =
findDomain(addOperation.getEntryDN(), addOperation);
if (domain == null)
return new SynchronizationProviderResult.ContinueProcessing();
+ // For LOCAL op only, generate ChangeNumber and attach Context
if (!addOperation.isSynchronizationOperation())
domain.doPreOperation(addOperation);
- Historical.generateState(addOperation);
+ // Add to the operation the historical attribute : "dn:changeNumger:add"
+ EntryHistorical.setHistoricalAttrToOperation(addOperation);
return new SynchronizationProviderResult.ContinueProcessing();
}
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 538fb46..6cf5725 100644
--- a/opends/src/server/org/opends/server/replication/plugin/PersistentServerState.java
+++ b/opends/src/server/org/opends/server/replication/plugin/PersistentServerState.java
@@ -422,7 +422,7 @@
ChangeNumber serverStateMaxCn;
ChangeNumber dbMaxCn;
final AttributeType histType =
- DirectoryServer.getAttributeType(Historical.HISTORICALATTRIBUTENAME);
+ DirectoryServer.getAttributeType(EntryHistorical.HISTORICALATTRIBUTENAME);
// Retrieves the entries that have changed since the
// maxCn stored in the serverState
@@ -461,7 +461,8 @@
while (true)
{
AttributeValue attrVal = iav.next();
- HistVal histVal = new HistVal(attrVal.toString());
+ HistoricalAttributeValue histVal =
+ new HistoricalAttributeValue(attrVal.toString());
ChangeNumber cn = histVal.getCn();
if ((cn != null) && (cn.getServerId() == serverId))
diff --git a/opends/src/server/org/opends/server/replication/protocol/AddMsg.java b/opends/src/server/org/opends/server/replication/protocol/AddMsg.java
index 99da1b8..0f4f479 100644
--- a/opends/src/server/org/opends/server/replication/protocol/AddMsg.java
+++ b/opends/src/server/org/opends/server/replication/protocol/AddMsg.java
@@ -42,7 +42,7 @@
import org.opends.server.protocols.asn1.ASN1;
import org.opends.server.protocols.asn1.ASN1Exception;
import org.opends.server.replication.common.ChangeNumber;
-import org.opends.server.replication.plugin.Historical;
+import org.opends.server.replication.plugin.EntryHistorical;
import org.opends.server.types.*;
import org.opends.server.types.operation.PostOperationAddOperation;
@@ -345,7 +345,7 @@
{
for (Attribute a : list)
{
- if (!Historical.isHistoricalAttribute(a))
+ if (!EntryHistorical.isHistoricalAttribute(a))
if (!a.isVirtual())
new LDAPAttribute(a).write(writer);
}
@@ -356,7 +356,7 @@
{
for (Attribute a : list)
{
- if (!Historical.isHistoricalAttribute(a))
+ if (!EntryHistorical.isHistoricalAttribute(a))
if (!a.isVirtual())
new LDAPAttribute(a).write(writer);
}
diff --git a/opends/src/server/org/opends/server/replication/protocol/ModifyCommonMsg.java b/opends/src/server/org/opends/server/replication/protocol/ModifyCommonMsg.java
index 9a6b856..93f1031 100644
--- a/opends/src/server/org/opends/server/replication/protocol/ModifyCommonMsg.java
+++ b/opends/src/server/org/opends/server/replication/protocol/ModifyCommonMsg.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2009 Sun Microsystems, Inc.
+ * Copyright 2009-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.protocol;
@@ -37,7 +37,7 @@
import org.opends.server.protocols.ldap.LDAPAttribute;
import org.opends.server.protocols.ldap.LDAPModification;
import org.opends.server.replication.common.ChangeNumber;
-import org.opends.server.replication.plugin.Historical;
+import org.opends.server.replication.plugin.EntryHistorical;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.opends.server.types.AttributeUsage;
@@ -153,7 +153,7 @@
}
}
- if (!Historical.isHistoricalAttribute(attr))
+ if (!EntryHistorical.isHistoricalAttribute(attr))
{
LDAPModification ldapmod = new LDAPModification(
mod.getModificationType(), new LDAPAttribute(mod.getAttribute()));
diff --git a/opends/src/server/org/opends/server/replication/protocol/OperationContext.java b/opends/src/server/org/opends/server/replication/protocol/OperationContext.java
index 31ab7ad..6c2aa96 100644
--- a/opends/src/server/org/opends/server/replication/protocol/OperationContext.java
+++ b/opends/src/server/org/opends/server/replication/protocol/OperationContext.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2008 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.protocol;
@@ -101,7 +101,8 @@
}
/**
- * Get the change number of an operation.
+ * Get the change number of an operation from the synchronization context
+ * attached to the provided operation.
*
* @param op The operation.
*
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
index dfc0dbe..bb3b792 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
@@ -26,6 +26,10 @@
*/
package org.opends.server.replication;
+import static org.opends.messages.ReplicationMessages.ERR_INVALID_COOKIE_SYNTAX;
+import static org.opends.messages.ReplicationMessages.ERR_RESYNC_REQUIRED_MISSING_DOMAIN_IN_PROVIDED_COOKIE;
+import static org.opends.messages.ReplicationMessages.ERR_RESYNC_REQUIRED_TOO_OLD_DOMAIN_IN_PROVIDED_COOKIE;
+import static org.opends.messages.ReplicationMessages.ERR_RESYNC_REQUIRED_UNKNOWN_DOMAIN_IN_PROVIDED_COOKIE;
import static org.opends.server.TestCaseUtils.TEST_ROOT_DN_STRING;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.getTracer;
@@ -54,6 +58,10 @@
import java.util.SortedSet;
import java.util.TreeSet;
+import static org.opends.server.loggers.ErrorLogger.logError;
+import org.opends.messages.Category;
+import org.opends.messages.Message;
+import org.opends.messages.Severity;
import org.opends.server.TestCaseUtils;
import org.opends.server.api.Backend;
import org.opends.server.api.ConnectionHandler;
@@ -141,8 +149,6 @@
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import static org.opends.messages.ReplicationMessages.*;
-import org.opends.messages.Message;
/**
* Tests for the replicationServer code.
@@ -330,16 +336,16 @@
// Request from an invalid draft change number
ECLCompatBadSeqnum();
- // Write changes and read ECL from start
+ // Write 4 changes and read ECL from start
int ts = ECLCompatWriteReadAllOps(1);
- // Write additional changes and read ECL from a provided draft change number
+ // Write 4 additional changes and read ECL from a provided draft change number
ts = ECLCompatWriteReadAllOps(5);
- // Test request from a provided change number
+ // Test request from a provided change number - read 6
ECLCompatReadFrom(6);
- // Test request from a provided change number interval
+ // Test request from a provided change number interval - read 5-7
ECLCompatReadFromTo(5,7);
// Test first and last draft changenumber
@@ -4102,4 +4108,4 @@
operation.getErrorMessage().toString());
}
}
-}
\ No newline at end of file
+}
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 10e8417..da52880 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
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2009 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.plugin;
@@ -31,8 +31,8 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.replication.ReplicationTestCase;
import org.opends.server.replication.common.ChangeNumber;
-import org.opends.server.replication.plugin.AttrInfoMultiple;
-import org.opends.server.replication.plugin.ValueInfo;
+import org.opends.server.replication.plugin.AttrHistoricalMultiple;
+import org.opends.server.replication.plugin.AttrValueHistorical;
import org.opends.server.types.AttributeType;
import org.opends.server.types.AttributeValue;
import org.opends.server.types.Attributes;
@@ -85,50 +85,50 @@
throws Exception
{
// Create an empty AttrInfo
- AttrInfoMultiple attrInfo1 = new AttrInfoMultiple();
+ AttrHistoricalMultiple attrInfo1 = new AttrHistoricalMultiple();
// Check add(AttributeValue val, ChangeNumber CN)
attrInfo1.add(att, updateTime);
- ArrayList<ValueInfo> values1 = attrInfo1.getValuesInfo();
+ ArrayList<AttrValueHistorical> values1 = attrInfo1.getValuesHistorical();
assertTrue(values1.size() == 1);
- ValueInfo valueInfo1 = new ValueInfo(att, updateTime, null);
+ AttrValueHistorical valueInfo1 = new AttrValueHistorical(att, updateTime, null);
assertTrue(values1.get(0).equals(valueInfo1));
// Check constructor with parameter
- ValueInfo valueInfo2 = new ValueInfo(att, updateTime, deleteTime);
- ArrayList<ValueInfo> values = new ArrayList<ValueInfo>();
+ AttrValueHistorical valueInfo2 = new AttrValueHistorical(att, updateTime, deleteTime);
+ ArrayList<AttrValueHistorical> values = new ArrayList<AttrValueHistorical>();
values.add(valueInfo2);
- AttrInfoMultiple attrInfo2 = new AttrInfoMultiple(deleteTime, updateTime, values);
+ AttrHistoricalMultiple attrInfo2 = new AttrHistoricalMultiple(deleteTime, updateTime, values);
// Check equality
//assertTrue(attrInfo1.getDeleteTime().compareTo(attrInfo2.getDeleteTime())==0);
// Check constructor with time parameter and not Value
- AttrInfoMultiple attrInfo3 = new AttrInfoMultiple(deleteTime, updateTime, null);
+ AttrHistoricalMultiple attrInfo3 = new AttrHistoricalMultiple(deleteTime, updateTime, null);
attrInfo3.add(att, updateTime);
- ArrayList<ValueInfo> values3 = attrInfo3.getValuesInfo();
+ ArrayList<AttrValueHistorical> values3 = attrInfo3.getValuesHistorical();
assertTrue(values3.size() == 1);
- valueInfo1 = new ValueInfo(att, updateTime, null);
+ valueInfo1 = new AttrValueHistorical(att, updateTime, null);
assertTrue(values3.get(0).equals(valueInfo1));
// Check duplicate
- AttrInfoMultiple attrInfo4 = attrInfo3.duplicate();
- ArrayList<ValueInfo> values4 = attrInfo4.getValuesInfo();
+ AttrHistoricalMultiple attrInfo4 = attrInfo3.duplicate();
+ ArrayList<AttrValueHistorical> values4 = attrInfo4.getValuesHistorical();
assertTrue(attrInfo4.getDeleteTime().compareTo(attrInfo3.getDeleteTime())==0);
assertEquals(values4.size(), values3.size());
// Check delete(AttributeValue val, ChangeNumber CN)
attrInfo4.delete(att, updateTime);
- assertTrue(attrInfo4.getValuesInfo().size() == 1);
+ assertTrue(attrInfo4.getValuesHistorical().size() == 1);
// Check delete(LinkedHashSet<AttributeValue> values, ChangeNumber CN)
AttributeType type = DirectoryServer.getAttributeType("description");
attrInfo3.delete(Attributes.create(type, att), updateTime) ;
- assertTrue(attrInfo3.getValuesInfo().size() == 1);
+ assertTrue(attrInfo3.getValuesHistorical().size() == 1);
// Check delete(ChangeNumber CN)
attrInfo2.delete(updateTime) ;
- assertTrue(attrInfo2.getValuesInfo().size() == 0);
+ assertTrue(attrInfo2.getValuesHistorical().size() == 0);
}
}
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 8f19763..8382623 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
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008-2009 Sun Microsystems, Inc.
+ * Copyright 2008-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.plugin;
@@ -141,7 +141,7 @@
long startTime = TimeThread.getTime();
final DN dn1 = DN.decode("cn=test1," + baseDn.toString());
final AttributeType histType =
- DirectoryServer.getAttributeType(Historical.HISTORICALATTRIBUTENAME);
+ DirectoryServer.getAttributeType(EntryHistorical.HISTORICALATTRIBUTENAME);
logError(Message.raw(Category.SYNC, Severity.INFORMATION,
"Starting replication test : changesCmpTest"));
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalTest.java
index 7560951..7ccdf26 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalTest.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008-2009 Sun Microsystems, Inc.
+ * Copyright 2008-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.plugin;
@@ -183,11 +183,11 @@
DN dn = DN.decode("uid=user.1," + TEST_ROOT_DN_STRING);
Entry entry = DirectoryServer.getEntry(dn);
- List<Attribute> attrs = Historical.getHistoricalAttr(entry);
+ List<Attribute> attrs = EntryHistorical.getHistoricalAttr(entry);
Attribute before = attrs.get(0);
// Check that encoding and decoding preserves the history information.
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
Attribute after = hist.encode();
assertEquals(after, before);
@@ -368,7 +368,7 @@
// This will ensure both that the Add historical information is
// correctly added and also that the code that rebuild operation
// from this historical information is working.
- Iterable<FakeOperation> ops = Historical.generateFakeOperations(entry);
+ Iterable<FakeOperation> ops = EntryHistorical.generateFakeOperations(entry);
// Perform a few check on the Operation to see that it
// was correctly generated.
@@ -387,7 +387,7 @@
// use historical information to generate new list of operations
// equivalent to the operations that have been applied to this entry.
- ops = Historical.generateFakeOperations(entry);
+ ops = EntryHistorical.generateFakeOperations(entry);
// Perform a few check on the operation list to see that it
// was correctly generated.
@@ -406,7 +406,7 @@
// use historical information to generate new list of operations
// equivalent to the operations that have been applied to this entry.
- ops = Historical.generateFakeOperations(entry);
+ ops = EntryHistorical.generateFakeOperations(entry);
// Perform a few check on the operation list to see that it
// was correctly generated.
@@ -450,7 +450,7 @@
assertTrue(addOp.getChangeNumber() != null);
AddMsg addmsg = addOp.generateMessage();
assertTrue(dn1.equals(DN.decode(addmsg.getDn())));
- assertTrue(addmsg.getUniqueId().equals(Historical.getEntryUuid(entry)));
+ assertTrue(addmsg.getUniqueId().equals(EntryHistorical.getEntryUuid(entry)));
String parentId = LDAPReplicationDomain.findEntryId(dn1.getParent());
assertTrue(addmsg.getParentUid().equals(parentId));
addmsg.createOperation(InternalClientConnection.getRootConnection());
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ModifyConflictTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ModifyConflictTest.java
index 1d61470..5c478f2 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ModifyConflictTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ModifyConflictTest.java
@@ -48,7 +48,7 @@
import org.opends.server.replication.common.ChangeNumber;
import org.opends.server.replication.plugin.FakeOperation;
import org.opends.server.replication.plugin.FakeOperationComparator;
-import org.opends.server.replication.plugin.Historical;
+import org.opends.server.replication.plugin.EntryHistorical;
import org.opends.server.replication.protocol.ModifyContext;
import org.opends.server.replication.protocol.ReplicationMsg;
import org.opends.server.types.*;
@@ -86,7 +86,7 @@
Entry entry = initializeEntry();
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a modify-replace done at time t10
@@ -128,7 +128,7 @@
Entry entry = initializeEntry();
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a modify-replace done at time t10
@@ -171,7 +171,7 @@
Entry entry = initializeEntry();
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a replace with null done at time t3
@@ -212,7 +212,7 @@
Entry entry = initializeEntry();
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a modify-add done at time t10
@@ -254,7 +254,7 @@
Entry entry = initializeEntry();
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a modify-add done at time 2
@@ -289,7 +289,7 @@
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a delete of the whole description attribute done at time
@@ -345,7 +345,7 @@
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a delete of the description attribute value "value1"
@@ -401,7 +401,7 @@
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a delete of the description attribute values
@@ -449,7 +449,7 @@
entry.addAttribute(attribute, duplicateValues);
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a delete of attribute employeenumber.
@@ -483,7 +483,7 @@
entry.addAttribute(attribute, duplicateValues);
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* now simulate a delete of value "value1"
@@ -523,7 +523,7 @@
entry.addAttribute(builder.toAttribute(), duplicateValues);
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a delete of the description attribute value "value1"
@@ -569,7 +569,7 @@
entry.addAttribute(attribute, duplicateValues);
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a delete of the whole description attribute done at time
@@ -612,7 +612,7 @@
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a delete of the whole description attribute done at time
@@ -657,7 +657,7 @@
entry.addAttribute(builder.toAttribute(), duplicateValues);
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
// simulate a REPLACE of the attribute with values : value1, value2, value3
// at time t1.
@@ -714,7 +714,7 @@
entry.addAttribute(builder.toAttribute(), duplicateValues);
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
// simulate a DELETE of the attribute values : value3 and value4
// at time t2.
@@ -786,7 +786,7 @@
entry.addAttribute(attribute, duplicateValues);
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a delete of the whole description attribute done at time
@@ -813,7 +813,7 @@
Entry entry = initializeEntry();
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a add of the description attribute done at time t10
@@ -855,7 +855,7 @@
Entry entry = initializeEntry();
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a add of the description attribute done at time t10
@@ -898,7 +898,7 @@
Entry entry = initializeEntry();
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* Now simulate a del and a add in the same operation
@@ -937,7 +937,7 @@
Entry entry = initializeEntry();
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a add of the description attribute done at time 1
@@ -967,7 +967,7 @@
entry = initializeEntry();
// load historical from the entry
- hist = Historical.load(entry);
+ hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate an add of the description attribute values
@@ -1002,7 +1002,7 @@
Entry entry = initializeEntry();
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a add of the description attribute done at time t10
@@ -1044,7 +1044,7 @@
Entry entry = initializeEntry();
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a add of the description attribute done at time t1
@@ -1082,7 +1082,7 @@
Entry entry = initializeEntry();
// load historical from the entry
- Historical hist = Historical.load(entry);
+ EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
/*
* simulate a add of the description attribute done at time t1
@@ -1134,7 +1134,7 @@
{
AttributeType entryuuidAttrType =
DirectoryServer.getSchema().getAttributeType(
- Historical.ENTRYUIDNAME);
+ EntryHistorical.ENTRYUIDNAME);
/*
* Objectclass and DN do not have any impact on the modify conflict
@@ -1174,14 +1174,14 @@
* helper function.
*/
private void testHistoricalAndFake(
- Historical hist, Entry entry)
+ EntryHistorical hist, Entry entry)
{
AttributeType entryuuidAttrType =
- DirectoryServer.getSchema().getAttributeType(Historical.ENTRYUIDNAME);
+ DirectoryServer.getSchema().getAttributeType(EntryHistorical.ENTRYUIDNAME);
// Get the historical uuid associated to the entry
// (the one that needs to be tested)
- String uuid = Historical.getEntryUuid(entry);
+ String uuid = EntryHistorical.getEntryUuid(entry);
// Get the Entry uuid in String format
List<Attribute> uuidAttrs = entry
@@ -1202,7 +1202,7 @@
// Test FakeOperation
try
{
- Iterable<FakeOperation> fks = Historical.generateFakeOperations(entry);
+ Iterable<FakeOperation> fks = EntryHistorical.generateFakeOperations(entry);
if (fks.iterator().hasNext())
{
FakeOperation fk = fks.iterator().next();
@@ -1230,7 +1230,7 @@
*
*/
private void testModify(Entry entry,
- Historical hist, String attrName,
+ EntryHistorical hist, String attrName,
ModificationType modType, String value,
int date, boolean keepChangeResult) throws DirectoryException
{
@@ -1242,7 +1242,7 @@
*
*/
private void testModify(Entry entry,
- Historical hist, String attrName, Modification mod,
+ EntryHistorical hist, String attrName, Modification mod,
int date, boolean keepChangeResult) throws DirectoryException
{
List<Modification> mods = replayModify(entry, hist, mod, date);
@@ -1273,7 +1273,7 @@
*/
private void replayModifies(
- Entry entry, Historical hist, List<Modification> mods, int date)
+ Entry entry, EntryHistorical hist, List<Modification> mods, int date)
{
InternalClientConnection connection =
InternalClientConnection.getRootConnection();
@@ -1289,11 +1289,11 @@
}
private List<Modification> replayModify(
- Entry entry, Historical hist, Modification mod, int date)
+ Entry entry, EntryHistorical hist, Modification mod, int date)
{
AttributeType historicalAttrType =
DirectoryServer.getSchema().getAttributeType(
- Historical.HISTORICALATTRIBUTENAME);
+ EntryHistorical.HISTORICALATTRIBUTENAME);
InternalClientConnection connection =
InternalClientConnection.getRootConnection();
@@ -1330,7 +1330,7 @@
*/
entry.removeAttribute(historicalAttrType);
entry.addAttribute(hist.encode(), null);
- Historical hist2 = Historical.load(entry);
+ EntryHistorical hist2 = EntryHistorical.newInstanceFromEntry(entry);
assertEquals(hist2.encode().toString(), hist.encode().toString());
return mods;
@@ -1367,15 +1367,15 @@
*
*/
private void testHistorical(
- Historical hist, LocalBackendAddOperation addOp)
+ EntryHistorical hist, LocalBackendAddOperation addOp)
{
AttributeType entryuuidAttrType =
DirectoryServer.getSchema().getAttributeType(
- Historical.ENTRYUIDNAME);
+ EntryHistorical.ENTRYUIDNAME);
// Get the historical uuid associated to the entry
// (the one that needs to be tested)
- String uuid = Historical.getEntryUuid(addOp);
+ String uuid = EntryHistorical.getEntryUuid(addOp);
// Get the op uuid in String format
List<Attribute> uuidAttrs = addOp.getOperationalAttributes().get(
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ValueInfoTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ValueInfoTest.java
index 08a1555..2b2369a 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ValueInfoTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ValueInfoTest.java
@@ -22,14 +22,14 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2009 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.plugin;
import org.opends.server.core.DirectoryServer;
import org.opends.server.replication.ReplicationTestCase;
import org.opends.server.replication.common.ChangeNumber;
-import org.opends.server.replication.plugin.ValueInfo;
+import org.opends.server.replication.plugin.AttrValueHistorical;
import org.opends.server.types.AttributeType;
import org.opends.server.types.AttributeValue;
import org.opends.server.types.AttributeValues;
@@ -80,9 +80,9 @@
throws Exception
{
AttributeType type = DirectoryServer.getAttributeType("description");
- ValueInfo valInfo1 = new ValueInfo(value,CNupdate,CNdelete);
- ValueInfo valInfo2 = new ValueInfo(value,CNupdate,CNupdate);
- ValueInfo valInfo3 = new ValueInfo(AttributeValues.create(type,"Test"),
+ AttrValueHistorical valInfo1 = new AttrValueHistorical(value,CNupdate,CNdelete);
+ AttrValueHistorical valInfo2 = new AttrValueHistorical(value,CNupdate,CNupdate);
+ AttrValueHistorical valInfo3 = new AttrValueHistorical(AttributeValues.create(type,"Test"),
CNupdate,CNupdate);
// Check equals
@@ -107,7 +107,7 @@
}
// Check getValue
- assertTrue(valInfo1.getValue().equals(value)) ;
+ assertTrue(valInfo1.getAttributeValue().equals(value)) ;
// Chek valueUpdateTime
if (CNupdate == null)
--
Gitblit v1.10.0