use of siena.base.test.model.PersonLongAutoIDModel in project siena by mandubian.
the class BaseModelTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
List<Class<?>> classes = new ArrayList<Class<?>>();
classes.add(PersonLongAutoIDModel.class);
classes.add(DiscoveryModel.class);
classes.add(SampleModel.class);
classes.add(SampleModel2.class);
classes.add(PersonLongAutoIDExtended.class);
classes.add(PersonLongAutoIDExtended2.class);
classes.add(PersonLongAutoIDAbstract.class);
classes.add(PersonLongAutoIDExtendedAbstract.class);
classes.add(PersonLongAutoIDExtendedFilter.class);
classes.add(TransactionAccountFromModel.class);
classes.add(TransactionAccountToModel.class);
// classes.add(AggregateChildModel.class);
// classes.add(AggregateParentModel.class);
pm = createPersistenceManager(classes);
PersistenceManagerFactory.install(pm, classes);
for (Class<?> clazz : classes) {
if (!Modifier.isAbstract(clazz.getModifiers())) {
pm.createQuery(clazz).delete();
}
}
Batch<PersonLongAutoIDModel> batch = PersonLongAutoIDModel.batch();
batch.insert(PERSON_LONGAUTOID_TESLA, PERSON_LONGAUTOID_CURIE, PERSON_LONGAUTOID_EINSTEIN);
for (int i = 0; i < 200; i++) {
discs[i] = new DiscoveryModel("Disc_" + i, PERSON_LONGAUTOID_CURIE);
}
Batch<DiscoveryModel> batch2 = DiscoveryModel.batch();
batch2.insert(discs);
}
use of siena.base.test.model.PersonLongAutoIDModel in project siena by mandubian.
the class BaseModelTest method testFetchPaginateAsyncAndGetAndResetAsync2Models.
public void testFetchPaginateAsyncAndGetAndResetAsync2Models() {
QueryAsync<DiscoveryModel> qd = DiscoveryModel.all().async();
QueryAsync<PersonLongAutoIDModel> qp = PersonLongAutoIDModel.all().async();
SienaFuture<List<DiscoveryModel>> futured = qd.paginate(50).fetch();
SienaFuture<PersonLongAutoIDModel> futurep1 = qp.filter("lastName", "Tesla").get();
PersonLongAutoIDModel person = futurep1.get();
assertEquals(PERSON_LONGAUTOID_TESLA, person);
List<DiscoveryModel> res = futured.get();
assertEquals(50, res.size());
for (int i = 0; i < 50; i++) {
assertEquals(discs[i], res.get(i));
}
futured = qd.nextPage().fetch();
SienaFuture<PersonLongAutoIDModel> futurep2 = qp.resetData().filter("lastName", "Curie").get();
PersonLongAutoIDModel person2 = futurep2.get();
assertEquals(PERSON_LONGAUTOID_CURIE, person2);
res = futured.get();
assertEquals(50, res.size());
for (int i = 0; i < 50; i++) {
assertEquals(discs[i + 50], res.get(i));
}
}
use of siena.base.test.model.PersonLongAutoIDModel in project siena by mandubian.
the class BaseModelTest method testFetchPaginateStatefulAsyncAndGetAndResetAsync2Models.
public void testFetchPaginateStatefulAsyncAndGetAndResetAsync2Models() {
QueryAsync<DiscoveryModel> qd = DiscoveryModel.all().stateful().async();
QueryAsync<PersonLongAutoIDModel> qp = PersonLongAutoIDModel.all().async();
SienaFuture<List<DiscoveryModel>> futured = qd.paginate(50).fetch();
SienaFuture<PersonLongAutoIDModel> futurep1 = qp.filter("lastName", "Tesla").get();
PersonLongAutoIDModel person = futurep1.get();
assertEquals(PERSON_LONGAUTOID_TESLA, person);
List<DiscoveryModel> res = futured.get();
assertEquals(50, res.size());
for (int i = 0; i < 50; i++) {
assertEquals(discs[i], res.get(i));
}
futured = qd.nextPage().fetch();
SienaFuture<PersonLongAutoIDModel> futurep2 = qp.resetData().filter("lastName", "Curie").get();
PersonLongAutoIDModel person2 = futurep2.get();
assertEquals(PERSON_LONGAUTOID_CURIE, person2);
res = futured.get();
assertEquals(50, res.size());
for (int i = 0; i < 50; i++) {
assertEquals(discs[i + 50], res.get(i));
}
}
use of siena.base.test.model.PersonLongAutoIDModel in project siena by mandubian.
the class BaseModelTest method testFetchPaginateAsyncStatefulAndGetAndResetAsync2Models.
public void testFetchPaginateAsyncStatefulAndGetAndResetAsync2Models() {
QueryAsync<DiscoveryModel> qd = DiscoveryModel.all().async().stateful();
QueryAsync<PersonLongAutoIDModel> qp = PersonLongAutoIDModel.all().async();
SienaFuture<List<DiscoveryModel>> futured = qd.paginate(50).fetch();
SienaFuture<PersonLongAutoIDModel> futurep1 = qp.filter("lastName", "Tesla").get();
PersonLongAutoIDModel person = futurep1.get();
assertEquals(PERSON_LONGAUTOID_TESLA, person);
List<DiscoveryModel> res = futured.get();
assertEquals(50, res.size());
for (int i = 0; i < 50; i++) {
assertEquals(discs[i], res.get(i));
}
futured = qd.nextPage().fetch();
SienaFuture<PersonLongAutoIDModel> futurep2 = qp.resetData().filter("lastName", "Curie").get();
PersonLongAutoIDModel person2 = futurep2.get();
assertEquals(PERSON_LONGAUTOID_CURIE, person2);
res = futured.get();
assertEquals(50, res.size());
for (int i = 0; i < 50; i++) {
assertEquals(discs[i + 50], res.get(i));
}
}
use of siena.base.test.model.PersonLongAutoIDModel in project siena by mandubian.
the class BaseModelTest method testGet.
public void testGet() {
PersonLongAutoIDModel person = PersonLongAutoIDModel.all().filter("lastName", "Tesla").get();
assertEquals(PERSON_LONGAUTOID_TESLA, person);
}
Aggregations