query.descend("_val2").orderAscending();
}else{
query.descend("_val2").orderDescending();
}
JODBQueryList list = (JODBQueryList) query.execute();
if(list.size() != maxObjects){
throw new RuntimeException();
}
ObjectA prev = null;
for (int i = 0; i < list.size(); i++) {
ObjectA current = (ObjectA) list.get(i);
//System.err.println("Indexing Random test iter #="+i);
if(prev!=null){
if(ascending){
if( prev.getVal2() > current.getVal2() ){
throw new RuntimeException();
}
}else if(prev.getVal2() < current.getVal2() ){
JODBIndexingAgent indexingAgent = sessionContainer.getIndexingAgent(ObjectA.class.getDeclaredField("_val2") );
long prevID = sessionContainer.getPersistenceStatistics(prev).getObjectID();
long currentID = sessionContainer.getPersistenceStatistics(current).getObjectID();
int prevPosition = indexingAgent.linearIdSearch(prevID);
int currentPosition = indexingAgent.linearIdSearch(currentID);
throw new RuntimeException(""+prevID+" "+prevPosition+" "+ currentID+" "+currentPosition);
}
}
prev = current;
}
//System.err.println("_________________________________________________________");
//sessionContainer.printFileMap();
list = sessionContainer.getAllObjects();
int total = list.size();
for (int i = 0; i < total; i++) {
ObjectA nextObj = (ObjectA) list.get(i);
nextObj.setVal2((short) i);
sessionContainer.set(nextObj);
}
sessionContainer.commit();
if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
query = sessionContainer.query();
query.constrain(ObjectA.class);
if(ascending){
query.descend("_val2").orderAscending();
}else{
query.descend("_val2").orderDescending();
}
list = (JODBQueryList) query.execute();
if(list.size() == 0){
throw new RuntimeException();
}
prev = null;
for (int i = 0; i < list.size(); i++) {
//System.err.println("Indexing Random test iter1 #="+i);
ObjectA current = (ObjectA) list.get(i);
if(prev!=null){
if(ascending){
if( prev.getVal2() > current.getVal2() ){
throw new RuntimeException();
}