Search in sources :

Example 46 with PersonLongAutoID

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());
}
Also used : QueryFilter(siena.QueryFilter) QueryFilterSimple(siena.QueryFilterSimple) PersonLongAutoID(siena.base.test.model.PersonLongAutoID)

Example 47 with PersonLongAutoID

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());
}
Also used : PersonLongAutoID(siena.base.test.model.PersonLongAutoID) QueryOrder(siena.QueryOrder)

Aggregations

PersonLongAutoID (siena.base.test.model.PersonLongAutoID)47 SienaRestrictedApiException (siena.SienaRestrictedApiException)11 ArrayList (java.util.ArrayList)3 List (java.util.List)3 QueryFilter (siena.QueryFilter)2 QueryOption (siena.core.options.QueryOption)2 QueryOptionPage (siena.core.options.QueryOptionPage)2 Json (siena.Json)1 QueryFilterSearch (siena.QueryFilterSearch)1 QueryFilterSimple (siena.QueryFilterSimple)1 QueryOrder (siena.QueryOrder)1