void checkHelper(Db4oHashMapHelper helper) { ExtObjectContainer con = db(); if (con.isActive(helper)) { Assert.areEqual("hi", helper.i_childList.get(0)); checkHelper(helper.i_child); } }
public void testUpdate() { ExtObjectContainer oc = fixture().db(); initGenericObjects(); // Db4oUtil.dump(oc); ReflectClass rc = getReflectClass(oc, PERSON_CLASSNAME); Assert.isNotNull(rc); Query q = oc.query(); q.constrain(rc); ObjectSet results = q.execute(); // Db4oUtil.dumpResults(oc, results); Assert.isTrue(results.size() == 1); }
public void testQuery() { ExtObjectContainer oc = fixture().db(); initGenericObjects(); ReflectClass rc = getReflectClass(oc, PERSON_CLASSNAME); Assert.isNotNull(rc); // now query to make sure there are none left Query q = oc.query(); q.constrain(rc); q.descend("surname").constrain("John"); ObjectSet results = q.execute(); Assert.isTrue(results.size() == 1); }
public void testCreate() throws Exception { initGenericObjects(); // fixture().reopen(); ExtObjectContainer oc = fixture().db(); // now check to see if person was saved ReflectClass rc = getReflectClass(oc, PERSON_CLASSNAME); Assert.isNotNull(rc); Query q = oc.query(); q.constrain(rc); ObjectSet results = q.execute(); Assert.isTrue(results.size() == 1); // Db4oUtil.dumpResults(fixture().db(), results); }
private void operateOnClient1And2( ArrayList4Operation<Integer> op1, ArrayList4Operation<Integer> op2) throws Exception { ExtObjectContainer client1 = openNewSession(); ExtObjectContainer client2 = openNewSession(); ArrayList4<Integer> list1 = retrieveAndAssertNullArrayList4(client1); ArrayList4<Integer> list2 = retrieveAndAssertNullArrayList4(client2); op1.operate(list1); op2.operate(list2); client1.store(list1); client2.store(list2); client1.commit(); client2.commit(); client1.close(); client2.close(); }
/** * This is to ensure that reflector.forObject(GenericArray) returns an instance of * GenericArrayClass instead of GenericClass http://tracker.db4o.com/jira/browse/COR-376 */ public void testGenericArrayClass() { ExtObjectContainer oc = fixture().db(); initGenericObjects(); ReflectClass elementType = oc.reflector().forName(PERSON_CLASSNAME); Object array = reflector().array().newInstance(elementType, 5); ReflectClass arrayClass = oc.reflector().forObject(array); Assert.isTrue(arrayClass.isArray()); Assert.isTrue(arrayClass instanceof GenericArrayClass); arrayClass = oc.reflector().forName(array.getClass().getName()); Assert.isTrue(arrayClass.isArray()); Assert.isTrue(arrayClass instanceof GenericArrayClass); arrayClass = oc.reflector().forClass(array.getClass()); Assert.isTrue(arrayClass.isArray()); Assert.isTrue(arrayClass instanceof GenericArrayClass); Assert.areEqual(arrayClass.getName(), ReflectPlatform.fullyQualifiedName(array.getClass())); Assert.areEqual("(GA) " + elementType.getName(), array.toString()); }
private ReflectClass getReflectClass(ExtObjectContainer oc, String className) { return oc.reflector().forName(className); }