DynamicTestClass dynamicTestClass = new DynamicTestClass(className,i);
Object obj = dynamicTestClass.load(sessionContainer);
classLoaderForShortLengthObject = dynamicTestClass._classLoader;
sessionContainer.set(obj);
sessionContainer.commit();
IPersistentObjectStatistics objectStatistics = sessionContainer.getPersistenceStatistics(obj);
dynamicTestClass.delete();
long size = objectStatistics.getBodySize();
if(size >= 0xFF){
break;
}
}
sessionContainer.close();
testFile = new File(testFileDir,SimpleAddTest.class.getSimpleName()+(_testCounter++)+".jdb");
testFile.delete();
sessionContainer = getContainerForFile(testFile);
DynamicTestClass byteLengthDynamicTestClass = new DynamicTestClass(className,i-1);
Object obj = byteLengthDynamicTestClass.load(sessionContainer);
sessionContainer.set(obj);
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
sessionContainer.setClassLoader(classLoaderForShortLengthObject);
List list = sessionContainer.getAllObjects();
obj = list.get(0);
sessionContainer.set(obj);
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
sessionContainer.setClassLoader(classLoaderForShortLengthObject);
list = sessionContainer.getAllObjects();
obj = list.get(0);
IPersistentObjectStatistics objectStatistics = sessionContainer.getPersistenceStatistics(obj);
if(objectStatistics.getTotalRecords() != 1){
throw new RuntimeException();
}
modify(obj);
sessionContainer.set(obj);
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
sessionContainer.setClassLoader(classLoaderForShortLengthObject);
list = sessionContainer.getAllObjects();
obj = list.get(0);
objectStatistics = sessionContainer.getPersistenceStatistics(obj);
if(objectStatistics.getTotalRecords() != 2){
throw new RuntimeException();
}
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
sessionContainer.setClassLoader(byteLengthDynamicTestClass._classLoader);
list = sessionContainer.getAllObjects();
obj = list.get(0);
modify(obj);
sessionContainer.set(obj);
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
sessionContainer.setClassLoader(classLoaderForShortLengthObject);
list = sessionContainer.getAllObjects();
obj = list.get(0);
objectStatistics = sessionContainer.getPersistenceStatistics(obj);
if(objectStatistics.getTotalRecords() != 1){
throw new RuntimeException(""+objectStatistics.getTotalRecords());
}
sessionContainer.close();
byteLengthDynamicTestClass.delete();
sessionContainer.close();
}