// fail once
TestAvatarCheckpointingHandler h = new TestAvatarCheckpointingHandler(null, true);
InjectionHandler.set(h);
setUp();
createEdits(20);
AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
try {
Thread.sleep(3000);
h.failNextCheckpoint = true;
standby.doCheckpoint();
fail("Should get IOException here");
} catch (Exception e) { }
// checkpoint failed
assertNotNull(h.lastSignature);
h.failNextCheckpoint = false;
standby.doCheckpoint();
// checkpoint succeeded
assertNull(h.lastSignature);
h.failNextCheckpoint = true;
try {
standby.doCheckpoint();
fail("Should get IOException here");
} catch (Exception e) { }
// checkpoint failed -> now reading edits.new
assertNotNull(h.lastSignature);
createEdits(20);
standby.quiesceStandby(getCurrentTxId(primary)-1);
assertEquals(40, getCurrentTxId(primary));
assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
}