Search in sources :

Example 56 with PersonUUID

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

the class BaseAsyncTest method testIterLimitOffsetUUID.

public void testIterLimitOffsetUUID() {
    SienaFuture<Iterable<PersonUUID>> future = pm.createQuery(PersonUUID.class).order("n").iter(2, 1);
    Iterable<PersonUUID> people = future.get();
    assertNotNull(people);
    @SuppressWarnings("serial") ArrayList<PersonUUID> l = new ArrayList<PersonUUID>() {

        {
            add(UUID_CURIE);
            add(UUID_EINSTEIN);
        }
    };
    int i = 0;
    for (PersonUUID person : people) {
        assertEquals(l.get(i), person);
        i++;
    }
}
Also used : PersonUUID(siena.base.test.model.PersonUUID) ArrayList(java.util.ArrayList)

Example 57 with PersonUUID

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

the class BaseAsyncTest method getPersonUUID.

private PersonUUID getPersonUUID(String id) {
    PersonUUID p = new PersonUUID();
    p.id = id;
    pm.get(p).get();
    return p;
}
Also used : PersonUUID(siena.base.test.model.PersonUUID)

Example 58 with PersonUUID

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

the class BaseAsyncTest method testGetUUID.

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

Example 59 with PersonUUID

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

the class BaseAsyncTest method testGetByKeyUUID.

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

Example 60 with PersonUUID

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

the class GaeAsyncTest method testFilterWithOperatorNotEqualStateful.

public void testFilterWithOperatorNotEqualStateful() {
    List<PersonUUID> l = getOrderedPersonUUIDs();
    QueryAsync<PersonUUID> query = pm.createQuery(PersonUUID.class).filter("id!=", l.get(0).id).order("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(1), 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(2), people.get(0));
}
Also used : QueryOptionGaeContext(siena.gae.QueryOptionGaeContext) PersonUUID(siena.base.test.model.PersonUUID) List(java.util.List)

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