}
this.memoryManager.release(outView.close());
// create the reader input view
memory = this.memoryManager.allocatePages(this.parentTask, NUM_MEMORY_SEGMENTS);
final BlockChannelReader reader = this.ioManager.createBlockChannelReader(channel);
final ChannelReaderInputView inView = new ChannelReaderInputView(reader, memory, outView.getBlockCount(), true);
generator.reset();
// read and re-generate all records and compare them
try {
final Record readRec = new Record();
for (int i = 0; i < NUM_PAIRS_SHORT + 1; i++) {
generator.next(rec);
readRec.read(inView);
final Key k1 = rec.getField(0, Key.class);
final Value v1 = rec.getField(1, Value.class);
final Key k2 = readRec.getField(0, Key.class);
final Value v2 = readRec.getField(1, Value.class);
Assert.assertTrue("The re-generated and the read record do not match.", k1.equals(k2) && v1.equals(v2));
}
Assert.fail("Expected an EOFException which did not occur.");
}
catch (EOFException eofex) {
// expected
}
catch (Throwable t) {
// unexpected
Assert.fail("Unexpected Exception: " + t.getMessage());
}
this.memoryManager.release(inView.close());
reader.deleteChannel();
}