testFile.delete();
JODBSessionContainer sessionContainer = getContainerForFile(testFile);
Random random = new Random(19287);
for (int i = 0; i < 1000; i++) {
int next = random.nextInt(1000);
Pilot pilot = new Pilot(next, "Name"+i);
sessionContainer.set(pilot);
}
sessionContainer.commit();
if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
Predicate<Pilot> predicate= new Predicate<Pilot>() {
public boolean match(Pilot pilot) {
return pilot.getPoints() > 100 && pilot.getPoints() < 500 && pilot.getName().startsWith("Nam");
}
};
if(_checkOptimization && !sessionContainer.isOptimizedQuery(predicate, null)){
throw new RuntimeException();
}
ObjectSet<Pilot> pilots = sessionContainer.query(predicate);
if(pilots.size() == 0){
throw new RuntimeException();
}
while (pilots.hasNext()) {
if(pilots.next().getPoints()<=100){
throw new RuntimeException();
}
}
if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
predicate= new Predicate<Pilot>() {
public boolean match(Pilot pilot) {
return pilot.getPoints() > 100 && pilot.getPoints() < 500 && pilot._name.startsWith("Nam");
}
};
if(_checkOptimization && !sessionContainer.isOptimizedQuery(predicate, null)){
throw new RuntimeException();