baseDir = Files.createTempDir();
origCheckpointDir = new File(baseDir, "chkpt");
Assert.assertTrue(origCheckpointDir.mkdirs() || origCheckpointDir.isDirectory());
origDataDir = new File(baseDir, "data");
Assert.assertTrue(origDataDir.mkdirs() || origDataDir.isDirectory());
FileChannel channel = new FileChannel();
channel.setName("channel");
ctx = new Context();
ctx.put(FileChannelConfiguration.CAPACITY, "1000");
ctx.put(FileChannelConfiguration.CHECKPOINT_DIR, origCheckpointDir.toString());
ctx.put(FileChannelConfiguration.DATA_DIRS, origDataDir.toString());
ctx.put(FileChannelConfiguration.MAX_FILE_SIZE, "10000");
ctx.put(FileChannelConfiguration.TRANSACTION_CAPACITY, "100");
channel.configure(ctx);
channel.start();
for (int j = 0; j < 5; j++) {
Transaction tx = channel.getTransaction();
tx.begin();
for (int i = 0; i < 5; i++) {
channel.put(event);
}
tx.commit();
tx.close();
}
Log log = field("log")
.ofType(Log.class)
.in(channel)
.get();
Assert.assertTrue("writeCheckpoint returned false",
method("writeCheckpoint")
.withReturnType(Boolean.class)
.withParameterTypes(Boolean.class)
.in(log)
.invoke(true));
channel.stop();
}