public void testGetObjectFromClass() throws Exception
{
PersistenceManager persist = new PersistenceManager(driver, database, login, password);
// create a test object
SimpleObject so = new SimpleObject();
so.setAge(1000L);
so.setCount(3);
so.setName("foo bar");
so.setScale(0.67);
persist.saveObject(so);
LessSimpleObject lso = new LessSimpleObject();
lso.setAge(1000000L);
lso.setCount(123456);
lso.setKey((short) 99);
lso.setName("j random");
lso.setScale(-9.0);
persist.saveObject(lso);
// insert the same object again
persist.saveObject(lso);
persist.close();
persist = new PersistenceManager(driver, database, login, password);
// try getting all the objects
SimpleObject pattern = new SimpleObject();
pattern.setCount(3);
List<SimpleObject> obs = persist.getObjects(SimpleObject.class, new GreaterOrEqual(pattern));
assertEquals(2, obs.size());
pattern.setCount(4);
obs = persist.getObjects(SimpleObject.class, new GreaterOrEqual(pattern));
assertEquals(1, obs.size());
pattern.setCount(3);
List<LessSimpleObject> obs2 = persist.getObjects(LessSimpleObject.class, new GreaterOrEqual(pattern));
assertEquals(1, obs2.size());
// assert that two objects are equal if they are the result of the same
// search