use of siena.base.test.model.PersonLongAutoID in project siena by mandubian.
the class BaseTest method testIterLimitLongAutoID.
public void testIterLimitLongAutoID() {
Iterable<PersonLongAutoID> people = pm.createQuery(PersonLongAutoID.class).order("n").iter(2);
assertNotNull(people);
PersonLongAutoID[] array = new PersonLongAutoID[] { LongAutoID_TESLA, LongAutoID_CURIE };
int i = 0;
for (PersonLongAutoID person : people) {
assertEquals(array[i], person);
i++;
}
}
use of siena.base.test.model.PersonLongAutoID in project siena by mandubian.
the class BaseTest method testInsertLongAutoID.
public void testInsertLongAutoID() {
PersonLongAutoID maxwell = new PersonLongAutoID();
maxwell.firstName = "James Clerk";
maxwell.lastName = "Maxwell";
maxwell.city = "Edinburgh";
maxwell.n = 4;
pm.insert(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));
}
use of siena.base.test.model.PersonLongAutoID in project siena by mandubian.
the class BaseTest method testIterFullLongAutoID.
public void testIterFullLongAutoID() {
Iterable<PersonLongAutoID> people = pm.createQuery(PersonLongAutoID.class).order("n").iter();
assertNotNull(people);
PersonLongAutoID[] array = new PersonLongAutoID[] { LongAutoID_TESLA, LongAutoID_CURIE, LongAutoID_EINSTEIN };
int i = 0;
for (PersonLongAutoID person : people) {
assertEquals(array[i], person);
i++;
}
}
use of siena.base.test.model.PersonLongAutoID in project siena by mandubian.
the class BaseTest method testDumpRestoreQueryFilterSearch.
public void testDumpRestoreQueryFilterSearch() {
Query<PersonLongAutoID> query = pm.createQuery(PersonLongAutoID.class).search("test", "firstName", "lastName");
QueryFilterSearch qf = (QueryFilterSearch) query.getFilters().get(0);
String str = JsonSerializer.serialize(qf).toString();
assertNotNull(str);
QueryFilterSearch qfRes = (QueryFilterSearch) JsonSerializer.deserialize(QueryFilter.class, Json.loads(str));
assertNotNull(qfRes);
assertEquals(qf.match, qfRes.match);
for (int i = 0; i < qfRes.fields.length; i++) {
assertEquals(qf.fields[i], qfRes.fields[i]);
}
}
use of siena.base.test.model.PersonLongAutoID in project siena by mandubian.
the class BaseTest method testSaveLongAutoID.
public void testSaveLongAutoID() {
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));
}
Aggregations