public void testSnapReader() throws IOException {
final AtomicBoolean closed = new AtomicBoolean(false);
byte[] ar = readFile("test.snap");
ReadableByteChannel readableByteChannel = createReadableByteChannel(closed, ar);
TupleSupport ts = new TupleSupport();
SnapshotReader snapShotReader = new SnapshotReader(readableByteChannel);
for (int i = 0; i < 10; i++) {
Tuple tuple = ts.create(i, Long.parseLong("98765432" + i), "Hello world " + i + "!");
Row row = snapShotReader.nextRow();
Assert.assertTrue(Arrays.equals(tuple.pack(), row.data.pack()));
}
snapShotReader.close();
Assert.assertTrue(closed.get());