use of siena.base.test.model.DiscoveryStringId in project siena by mandubian.
the class BaseTestNoAutoInc_7_BATCH method testBatchInsertList.
public void testBatchInsertList() {
List<DiscoveryStringId> discs = new ArrayList<DiscoveryStringId>();
for (int i = 0; i < 100; i++) {
discs.add(new DiscoveryStringId("Disc_" + String.format("%03d", i), StringID_CURIE));
}
int nb = pm.insert(discs);
assertEquals(discs.size(), nb);
List<DiscoveryStringId> res = pm.createQuery(DiscoveryStringId.class).fetch();
assertEquals(discs.size(), res.size());
int i = 0;
for (DiscoveryStringId disc : res) {
assertEquals(discs.get(i++), disc);
}
}
use of siena.base.test.model.DiscoveryStringId in project siena by mandubian.
the class BaseTestNoAutoInc_7_BATCH method testBatchDeleteList.
public void testBatchDeleteList() {
List<DiscoveryStringId> discs = new ArrayList<DiscoveryStringId>();
for (int i = 0; i < 59; i++) {
DiscoveryStringId disc = new DiscoveryStringId("Disc_" + String.format("%03d", i), StringID_CURIE);
discs.add(disc);
}
pm.insert(discs);
List<DiscoveryStringId> res = pm.createQuery(DiscoveryStringId.class).fetch();
assertEquals(discs.size(), res.size());
int nb = pm.delete(discs);
assertEquals(discs.size(), nb);
res = pm.createQuery(DiscoveryStringId.class).fetch();
assertEquals(0, res.size());
}
use of siena.base.test.model.DiscoveryStringId in project siena by mandubian.
the class BaseTestNoAutoInc_7_BATCH method testBatchGetByKeysList.
public void testBatchGetByKeysList() {
DiscoveryStringId[] discs = new DiscoveryStringId[100];
for (int i = 0; i < 100; i++) {
discs[i] = new DiscoveryStringId("Disc_" + String.format("%03d", i), StringID_CURIE);
}
pm.insert((Object[]) discs);
List<String> discsKeys = new ArrayList<String>();
for (int i = 0; i < 100; i++) {
discsKeys.add(discs[i].name);
}
List<DiscoveryStringId> discs2Get = pm.getByKeys(DiscoveryStringId.class, discsKeys);
assertEquals(discs.length, discs2Get.size());
int i = 0;
for (DiscoveryStringId disc : discs2Get) {
assertEquals(discs[i++], disc);
}
}
use of siena.base.test.model.DiscoveryStringId in project siena by mandubian.
the class BaseTestNoAutoInc_7_BATCH method testBatchGet.
public void testBatchGet() {
DiscoveryStringId[] discs = new DiscoveryStringId[100];
for (int i = 0; i < 100; i++) {
discs[i] = new DiscoveryStringId("Disc_" + String.format("%03d", i), StringID_CURIE);
}
pm.insert((Object[]) discs);
DiscoveryStringId[] discs2Get = new DiscoveryStringId[100];
for (int i = 0; i < 100; i++) {
discs2Get[i] = new DiscoveryStringId();
discs2Get[i].name = discs[i].name;
}
int nb = pm.get((Object[]) discs2Get);
assertEquals(discs.length, nb);
assertEquals(discs.length, discs2Get.length);
for (int i = 0; i < discs.length; i++) {
assertEquals(discs[i], discs2Get[i]);
}
}
use of siena.base.test.model.DiscoveryStringId in project siena by mandubian.
the class BaseTestNoAutoInc_7_BATCH method testBatchInsert.
public void testBatchInsert() {
Object[] discs = new DiscoveryStringId[100];
for (int i = 0; i < 100; i++) {
discs[i] = new DiscoveryStringId("Disc_" + String.format("%03d", i), StringID_CURIE);
}
int nb = pm.insert(discs);
assertEquals(discs.length, nb);
List<DiscoveryStringId> res = pm.createQuery(DiscoveryStringId.class).fetch();
assertEquals(discs.length, res.size());
int i = 0;
for (DiscoveryStringId disc : res) {
assertEquals(discs[i++], disc);
}
}
Aggregations