+ "objectClass: top\n"
+ "objectClass: organization\n";
Entry entry = TestCaseUtils.entryFromLdifString(entryldif);
AttributeType uidType =
DirectoryServer.getSchema().getAttributeType("entryuuid");
ChangeNumberGenerator gen = new ChangeNumberGenerator(brokerId, 0L);
int renamedEntryUuid = 100;
// find a free port for the replicationServer
ServerSocket socket = TestCaseUtils.bindFreePort();
int replServerPort = socket.getLocalPort();
socket.close();
ReplServerFakeConfiguration conf =
new ReplServerFakeConfiguration(replServerPort, "dependencyTestModdnDelDependencyTestDb",
0, replServerId, 0,
200, null);
replServer = new ReplicationServer(conf);
// configure and start replication of TEST_ROOT_DN_STRING on the server
SortedSet<String> replServers = new TreeSet<String>();
replServers.add("localhost:"+replServerPort);
DomainFakeCfg domainConf =
new DomainFakeCfg(baseDn, serverId, replServers);
domainConf.setHeartbeatInterval(100000);
Thread.sleep(2000);
domain = MultimasterReplication.createNewDomain(domainConf);
domain.start();
ReplicationBroker broker =
openReplicationSession(baseDn, brokerId, 1000, replServerPort, 1000,
false, CLEAN_DB_GENERATION_ID);
// add an entry to play with.
entry.removeAttribute(uidType);
entry.addAttribute(Attributes.create("entryuuid",
stringUID(renamedEntryUuid)),
new LinkedList<AttributeValue>());
String addDn = "dc=moddndel" + "," + TEST_ROOT_DN_STRING;
AddMsg addMsg =
new AddMsg(gen.newChangeNumber(), addDn, stringUID(renamedEntryUuid),
stringUID(1),
entry.getObjectClassAttribute(),
entry.getAttributes(), null );
broker.publish(addMsg);
// check that the entry was correctly added
boolean found =
checkEntryHasAttribute(DN.decode(addDn), "entryuuid",
stringUID(renamedEntryUuid),
30000, true);
assertTrue(found, "The initial entry add failed");
// disable the domain to make sure that the messages are
// all sent in a row.
domain.disable();
// rename and delete the entry.
ModifyDNMsg moddnMsg =
new ModifyDNMsg(addDn, gen.newChangeNumber(),
stringUID(renamedEntryUuid),
stringUID(1), true, null, "dc=new_name");
broker.publish(moddnMsg);
DeleteMsg delMsg =
new DeleteMsg("dc=new_name" + "," + TEST_ROOT_DN_STRING,
gen.newChangeNumber(), stringUID(renamedEntryUuid));
broker.publish(delMsg);
// enable back the domain to trigger message replay.
domain.enable();