Search in sources :

Example 6 with PersonUUID

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

the class BaseAsyncTest method testIterFilter.

public void testIterFilter() {
    SienaFuture<Iterable<PersonUUID>> future = pm.createQuery(PersonUUID.class).filter("n>", 1).order("n").iter();
    Iterable<PersonUUID> people = future.get();
    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 7 with PersonUUID

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

the class BaseAsyncTest method testFilterOperatorEqualUUID.

public void testFilterOperatorEqualUUID() {
    List<PersonUUID> l = getOrderedPersonUUIDs();
    SienaFuture<PersonUUID> future = pm.createQuery(PersonUUID.class).filter("id", l.get(0).id).get();
    PersonUUID person = future.get();
    assertNotNull(person);
    assertEquals(l.get(0), person);
}
Also used : PersonUUID(siena.base.test.model.PersonUUID)

Example 8 with PersonUUID

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

the class BaseAsyncTest method testSaveUUID.

public void testSaveUUID() {
    PersonUUID maxwell = new PersonUUID();
    maxwell.firstName = "James Clerk";
    maxwell.lastName = "Maxwell";
    maxwell.city = "Edinburgh";
    maxwell.n = 4;
    pm.save(maxwell).get();
    assertNotNull(maxwell.id);
    SienaFuture<List<PersonUUID>> future = queryPersonUUIDOrderBy("n", 0, false).fetch();
    List<PersonUUID> people = future.get();
    assertEquals(4, people.size());
    assertEquals(UUID_TESLA, people.get(0));
    assertEquals(UUID_CURIE, people.get(1));
    assertEquals(UUID_EINSTEIN, people.get(2));
    assertEquals(maxwell, people.get(3));
    maxwell.firstName = "James Clerk UPD";
    maxwell.lastName = "Maxwell UPD";
    maxwell.city = "Edinburgh UPD";
    maxwell.n = 5;
    pm.save(maxwell).get();
    assertNotNull(maxwell.id);
    future = queryPersonUUIDOrderBy("n", 0, false).fetch();
    people = future.get();
    assertEquals(4, people.size());
    assertEquals(UUID_TESLA, people.get(0));
    assertEquals(UUID_CURIE, people.get(1));
    assertEquals(UUID_EINSTEIN, people.get(2));
    assertEquals(maxwell, people.get(3));
}
Also used : PersonUUID(siena.base.test.model.PersonUUID) ArrayList(java.util.ArrayList) List(java.util.List)

Example 9 with PersonUUID

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

the class BaseAsyncTest method testDeleteUUID.

public void testDeleteUUID() {
    PersonUUID curie = getPersonUUID(UUID_CURIE.id);
    pm.delete(curie).get();
    SienaFuture<List<PersonUUID>> future = queryPersonUUIDOrderBy("n", 0, false).fetch();
    List<PersonUUID> people = future.get();
    assertNotNull(people);
    assertEquals(2, people.size());
    assertEquals(UUID_TESLA, people.get(0));
    assertEquals(UUID_EINSTEIN, people.get(1));
}
Also used : PersonUUID(siena.base.test.model.PersonUUID) ArrayList(java.util.ArrayList) List(java.util.List)

Example 10 with PersonUUID

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

the class BaseAsyncTest method testUpdateUUID.

public void testUpdateUUID() {
    PersonUUID curie = getPersonUUID(UUID_CURIE.id);
    curie.lastName = "Sklodowska–Curie";
    pm.update(curie).get();
    PersonUUID curie2 = getPersonUUID(UUID_CURIE.id);
    assertEquals(curie2, 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