use of org.neo4j.io.pagecache.PageSwapper in project neo4j by neo4j.
the class SingleFilePageSwapperTest method swappingInMustFillPageWithData.
@Test
public void swappingInMustFillPageWithData() throws Exception {
byte[] bytes = new byte[] { 1, 2, 3, 4 };
StoreChannel channel = getFs().create(getFile());
channel.writeAll(wrap(bytes));
channel.close();
PageSwapperFactory factory = createSwapperFactory();
PageSwapper swapper = createSwapper(factory, getFile(), 4, null, false);
ByteBuffer target = ByteBuffer.allocateDirect(4);
ByteBufferPage page = new ByteBufferPage(target);
swapper.read(0, page);
assertThat(array(target), byteArray(bytes));
}
Aggregations