assertNotNull(resultEntry,
"The send ADD replication message was not applied");
// send a modify operation with the correct unique ID but another DN
List<Modification> mods = generatemods("telephonenumber", "01 02 45");
ModifyMsg modMsg = new ModifyMsg(gen.newChangeNumber(),
DN.decode("cn=something,ou=People," + TEST_ROOT_DN_STRING), mods,
user1entryUUID);
updateMonitorCount(baseDn, resolvedMonitorAttr);
int AlertCount = DummyAlertHandler.getAlertCount();
broker.publish(modMsg);
// check that the modify has been applied as if the entry had been renamed.
boolean found = checkEntryHasAttribute(personWithUUIDEntry.getDN(),
"telephonenumber", "01 02 45", 10000, true);
if (found == false)
fail("The modification has not been correctly replayed.");
assertEquals(getMonitorDelta(), 1);
// check that there was no administrative alert generated
// because the conflict has been automatically resolved.
assertEquals(DummyAlertHandler.getAlertCount(), AlertCount,
"An alert was incorrectly generated when resolving conflicts");
/*
* Test that modify conflict resolution is able to detect that
* because there is a conflict between a MODIFYDN and a MODIFY,
* when a MODIFY is replayed the attribute that is being modified is
* now the RDN of the entry and therefore should not be deleted.
*/
// send a modify operation attempting to replace the RDN entry
// with a new value
mods = generatemods("uid", "AnotherUid");
modMsg = new ModifyMsg(gen.newChangeNumber(),
personWithUUIDEntry.getDN(), mods,
user1entryUUID);
updateMonitorCount(baseDn, resolvedMonitorAttr);
AlertCount = DummyAlertHandler.getAlertCount();
broker.publish(modMsg);
// check that the modify has been applied.
found = checkEntryHasAttribute(personWithUUIDEntry.getDN(),
"uid", "AnotherUid", 10000, true);
if (found == false)
fail("The modification has not been correctly replayed.");
assertEquals(getMonitorDelta(), 1);
/*
* Test that the conflict resolution code is able to detect
* that an entry has been renamed and that a new entry has
* been created with the same DN but another entry UUID
* To simulate this, create and entry with a given UUID and a given DN
* then send a modify operation using the same DN but another UUID.
* Finally check that the modify operation has not been applied to the
* entry with the given DN.
*/
// create the entry with a given DN and unique ID
addMsg = new AddMsg(gen.newChangeNumber(),
personWithUUIDEntry.getDN().toString(),
user1entryUUID, baseUUID,
personWithUUIDEntry.getObjectClassAttribute(),
personWithUUIDEntry.getAttributes(), new ArrayList<Attribute>());
broker.publish(addMsg);
// Check that the entry has been created in the local DS.
resultEntry = getEntry(personWithUUIDEntry.getDN(), 10000, true);
assertNotNull(resultEntry,
"The ADD replication message was not applied");
// send a modify operation with a wrong unique ID but the same DN
mods = generatemods("telephonenumber", "02 01 03 05");
modMsg = new ModifyMsg(gen.newChangeNumber(),
DN.decode(user1dn), mods, "10000000-9abc-def0-1234-1234567890ab");
updateMonitorCount(baseDn, resolvedMonitorAttr);
AlertCount = DummyAlertHandler.getAlertCount();
broker.publish(modMsg);