Search in sources :

Example 16 with PersonUUID

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

the class BaseTest method getPersonUUID.

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

Example 17 with PersonUUID

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

the class BaseTest method testIterLimitUUID.

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

        {
            add(UUID_TESLA);
            add(UUID_CURIE);
        }
    };
    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 18 with PersonUUID

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

the class BaseTest method testFilterOperatorEqualUUID.

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

Example 19 with PersonUUID

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

the class BaseTest method testInsertUUID.

public void testInsertUUID() {
    PersonUUID maxwell = new PersonUUID();
    maxwell.firstName = "James Clerk";
    maxwell.lastName = "Maxwell";
    maxwell.city = "Edinburgh";
    maxwell.n = 4;
    pm.insert(maxwell);
    assertNotNull(maxwell.id);
    List<PersonUUID> people = queryPersonUUIDOrderBy("n", 0, false).fetch();
    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)

Example 20 with PersonUUID

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

the class BaseTest 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);
    assertNotNull(maxwell.id);
    List<PersonUUID> people = queryPersonUUIDOrderBy("n", 0, false).fetch();
    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);
    assertNotNull(maxwell.id);
    people = queryPersonUUIDOrderBy("n", 0, false).fetch();
    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)

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