Initial cleanup work for OPENDJ-181: DirectoryException provided value has an invalid length for a UUID
Use consistent naming for methods and variables which refer to entryUUIDs.
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | { |
| | | CustomSearchResult filteredSr; |
| | | List<Object> values = |
| | | sr.getAttributeValues(EntryHistorical.HISTORICALATTRIBUTENAME); |
| | | sr.getAttributeValues(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | if (values != null) |
| | | { |
| | | List<Object> newValues = new ArrayList<Object>(); |
| | |
| | | else |
| | | { |
| | | filteredSr = sr.duplicate(); |
| | | filteredSr.set(EntryHistorical.HISTORICALATTRIBUTENAME, newValues); |
| | | filteredSr.set(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME, newValues); |
| | | } |
| | | } |
| | | else |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | /** |
| | | * Name of the attribute used to store historical information. |
| | | */ |
| | | public static final String HISTORICALATTRIBUTENAME = "ds-sync-hist"; |
| | | public static final String HISTORICAL_ATTRIBUTE_NAME = "ds-sync-hist"; |
| | | |
| | | /** |
| | | * Name used to store attachment of historical information in the |
| | |
| | | /** |
| | | * Name of the entryuuid attribute. |
| | | */ |
| | | public static final String ENTRYUIDNAME = "entryuuid"; |
| | | public static final String ENTRYUUID_ATTRIBUTE_NAME = "entryuuid"; |
| | | |
| | | /* The delay to purge the historical informations |
| | | * This delay indicates the time the domain keeps the historical |
| | |
| | | PreOperationAddOperation addOperation) |
| | | { |
| | | AttributeType historicalAttrType = |
| | | DirectoryServer.getSchema().getAttributeType(HISTORICALATTRIBUTENAME); |
| | | DirectoryServer.getSchema().getAttributeType(HISTORICAL_ATTRIBUTE_NAME); |
| | | |
| | | // Get the changeNumber from the attached synchronization context |
| | | // Create the attribute (encoded) |
| | |
| | | private static AttributeValue encodeAddHistorical(ChangeNumber cn) |
| | | { |
| | | AttributeType historicalAttrType = |
| | | DirectoryServer.getSchema().getAttributeType(HISTORICALATTRIBUTENAME); |
| | | DirectoryServer.getSchema().getAttributeType(HISTORICAL_ATTRIBUTE_NAME); |
| | | |
| | | String strValue = "dn:" + cn.toString() +":add"; |
| | | AttributeValue val = AttributeValues.create(historicalAttrType, strValue); |
| | |
| | | private static AttributeValue encodeMODDNHistorical(ChangeNumber cn) |
| | | { |
| | | AttributeType historicalAttrType = |
| | | DirectoryServer.getSchema().getAttributeType(HISTORICALATTRIBUTENAME); |
| | | DirectoryServer.getSchema().getAttributeType(HISTORICAL_ATTRIBUTE_NAME); |
| | | |
| | | String strValue = "dn:" + cn.toString() +":moddn"; |
| | | AttributeValue val = AttributeValues.create(historicalAttrType, strValue); |
| | |
| | | purgeDate = TimeThread.getTime() - purgeDelayInMillisec; |
| | | |
| | | AttributeType historicalAttrType = |
| | | DirectoryServer.getSchema().getAttributeType(HISTORICALATTRIBUTENAME); |
| | | DirectoryServer.getSchema().getAttributeType(HISTORICAL_ATTRIBUTE_NAME); |
| | | AttributeBuilder builder = new AttributeBuilder(historicalAttrType); |
| | | |
| | | for (Map.Entry<AttributeType, AttrHistoricalWithOptions> entryWithOptions : |
| | |
| | | } |
| | | else |
| | | { |
| | | String uuidString = getEntryUuid(entry); |
| | | String uuidString = getEntryUUID(entry); |
| | | if (uuidString != null) |
| | | { |
| | | modifyFakeOperation = new FakeModifyOperation(entry.getDN(), |
| | |
| | | */ |
| | | public static List<Attribute> getHistoricalAttr(Entry entry) |
| | | { |
| | | return entry.getAttribute(HISTORICALATTRIBUTENAME); |
| | | return entry.getAttribute(HISTORICAL_ATTRIBUTE_NAME); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The Unique Id of the entry if it has one. null, otherwise. |
| | | */ |
| | | public static String getEntryUuid(Entry entry) |
| | | public static String getEntryUUID(Entry entry) |
| | | { |
| | | String uuidString = null; |
| | | AttributeType entryuuidAttrType = |
| | | DirectoryServer.getSchema().getAttributeType(ENTRYUIDNAME); |
| | | DirectoryServer.getSchema().getAttributeType(ENTRYUUID_ATTRIBUTE_NAME); |
| | | List<Attribute> uuidAttrs = |
| | | entry.getOperationalAttribute(entryuuidAttrType); |
| | | if (uuidAttrs != null) |
| | |
| | | * @param op The operation |
| | | * @return The Entry Unique Id String form. |
| | | */ |
| | | public static String getEntryUuid(PreOperationAddOperation op) |
| | | public static String getEntryUUID(PreOperationAddOperation op) |
| | | { |
| | | String uuidString = null; |
| | | Map<AttributeType, List<Attribute>> attrs = op.getOperationalAttributes(); |
| | | AttributeType entryuuidAttrType = |
| | | DirectoryServer.getSchema().getAttributeType(ENTRYUIDNAME); |
| | | DirectoryServer.getSchema().getAttributeType(ENTRYUUID_ATTRIBUTE_NAME); |
| | | List<Attribute> uuidAttrs = attrs.get(entryuuidAttrType); |
| | | |
| | | if (uuidAttrs != null) |
| | |
| | | { |
| | | AttributeType attrType = attr.getAttributeType(); |
| | | return |
| | | attrType.getNameOrOID().equals(EntryHistorical.HISTORICALATTRIBUTENAME); |
| | | attrType.getNameOrOID().equals(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | public AddMsg generateMessage() |
| | | { |
| | | return new AddMsg(getChangeNumber(), entry.getDN().toString(), |
| | | EntryHistorical.getEntryUuid(entry), |
| | | LDAPReplicationDomain.findEntryId( |
| | | EntryHistorical.getEntryUUID(entry), |
| | | LDAPReplicationDomain.findEntryUUID( |
| | | entry.getDN().getParentDNInSuffix()), |
| | | entry.getObjectClasses(), |
| | | entry.getUserAttributes(), entry.getOperationalAttributes()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | public class FakeDelOperation extends FakeOperation |
| | | { |
| | | final private String dn; |
| | | private final String uid; |
| | | private final String entryUUID; |
| | | |
| | | /** |
| | | * Creates a new FakeDelOperation from the provided information. |
| | | * |
| | | * @param dn The dn of the entry that was deleted. |
| | | * @param changeNumber The ChangeNumber of the operation. |
| | | * @param uid The Unique ID of the deleted entry. |
| | | * @param entryUUID The Unique ID of the deleted entry. |
| | | */ |
| | | public FakeDelOperation(String dn, ChangeNumber changeNumber, String uid) |
| | | public FakeDelOperation(String dn, ChangeNumber changeNumber, |
| | | String entryUUID) |
| | | { |
| | | super(changeNumber); |
| | | this.dn = dn; |
| | | this.uid = uid; |
| | | this.entryUUID = entryUUID; |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public ReplicationMsg generateMessage() |
| | | { |
| | | return new DeleteMsg(dn, this.getChangeNumber(), uid); |
| | | return new DeleteMsg(dn, this.getChangeNumber(), entryUUID); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The Unique ID of the entry that was deleted with this operation. |
| | | */ |
| | | public String getUUID() |
| | | public String getEntryUUID() |
| | | { |
| | | return uid; |
| | | return entryUUID; |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | { |
| | | DN dn = entry.getDN(); |
| | | return new ModifyDNMsg(dn.toString(), this.getChangeNumber(), |
| | | EntryHistorical.getEntryUuid(entry), |
| | | LDAPReplicationDomain.findEntryId(dn.getParent()), |
| | | EntryHistorical.getEntryUUID(entry), |
| | | LDAPReplicationDomain.findEntryUUID(dn.getParent()), |
| | | false, dn.getParent().toString(), dn.getRDN().toString()); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | 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.EntryHistorical.ENTRYUIDNAME; |
| | | import static org.opends.server.replication.plugin.EntryHistorical.*; |
| | | import static org.opends.server.replication.protocol.OperationContext.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.createEntry; |
| | |
| | | * Check that the modified entry has the same entryuuid |
| | | * as it was in the original message. |
| | | */ |
| | | String operationEntryUUID = ctx.getEntryUid(); |
| | | String modifiedEntryUUID = EntryHistorical.getEntryUuid(deletedEntry); |
| | | String operationEntryUUID = ctx.getEntryUUID(); |
| | | String modifiedEntryUUID = EntryHistorical.getEntryUUID(deletedEntry); |
| | | if (!operationEntryUUID.equals(modifiedEntryUUID)) |
| | | { |
| | | /* |
| | |
| | | // There is no replication context attached to the operation |
| | | // so this is not a replication operation. |
| | | ChangeNumber changeNumber = generateChangeNumber(deleteOperation); |
| | | String modifiedEntryUUID = EntryHistorical.getEntryUuid(deletedEntry); |
| | | String modifiedEntryUUID = EntryHistorical.getEntryUUID(deletedEntry); |
| | | ctx = new DeleteContext(changeNumber, modifiedEntryUUID); |
| | | deleteOperation.setAttachment(SYNCHROCONTEXT, ctx); |
| | | |
| | |
| | | * If an entry with the same entry uniqueID already exist then |
| | | * this operation has already been replayed in the past. |
| | | */ |
| | | String uuid = ctx.getEntryUid(); |
| | | String uuid = ctx.getEntryUUID(); |
| | | if (findEntryDN(uuid) != null) |
| | | { |
| | | return new SynchronizationProviderResult.StopProcessing( |
| | |
| | | * of the parent entry |
| | | */ |
| | | |
| | | String parentUid = ctx.getParentUid(); |
| | | String parentEntryUUID = ctx.getParentEntryUUID(); |
| | | // root entry have no parent, |
| | | // there is no need to check for it. |
| | | if (parentUid != null) |
| | | if (parentEntryUUID != null) |
| | | { |
| | | // There is a potential of perfs improvement here |
| | | // if we could avoid the following parent entry retrieval |
| | | DN parentDnFromCtx = findEntryDN(ctx.getParentUid()); |
| | | DN parentDnFromCtx = findEntryDN(ctx.getParentEntryUUID()); |
| | | |
| | | if (parentDnFromCtx == null) |
| | | { |
| | |
| | | * as was in the original message. |
| | | */ |
| | | String modifiedEntryUUID = |
| | | EntryHistorical.getEntryUuid(modifyDNOperation.getOriginalEntry()); |
| | | if (!modifiedEntryUUID.equals(ctx.getEntryUid())) |
| | | EntryHistorical.getEntryUUID(modifyDNOperation.getOriginalEntry()); |
| | | if (!modifiedEntryUUID.equals(ctx.getEntryUUID())) |
| | | { |
| | | /* |
| | | * The modified entry is not the same entry as the one on |
| | |
| | | * Also check that the current id of the |
| | | * parent is the same as when the operation was performed. |
| | | */ |
| | | String newParentId = findEntryId(modifyDNOperation.getNewSuperior()); |
| | | if ((newParentId != null) && (ctx.getNewParentId() != null) && |
| | | (!newParentId.equals(ctx.getNewParentId()))) |
| | | String newParentId = findEntryUUID(modifyDNOperation.getNewSuperior()); |
| | | if ((newParentId != null) && (ctx.getNewSuperiorEntryUUID() != null) && |
| | | (!newParentId.equals(ctx.getNewSuperiorEntryUUID()))) |
| | | { |
| | | return new SynchronizationProviderResult.StopProcessing( |
| | | ResultCode.NO_SUCH_OBJECT, null); |
| | |
| | | String newParentId = null; |
| | | if (modifyDNOperation.getNewSuperior() != null) |
| | | { |
| | | newParentId = findEntryId(modifyDNOperation.getNewSuperior()); |
| | | newParentId = findEntryUUID(modifyDNOperation.getNewSuperior()); |
| | | } |
| | | |
| | | Entry modifiedEntry = modifyDNOperation.getOriginalEntry(); |
| | | String modifiedEntryUUID = EntryHistorical.getEntryUuid(modifiedEntry); |
| | | String modifiedEntryUUID = EntryHistorical.getEntryUUID(modifiedEntry); |
| | | ctx = new ModifyDnContext(changeNumber, modifiedEntryUUID, newParentId); |
| | | modifyDNOperation.setAttachment(SYNCHROCONTEXT, ctx); |
| | | } |
| | |
| | | // - attach the context to the op |
| | | |
| | | ChangeNumber changeNumber = generateChangeNumber(modifyOperation); |
| | | String modifiedEntryUUID = EntryHistorical.getEntryUuid(modifiedEntry); |
| | | String modifiedEntryUUID = EntryHistorical.getEntryUUID(modifiedEntry); |
| | | if (modifiedEntryUUID == null) |
| | | modifiedEntryUUID = modifyOperation.getEntryDN().toString(); |
| | | ctx = new ModifyContext(changeNumber, modifiedEntryUUID); |
| | |
| | | // replayed here, it is necessary to |
| | | // - check if the entry has been renamed |
| | | // - check for conflicts |
| | | String modifiedEntryUUID = ctx.getEntryUid(); |
| | | String currentEntryUUID = EntryHistorical.getEntryUuid(modifiedEntry); |
| | | String modifiedEntryUUID = ctx.getEntryUUID(); |
| | | String currentEntryUUID = EntryHistorical.getEntryUUID(modifiedEntry); |
| | | if ((currentEntryUUID != null) && |
| | | (!currentEntryUUID.equals(modifiedEntryUUID))) |
| | | { |
| | |
| | | * The preOperation phase for the add Operation. |
| | | * Its job is to generate the replication context associated to the |
| | | * operation. It is necessary to do it in this phase because contrary to |
| | | * the other operations, the entry uid is not set when the handleConflict |
| | | * the other operations, the entry UUID is not set when the handleConflict |
| | | * phase is called. |
| | | * |
| | | * @param addOperation The Add Operation. |
| | |
| | | public void doPreOperation(PreOperationAddOperation addOperation) |
| | | { |
| | | AddContext ctx = new AddContext(generateChangeNumber(addOperation), |
| | | EntryHistorical.getEntryUuid(addOperation), |
| | | findEntryId(addOperation.getEntryDN().getParentDNInSuffix())); |
| | | EntryHistorical.getEntryUUID(addOperation), |
| | | findEntryUUID(addOperation.getEntryDN().getParentDNInSuffix())); |
| | | |
| | | addOperation.setAttachment(SYNCHROCONTEXT, ctx); |
| | | } |
| | |
| | | * for which an other entry was in conflict. |
| | | * Steps: |
| | | * - get the DN freed by a DELETE or MODRDN op |
| | | * - search for entries put in the conflict space (dn=entryuid'+'....) |
| | | * - search for entries put in the conflict space (dn=entryUUID'+'....) |
| | | * because the expected DN was not available (ds-sync-conflict=expected DN) |
| | | * - retain the entry with the oldest conflict |
| | | * - rename this entry with the freedDN as it was expected originally |
| | |
| | | ByteString.valueOf(freedDN.toString())); |
| | | |
| | | LinkedHashSet<String> attrs = new LinkedHashSet<String>(1); |
| | | attrs.add(EntryHistorical.HISTORICALATTRIBUTENAME); |
| | | attrs.add(EntryHistorical.ENTRYUIDNAME); |
| | | attrs.add(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | attrs.add(EntryHistorical.ENTRYUUID_ATTRIBUTE_NAME); |
| | | attrs.add("*"); |
| | | InternalSearchOperation searchOp = conn.processSearch( |
| | | ByteString.valueOf(baseDn.toString()), |
| | |
| | | |
| | | /** |
| | | * Find the Unique Id of the entry with the provided DN by doing a |
| | | * search of the entry and extracting its uniqueID from its attributes. |
| | | * search of the entry and extracting its entryUUID from its attributes. |
| | | * |
| | | * @param dn The dn of the entry for which the unique Id is searched. |
| | | * |
| | | * @return The unique Id of the entry with the provided DN. |
| | | */ |
| | | static String findEntryId(DN dn) |
| | | static String findEntryUUID(DN dn) |
| | | { |
| | | if (dn == null) |
| | | return null; |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | LinkedHashSet<String> attrs = new LinkedHashSet<String>(1); |
| | | attrs.add(ENTRYUIDNAME); |
| | | attrs.add(ENTRYUUID_ATTRIBUTE_NAME); |
| | | InternalSearchOperation search = conn.processSearch(dn, |
| | | SearchScope.BASE_OBJECT, DereferencePolicy.NEVER_DEREF_ALIASES, |
| | | 0, 0, false, |
| | |
| | | SearchResultEntry resultEntry = result.getFirst(); |
| | | if (resultEntry != null) |
| | | { |
| | | return EntryHistorical.getEntryUuid(resultEntry); |
| | | return EntryHistorical.getEntryUUID(resultEntry); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | ResultCode result = op.getResultCode(); |
| | | ModifyContext ctx = (ModifyContext) op.getAttachment(SYNCHROCONTEXT); |
| | | String entryUid = ctx.getEntryUid(); |
| | | String entryUUID = ctx.getEntryUUID(); |
| | | |
| | | if (result == ResultCode.NO_SUCH_OBJECT) |
| | | { |
| | |
| | | * search if the entry has been renamed, and return the new dn |
| | | * of the entry. |
| | | */ |
| | | DN newdn = findEntryDN(entryUid); |
| | | DN newdn = findEntryDN(entryUUID); |
| | | if (newdn != null) |
| | | { |
| | | // There is an entry with the same unique id as this modify operation |
| | |
| | | } |
| | | else if (result == ResultCode.NOT_ALLOWED_ON_RDN) |
| | | { |
| | | DN currentDN = findEntryDN(entryUid); |
| | | DN currentDN = findEntryDN(entryUUID); |
| | | RDN currentRDN; |
| | | if (currentDN != null) |
| | | { |
| | |
| | | { |
| | | ResultCode result = op.getResultCode(); |
| | | DeleteContext ctx = (DeleteContext) op.getAttachment(SYNCHROCONTEXT); |
| | | String entryUid = ctx.getEntryUid(); |
| | | String entryUUID = ctx.getEntryUUID(); |
| | | |
| | | if (result == ResultCode.NO_SUCH_OBJECT) |
| | | { |
| | | /* |
| | | * Find if the entry is still in the database. |
| | | */ |
| | | DN currentDn = findEntryDN(entryUid); |
| | | DN currentDn = findEntryDN(entryUUID); |
| | | if (currentDn == null) |
| | | { |
| | | /* |
| | |
| | | * when we are adding an entry whose parent entry has already been deleted. |
| | | * |
| | | */ |
| | | if (findAndRenameChild(entryUid, op.getEntryDN(), op)) |
| | | if (findAndRenameChild(entryUUID, op.getEntryDN(), op)) |
| | | numUnresolvedNamingConflicts.incrementAndGet(); |
| | | |
| | | return false; |
| | |
| | | { |
| | | ResultCode result = op.getResultCode(); |
| | | ModifyDnContext ctx = (ModifyDnContext) op.getAttachment(SYNCHROCONTEXT); |
| | | String entryUid = ctx.getEntryUid(); |
| | | String newSuperiorID = ctx.getNewParentId(); |
| | | String entryUUID = ctx.getEntryUUID(); |
| | | String newSuperiorID = ctx.getNewSuperiorEntryUUID(); |
| | | |
| | | /* |
| | | * four possible cases : |
| | |
| | | */ |
| | | |
| | | // get the current DN of this entry in the database. |
| | | DN currentDN = findEntryDN(entryUid); |
| | | DN currentDN = findEntryDN(entryUUID); |
| | | |
| | | // Construct the new DN to use for the entry. |
| | | DN entryDN = op.getEntryDN(); |
| | |
| | | */ |
| | | ModifyDNMsg modifyDnMsg = (ModifyDNMsg) msg; |
| | | markConflictEntry(op, op.getEntryDN(), newDN); |
| | | modifyDnMsg.setNewRDN(generateConflictRDN(entryUid, |
| | | modifyDnMsg.setNewRDN(generateConflictRDN(entryUUID, |
| | | modifyDnMsg.getNewRDN())); |
| | | modifyDnMsg.setNewSuperior(newSuperior.toString()); |
| | | numUnresolvedNamingConflicts.incrementAndGet(); |
| | |
| | | { |
| | | ResultCode result = op.getResultCode(); |
| | | AddContext ctx = (AddContext) op.getAttachment(SYNCHROCONTEXT); |
| | | String entryUid = ctx.getEntryUid(); |
| | | String parentUniqueId = ctx.getParentUid(); |
| | | String entryUUID = ctx.getEntryUUID(); |
| | | String parentUniqueId = ctx.getParentEntryUUID(); |
| | | |
| | | if (result == ResultCode.NO_SUCH_OBJECT) |
| | | { |
| | |
| | | */ |
| | | addConflict(msg); |
| | | |
| | | msg.setDn(generateConflictRDN(entryUid, |
| | | msg.setDn(generateConflictRDN(entryUUID, |
| | | op.getEntryDN().getRDN().toString()) + "," |
| | | + baseDn); |
| | | // reset the parent uid so that the check done is the handleConflict |
| | | // phase does not fail. |
| | | msg.setParentUid(null); |
| | | // reset the parent entryUUID so that the check done is the |
| | | // handleConflict phase does not fail. |
| | | msg.setParentEntryUUID(null); |
| | | numUnresolvedNamingConflicts.incrementAndGet(); |
| | | return false; |
| | | } |
| | |
| | | * don't do anything |
| | | * if the entry unique id do not exist, generate conflict. |
| | | */ |
| | | if (findEntryDN(entryUid) != null) |
| | | if (findEntryDN(entryUUID) != null) |
| | | { |
| | | // entry already exist : this is a replay |
| | | return true; |
| | |
| | | else |
| | | { |
| | | addConflict(msg); |
| | | msg.setDn(generateConflictRDN(entryUid, msg.getDn())); |
| | | msg.setDn(generateConflictRDN(entryUUID, msg.getDn())); |
| | | numUnresolvedNamingConflicts.incrementAndGet(); |
| | | return false; |
| | | } |
| | |
| | | * so that they stay below the baseDn of this replicationDomain and |
| | | * use the conflicting name and attribute. |
| | | * |
| | | * @param entryUid The unique ID of the entry whose child must be renamed. |
| | | * @param entryUUID The unique ID of the entry whose child must be renamed. |
| | | * @param entryDN The DN of the entry whose child must be renamed. |
| | | * @param conflictOp The Operation that generated the conflict. |
| | | */ |
| | | private boolean findAndRenameChild( |
| | | String entryUid, DN entryDN, Operation conflictOp) |
| | | String entryUUID, DN entryDN, Operation conflictOp) |
| | | { |
| | | boolean conflict = false; |
| | | |
| | |
| | | try |
| | | { |
| | | LinkedHashSet<String> attrs = new LinkedHashSet<String>(1); |
| | | attrs.add(ENTRYUIDNAME); |
| | | attrs.add(EntryHistorical.HISTORICALATTRIBUTENAME); |
| | | attrs.add(ENTRYUUID_ATTRIBUTE_NAME); |
| | | attrs.add(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | |
| | | SearchFilter ALLMATCH; |
| | | ALLMATCH = SearchFilter.createFilterFromString("(objectClass=*)"); |
| | |
| | | */ |
| | | conflict = true; |
| | | renameConflictEntry(conflictOp, entry.getDN(), |
| | | EntryHistorical.getEntryUuid(entry)); |
| | | EntryHistorical.getEntryUUID(entry)); |
| | | } |
| | | } |
| | | } |
| | |
| | | * |
| | | * @param conflictOp The Operation that caused the conflict. |
| | | * @param dn The DN of the entry to be renamed. |
| | | * @param uid The uniqueID of the entry to be renamed. |
| | | * @param entryUUID The uniqueID of the entry to be renamed. |
| | | */ |
| | | private void renameConflictEntry(Operation conflictOp, DN dn, String uid) |
| | | private void renameConflictEntry(Operation conflictOp, DN dn, |
| | | String entryUUID) |
| | | { |
| | | Message alertMessage = NOTE_UNRESOLVED_CONFLICT.get(dn.toString()); |
| | | DirectoryServer.sendAlertNotification(this, |
| | | ALERT_TYPE_REPLICATION_UNRESOLVED_CONFLICT, alertMessage); |
| | | |
| | | ModifyDNOperation newOp = |
| | | renameEntry(dn, generateDeleteConflictDn(uid, dn), baseDn, true); |
| | | renameEntry(dn, generateDeleteConflictDn(entryUUID, dn), baseDn, true); |
| | | |
| | | if (newOp.getResultCode() != ResultCode.SUCCESS) |
| | | { |
| | |
| | | /** |
| | | * Generate the Dn to use for a conflicting entry. |
| | | * |
| | | * @param entryUid The unique identifier of the entry involved in the |
| | | * @param entryUUID The unique identifier of the entry involved in the |
| | | * conflict. |
| | | * @param rdn Original rdn. |
| | | * @return The generated RDN for a conflicting entry. |
| | | */ |
| | | private String generateConflictRDN(String entryUid, String rdn) |
| | | private String generateConflictRDN(String entryUUID, String rdn) |
| | | { |
| | | return "entryuuid=" + entryUid + "+" + rdn; |
| | | return "entryuuid=" + entryUUID + "+" + rdn; |
| | | } |
| | | |
| | | /** |
| | | * Generate the RDN to use for a conflicting entry whose father was deleted. |
| | | * |
| | | * @param entryUid The unique identifier of the entry involved in the |
| | | * @param entryUUID The unique identifier of the entry involved in the |
| | | * conflict. |
| | | * @param dn The original DN of the entry. |
| | | * |
| | | * @return The generated RDN for a conflicting entry. |
| | | * @throws DirectoryException |
| | | */ |
| | | private RDN generateDeleteConflictDn(String entryUid, DN dn) |
| | | private RDN generateDeleteConflictDn(String entryUUID, DN dn) |
| | | { |
| | | String newRDN = "entryuuid=" + entryUid + "+" + dn.getRDN(); |
| | | String newRDN = "entryuuid=" + entryUUID + "+" + dn.getRDN(); |
| | | RDN rdn = null; |
| | | try |
| | | { |
| | |
| | | } |
| | | |
| | | LDAPFilter filter = LDAPFilter.decode( |
| | | "(&(" + EntryHistorical.HISTORICALATTRIBUTENAME + ">=dummy:" |
| | | + fromChangeNumber + ")(" + EntryHistorical.HISTORICALATTRIBUTENAME + |
| | | "(&(" + EntryHistorical.HISTORICAL_ATTRIBUTE_NAME + ">=dummy:" |
| | | + fromChangeNumber + ")(" + EntryHistorical.HISTORICAL_ATTRIBUTE_NAME + |
| | | "<=dummy:" + maxValueForId + "))"); |
| | | |
| | | LinkedHashSet<String> attrs = new LinkedHashSet<String>(1); |
| | | attrs.add(EntryHistorical.HISTORICALATTRIBUTENAME); |
| | | attrs.add(EntryHistorical.ENTRYUIDNAME); |
| | | attrs.add(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | attrs.add(EntryHistorical.ENTRYUUID_ATTRIBUTE_NAME); |
| | | attrs.add("*"); |
| | | return conn.processSearch( |
| | | ByteString.valueOf(baseDn.toString()), |
| | |
| | | * for which an other entry was in conflict. |
| | | * Steps: |
| | | * - get the DN freed by a DELETE or MODRDN op |
| | | * - search for entries put in the conflict space (dn=entryuid'+'....) |
| | | * - search for entries put in the conflict space (dn=entryUUID'+'....) |
| | | * because the expected DN was not available (ds-sync-conflict=expected DN) |
| | | * - retain the entry with the oldest conflict |
| | | * - rename this entry with the freedDN as it was expected originally |
| | |
| | | try |
| | | { |
| | | filter = LDAPFilter.decode( |
| | | "(" + EntryHistorical.HISTORICALATTRIBUTENAME + ">=dummy:" |
| | | "(" + EntryHistorical.HISTORICAL_ATTRIBUTE_NAME + ">=dummy:" |
| | | + lastChangeNumberPurgedFromHist + ")"); |
| | | |
| | | } catch (LDAPException e) |
| | |
| | | } |
| | | |
| | | LinkedHashSet<String> attrs = new LinkedHashSet<String>(1); |
| | | attrs.add(EntryHistorical.HISTORICALATTRIBUTENAME); |
| | | attrs.add(EntryHistorical.ENTRYUIDNAME); |
| | | attrs.add(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | attrs.add(EntryHistorical.ENTRYUUID_ATTRIBUTE_NAME); |
| | | attrs.add("*"); |
| | | InternalSearchOperation searchOp = conn.processSearch( |
| | | ByteString.valueOf(baseDn.toString()), |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | import org.opends.messages.Message; |
| | |
| | | InternalSearchOperation op; |
| | | ChangeNumber serverStateMaxCn; |
| | | ChangeNumber dbMaxCn; |
| | | final AttributeType histType = |
| | | DirectoryServer.getAttributeType(EntryHistorical.HISTORICALATTRIBUTENAME); |
| | | final AttributeType histType = DirectoryServer.getAttributeType( |
| | | EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | |
| | | // Retrieves the entries that have changed since the |
| | | // maxCn stored in the serverState |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | /** |
| | | * The Unique Id of the parent entry of the added entry. |
| | | */ |
| | | private String parentUid; |
| | | private String parentEntryUUID; |
| | | |
| | | /** |
| | | * Creates a new AddContext with the provided information. |
| | | * |
| | | * @param changeNumber The change number of the add operation. |
| | | * @param uid the Unique Id of the added entry. |
| | | * @param parentUid The unique Id of the parent of the added entry. |
| | | * @param entryUUID the Unique Id of the added entry. |
| | | * @param parentEntryUUID The unique Id of the parent of the added entry. |
| | | */ |
| | | public AddContext(ChangeNumber changeNumber, String uid, String parentUid) |
| | | public AddContext(ChangeNumber changeNumber, String entryUUID, |
| | | String parentEntryUUID) |
| | | { |
| | | super(changeNumber, uid); |
| | | this.parentUid = parentUid; |
| | | super(changeNumber, entryUUID); |
| | | this.parentEntryUUID = parentEntryUUID; |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return Returns the Unique Id of the parent of the added entry. |
| | | */ |
| | | public String getParentUid() |
| | | public String getParentEntryUUID() |
| | | { |
| | | return parentUid; |
| | | return parentEntryUUID; |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | private byte[] encodedAttributes; |
| | | |
| | | // Parent is managed decoded |
| | | private String parentUniqueId; |
| | | private String parentEntryUUID; |
| | | |
| | | /** |
| | | * Creates a new AddMessage. |
| | |
| | | AddContext ctx = (AddContext) op.getAttachment(SYNCHROCONTEXT); |
| | | |
| | | // Stores parentUniqueID not encoded |
| | | this.parentUniqueId = ctx.getParentUid(); |
| | | this.parentEntryUUID = ctx.getParentEntryUUID(); |
| | | |
| | | // Stores attributes encoded |
| | | this.encodedAttributes = encodeAttributes(op.getObjectClasses(), |
| | |
| | | * |
| | | * @param cn ChangeNumber of the add. |
| | | * @param dn DN of the added entry. |
| | | * @param uniqueId The Unique identifier of the added entry. |
| | | * @param parentId The unique Id of the parent of the added |
| | | * @param entryUUID The Unique identifier of the added entry. |
| | | * @param parentEntryUUID The unique Id of the parent of the added |
| | | * entry. |
| | | * @param objectClasses objectclass of the added entry. |
| | | * @param userAttributes user attributes of the added entry. |
| | |
| | | */ |
| | | public AddMsg(ChangeNumber cn, |
| | | String dn, |
| | | String uniqueId, |
| | | String parentId, |
| | | String entryUUID, |
| | | String parentEntryUUID, |
| | | Map<ObjectClass, String> objectClasses, |
| | | Map<AttributeType,List<Attribute>> userAttributes, |
| | | Map<AttributeType,List<Attribute>> operationalAttributes) |
| | | { |
| | | super (cn, uniqueId, dn); |
| | | super (cn, entryUUID, dn); |
| | | |
| | | // Stores parentUniqueID not encoded |
| | | this.parentUniqueId = parentId; |
| | | this.parentEntryUUID = parentEntryUUID; |
| | | |
| | | // Stores attributes encoded |
| | | this.encodedAttributes = encodeAttributes(objectClasses, userAttributes, |
| | |
| | | super (cn, uniqueId, dn); |
| | | |
| | | // Stores parentUniqueID not encoded |
| | | this.parentUniqueId = parentId; |
| | | this.parentEntryUUID = parentId; |
| | | |
| | | // Stores attributes encoded |
| | | this.encodedAttributes = encodeAttributes(objectClass, userAttributes, |
| | |
| | | InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, |
| | | ByteString.valueOf(newDn), attr); |
| | | AddContext ctx = new AddContext(getChangeNumber(), getUniqueId(), |
| | | parentUniqueId); |
| | | AddContext ctx = new AddContext(getChangeNumber(), getEntryUUID(), |
| | | parentEntryUUID); |
| | | add.setAttachment(SYNCHROCONTEXT, ctx); |
| | | return add; |
| | | } |
| | |
| | | { |
| | | int bodyLength = encodedAttributes.length; |
| | | byte[] byteParentId = null; |
| | | if (parentUniqueId != null) |
| | | if (parentEntryUUID != null) |
| | | { |
| | | byteParentId = parentUniqueId.getBytes("UTF-8"); |
| | | byteParentId = parentEntryUUID.getBytes("UTF-8"); |
| | | bodyLength += byteParentId.length + 1; |
| | | } |
| | | else |
| | |
| | | |
| | | // Compute the total length of the body |
| | | byte[] byteParentId = null; |
| | | if (parentUniqueId != null) |
| | | if (parentEntryUUID != null) |
| | | { |
| | | // Encode parentID now to get the length of the encoded bytes |
| | | byteParentId = parentUniqueId.getBytes("UTF-8"); |
| | | byteParentId = parentEntryUUID.getBytes("UTF-8"); |
| | | bodyLength += byteParentId.length + 1; |
| | | } |
| | | else |
| | |
| | | |
| | | // Compute the total length of the body |
| | | byte[] byteParentId = null; |
| | | if (parentUniqueId != null) |
| | | if (parentEntryUUID != null) |
| | | { |
| | | // Encode parentID now to get the length of the encoded bytes |
| | | byteParentId = parentUniqueId.getBytes("UTF-8"); |
| | | byteParentId = parentEntryUUID.getBytes("UTF-8"); |
| | | bodyLength += byteParentId.length + 1; |
| | | } |
| | | else |
| | |
| | | int length = getNextLength(in, pos); |
| | | if (length != 0) |
| | | { |
| | | parentUniqueId = new String(in, pos, length, "UTF-8"); |
| | | parentEntryUUID = new String(in, pos, length, "UTF-8"); |
| | | pos += length + 1; |
| | | } |
| | | else |
| | | { |
| | | parentUniqueId = null; |
| | | parentEntryUUID = null; |
| | | pos += 1; |
| | | } |
| | | |
| | |
| | | int length = getNextLength(in, pos); |
| | | if (length != 0) |
| | | { |
| | | parentUniqueId = new String(in, pos, length, "UTF-8"); |
| | | parentEntryUUID = new String(in, pos, length, "UTF-8"); |
| | | pos += length + 1; |
| | | } |
| | | else |
| | | { |
| | | parentUniqueId = null; |
| | | parentEntryUUID = null; |
| | | pos += 1; |
| | | } |
| | | |
| | |
| | | " protocolVersion: " + protocolVersion + |
| | | " dn: " + dn + |
| | | " changeNumber: " + changeNumber + |
| | | " uniqueId: " + uniqueId + |
| | | " uniqueId: " + entryUUID + |
| | | " assuredFlag: " + assuredFlag; |
| | | } |
| | | if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V2) |
| | |
| | | " protocolVersion: " + protocolVersion + |
| | | " dn: " + dn + |
| | | " changeNumber: " + changeNumber + |
| | | " uniqueId: " + uniqueId + |
| | | " uniqueId: " + entryUUID + |
| | | " assuredFlag: " + assuredFlag + |
| | | " assuredMode: " + assuredMode + |
| | | " safeDataLevel: " + safeDataLevel; |
| | |
| | | /** |
| | | * Set the parent unique id of this add msg. |
| | | * |
| | | * @param uid the parent unique id. |
| | | * @param entryUUID the parent unique id. |
| | | */ |
| | | public void setParentUid(String uid) |
| | | public void setParentEntryUUID(String entryUUID) |
| | | { |
| | | parentUniqueId = uid; |
| | | parentEntryUUID = entryUUID; |
| | | } |
| | | |
| | | /** |
| | | * Get the parent unique id of this add msg. |
| | | * @return the parent unique id. |
| | | */ |
| | | public String getParentUid() |
| | | public String getParentEntryUUID() |
| | | { |
| | | return parentUniqueId; |
| | | return parentEntryUUID; |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | * Creates a new DeleteContext with the provided information. |
| | | * |
| | | * @param changeNumber The change number of the Delete Operation. |
| | | * @param uid The unique Id of the deleted entry. |
| | | * @param entryUUID The unique Id of the deleted entry. |
| | | */ |
| | | public DeleteContext(ChangeNumber changeNumber, String uid) |
| | | public DeleteContext(ChangeNumber changeNumber, String entryUUID) |
| | | { |
| | | super(changeNumber, uid); |
| | | super(changeNumber, entryUUID); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | * @param dn The dn with which the message must be created. |
| | | * @param changeNumber The change number with which the message must be |
| | | * created. |
| | | * @param uid The unique id with which the message must be created. |
| | | * @param entryUUID The unique id with which the message must be created. |
| | | */ |
| | | public DeleteMsg(String dn, ChangeNumber changeNumber, String uid) |
| | | public DeleteMsg(String dn, ChangeNumber changeNumber, String entryUUID) |
| | | { |
| | | super(new DeleteContext(changeNumber, uid), dn); |
| | | super(new DeleteContext(changeNumber, entryUUID), dn); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (isSubtreeDelete) |
| | | del.addRequestControl(new SubtreeDeleteControl(false)); |
| | | |
| | | DeleteContext ctx = new DeleteContext(getChangeNumber(), getUniqueId()); |
| | | DeleteContext ctx = new DeleteContext(getChangeNumber(), getEntryUUID()); |
| | | del.setAttachment(SYNCHROCONTEXT, ctx); |
| | | return del; |
| | | } |
| | |
| | | " protocolVersion: " + protocolVersion + |
| | | " dn: " + dn + |
| | | " changeNumber: " + changeNumber + |
| | | " uniqueId: " + uniqueId + |
| | | " uniqueId: " + entryUUID + |
| | | " assuredFlag: " + assuredFlag; |
| | | } |
| | | if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V2) |
| | |
| | | " protocolVersion: " + protocolVersion + |
| | | " dn: " + dn + |
| | | " changeNumber: " + changeNumber + |
| | | " uniqueId: " + uniqueId + |
| | | " uniqueId: " + entryUUID + |
| | | " assuredFlag: " + assuredFlag + |
| | | " assuredMode: " + assuredMode + |
| | | " safeDataLevel: " + safeDataLevel; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | protected String dn = null; |
| | | |
| | | /** |
| | | * The uniqueId of the entry that was updated. |
| | | * The entryUUID of the entry that was updated. |
| | | */ |
| | | protected String uniqueId; |
| | | protected String entryUUID; |
| | | |
| | | /** |
| | | * Encoded form of the LDAPUpdateMsg. |
| | |
| | | { |
| | | this.protocolVersion = ProtocolVersion.getCurrentVersion(); |
| | | this.changeNumber = ctx.getChangeNumber(); |
| | | this.uniqueId = ctx.getEntryUid(); |
| | | this.entryUUID = ctx.getEntryUUID(); |
| | | this.dn = dn; |
| | | } |
| | | |
| | |
| | | { |
| | | this.protocolVersion = ProtocolVersion.getCurrentVersion(); |
| | | this.changeNumber = cn; |
| | | this.uniqueId = entryUUID; |
| | | this.entryUUID = entryUUID; |
| | | this.dn = dn; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * Get the Unique Identifier of the entry on which the operation happened. |
| | | * Get the entryUUID of the entry on which the operation happened. |
| | | * |
| | | * @return The Unique Identifier of the entry on which the operation happened. |
| | | * @return The entryUUID of the entry on which the operation happened. |
| | | */ |
| | | public String getUniqueId() |
| | | public String getEntryUUID() |
| | | { |
| | | return uniqueId; |
| | | return entryUUID; |
| | | } |
| | | |
| | | /** |
| | |
| | | byte[] byteDn = dn.getBytes("UTF-8"); |
| | | byte[] changeNumberByte = |
| | | this.getChangeNumber().toString().getBytes("UTF-8"); |
| | | byte[] byteEntryuuid = getUniqueId().getBytes("UTF-8"); |
| | | byte[] byteEntryuuid = getEntryUUID().getBytes("UTF-8"); |
| | | |
| | | /* The message header is stored in the form : |
| | | * <operation type><protocol version><changenumber><dn><entryuuid><assured> |
| | |
| | | byte[] byteDn = dn.getBytes("UTF-8"); |
| | | byte[] changeNumberByte = |
| | | this.getChangeNumber().toString().getBytes("UTF-8"); |
| | | byte[] byteEntryuuid = getUniqueId().getBytes("UTF-8"); |
| | | byte[] byteEntryuuid = getEntryUUID().getBytes("UTF-8"); |
| | | |
| | | /* The message header is stored in the form : |
| | | * <operation type><changenumber><dn><assured><entryuuid><change> |
| | |
| | | |
| | | /* Read the entryuuid */ |
| | | length = getNextLength(encodedMsg, pos); |
| | | uniqueId = new String(encodedMsg, pos, length, "UTF-8"); |
| | | entryUUID = new String(encodedMsg, pos, length, "UTF-8"); |
| | | pos += length + 1; |
| | | |
| | | /* Read the assured information */ |
| | |
| | | |
| | | /* read the entryuuid */ |
| | | length = getNextLength(encodedMsg, pos); |
| | | uniqueId = new String(encodedMsg, pos, length, "UTF-8"); |
| | | entryUUID = new String(encodedMsg, pos, length, "UTF-8"); |
| | | pos += length + 1; |
| | | |
| | | return pos; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | * Creates a new Modify Context with the provided parameters. |
| | | * |
| | | * @param changeNumber The change number of the operation. |
| | | * @param uid the unique Id of the modified entry. |
| | | * @param entryUUID the unique Id of the modified entry. |
| | | */ |
| | | public ModifyContext(ChangeNumber changeNumber, String uid) |
| | | public ModifyContext(ChangeNumber changeNumber, String entryUUID) |
| | | { |
| | | super(changeNumber, uid); |
| | | super(changeNumber, entryUUID); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | private String newRDN; |
| | | private String newSuperior; |
| | | private boolean deleteOldRdn; |
| | | private String newSuperiorId; |
| | | private String newSuperiorEntryUUID; |
| | | |
| | | /** |
| | | * construct a new Modify DN message. |
| | |
| | | |
| | | ModifyDnContext ctx = |
| | | (ModifyDnContext) operation.getAttachment(SYNCHROCONTEXT); |
| | | newSuperiorId = ctx.getNewParentId(); |
| | | newSuperiorEntryUUID = ctx.getNewSuperiorEntryUUID(); |
| | | |
| | | deleteOldRdn = operation.deleteOldRDN(); |
| | | if (operation.getRawNewSuperior() != null) |
| | |
| | | * |
| | | * @param dn The dn to use for building the message. |
| | | * @param changeNumber The changeNumberto use for building the message. |
| | | * @param uid The unique id to use for building the message. |
| | | * @param newParentUid The new parent unique id to use for building |
| | | * @param entryUUID The unique id to use for building the message. |
| | | * @param newSuperiorEntryUUID The new parent unique id to use for building |
| | | * the message. |
| | | * @param deleteOldRdn boolean indicating if old rdn must be deleted to use |
| | | * for building the message. |
| | | * @param newSuperior The new Superior entry to use for building the message. |
| | | * @param newRDN The new Rdn to use for building the message. |
| | | */ |
| | | public ModifyDNMsg(String dn, ChangeNumber changeNumber, String uid, |
| | | String newParentUid, boolean deleteOldRdn, |
| | | public ModifyDNMsg(String dn, ChangeNumber changeNumber, String entryUUID, |
| | | String newSuperiorEntryUUID, boolean deleteOldRdn, |
| | | String newSuperior, String newRDN) |
| | | { |
| | | super(new ModifyDnContext(changeNumber, uid, newParentUid), dn); |
| | | super(new ModifyDnContext(changeNumber, entryUUID, newSuperiorEntryUUID), |
| | | dn); |
| | | |
| | | newSuperiorId = newParentUid; |
| | | |
| | | this.newSuperiorEntryUUID = newSuperiorEntryUUID; |
| | | this.deleteOldRdn = deleteOldRdn; |
| | | this.newSuperior = newSuperior; |
| | | this.newRDN = newRDN; |
| | |
| | | * |
| | | * @param dn The dn to use for building the message. |
| | | * @param changeNumber The changeNumberto use for building the message. |
| | | * @param uid The unique id to use for building the message. |
| | | * @param newParentUid The new parent unique id to use for building |
| | | * @param entryUUID The unique id to use for building the message. |
| | | * @param newSuperiorEntryUUID The new parent unique id to use for building |
| | | * the message. |
| | | * @param deleteOldRdn boolean indicating if old rdn must be deleted to use |
| | | * for building the message. |
| | |
| | | * @param newRDN The new Rdn to use for building the message. |
| | | * @param mods The mod of the operation. |
| | | */ |
| | | public ModifyDNMsg(String dn, ChangeNumber changeNumber, String uid, |
| | | String newParentUid, boolean deleteOldRdn, |
| | | String newSuperior, String newRDN, List<Modification> mods) |
| | | public ModifyDNMsg(String dn, ChangeNumber changeNumber, String entryUUID, |
| | | String newSuperiorEntryUUID, boolean deleteOldRdn, String newSuperior, |
| | | String newRDN, List<Modification> mods) |
| | | { |
| | | this(dn, changeNumber, uid, newParentUid, deleteOldRdn, newSuperior, |
| | | newRDN); |
| | | this(dn, changeNumber, entryUUID, newSuperiorEntryUUID, deleteOldRdn, |
| | | newSuperior, newRDN); |
| | | this.encodedMods = encodeMods(mods); |
| | | } |
| | | |
| | |
| | | moddn.addModification(mod); |
| | | } |
| | | |
| | | ModifyDnContext ctx = new ModifyDnContext(getChangeNumber(), getUniqueId(), |
| | | newSuperiorId); |
| | | ModifyDnContext ctx = new ModifyDnContext(getChangeNumber(), getEntryUUID(), |
| | | newSuperiorEntryUUID); |
| | | moddn.setAttachment(SYNCHROCONTEXT, ctx); |
| | | return moddn; |
| | | } |
| | |
| | | else |
| | | bodyLength += 1; |
| | | |
| | | if (newSuperiorId != null) |
| | | if (newSuperiorEntryUUID != null) |
| | | { |
| | | byteNewSuperiorId = newSuperiorId.getBytes("UTF-8"); |
| | | byteNewSuperiorId = newSuperiorEntryUUID.getBytes("UTF-8"); |
| | | bodyLength += byteNewSuperiorId.length + 1; |
| | | } |
| | | else |
| | |
| | | encodedMsg[pos++] = 0; |
| | | |
| | | /* put the newsuperiorId and a terminating 0 */ |
| | | if (newSuperiorId != null) |
| | | if (newSuperiorEntryUUID != null) |
| | | { |
| | | pos = addByteArray(byteNewSuperiorId, encodedMsg, pos); |
| | | } |
| | |
| | | else |
| | | length += 1; |
| | | |
| | | if (newSuperiorId != null) |
| | | if (newSuperiorEntryUUID != null) |
| | | { |
| | | byteNewSuperiorId = newSuperiorId.getBytes("UTF-8"); |
| | | byteNewSuperiorId = newSuperiorEntryUUID.getBytes("UTF-8"); |
| | | length += byteNewSuperiorId.length + 1; |
| | | } |
| | | else |
| | |
| | | encodedMsg[pos++] = 0; |
| | | |
| | | /* put the newsuperiorId and a terminating 0 */ |
| | | if (newSuperiorId != null) |
| | | if (newSuperiorEntryUUID != null) |
| | | { |
| | | pos = addByteArray(byteNewSuperiorId, encodedMsg, pos); |
| | | } |
| | |
| | | else |
| | | bodyLength += 1; |
| | | |
| | | if (newSuperiorId != null) |
| | | if (newSuperiorEntryUUID != null) |
| | | { |
| | | byteNewSuperiorId = newSuperiorId.getBytes("UTF-8"); |
| | | byteNewSuperiorId = newSuperiorEntryUUID.getBytes("UTF-8"); |
| | | bodyLength += byteNewSuperiorId.length + 1; |
| | | } |
| | | else |
| | |
| | | else |
| | | encodedMsg[pos++] = 0; |
| | | /* put the newsuperiorId and a terminating 0 */ |
| | | if (newSuperiorId != null) |
| | | if (newSuperiorEntryUUID != null) |
| | | { |
| | | pos = addByteArray(byteNewSuperiorId, encodedMsg, pos); |
| | | } |
| | |
| | | */ |
| | | length = getNextLength(in, pos); |
| | | if (length != 0) |
| | | newSuperiorId = new String(in, pos, length, "UTF-8"); |
| | | newSuperiorEntryUUID = new String(in, pos, length, "UTF-8"); |
| | | else |
| | | newSuperiorId = null; |
| | | newSuperiorEntryUUID = null; |
| | | pos += length + 1; |
| | | |
| | | /* get the deleteoldrdn flag */ |
| | |
| | | */ |
| | | length = getNextLength(in, pos); |
| | | if (length != 0) |
| | | newSuperiorId = new String(in, pos, length, "UTF-8"); |
| | | newSuperiorEntryUUID = new String(in, pos, length, "UTF-8"); |
| | | else |
| | | newSuperiorId = null; |
| | | newSuperiorEntryUUID = null; |
| | | pos += length + 1; |
| | | |
| | | /* get the deleteoldrdn flag */ |
| | |
| | | " protocolVersion: " + protocolVersion + |
| | | " dn: " + dn + |
| | | " changeNumber: " + changeNumber + |
| | | " uniqueId: " + uniqueId + |
| | | " uniqueId: " + entryUUID + |
| | | " assuredFlag: " + assuredFlag + |
| | | " newRDN: " + newRDN + |
| | | " newSuperior: " + newSuperior + |
| | |
| | | " protocolVersion: " + protocolVersion + |
| | | " dn: " + dn + |
| | | " changeNumber: " + changeNumber + |
| | | " uniqueId: " + uniqueId + |
| | | " uniqueId: " + entryUUID + |
| | | " newRDN: " + newRDN + |
| | | " newSuperior: " + newSuperior + |
| | | " deleteOldRdn: " + deleteOldRdn + |
| | |
| | | * |
| | | * @return The new superior id. |
| | | */ |
| | | public String getNewSuperiorId() |
| | | public String getNewSuperiorEntryUUID() |
| | | { |
| | | return newSuperiorId; |
| | | return newSuperiorEntryUUID; |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @param newSup The new superior id. |
| | | */ |
| | | public void setNewSuperiorId(String newSup) |
| | | public void setNewSuperiorEntryUUID(String newSup) |
| | | { |
| | | newSuperiorId = newSup; |
| | | newSuperiorEntryUUID = newSup; |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | */ |
| | | public class ModifyDnContext extends OperationContext |
| | | { |
| | | private String newParentId; |
| | | private String newSuperiorEntryUUID; |
| | | |
| | | /** |
| | | * Creates a new ModifyDN Context with the provided parameters. |
| | | * |
| | | * @param changeNumber The change number of the operation. |
| | | * @param uid the unique Id of the modified entry. |
| | | * @param newParentId The unique Identifier of the new parent, |
| | | * @param entryUUID the unique Id of the modified entry. |
| | | * @param newSuperiorEntryUUID The unique Identifier of the new parent, |
| | | * can be null if the entry is to stay below the same |
| | | * parent. |
| | | */ |
| | | public ModifyDnContext(ChangeNumber changeNumber, String uid, |
| | | String newParentId) |
| | | public ModifyDnContext(ChangeNumber changeNumber, String entryUUID, |
| | | String newSuperiorEntryUUID) |
| | | { |
| | | super(changeNumber, uid); |
| | | this.newParentId = newParentId; |
| | | super(changeNumber, entryUUID); |
| | | this.newSuperiorEntryUUID = newSuperiorEntryUUID; |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return Returns the unique Identifier of the new parent.. |
| | | */ |
| | | public String getNewParentId() |
| | | public String getNewSuperiorEntryUUID() |
| | | { |
| | | return newParentId; |
| | | return newSuperiorEntryUUID; |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | * @param changeNumber The ChangeNumber for the operation. |
| | | * @param dn The baseDN of the operation. |
| | | * @param mods The mod of the operation. |
| | | * @param entryuuid The unique id of the entry on which the modification |
| | | * @param entryUUID The unique id of the entry on which the modification |
| | | * needs to apply. |
| | | */ |
| | | public ModifyMsg(ChangeNumber changeNumber, DN dn, List<Modification> mods, |
| | | String entryuuid) |
| | | String entryUUID) |
| | | { |
| | | super(new ModifyContext(changeNumber, entryuuid), |
| | | super(new ModifyContext(changeNumber, entryUUID), |
| | | dn.toNormalizedString()); |
| | | this.encodedMods = encodeMods(mods); |
| | | } |
| | |
| | | InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, |
| | | ByteString.valueOf(newDn), ldapmods); |
| | | ModifyContext ctx = new ModifyContext(getChangeNumber(), getUniqueId()); |
| | | ModifyContext ctx = new ModifyContext(getChangeNumber(), getEntryUUID()); |
| | | mod.setAttachment(SYNCHROCONTEXT, ctx); |
| | | return mod; |
| | | |
| | |
| | | " protocolVersion: " + protocolVersion + |
| | | " dn: " + dn + |
| | | " changeNumber: " + changeNumber + |
| | | " uniqueId: " + uniqueId + |
| | | " uniqueId: " + entryUUID + |
| | | " assuredFlag: " + assuredFlag; |
| | | } |
| | | if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V2) |
| | |
| | | " protocolVersion: " + protocolVersion + |
| | | " dn: " + dn + |
| | | " changeNumber: " + changeNumber + |
| | | " uniqueId: " + uniqueId + |
| | | " uniqueId: " + entryUUID + |
| | | " assuredFlag: " + assuredFlag + |
| | | " assuredMode: " + assuredMode + |
| | | " safeDataLevel: " + safeDataLevel + |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | /** |
| | | * The unique Id of the entry that was modified in the original operation. |
| | | */ |
| | | private String entryUid; |
| | | private String entryUUID; |
| | | |
| | | /** |
| | | * Create a new OperationContext. |
| | | * @param changeNumber The change number of the operation. |
| | | * @param uid The unique Identifier of the modified entry. |
| | | * @param entryUUID The unique Identifier of the modified entry. |
| | | */ |
| | | protected OperationContext(ChangeNumber changeNumber, String uid) |
| | | protected OperationContext(ChangeNumber changeNumber, String entryUUID) |
| | | { |
| | | this.changeNumber = changeNumber; |
| | | this.entryUid = uid; |
| | | this.entryUUID = entryUUID; |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return the unique Identifier of the modified entry. |
| | | */ |
| | | public String getEntryUid() |
| | | public String getEntryUUID() |
| | | { |
| | | return entryUid; |
| | | return entryUUID; |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | OperationContext ctx = (OperationContext) obj; |
| | | return ((this.changeNumber.equals(ctx.getChangeNumber()) && |
| | | (this.entryUid.equals(ctx.getEntryUid())))); |
| | | (this.entryUUID.equals(ctx.getEntryUUID())))); |
| | | } |
| | | else |
| | | return false; |
| | |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | | return changeNumber.hashCode() + entryUid.hashCode(); |
| | | return changeNumber.hashCode() + entryUUID.hashCode(); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | import static org.opends.messages.BackendMessages.*; |
| | |
| | | AddMsg addMsg = (AddMsg)msg; |
| | | AddOperation addOperation = (AddOperation)msg.createOperation(conn); |
| | | |
| | | dn = DN.decode("puid=" + addMsg.getParentUid() + "+" + |
| | | dn = DN.decode("puid=" + addMsg.getParentEntryUUID() + "+" + |
| | | CHANGE_NUMBER + "=" + msg.getChangeNumber().toString() + "+" + |
| | | msg.getDn() + "," + BASE_DN); |
| | | |
| | |
| | | { |
| | | DeleteMsg delMsg = (DeleteMsg)msg; |
| | | |
| | | dn = DN.decode("uuid=" + msg.getUniqueId() + "," + |
| | | dn = DN.decode("uuid=" + msg.getEntryUUID() + "," + |
| | | CHANGE_NUMBER + "=" + delMsg.getChangeNumber().toString()+ "," + |
| | | msg.getDn() +","+ BASE_DN); |
| | | |
| | |
| | | { |
| | | ModifyOperation op = (ModifyOperation)msg.createOperation(conn); |
| | | |
| | | dn = DN.decode("uuid=" + msg.getUniqueId() + "," + |
| | | dn = DN.decode("uuid=" + msg.getEntryUUID() + "," + |
| | | CHANGE_NUMBER + "=" + msg.getChangeNumber().toString()+ "," + |
| | | msg.getDn() +","+ BASE_DN); |
| | | op.setInternalOperation(true); |
| | |
| | | { |
| | | ModifyDNOperation op = (ModifyDNOperation)msg.createOperation(conn); |
| | | |
| | | dn = DN.decode("uuid=" + msg.getUniqueId() + "," + |
| | | dn = DN.decode("uuid=" + msg.getEntryUUID() + "," + |
| | | CHANGE_NUMBER + "=" + msg.getChangeNumber().toString()+ "," + |
| | | msg.getDn() +","+ BASE_DN); |
| | | op.setInternalOperation(true); |
| | |
| | | .getCookie().toString(), DN.decode(addMsg.getDn()), |
| | | addMsg.getChangeNumber(), ldifChanges, // entry as created (in LDIF |
| | | // format) |
| | | addMsg.getUniqueId(), |
| | | addMsg.getEntryUUID(), |
| | | eclAttributes, // entry attributes |
| | | eclmsg.getDraftChangeNumber(), "add", changeInitiatorsName); |
| | | |
| | |
| | | clEntry = createChangelogEntry(eclmsg.getServiceId(), eclmsg |
| | | .getCookie().toString(), DN.decode(modifyMsg.getDn()), |
| | | modifyMsg.getChangeNumber(), ldifChanges, |
| | | modifyMsg.getUniqueId(), |
| | | modifyMsg.getEntryUUID(), |
| | | modifyMsg.getEclIncludes(), // entry attributes |
| | | eclmsg.getDraftChangeNumber(), changeType, |
| | | changeInitiatorsName); |
| | |
| | | .getCookie().toString(), DN.decode(delMsg.getDn()), |
| | | delMsg.getChangeNumber(), |
| | | null, // no changes |
| | | delMsg.getUniqueId(), |
| | | delMsg.getEntryUUID(), |
| | | delMsg.getEclIncludes(), // entry attributes |
| | | eclmsg.getDraftChangeNumber(), "delete", |
| | | delMsg.getInitiatorsName()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | long startTime = TimeThread.getTime(); |
| | | final DN dn1 = DN.decode("cn=test1," + baseDn.toString()); |
| | | final AttributeType histType = |
| | | DirectoryServer.getAttributeType(EntryHistorical.HISTORICALATTRIBUTENAME); |
| | | DirectoryServer.getAttributeType(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | |
| | | logError(Message.raw(Category.SYNC, Severity.INFORMATION, |
| | | "Starting replication test : changesCmpTest")); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.replication.plugin; |
| | |
| | | assertTrue(addOp.getChangeNumber() != null); |
| | | AddMsg addmsg = addOp.generateMessage(); |
| | | assertTrue(dn1.equals(DN.decode(addmsg.getDn()))); |
| | | assertTrue(addmsg.getUniqueId().equals(EntryHistorical.getEntryUuid(entry))); |
| | | String parentId = LDAPReplicationDomain.findEntryId(dn1.getParent()); |
| | | assertTrue(addmsg.getParentUid().equals(parentId)); |
| | | assertTrue(addmsg.getEntryUUID().equals(EntryHistorical.getEntryUUID(entry))); |
| | | String parentId = LDAPReplicationDomain.findEntryUUID(dn1.getParent()); |
| | | assertTrue(addmsg.getParentEntryUUID().equals(parentId)); |
| | | addmsg.createOperation(InternalClientConnection.getRootConnection()); |
| | | } else |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | { |
| | | AttributeType entryuuidAttrType = |
| | | DirectoryServer.getSchema().getAttributeType( |
| | | EntryHistorical.ENTRYUIDNAME); |
| | | EntryHistorical.ENTRYUUID_ATTRIBUTE_NAME); |
| | | |
| | | /* |
| | | * Objectclass and DN do not have any impact on the modify conflict |
| | |
| | | EntryHistorical hist, Entry entry) |
| | | { |
| | | AttributeType entryuuidAttrType = |
| | | DirectoryServer.getSchema().getAttributeType(EntryHistorical.ENTRYUIDNAME); |
| | | DirectoryServer.getSchema().getAttributeType(EntryHistorical.ENTRYUUID_ATTRIBUTE_NAME); |
| | | |
| | | // Get the historical uuid associated to the entry |
| | | // (the one that needs to be tested) |
| | | String uuid = EntryHistorical.getEntryUuid(entry); |
| | | String uuid = EntryHistorical.getEntryUUID(entry); |
| | | |
| | | // Get the Entry uuid in String format |
| | | List<Attribute> uuidAttrs = entry |
| | |
| | | if (generatedMsg instanceof LDAPUpdateMsg) |
| | | { |
| | | LDAPUpdateMsg new_name = (LDAPUpdateMsg) generatedMsg; |
| | | assertEquals(new_name.getUniqueId(),uuid); |
| | | assertEquals(new_name.getEntryUUID(),uuid); |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | AttributeType historicalAttrType = |
| | | DirectoryServer.getSchema().getAttributeType( |
| | | EntryHistorical.HISTORICALATTRIBUTENAME); |
| | | EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | |
| | | InternalClientConnection aConnection = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | { |
| | | AttributeType entryuuidAttrType = |
| | | DirectoryServer.getSchema().getAttributeType( |
| | | EntryHistorical.ENTRYUIDNAME); |
| | | EntryHistorical.ENTRYUUID_ATTRIBUTE_NAME); |
| | | |
| | | // Get the historical uuid associated to the entry |
| | | // (the one that needs to be tested) |
| | | String uuid = EntryHistorical.getEntryUuid(addOp); |
| | | String uuid = EntryHistorical.getEntryUUID(addOp); |
| | | |
| | | // Get the op uuid in String format |
| | | List<Attribute> uuidAttrs = addOp.getOperationalAttributes().get( |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.replication.protocol; |
| | |
| | | assertEquals(newMsg.getVersion(), ProtocolVersion.REPLICATION_PROTOCOL_V1); |
| | | |
| | | // Check fields common to both versions |
| | | assertEquals(newMsg.getUniqueId(), msg.getUniqueId()); |
| | | assertEquals(newMsg.getEntryUUID(), msg.getEntryUUID()); |
| | | assertEquals(newMsg.getDn(), msg.getDn()); |
| | | assertEquals(newMsg.getChangeNumber(), msg.getChangeNumber()); |
| | | assertEquals(newMsg.isAssured(), msg.isAssured()); |
| | | assertEquals(newMsg.getParentUid(), msg.getParentUid()); |
| | | assertEquals(newMsg.getParentEntryUUID(), msg.getParentEntryUUID()); |
| | | |
| | | // Create an add operation from each message to compare attributes (kept encoded in messages) |
| | | Operation op = msg.createOperation(connection, rawDN); |
| | |
| | | assertEquals(vlastMsg.getVersion(), REPLICATION_PROTOCOL_VLAST); |
| | | |
| | | // Check we retrieve original VLAST message (VLAST fields) |
| | | assertEquals(msg.getUniqueId(), vlastMsg.getUniqueId()); |
| | | assertEquals(msg.getEntryUUID(), vlastMsg.getEntryUUID()); |
| | | assertEquals(msg.getDn(), vlastMsg.getDn()); |
| | | assertEquals(msg.getChangeNumber(), vlastMsg.getChangeNumber()); |
| | | assertEquals(msg.getParentUid(), vlastMsg.getParentUid()); |
| | | assertEquals(msg.getParentEntryUUID(), vlastMsg.getParentEntryUUID()); |
| | | assertEquals(msg.isAssured(), vlastMsg.isAssured()); |
| | | assertEquals(msg.getAssuredMode(), vlastMsg.getAssuredMode()); |
| | | assertEquals(msg.getSafeDataLevel(), vlastMsg.getSafeDataLevel()); |
| | |
| | | assertEquals(newMsg.getVersion(), ProtocolVersion.REPLICATION_PROTOCOL_V1); |
| | | |
| | | // Check fields common to both versions |
| | | assertEquals(newMsg.getUniqueId(), msg.getUniqueId()); |
| | | assertEquals(newMsg.getEntryUUID(), msg.getEntryUUID()); |
| | | assertEquals(newMsg.getDn(), msg.getDn()); |
| | | assertEquals(newMsg.getChangeNumber(), msg.getChangeNumber()); |
| | | assertEquals(newMsg.isAssured(), msg.isAssured()); |
| | |
| | | assertEquals(vlastMsg.getVersion(), REPLICATION_PROTOCOL_VLAST); |
| | | |
| | | // Check we retrieve original VLAST message (VLAST fields) |
| | | assertEquals(msg.getUniqueId(), vlastMsg.getUniqueId()); |
| | | assertEquals(msg.getEntryUUID(), vlastMsg.getEntryUUID()); |
| | | assertEquals(msg.getDn(), vlastMsg.getDn()); |
| | | assertEquals(msg.getChangeNumber(), vlastMsg.getChangeNumber()); |
| | | assertEquals(msg.isAssured(), vlastMsg.isAssured()); |
| | |
| | | assertEquals(newv1Msg.getVersion(), ProtocolVersion.REPLICATION_PROTOCOL_V1); |
| | | |
| | | // Check fields common to both versions |
| | | assertEquals(newv1Msg.getUniqueId(), origVlastMsg.getUniqueId()); |
| | | assertEquals(newv1Msg.getEntryUUID(), origVlastMsg.getEntryUUID()); |
| | | assertEquals(newv1Msg.getDn(), origVlastMsg.getDn()); |
| | | assertEquals(newv1Msg.getChangeNumber(), origVlastMsg.getChangeNumber()); |
| | | assertEquals(newv1Msg.isAssured(), origVlastMsg.isAssured()); |
| | |
| | | assertEquals(generatedVlastMsg.getVersion(), REPLICATION_PROTOCOL_VLAST); |
| | | |
| | | // Check we retrieve original VLAST message (VLAST fields) |
| | | assertEquals(origVlastMsg.getUniqueId(), generatedVlastMsg.getUniqueId()); |
| | | assertEquals(origVlastMsg.getEntryUUID(), generatedVlastMsg.getEntryUUID()); |
| | | assertEquals(origVlastMsg.getDn(), generatedVlastMsg.getDn()); |
| | | assertEquals(origVlastMsg.getChangeNumber(), generatedVlastMsg.getChangeNumber()); |
| | | assertEquals(origVlastMsg.isAssured(), generatedVlastMsg.isAssured()); |
| | |
| | | assertEquals(newMsg.getVersion(), ProtocolVersion.REPLICATION_PROTOCOL_V1); |
| | | |
| | | // Check fields common to both versions |
| | | assertEquals(newMsg.getUniqueId(), msg.getUniqueId()); |
| | | assertEquals(newMsg.getEntryUUID(), msg.getEntryUUID()); |
| | | assertEquals(newMsg.getDn(), msg.getDn()); |
| | | assertEquals(newMsg.getChangeNumber(), msg.getChangeNumber()); |
| | | assertEquals(newMsg.isAssured(), msg.isAssured()); |
| | | assertEquals(newMsg.getNewRDN(), msg.getNewRDN()); |
| | | assertEquals(newMsg.getNewSuperior(), msg.getNewSuperior()); |
| | | assertEquals(newMsg.getNewSuperiorId(), msg.getNewSuperiorId()); |
| | | assertEquals(newMsg.getNewSuperiorEntryUUID(), msg.getNewSuperiorEntryUUID()); |
| | | assertEquals(newMsg.deleteOldRdn(), msg.deleteOldRdn()); |
| | | |
| | | // Create a modDn operation from each message to compare fields) |
| | |
| | | assertEquals(vlastMsg.getVersion(), REPLICATION_PROTOCOL_VLAST); |
| | | |
| | | // Check we retrieve original VLAST message (VLAST fields) |
| | | assertEquals(msg.getUniqueId(), vlastMsg.getUniqueId()); |
| | | assertEquals(msg.getEntryUUID(), vlastMsg.getEntryUUID()); |
| | | assertEquals(msg.getDn(), vlastMsg.getDn()); |
| | | assertEquals(msg.getChangeNumber(), vlastMsg.getChangeNumber()); |
| | | assertEquals(msg.isAssured(), vlastMsg.isAssured()); |
| | |
| | | assertEquals(msg.getSafeDataLevel(), vlastMsg.getSafeDataLevel()); |
| | | assertEquals(msg.getNewRDN(), vlastMsg.getNewRDN()); |
| | | assertEquals(msg.getNewSuperior(), vlastMsg.getNewSuperior()); |
| | | assertEquals(msg.getNewSuperiorId(), vlastMsg.getNewSuperiorId()); |
| | | assertEquals(msg.getNewSuperiorEntryUUID(), vlastMsg.getNewSuperiorEntryUUID()); |
| | | assertEquals(msg.deleteOldRdn(), vlastMsg.deleteOldRdn()); |
| | | |
| | | // Get ECL entry attributes |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | assertEquals(msg.getDn(), fakeDN) ; |
| | | |
| | | // Check uuid |
| | | assertEquals(msg.getUniqueId(), generatedMsg.getUniqueId()); |
| | | assertEquals(msg.getEntryUUID(), generatedMsg.getEntryUUID()); |
| | | |
| | | // Check assured flag |
| | | assertEquals(msg.isAssured(), generatedMsg.isAssured()); |
| | |
| | | assertEquals(generatedMsg.toString(), msg.toString()); |
| | | |
| | | // Test that generated attributes match original attributes. |
| | | assertEquals(generatedMsg.getParentUid(), msg.getParentUid()); |
| | | assertEquals(generatedMsg.getParentEntryUUID(), msg.getParentEntryUUID()); |
| | | assertEquals(generatedMsg.isAssured(), isAssured); |
| | | assertEquals(generatedMsg.getAssuredMode(), assuredMode); |
| | | assertEquals(generatedMsg.getSafeDataLevel(), safeDataLevel); |