use of com.google.apphosting.datastore.DatastoreV3Pb.CompiledCursor in project appengine-java-standard by GoogleCloudPlatform.
the class CursorTest method testReverseCursorPostfix.
@SuppressWarnings("deprecation")
@Test
public void testReverseCursorPostfix() {
IndexPostfix postfixPosition = new IndexPostfix().setKey(new Reference()).setBefore(true);
Cursor pfCursor = toCursor(new CompiledCursor().setPostfixPosition(postfixPosition));
// reverse() is a no-op.
Cursor pfReverse = pfCursor.reverse();
assertThat(pfReverse).isEqualTo(pfCursor);
assertThat(pfCursor).isEqualTo(pfReverse.reverse());
}
use of com.google.apphosting.datastore.DatastoreV3Pb.CompiledCursor in project appengine-java-standard by GoogleCloudPlatform.
the class CursorTest method testReverseCursorAbsolutePosition.
@SuppressWarnings("deprecation")
@Test
public void testReverseCursorAbsolutePosition() {
IndexPosition absolutePosition = new IndexPosition().setKey("Goodnight moon").setBefore(true);
Cursor absCursor = toCursor(new CompiledCursor().setAbsolutePosition(absolutePosition));
// reverse() is a no-op.
Cursor absReverse = absCursor.reverse();
assertThat(absCursor).isEqualTo(absReverse);
assertThat(absCursor).isEqualTo(absReverse.reverse());
}
use of com.google.apphosting.datastore.DatastoreV3Pb.CompiledCursor in project appengine-java-standard by GoogleCloudPlatform.
the class CursorTest method toPb.
private static CompiledCursor toPb(Cursor cursor) {
CompiledCursor pb = new CompiledCursor();
assertThat(pb.parseFrom(cursor.toByteString())).isTrue();
return pb;
}
use of com.google.apphosting.datastore.DatastoreV3Pb.CompiledCursor in project appengine-java-standard by GoogleCloudPlatform.
the class CursorTest method testCursorLifeCycle.
@Test
public void testCursorLifeCycle() {
Cursor reconstituted = Cursor.fromWebSafeString(cursor.toWebSafeString());
assertThat(reconstituted).isEqualTo(cursor);
Query query = new Query();
query.setOffset(3);
query.setCompiledCursor(toPb(reconstituted));
assertThat(query.getCompiledCursor()).isEqualTo(compiledCursor);
assertThat(query.getOffset()).isEqualTo(3);
}
use of com.google.apphosting.datastore.DatastoreV3Pb.CompiledCursor in project appengine-java-standard by GoogleCloudPlatform.
the class CursorTest method setUp.
@Before
public void setUp() throws Exception {
compiledCursor = new CompiledCursor();
CompiledCursor.Position position = compiledCursor.getMutablePosition();
position.setStartKey("Hello World");
position.setStartInclusive(true);
cursor = toCursor(compiledCursor);
}
Aggregations