use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method getIntOffsettedBeforeFirstPageMustRaiseBoundsFlag.
@Test
public void getIntOffsettedBeforeFirstPageMustRaiseBoundsFlag() throws Exception {
PageCursor pageCursor = CompositePageCursor.compose(first, PAGE_SIZE, second, PAGE_SIZE);
pageCursor.getInt(-1);
assertTrue(pageCursor.checkAndClearBoundsFlag());
assertFalse(pageCursor.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method overlappingGetAccess.
@Test
public void overlappingGetAccess() throws Exception {
PageCursor c = CompositePageCursor.compose(first, PAGE_SIZE, second, PAGE_SIZE);
c.setOffset(PAGE_SIZE - 2);
assertThat(c.getInt(), is(0xAEAFB0B1));
c.setOffset(PAGE_SIZE - 1);
assertThat(c.getShort(), is((short) 0xAFB0));
c.setOffset(PAGE_SIZE - 4);
assertThat(c.getLong(), is(0xACADAEAFB0B1B2B3L));
c.setOffset(PAGE_SIZE - 2);
c.getBytes(bytes);
assertThat(bytes, byteArray(0xAE, 0xAF, 0xB0, 0xB1));
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method putShortMustRespectOffsetIntoSecondCursor.
@Test
public void putShortMustRespectOffsetIntoSecondCursor() throws Exception {
second.setOffset(1);
PageCursor c = CompositePageCursor.compose(first, 2, second, 4);
c.putShort((short) 1);
c.putShort((short) 2);
assertThat(second.getShort(1), is((short) 2));
assertThat(c.getShort(), is((short) 0xB3B4));
assertFalse(c.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method rewindCompositeCursor.
@Test
public void rewindCompositeCursor() throws Exception {
first.setOffset(1);
second.setOffset(2);
PageCursor pageCursor = CompositePageCursor.compose(first, PAGE_SIZE, second, PAGE_SIZE);
pageCursor.getLong();
pageCursor.getLong();
pageCursor.getLong();
pageCursor.rewind();
assertEquals(0, pageCursor.getOffset());
assertEquals(1, first.getOffset());
assertEquals(2, second.getOffset());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method getLongMustHitSecondCursorAfterFlip.
@Test
public void getLongMustHitSecondCursorAfterFlip() throws Exception {
PageCursor c = CompositePageCursor.compose(first, 8, second, 8);
assertThat(c.getLong(), is(0xA0A1A2A3A4A5A6A7L));
assertThat(c.getLong(), is(0xB0B1B2B3B4B5B6B7L));
assertFalse(c.checkAndClearBoundsFlag());
}
Aggregations