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++;
}
}
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);
}
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));
}
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));
}
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);
}
Aggregations