Search in sources :

Example 6 with QueryOptionGaeContext

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));
    }
}
Also used : QueryOptionGaeContext(siena.gae.QueryOptionGaeContext) Discovery(siena.base.test.model.Discovery) List(java.util.List)

Example 7 with QueryOptionGaeContext

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));
    }
}
Also used : QueryOptionGaeContext(siena.gae.QueryOptionGaeContext) Discovery(siena.base.test.model.Discovery) List(java.util.List)

Example 8 with QueryOptionGaeContext

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));
}
Also used : QueryOptionGaeContext(siena.gae.QueryOptionGaeContext) PersonUUID(siena.base.test.model.PersonUUID) List(java.util.List)

Example 9 with QueryOptionGaeContext

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));
}
Also used : QueryOptionGaeContext(siena.gae.QueryOptionGaeContext) Discovery(siena.base.test.model.Discovery) List(java.util.List)

Example 10 with QueryOptionGaeContext

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));
}
Also used : QueryOptionGaeContext(siena.gae.QueryOptionGaeContext) Discovery(siena.base.test.model.Discovery)

Aggregations

QueryOptionGaeContext (siena.gae.QueryOptionGaeContext)14 Discovery (siena.base.test.model.Discovery)10 List (java.util.List)7 PersonUUID (siena.base.test.model.PersonUUID)4