if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
Query query = sessionContainer.query();
query.constrain(ObjectA.class);
list = query.execute();
if(list.size()!=1){
throw new RuntimeException();
}
if(list.get(0).getClass() != ObjectA.class){
throw new RuntimeException();
}
if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
query = sessionContainer.query();
query.constrain(ObjectA.class).not();
list = query.execute();
if(list.size()!=1){
throw new RuntimeException();
}
if(list.get(0).getClass() != ObjectB.class){
throw new RuntimeException();
}
if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
query = sessionContainer.query();
query.constrain(ObjectA.class).or(query.constrain(ObjectB.class));
list = query.execute();
if(list.size()!=2){
throw new RuntimeException();
}
if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
query = sessionContainer.query();
query.constrain(ObjectA.class).or(query.constrain(ObjectB.class).not());
list = query.execute();
if(list.size()!=1){
throw new RuntimeException();
}
if(list.get(0).getClass() != ObjectA.class){
throw new RuntimeException();
}
if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
query = sessionContainer.query();
query.descend("_val3").constrain(ObjectA.class);
list = query.execute();
if(list.size()!=1){
throw new RuntimeException();
}
if(list.get(0).getClass() != ObjectB.class){
throw new RuntimeException();
}
if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
query = sessionContainer.query();
query.descend("_val3").constrain(ObjectB.class);
list = query.execute();
if(list.size()!=1){
throw new RuntimeException();
}
if(list.get(0).getClass() != ObjectA.class){
throw new RuntimeException();
}
if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
query = sessionContainer.query();
query.descend("_val3").constrain(ObjectA.class);
query.descend("_val2").constrain(short.class);
list = query.execute();
if(list.size()!=1){
throw new RuntimeException();
}
if(list.get(0).getClass() != ObjectB.class){
throw new RuntimeException();
}
if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
query = sessionContainer.query();
Constraint constraint = query.descend("_val3").constrain(ObjectB.class);
query.descend("_val2").constrain(short.class).or(constraint);
list = query.execute();
if(list.size()!=2){
throw new RuntimeException();
}
if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
query = sessionContainer.query();
constraint = query.descend("_val3").constrain(ObjectB.class);
query.descend("_val2").constrain(short.class);
list = query.execute();
if(list.size()!=1){
throw new RuntimeException();
}
if(list.get(0).getClass() != ObjectA.class){
throw new RuntimeException();
}
if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
query = sessionContainer.query();
constraint = query.descend("_val3").constrain(ObjectB.class);
query.descend("_val2").constrain(int.class).or(constraint);
list = query.execute();
if(list.size()!=1){
throw new RuntimeException();
}
if(list.get(0).getClass() != ObjectA.class){
throw new RuntimeException();
}
if(reopen){
sessionContainer.close();
sessionContainer = getContainerForFile(testFile);
}
query = sessionContainer.query();
constraint = query.descend("_val3").constrain(ObjectB.class);
query.descend("_val2").constrain(int.class).and(constraint);
list = query.execute();
if(list.size()!=0){
throw new RuntimeException();
}
sessionContainer.close();
}