replicationServer.getReplicationServerDomain(TEST_ROOT_DN_STRING, false);
// The replication changelog is empty
long count = rsdtest.getEligibleCount(
new ServerState(),
new ChangeNumber(TimeThread.getTime(), 1, 1201));
assertEquals(count, 0);
// Creates broker on o=test
ReplicationBroker server01 = openReplicationSession(
DN.decode(TEST_ROOT_DN_STRING), 1201,
1000, replicationServerPort,
brokerSessionTimeout, true);
// Publish one first message
ChangeNumber cn1 = new ChangeNumber(TimeThread.getTime(), 1, 1201);
DeleteMsg delMsg =
new DeleteMsg("uid="+tn+"1," + TEST_ROOT_DN_STRING, cn1,
user1entryUUID);
server01.publish(delMsg);
debugInfo(tn, " publishes " + delMsg.getChangeNumber());
sleep(300);
// From begin to now : 1 change
count = rsdtest.getEligibleCount(
new ServerState(),
new ChangeNumber(TimeThread.getTime(), 1, 1201));
assertEquals(count, 1);
// Publish one second message
ChangeNumber cn2 = new ChangeNumber(TimeThread.getTime(), 2, 1201);
delMsg =
new DeleteMsg("uid="+tn+"1," + TEST_ROOT_DN_STRING, cn2,
user1entryUUID);
server01.publish(delMsg);
debugInfo(tn, " publishes " + delMsg.getChangeNumber());
sleep(300);
// From begin to now : 2 changes
count = rsdtest.getEligibleCount(
new ServerState(),
new ChangeNumber(TimeThread.getTime(), 1, 1201));
assertEquals(count, 2);
// From begin to first change (inclusive) : 1 change = cn1
count = rsdtest.getEligibleCount(
new ServerState(), cn1);
assertEquals(count, 1);
ServerState ss = new ServerState();
ss.update(cn1);
// From state/cn1(exclusive) to cn1 (inclusive) : 0 change
count = rsdtest.getEligibleCount(ss, cn1);
assertEquals(count, 0);
// From state/cn1(exclusive) to cn2 (inclusive) : 1 change = cn2
count = rsdtest.getEligibleCount(ss, cn2);
assertEquals(count, 1);
ss.update(cn2);
// From state/cn2(exclusive) to now (inclusive) : 0 change
count = rsdtest.getEligibleCount(ss,
new ChangeNumber(TimeThread.getTime(), 4, 1201));
assertEquals(count, 0);
// Publish one third message
ChangeNumber cn3 = new ChangeNumber(TimeThread.getTime(), 3, 1201);
delMsg =
new DeleteMsg("uid="+tn+"1," + TEST_ROOT_DN_STRING, cn3,
user1entryUUID);
server01.publish(delMsg);
debugInfo(tn, " publishes " + delMsg.getChangeNumber());
sleep(300);
ss.update(cn2);
// From state/cn2(exclusive) to now : 1 change = cn3
count = rsdtest.getEligibleCount(ss,
new ChangeNumber(TimeThread.getTime(), 4, 1201));
assertEquals(count, 1);
boolean perfs=false;
if (perfs)
{
// number of msgs used by the test
int maxMsg = 999999;
// We need an RS configured with a window size bigger than the number
// of msg used by the test.
assertTrue(maxMsg<maxWindow);
debugInfo(tn, "Perf test in compat mode - will generate " + maxMsg + " msgs.");
for (int i=4; i<=maxMsg; i++)
{
ChangeNumber cnx = new ChangeNumber(TimeThread.getTime(), i, 1201);
delMsg =
new DeleteMsg("uid="+tn+i+"," + TEST_ROOT_DN_STRING, cnx,
user1entryUUID);
server01.publish(delMsg);
}