use of siena.gae.QueryOptionGaeContext in project siena by mandubian.
the class GaeAsyncTest method testFilterWithOperatorNotEqualLotsOfEntitiesStateless.
public void testFilterWithOperatorNotEqualLotsOfEntitiesStateless() {
Discovery[] discs = new Discovery[200];
for (int i = 0; i < 200; i++) {
discs[i] = new Discovery("Disc_" + i, LongAutoID_CURIE);
}
pm.insert((Object[]) discs).get();
QueryAsync<Discovery> query = pm.createQuery(Discovery.class).filter("id !=", discs[48].id);
SienaFuture<List<Discovery>> future = query.fetch();
List<Discovery> res = future.get();
QueryOptionGaeContext gaeCtx = (QueryOptionGaeContext) query.option(QueryOptionGaeContext.ID);
assertFalse(gaeCtx.useCursor);
assertNotNull(res);
assertEquals(200 - 1, res.size());
for (Discovery disc : res) {
assertFalse(discs[48].equals(disc));
}
}
use of siena.gae.QueryOptionGaeContext in project siena by mandubian.
the class GaeAsyncTest method testFilterWithOperatorNotEqualLotsOfEntitiesStateful.
public void testFilterWithOperatorNotEqualLotsOfEntitiesStateful() {
Discovery[] discs = new Discovery[200];
for (int i = 0; i < 200; i++) {
discs[i] = new Discovery("Disc_" + i, LongAutoID_CURIE);
}
pm.insert((Object[]) discs).get();
QueryAsync<Discovery> query = pm.createQuery(Discovery.class).stateful().filter("id !=", discs[48].id);
SienaFuture<List<Discovery>> future = query.fetch();
List<Discovery> res = future.get();
QueryOptionGaeContext gaeCtx = (QueryOptionGaeContext) query.option(QueryOptionGaeContext.ID);
assertFalse(gaeCtx.useCursor);
assertNotNull(res);
assertEquals(200 - 1, res.size());
for (Discovery disc : res) {
assertFalse(discs[48].equals(disc));
}
}
use of siena.gae.QueryOptionGaeContext in project siena by mandubian.
the class GaeAsyncTest method testFilterWithOperatorINStateful.
public void testFilterWithOperatorINStateful() {
List<PersonUUID> l = getOrderedPersonUUIDs();
QueryAsync<PersonUUID> query = pm.createQuery(PersonUUID.class).filter("id IN", Arrays.asList(l.get(0).id, l.get(1).id)).stateful().paginate(1);
SienaFuture<List<PersonUUID>> future = query.fetch();
List<PersonUUID> people = future.get();
QueryOptionGaeContext gaeCtx = (QueryOptionGaeContext) query.option(QueryOptionGaeContext.ID);
assertFalse(gaeCtx.useCursor);
assertNotNull(people);
assertEquals(1, people.size());
assertEquals(l.get(0), people.get(0));
future = query.nextPage().fetch();
people = future.get();
gaeCtx = (QueryOptionGaeContext) query.option(QueryOptionGaeContext.ID);
assertFalse(gaeCtx.useCursor);
assertNotNull(people);
assertEquals(1, people.size());
assertEquals(l.get(1), people.get(0));
}
use of siena.gae.QueryOptionGaeContext in project siena by mandubian.
the class GaeAsyncTest method testFilterWithOperatorINLotsOfEntitiesStateful.
public void testFilterWithOperatorINLotsOfEntitiesStateful() {
Discovery[] discs = new Discovery[200];
for (int i = 0; i < 200; i++) {
discs[i] = new Discovery("Disc_" + i, LongAutoID_CURIE);
}
pm.insert((Object[]) discs).get();
QueryAsync<Discovery> query = pm.createQuery(Discovery.class).filter("id IN", Arrays.asList(discs[48].id, discs[73].id, discs[86].id));
SienaFuture<List<Discovery>> future = query.fetch();
List<Discovery> people = future.get();
QueryOptionGaeContext gaeCtx = (QueryOptionGaeContext) query.option(QueryOptionGaeContext.ID);
assertFalse(gaeCtx.useCursor);
assertNotNull(people);
assertEquals(3, people.size());
assertEquals(discs[48], people.get(0));
assertEquals(discs[73], people.get(1));
assertEquals(discs[86], people.get(2));
}
use of siena.gae.QueryOptionGaeContext in project siena by mandubian.
the class GaeTest method testFilterWithOperatorINLotsOfEntitiesStateful.
public void testFilterWithOperatorINLotsOfEntitiesStateful() {
Discovery[] discs = new Discovery[200];
for (int i = 0; i < 200; i++) {
discs[i] = new Discovery("Disc_" + i, LongAutoID_CURIE);
}
pm.insert((Object[]) discs);
Query<Discovery> query = pm.createQuery(Discovery.class).filter("id IN", Arrays.asList(discs[48].id, discs[73].id, discs[86].id));
List<Discovery> people = query.fetch();
QueryOptionGaeContext gaeCtx = (QueryOptionGaeContext) query.option(QueryOptionGaeContext.ID);
assertFalse(gaeCtx.useCursor);
assertNotNull(people);
assertEquals(3, people.size());
assertEquals(discs[48], people.get(0));
assertEquals(discs[73], people.get(1));
assertEquals(discs[86], people.get(2));
}
Aggregations