use of siena.base.test.model.PersonLongAutoID in project siena by mandubian.
the class BaseTest method testDumpRestoreQueryFilterSimple.
public void testDumpRestoreQueryFilterSimple() {
Query<PersonLongAutoID> query = pm.createQuery(PersonLongAutoID.class).filter("firstName", "abcde");
QueryFilterSimple qf = (QueryFilterSimple) query.getFilters().get(0);
String str = JsonSerializer.serialize(qf).toString();
assertNotNull(str);
QueryFilterSimple qfRes = (QueryFilterSimple) JsonSerializer.deserialize(QueryFilter.class, Json.loads(str));
assertNotNull(qfRes);
assertEquals(qf.operator, qfRes.operator);
assertEquals(qf.value, qfRes.value);
assertEquals(qf.field.getName(), qfRes.field.getName());
}
use of siena.base.test.model.PersonLongAutoID in project siena by mandubian.
the class BaseTest method testDumpRestoreQueryOrder.
public void testDumpRestoreQueryOrder() {
Query<PersonLongAutoID> query = pm.createQuery(PersonLongAutoID.class).order("firstName");
QueryOrder qo = (QueryOrder) query.getOrders().get(0);
String str = JsonSerializer.serialize(qo).toString();
assertNotNull(str);
QueryOrder qoRes = (QueryOrder) JsonSerializer.deserialize(QueryOrder.class, Json.loads(str));
assertNotNull(qoRes);
assertEquals(qo.ascending, qoRes.ascending);
assertEquals(qo.field.getName(), qoRes.field.getName());
}
Aggregations