"ObjectClass: organizationalUnit",
"ou", "test" + i,
"entryCsn", entryCsn.toString()
);
ReplicaEventMessage replicaEventMessage = new ReplicaEventMessage( ChangeType.ADD, entry );
journal.put( entryCsn.toString(), replicaEventMessage );
journal.sync();
entryCsn = csnFactory.newInstance();
}
// Now check that the ReplicaEventMessages has been written
ReplicaEventMessage firstMessage = journal.get( firstCsn.toString() );
assertEquals( ChangeType.ADD, firstMessage.getChangeType() );
assertEquals( "test0", firstMessage.getEntry().get( "ou" ).getString() );
// Read entry from the 100th element
Cursor<Tuple<String, ReplicaEventMessage>> cursor = journal.cursor( csn100.toString() );
int pos = 100;
while ( cursor.next() )
{
Tuple<String, ReplicaEventMessage> tuple = cursor.get();
ReplicaEventMessage replicaEventMessage = tuple.getValue();
assertEquals( ChangeType.ADD, replicaEventMessage.getChangeType() );
assertEquals( "test" + pos, replicaEventMessage.getEntry().get( "ou" ).getString() );
pos++;
}
cursor.close();