use of siena.base.test.model.PersonLongAutoID in project siena by mandubian.
the class BaseTest method testGetByKeyNonExisting.
public void testGetByKeyNonExisting() {
PersonLongAutoID pers = getByKeyPersonLongAutoID(12345678L);
assertNull(pers);
}
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());
}
use of siena.base.test.model.PersonLongAutoID in project siena by mandubian.
the class BaseTestNoAutoInc_3_ITER method testIterLimitOffsetLongAutoID.
public void testIterLimitOffsetLongAutoID() {
if (supportsAutoincrement()) {
Iterable<PersonLongAutoID> people = pm.createQuery(PersonLongAutoID.class).order("n").iter(2, 1);
assertNotNull(people);
PersonLongAutoID[] array = new PersonLongAutoID[] { LongAutoID_CURIE, LongAutoID_EINSTEIN };
int i = 0;
for (PersonLongAutoID person : people) {
assertEquals(array[i], person);
i++;
}
} else {
try {
Iterable<PersonLongAutoID> people = pm.createQuery(PersonLongAutoID.class).order("n").iter(2, 1);
} catch (SienaRestrictedApiException ex) {
return;
}
fail();
}
}
use of siena.base.test.model.PersonLongAutoID in project siena by mandubian.
the class BaseTestNoAutoInc_1_CRUD method testSaveLongAutoID.
public void testSaveLongAutoID() {
if (supportsAutoincrement()) {
PersonLongAutoID maxwell = new PersonLongAutoID();
maxwell.firstName = "James Clerk";
maxwell.lastName = "Maxwell";
maxwell.city = "Edinburgh";
maxwell.n = 4;
pm.save(maxwell);
assertNotNull(maxwell.id);
List<PersonLongAutoID> people = queryPersonLongAutoIDOrderBy("n", 0, false).fetch();
assertEquals(4, people.size());
assertEquals(LongAutoID_TESLA, people.get(0));
assertEquals(LongAutoID_CURIE, people.get(1));
assertEquals(LongAutoID_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 = queryPersonLongAutoIDOrderBy("n", 0, false).fetch();
assertEquals(4, people.size());
assertEquals(LongAutoID_TESLA, people.get(0));
assertEquals(LongAutoID_CURIE, people.get(1));
assertEquals(LongAutoID_EINSTEIN, people.get(2));
assertEquals(maxwell, people.get(3));
} else {
try {
PersonLongAutoID maxwell = new PersonLongAutoID();
maxwell.firstName = "James Clerk";
maxwell.lastName = "Maxwell";
maxwell.city = "Edinburgh";
maxwell.n = 4;
pm.save(maxwell);
} catch (SienaRestrictedApiException ex) {
return;
}
fail();
}
}
Aggregations