jars/imsobjects-1.2.0-SNAPSHOT.jar:/home/russ/.maven/repository/db4o/jars/db4o-4.5-java1.4.jar:. junit.textui.TestRunner org.lds.im
s.objects.TestDb4o
.Loading database with: 1000000 ids(2x), names, people
502640ms elapsed for task
Looking up Person by id 113322
1ms elapsed for task
Looking up Name from Person
[db4o 4.5.009 2005-07-29 10:48:45]
Uncaught Exception. Engine closed.
[db4o 4.5.009 2005-07-29 10:48:45]
Please mail the following to info@db4o.com:
java.lang.OutOfMemoryError
Closing database
39ms elapsed for task
E
Time: 569.755
There was 1 error:
1) testLookupByRfn(org.lds.ims.objects.TestDb4o)java.lang.RuntimeException: Uncaught Exception. db4o engine closed.
at com.db4o.YapStream.fatalException(Unknown Source)
at com.db4o.YapStream.get1(Unknown Source)
at com.db4o.YapStream.get(Unknown Source)
at org.lds.ims.objects.TestDb4o.testLookupByRfn(TestDb4o.java:152)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
FAILURES!!!
Tests run: 1, Failures: 0, Errors: 1
------
public void setUp(){
Db4o.configure().objectClass(TId.class).objectField("idValue").indexed(true);
Db4o.configure().objectClass(TName.class).objectField("nameValue").indexed(true);
Db4o.configure().objectClass(TName.class).objectField("person").indexed(true);
Db4o.configure().objectClass(TBasicPerson.class).objectField("imsId").indexed(true);
database = Db4o.openFile(DB_FILENAME);
setupDatabaseWithPeople(NUM_OF_PEOPLE_TO_LOAD);
}
-----
---loading code---
IMSID ims = new IMSID("" + (peopleCntr * 17));
TBasicPerson newDude = new TBasicPerson();
newDude.setImsId(ims);
database.set(newDude);
TId imsId = new TId();
imsId.setIdType(IdType.IMS_ID);
imsId.setIdValue(ims.toString());
imsId.setPerson(newDude);
database.set(imsId);
TId rfn = new TId();
rfn.setIdType(IdType.RFN);
rfn.setIdValue("" + (peopleCntr * 31));
rfn.setPerson(newDude);
database.set(rfn);
TName name = new TName();
name.setNameValue("Some Test dude name" + (peopleCntr * 19));
name.setNameType(NameType.CMIS_NAME);
name.setPerson(newDude);
database.set(name);
---end loading code---
---tests---
TId queryId = new TId();
queryId.setIdValue("113322");
Query query = database.query();
query.constrain(TId.class);
ObjectSet results = database.get(queryId);
beginLoggedEvent("Looking up Person by id " + queryId.getIdValue());
assertTrue(results.size() == 1);
TBasicPerson person = ((TId)results.next()).getPerson();
endLoggedEvent();
beginLoggedEvent("Looking up Name from Person");
TName queryName = new TName();
queryName.setPerson(person);
results = database.get(queryName);
assertTrue(results.size() == 1);
System.out.println("Name is: " + ((TName)results.next()).getNameValue());
endLoggedEvent();
---end tests---
1 comment:
Russ,
please retry your test with the db4o 4.6 Development build, available from the db4o
downloadcenter.
The query processor has been improved specifically for multi-level constraints like object.member.member
Best,
Carl
Post a Comment