File testFileDir = new File(TEST_DATA_DIR);
testFileDir.mkdirs();
File testFile = new File(testFileDir,SimpleAddTest.class.getSimpleName()+(_testCounter++)+".jdb");
testFile.delete();
JODBSessionContainer sessionContainer = getContainerForFile(testFile);
Object_Enum objectWithEnum = new Object_Enum();
objectWithEnum._val1 = TEST_ENUM.ENUM_VAL1;
sessionContainer.set(objectWithEnum);
sessionContainer.commit();
if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
Query query = sessionContainer.query();
query.descend("_val1").constrain(objectWithEnum._val1);
List list = query.execute();
if(list.size()!=1){
throw new RuntimeException(""+list.size());
}
Object_Enum objectWithEnumFromDb = (Object_Enum) list.get(0);
if(!objectWithEnumFromDb._val1.equals(objectWithEnum._val1)){
throw new RuntimeException();
}
Object_Enum objectWithEnum1 = new Object_Enum();
objectWithEnum1._val1 = TEST_ENUM.ENUM_VAL2;
sessionContainer.set(objectWithEnum1);
sessionContainer.commit();