}
}
public void testApi() throws Exception {
int cnt = getEventBatchSize() + _rand.nextInt(getNumRetentionBatches() * getEventBatchSize() / 2);
Clock clock = _clockFactory.next();
Clock minClock = clock;
_retention.put(nextEvent(clock));
// Create an idle clock
Clock idleClock0 = _clockFactory.next();
clock = _clockFactory.next();
_retention.put(nextEvent(clock));
// Create an idle clock
Clock idleClock1 = _clockFactory.next();
for(int i = 2; i < cnt; i++) {
clock = _clockFactory.next();
_retention.put(nextEvent(clock));
}
Clock maxClock = clock;
assertEquals(getId(), _retention.getId());
Position pos = _retention.getPosition();
assertEquals((long)cnt, pos.getOffset());
assertEquals(cnt, _retention.getOffset());
assertTrue(minClock.compareTo(_retention.getMinClock()) == Occurred.EQUICONCURRENTLY);
assertTrue(maxClock.compareTo(_retention.getMaxClock()) == Occurred.EQUICONCURRENTLY);
Position sincePosition = _retention.getPosition(idleClock0);
assertEquals(getId(), sincePosition.getId());
assertEquals(0, sincePosition.getOffset());