use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method pageIdEqualSecondCursorPageIdAfterFlip.
@Test
public void pageIdEqualSecondCursorPageIdAfterFlip() throws Exception {
PageCursor pageCursor = CompositePageCursor.compose(first, PAGE_SIZE, second, PAGE_SIZE);
assertNotEquals(second.getCurrentPageId(), pageCursor.getCurrentPageId());
pageCursor.getLong();
assertNotEquals(second.getCurrentPageId(), pageCursor.getCurrentPageId());
pageCursor.getLong();
assertEquals(second.getCurrentPageId(), pageCursor.getCurrentPageId());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method putLongOffsettedBeforeFirstPageMustRaiseBoundsFlag.
@Test
public void putLongOffsettedBeforeFirstPageMustRaiseBoundsFlag() throws Exception {
PageCursor pageCursor = CompositePageCursor.compose(first, PAGE_SIZE, second, PAGE_SIZE);
pageCursor.putLong(-1, (long) 1);
assertTrue(pageCursor.checkAndClearBoundsFlag());
assertFalse(pageCursor.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method getByteMustRespectOffsetIntoSecondCursor.
@Test
public void getByteMustRespectOffsetIntoSecondCursor() throws Exception {
second.setOffset(1);
PageCursor c = CompositePageCursor.compose(first, 1, second, 1);
assertThat(c.getByte(), is((byte) 0xA0));
assertThat(c.getByte(), is((byte) 0xB1));
assertFalse(c.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method putShortWithOffsetMustHitCorrectCursors.
@Test
public void putShortWithOffsetMustHitCorrectCursors() throws Exception {
first.setOffset(1);
second.setOffset(2);
PageCursor c = CompositePageCursor.compose(first, 2 * 2, second, 2 * 2);
c.putShort(2, (short) 1);
c.putShort(2 + 2, (short) 2);
assertThat(c.getShort(), is((short) 0xA1A2));
assertThat(c.getShort(), is((short) 1));
assertThat(c.getShort(), is((short) 2));
assertThat(c.getShort(), is((short) 0xB4B5));
assertFalse(c.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method nextIsNotSupportedOperation.
@Test(expected = UnsupportedOperationException.class)
public void nextIsNotSupportedOperation() throws Exception {
PageCursor pageCursor = CompositePageCursor.compose(first, PAGE_SIZE, second, PAGE_SIZE);
pageCursor.next();
}
Aggregations