String entryuuid2 =
attrs.get(0).iterator().next().getValue().toString();
long now = System.currentTimeMillis();
// A change on a first server.
ChangeNumber t1 = new ChangeNumber(now, 0, 3);
// A change on a second server.
ChangeNumber t2 = new ChangeNumber(now+1, 0, 4);
// Simulate the ordering t1:add:A followed by t2:add:B that would
// happen on one server.
// Replay an add of a value A at time t1 on a first server.
Attribute attr = Attributes.create(attrType.getNormalizedPrimaryName(), "A");
Modification mod = new Modification(ModificationType.ADD, attr);
publishModify(broker, t1, dn1, entryuuid, mod);
// It would be nice to avoid these sleeps.
// We need to preserve the replay order but the order could be changed
// due to the multi-threaded nature of the replication replay.
// Putting a sentinel value in the modification is not foolproof since
// the operation might not get replayed at all.
Thread.sleep(2000);
// Replay an add of a value B at time t2 on a second server.
attr = Attributes.create(attrType.getNormalizedPrimaryName(), "B");
mod = new Modification(ModificationType.ADD, attr);
publishModify(broker, t2, dn1, entryuuid, mod);
Thread.sleep(2000);
// Simulate the reverse ordering t2:add:B followed by t1:add:A that
// would happen on the other server.
t1 = new ChangeNumber(now+3, 0, 3);
t2 = new ChangeNumber(now+4, 0, 4);
// Replay an add of a value B at time t2 on a second server.
attr = Attributes.create(attrType.getNormalizedPrimaryName(), "B");
mod = new Modification(ModificationType.ADD, attr);
publishModify(broker, t2, dn2, entryuuid2, mod);