use of siena.base.test.model.PersonLongAutoID in project siena by mandubian.
the class BaseTestNoAutoInc_2_FETCH method testFilterOperatorEqualLongAutoID.
public void testFilterOperatorEqualLongAutoID() {
if (supportsAutoincrement()) {
PersonLongAutoID person = pm.createQuery(PersonLongAutoID.class).filter("id", LongAutoID_EINSTEIN.id).get();
assertNotNull(person);
assertEquals(LongAutoID_EINSTEIN, person);
} else {
try {
PersonLongAutoID person = pm.createQuery(PersonLongAutoID.class).filter("id", LongAutoID_EINSTEIN.id).get();
} catch (SienaRestrictedApiException ex) {
return;
}
fail();
}
}
use of siena.base.test.model.PersonLongAutoID in project siena by mandubian.
the class BaseTestNoAutoInc_2_FETCH method testOrderLongAutoId.
public void testOrderLongAutoId() {
if (supportsAutoincrement()) {
List<PersonLongAutoID> people = queryPersonLongAutoIDOrderBy("id", "", false).fetch();
assertNotNull(people);
assertEquals(3, people.size());
PersonLongAutoID[] array = new PersonLongAutoID[] { LongAutoID_TESLA, LongAutoID_CURIE, LongAutoID_EINSTEIN };
int i = 0;
for (PersonLongAutoID person : people) {
assertEquals(array[i], person);
i++;
}
} else {
try {
List<PersonLongAutoID> people = queryPersonLongAutoIDOrderBy("id", "", false).fetch();
} catch (SienaRestrictedApiException ex) {
return;
}
fail();
}
}
use of siena.base.test.model.PersonLongAutoID in project siena by mandubian.
the class BaseAsyncTest method testFilterOperatorEqualLongAutoID.
public void testFilterOperatorEqualLongAutoID() {
SienaFuture<PersonLongAutoID> future = pm.createQuery(PersonLongAutoID.class).filter("id", LongAutoID_EINSTEIN.id).get();
PersonLongAutoID person = future.get();
assertNotNull(person);
assertEquals(LongAutoID_EINSTEIN, person);
}
use of siena.base.test.model.PersonLongAutoID in project siena by mandubian.
the class BaseAsyncTest 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).get();
assertNotNull(maxwell.id);
SienaFuture<List<PersonLongAutoID>> future = queryPersonLongAutoIDOrderBy("n", 0, false).fetch();
List<PersonLongAutoID> people = future.get();
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 BaseAsyncTest 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).get();
assertNotNull(maxwell.id);
SienaFuture<List<PersonLongAutoID>> future = queryPersonLongAutoIDOrderBy("n", 0, false).fetch();
List<PersonLongAutoID> people = future.get();
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).get();
assertNotNull(maxwell.id);
future = queryPersonLongAutoIDOrderBy("n", 0, false).fetch();
people = future.get();
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