Search in sources :

Example 36 with PersonUUID

use of siena.base.test.model.PersonUUID in project siena by mandubian.

the class GaeTest method testFilterWithOperatorNotEqualStateful.

public void testFilterWithOperatorNotEqualStateful() {
    List<PersonUUID> l = getOrderedPersonUUIDs();
    Query<PersonUUID> query = pm.createQuery(PersonUUID.class).filter("id!=", l.get(0).id).order("id").stateful().paginate(1);
    List<PersonUUID> people = query.fetch();
    QueryOptionGaeContext gaeCtx = (QueryOptionGaeContext) query.option(QueryOptionGaeContext.ID);
    assertFalse(gaeCtx.useCursor);
    assertNotNull(people);
    assertEquals(1, people.size());
    assertEquals(l.get(1), people.get(0));
    people = query.nextPage().fetch();
    gaeCtx = (QueryOptionGaeContext) query.option(QueryOptionGaeContext.ID);
    assertFalse(gaeCtx.useCursor);
    assertNotNull(people);
    assertEquals(1, people.size());
    assertEquals(l.get(2), people.get(0));
}
Also used : QueryOptionGaeContext(siena.gae.QueryOptionGaeContext) PersonUUID(siena.base.test.model.PersonUUID)

Example 37 with PersonUUID

use of siena.base.test.model.PersonUUID in project siena by mandubian.

the class GaeTest method testFilterWithOperatorINStateful.

public void testFilterWithOperatorINStateful() {
    List<PersonUUID> l = getOrderedPersonUUIDs();
    Query<PersonUUID> query = pm.createQuery(PersonUUID.class).filter("id IN", Arrays.asList(l.get(0).id, l.get(1).id)).stateful().paginate(1);
    List<PersonUUID> people = query.fetch();
    QueryOptionGaeContext gaeCtx = (QueryOptionGaeContext) query.option(QueryOptionGaeContext.ID);
    assertFalse(gaeCtx.useCursor);
    assertNotNull(people);
    assertEquals(1, people.size());
    assertEquals(l.get(0), people.get(0));
    people = query.nextPage().fetch();
    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)

Example 38 with PersonUUID

use of siena.base.test.model.PersonUUID in project siena by mandubian.

the class BaseTestNoAutoInc_DEFAULT method testIterFilter.

public void testIterFilter() {
    Iterable<PersonUUID> people = pm.createQuery(PersonUUID.class).filter("n>", 1).order("n").iter();
    assertNotNull(people);
    PersonUUID[] array = new PersonUUID[] { UUID_CURIE, UUID_EINSTEIN };
    int i = 0;
    for (PersonUUID PersonIntKey : people) {
        assertEquals(array[i], PersonIntKey);
        i++;
    }
}
Also used : PersonUUID(siena.base.test.model.PersonUUID)

Example 39 with PersonUUID

use of siena.base.test.model.PersonUUID in project siena by mandubian.

the class BaseTest method testIterFilter.

public void testIterFilter() {
    Iterable<PersonUUID> people = pm.createQuery(PersonUUID.class).filter("n>", 1).order("n").iter();
    assertNotNull(people);
    PersonUUID[] array = new PersonUUID[] { UUID_CURIE, UUID_EINSTEIN };
    int i = 0;
    for (PersonUUID PersonIntKey : people) {
        assertEquals(array[i], PersonIntKey);
        i++;
    }
}
Also used : PersonUUID(siena.base.test.model.PersonUUID)

Example 40 with PersonUUID

use of siena.base.test.model.PersonUUID in project siena by mandubian.

the class BaseTest method testGetByKeyUUID.

public void testGetByKeyUUID() {
    PersonUUID curie = getByKeyPersonUUID(UUID_CURIE.id);
    assertEquals(UUID_CURIE, curie);
}
Also used : PersonUUID(siena.base.test.model.PersonUUID)

Aggregations

PersonUUID (siena.base.test.model.PersonUUID)69 ArrayList (java.util.ArrayList)15 List (java.util.List)5 QueryOptionGaeContext (siena.gae.QueryOptionGaeContext)4 SienaException (siena.SienaException)2 SienaRestrictedApiException (siena.SienaRestrictedApiException)1