use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method getLongMustHitFirstCursorBeforeFlip.
@Test
public void getLongMustHitFirstCursorBeforeFlip() throws Exception {
PageCursor c = CompositePageCursor.compose(first, 8, second, 8);
assertThat(c.getLong(), is(0xA0A1A2A3A4A5A6A7L));
assertFalse(c.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method retryMustResetOffsetsInBothCursors.
@Test
public void retryMustResetOffsetsInBothCursors() throws Exception {
first.setOffset(1);
second.setOffset(2);
PageCursor pageCursor = CompositePageCursor.compose(first, 8, second, 8);
pageCursor.setOffset(5);
first.setOffset(3);
second.setOffset(4);
first.setNeedsRetry(true);
pageCursor.shouldRetry();
assertThat(first.getOffset(), is(1));
assertThat(second.getOffset(), is(2));
assertThat(pageCursor.getOffset(), is(0));
pageCursor.setOffset(5);
first.setOffset(3);
second.setOffset(4);
first.setNeedsRetry(false);
second.setNeedsRetry(true);
pageCursor.shouldRetry();
assertThat(first.getOffset(), is(1));
assertThat(second.getOffset(), is(2));
assertThat(pageCursor.getOffset(), is(0));
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method putLongBeyondEndOfViewMustRaiseBoundsFlag.
@Test
public void putLongBeyondEndOfViewMustRaiseBoundsFlag() throws Exception {
PageCursor pageCursor = CompositePageCursor.compose(first, PAGE_SIZE, second, PAGE_SIZE);
for (int i = 0; i < 3 * PAGE_SIZE; i++) {
pageCursor.putLong((long) 1);
}
assertTrue(pageCursor.checkAndClearBoundsFlag());
assertFalse(pageCursor.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method putIntMustHitSecondCursorAfterFlip.
@Test
public void putIntMustHitSecondCursorAfterFlip() throws Exception {
PageCursor c = CompositePageCursor.compose(first, 4, second, 4);
c.putInt(1);
c.putInt(2);
c.setOffset(4);
assertThat(c.getInt(), is(2));
assertFalse(c.checkAndClearBoundsFlag());
}
use of org.neo4j.io.pagecache.PageCursor in project neo4j by neo4j.
the class CompositePageCursorTest method isWriteLockedMustBeFalseIfSecondCursorIsNotWriteLocked.
@Test
public void isWriteLockedMustBeFalseIfSecondCursorIsNotWriteLocked() throws Exception {
PageCursor cursor = CompositePageCursor.compose(first, PAGE_SIZE, second, PAGE_SIZE);
first.setWriteLocked(true);
second.setWriteLocked(false);
assertFalse(cursor.isWriteLocked());
}
Aggregations