Program: 65488
Project: 65488
Buggy source:
public void testIVWithIncrementNoAggrUpdateFilter4() throws Exception {
  ICubeQueryDefinition cqd=new CubeQueryDefinition(cubeName);
  IEdgeDefinition columnEdge=cqd.createEdge(ICubeQueryDefinition.COLUMN_EDGE);
  IEdgeDefinition rowEdge=cqd.createEdge(ICubeQueryDefinition.ROW_EDGE);
  IDimensionDefinition dim1=columnEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier1=dim1.createHierarchy("String_Node_Str");
  hier1.createLevel("String_Node_Str");
  hier1.createLevel("String_Node_Str");
  hier1.createLevel("String_Node_Str");
  IDimensionDefinition dim2=rowEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier2=dim2.createHierarchy("String_Node_Str");
  hier2.createLevel("String_Node_Str");
  IMeasureDefinition measure=cqd.createMeasure("String_Node_Str");
  measure.setAggrFunction("String_Node_Str");
  IBinding binding1=new Binding("String_Node_Str");
  binding1.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding1);
  IBinding binding2=new Binding("String_Node_Str");
  binding2.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding2);
  IBinding binding3=new Binding("String_Node_Str");
  binding3.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding3);
  IBinding binding4=new Binding("String_Node_Str");
  binding4.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding4);
  IBinding binding5=new Binding("String_Node_Str");
  binding5.setExpression(new ScriptExpression("String_Node_Str"));
  binding5.setAggrFunction("String_Node_Str");
  binding5.addAggregateOn("String_Node_Str");
  binding5.addAggregateOn("String_Node_Str");
  binding5.addAggregateOn("String_Node_Str");
  binding5.addAggregateOn("String_Node_Str");
  cqd.addBinding(binding5);
  IBinding binding6=new Binding("String_Node_Str");
  binding6.setExpression(new ScriptExpression("String_Node_Str"));
  binding6.setAggrFunction("String_Node_Str");
  binding6.addAggregateOn("String_Node_Str");
  cqd.addBinding(binding6);
  cqd.setCacheQueryResults(true);
  FileArchiveWriter writter=new FileArchiveWriter(documentPath + "String_Node_Str");
  DataEngineContext context=DataEngineContext.newInstance(DataEngineContext.MODE_GENERATION,null,null,writter);
  context.setTmpdir(this.getTempDir());
  DataEngineImpl engine=(DataEngineImpl)DataEngine.newDataEngine(context);
  this.createCube(writter,engine);
  IPreparedCubeQuery pcq=engine.prepare(cqd,null);
  ICubeQueryResults queryResults=pcq.execute(null);
  CubeCursor cursor=queryResults.getCubeCursor();
  cqd.setQueryResultsID(queryResults.getID());
  pcq=engine.prepare(cqd,null);
  queryResults=pcq.execute(null);
  cursor=queryResults.getCubeCursor();
  writter.finish();
  engine.shutdown();
  List columnEdgeBindingNames=new ArrayList();
  columnEdgeBindingNames.add("String_Node_Str");
  columnEdgeBindingNames.add("String_Node_Str");
  columnEdgeBindingNames.add("String_Node_Str");
  FileArchiveReader reader=new FileArchiveReader(documentPath + "String_Node_Str");
  ArchiveWriter writer=new ArchiveWriter(new ArchiveFile(documentPath + "String_Node_Str","String_Node_Str"));
  ICubeQueryDefinition savedQuery=CubeQueryDefinitionIOUtil.load(queryResults.getID(),DataEngineContext.newInstance(DataEngineContext.MODE_UPDATE,null,reader,writer));
  engine=(DataEngineImpl)DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.MODE_UPDATE,null,reader,writer));
  cqd.setQueryResultsID(queryResults.getID());
  List<IScriptExpression> left=new ArrayList<IScriptExpression>();
  left.add(new ScriptExpression("String_Node_Str"));
  left.add(new ScriptExpression("String_Node_Str"));
  left.add(new ScriptExpression("String_Node_Str"));
  List<IScriptExpression> CNBJCP=new ArrayList<IScriptExpression>();
  CNBJCP.add(new ScriptExpression("String_Node_Str"));
  CNBJCP.add(new ScriptExpression("String_Node_Str"));
  CNBJCP.add(new ScriptExpression("String_Node_Str"));
  List<IScriptExpression> JPILP1=new ArrayList<IScriptExpression>();
  JPILP1.add(new ScriptExpression("String_Node_Str"));
  JPILP1.add(new ScriptExpression("String_Node_Str"));
  JPILP1.add(new ScriptExpression("String_Node_Str"));
  List<IScriptExpression> USCSB1=new ArrayList<IScriptExpression>();
  USCSB1.add(new ScriptExpression("String_Node_Str"));
  USCSB1.add(new ScriptExpression("String_Node_Str"));
  USCSB1.add(new ScriptExpression("String_Node_Str"));
  List<Collection<IScriptExpression>> right=new ArrayList<Collection<IScriptExpression>>();
  right.add(CNBJCP);
  right.add(JPILP1);
  right.add(USCSB1);
  ICollectionConditionalExpression cce=new CollectionConditionalExpression(left,IConditionalExpression.OP_IN,right);
  IFilterDefinition filter=new FilterDefinition(new CollectionConditionalExpression(left,IConditionalExpression.OP_IN,right));
  cqd.addFilter(filter);
  filter.setUpdateAggregation(false);
  ConditionalExpression expression=new ConditionalExpression("String_Node_Str",IConditionalExpression.OP_GT,"String_Node_Str");
  ((ScriptExpression)expression.getOperand1()).setConstantValue("String_Node_Str");
  ((ScriptExpression)expression.getOperand1()).setConstant(true);
  FilterDefinition fd=new CubeFilterDefinition(expression);
  ((CubeFilterDefinition)fd).setTargetLevel(cqd.getEdge(ICubeQueryDefinition.ROW_EDGE).getDimensions().get(0).getHierarchy().get(0).getLevels().get(0));
  cqd.addFilter(fd);
  pcq=engine.prepare(cqd,null);
  queryResults=pcq.execute(null);
  cursor=queryResults.getCubeCursor();
  reader.close();
  writer.finish();
  engine.shutdown();
  reader=new FileArchiveReader(documentPath + "String_Node_Str");
  engine=(DataEngineImpl)DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.MODE_PRESENTATION,null,reader,null));
  cqd.setQueryResultsID(queryResults.getID());
  pcq=engine.prepare(cqd,null);
  queryResults=pcq.execute(null);
  cursor=queryResults.getCubeCursor();
  this.printCube(cursor,columnEdgeBindingNames,"String_Node_Str","String_Node_Str",null,"String_Node_Str",null);
  engine.shutdown();
}

Fixed version (ground truth):
public void testIVWithIncrementNoAggrUpdateFilter4() throws Exception {
  ICubeQueryDefinition cqd=new CubeQueryDefinition(cubeName);
  IEdgeDefinition columnEdge=cqd.createEdge(ICubeQueryDefinition.COLUMN_EDGE);
  IEdgeDefinition rowEdge=cqd.createEdge(ICubeQueryDefinition.ROW_EDGE);
  IDimensionDefinition dim1=columnEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier1=dim1.createHierarchy("String_Node_Str");
  hier1.createLevel("String_Node_Str");
  hier1.createLevel("String_Node_Str");
  hier1.createLevel("String_Node_Str");
  IDimensionDefinition dim2=rowEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier2=dim2.createHierarchy("String_Node_Str");
  hier2.createLevel("String_Node_Str");
  IMeasureDefinition measure=cqd.createMeasure("String_Node_Str");
  measure.setAggrFunction("String_Node_Str");
  IBinding binding1=new Binding("String_Node_Str");
  binding1.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding1);
  IBinding binding2=new Binding("String_Node_Str");
  binding2.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding2);
  IBinding binding3=new Binding("String_Node_Str");
  binding3.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding3);
  IBinding binding4=new Binding("String_Node_Str");
  binding4.setExpression(new ScriptExpression("String_Node_Str"));
  cqd.addBinding(binding4);
  IBinding binding5=new Binding("String_Node_Str");
  binding5.setExpression(new ScriptExpression("String_Node_Str"));
  binding5.setAggrFunction("String_Node_Str");
  binding5.addAggregateOn("String_Node_Str");
  binding5.addAggregateOn("String_Node_Str");
  binding5.addAggregateOn("String_Node_Str");
  binding5.addAggregateOn("String_Node_Str");
  cqd.addBinding(binding5);
  IBinding binding6=new Binding("String_Node_Str");
  binding6.setExpression(new ScriptExpression("String_Node_Str"));
  binding6.setAggrFunction("String_Node_Str");
  binding6.addAggregateOn("String_Node_Str");
  cqd.addBinding(binding6);
  cqd.setCacheQueryResults(true);
  FileArchiveWriter writter=new FileArchiveWriter(documentPath + "String_Node_Str");
  DataEngineContext context=DataEngineContext.newInstance(DataEngineContext.MODE_GENERATION,null,null,writter);
  context.setTmpdir(this.getTempDir());
  DataEngineImpl engine=(DataEngineImpl)DataEngine.newDataEngine(context);
  this.createCube(writter,engine);
  IPreparedCubeQuery pcq=engine.prepare(cqd,null);
  ICubeQueryResults queryResults=pcq.execute(null);
  CubeCursor cursor=queryResults.getCubeCursor();
  cqd.setQueryResultsID(queryResults.getID());
  pcq=engine.prepare(cqd,null);
  queryResults=pcq.execute(null);
  cursor=queryResults.getCubeCursor();
  writter.finish();
  engine.shutdown();
  List columnEdgeBindingNames=new ArrayList();
  columnEdgeBindingNames.add("String_Node_Str");
  columnEdgeBindingNames.add("String_Node_Str");
  columnEdgeBindingNames.add("String_Node_Str");
  FileArchiveReader reader=new FileArchiveReader(documentPath + "String_Node_Str");
  ArchiveWriter writer=new ArchiveWriter(new ArchiveFile(documentPath + "String_Node_Str","String_Node_Str"));
  ICubeQueryDefinition savedQuery=CubeQueryDefinitionIOUtil.load(queryResults.getID(),DataEngineContext.newInstance(DataEngineContext.MODE_UPDATE,null,reader,writer));
  engine=(DataEngineImpl)DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.MODE_UPDATE,null,reader,writer));
  cqd.setQueryResultsID(queryResults.getID());
  List<IScriptExpression> left=new ArrayList<IScriptExpression>();
  left.add(new ScriptExpression("String_Node_Str"));
  left.add(new ScriptExpression("String_Node_Str"));
  left.add(new ScriptExpression("String_Node_Str"));
  List<IScriptExpression> CNBJCP=new ArrayList<IScriptExpression>();
  CNBJCP.add(new ScriptExpression("String_Node_Str"));
  CNBJCP.add(new ScriptExpression("String_Node_Str"));
  CNBJCP.add(new ScriptExpression("String_Node_Str"));
  List<IScriptExpression> JPILP1=new ArrayList<IScriptExpression>();
  JPILP1.add(new ScriptExpression("String_Node_Str"));
  JPILP1.add(new ScriptExpression("String_Node_Str"));
  JPILP1.add(new ScriptExpression("String_Node_Str"));
  List<IScriptExpression> USCSB1=new ArrayList<IScriptExpression>();
  USCSB1.add(new ScriptExpression("String_Node_Str"));
  USCSB1.add(new ScriptExpression("String_Node_Str"));
  USCSB1.add(new ScriptExpression("String_Node_Str"));
  List<Collection<IScriptExpression>> right=new ArrayList<Collection<IScriptExpression>>();
  right.add(CNBJCP);
  right.add(JPILP1);
  right.add(USCSB1);
  ICollectionConditionalExpression cce=new CollectionConditionalExpression(left,IConditionalExpression.OP_IN,right);
  IFilterDefinition filter=new FilterDefinition(new CollectionConditionalExpression(left,IConditionalExpression.OP_IN,right));
  cqd.addFilter(filter);
  filter.setUpdateAggregation(false);
  ConditionalExpression expression=new ConditionalExpression("String_Node_Str",IConditionalExpression.OP_GT,"String_Node_Str");
  ((ScriptExpression)expression.getOperand1()).setHandle("String_Node_Str");
  ((ScriptExpression)expression.getOperand1()).setScriptId(BaseExpression.constantId);
  FilterDefinition fd=new CubeFilterDefinition(expression);
  ((CubeFilterDefinition)fd).setTargetLevel(cqd.getEdge(ICubeQueryDefinition.ROW_EDGE).getDimensions().get(0).getHierarchy().get(0).getLevels().get(0));
  cqd.addFilter(fd);
  pcq=engine.prepare(cqd,null);
  queryResults=pcq.execute(null);
  cursor=queryResults.getCubeCursor();
  reader.close();
  writer.finish();
  engine.shutdown();
  reader=new FileArchiveReader(documentPath + "String_Node_Str");
  engine=(DataEngineImpl)DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.MODE_PRESENTATION,null,reader,null));
  cqd.setQueryResultsID(queryResults.getID());
  pcq=engine.prepare(cqd,null);
  queryResults=pcq.execute(null);
  cursor=queryResults.getCubeCursor();
  this.printCube(cursor,columnEdgeBindingNames,"String_Node_Str","String_Node_Str",null,"String_Node_Str",null);
  engine.shutdown();
}