byte[] value = (num + ".value").getBytes();
_store.put(key, value);
}
public void testPersistableListener() throws Exception {
PersistCounter l = new PersistCounter();
_store.setPersistableListener(l);
assertEquals(0, l.getBeforeCount());
assertEquals(0, l.getAfterCount());
for(int i = 0, cnt = getBatchSize(); i < cnt; i++) {
nextPut();
}
assertEquals(1, l.getBeforeCount());
assertEquals(1, l.getAfterCount());
for(int i = 0, cnt = getBatchSize(); i < cnt; i++) {
nextPut();
}
assertEquals(2, l.getBeforeCount());
assertEquals(2, l.getAfterCount());
for(int i = 0, cnt = getBatchSize() + _rand.nextInt(10000); i < cnt; i++) {
nextPut();
}
assertTrue(2 < l.getBeforeCount());
assertTrue(2 < l.getAfterCount());
assertEquals(l.getBeforeCount(), l.getAfterCount());
System.out.println(String.format("persisted %d times", l.getAfterCount()));
}