use of siena.base.test.model.PersonUUID in project siena by mandubian.
the class BaseTestNoAutoInc_DEFAULT method testDeleteObjectNotFound.
public void testDeleteObjectNotFound() {
try {
PersonUUID p = new PersonUUID();
pm.delete(p);
fail();
} catch (Exception e) {
System.out.println("Everything is OK");
}
}
use of siena.base.test.model.PersonUUID in project siena by mandubian.
the class BaseTestNoAutoInc_DEFAULT method testDeleteUUID.
public void testDeleteUUID() {
PersonUUID curie = getPersonUUID(UUID_CURIE.id);
pm.delete(curie);
List<PersonUUID> people = queryPersonUUIDOrderBy("n", 0, false).fetch();
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 BaseTestNoAutoInc_DEFAULT method testUpdateUUID.
public void testUpdateUUID() {
PersonUUID curie = getPersonUUID(UUID_CURIE.id);
curie.lastName = "Sklodowska–Curie";
pm.update(curie);
PersonUUID curie2 = getPersonUUID(UUID_CURIE.id);
assertEquals(curie2, curie);
}
use of siena.base.test.model.PersonUUID in project siena by mandubian.
the class GaeAsyncTest method testFilterWithOperatorINStateful.
public void testFilterWithOperatorINStateful() {
List<PersonUUID> l = getOrderedPersonUUIDs();
QueryAsync<PersonUUID> query = pm.createQuery(PersonUUID.class).filter("id IN", Arrays.asList(l.get(0).id, l.get(1).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(0), 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(1), people.get(0));
}
use of siena.base.test.model.PersonUUID in project siena by mandubian.
the class BaseTestNoAutoInc_DEFAULT method testInsertUUID.
/* @Deprecated
public void testCountLimitOffset() {
Query<PersonUUID> query = queryPersonUUIDOrderBy("n", 0, false);
query.fetch(1);
assertEquals(2, query.count(2, 1));
}
*/
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));
}
Aggregations