Program: 75837
Project: 75837
Buggy source:
public void testCube2Aggregation() throws IOException, BirtException {
  createCube2();
  CubeQueryExecutorHelper cubeQueryExcutorHelper=new CubeQueryExecutorHelper(CubeQueryExecutorHelper.loadCube("String_Node_Str",documentManager,new StopSign()));
  ISelection[][] filter=new ISelection[1][1];
  filter[0][0]=SelectionFactory.createRangeSelection(new Object[]{"String_Node_Str"},new Object[]{"String_Node_Str"},true,false);
  cubeQueryExcutorHelper.addFilter("String_Node_Str",filter[0]);
  AggregationDefinition[] aggregations=new AggregationDefinition[4];
  int[] sortType=new int[1];
  sortType[0]=IDimensionSortDefn.SORT_ASC;
  String[] levelNamesForFilter=new String[1];
  levelNamesForFilter[0]="String_Node_Str";
  AggregationFunctionDefinition[] funcitons=new AggregationFunctionDefinition[1];
  funcitons[0]=new AggregationFunctionDefinition("String_Node_Str",IBuildInAggregation.TOTAL_SUM_FUNC);
  aggregations[0]=new AggregationDefinition(levelNamesForFilter,sortType,funcitons);
  sortType=new int[2];
  sortType[0]=IDimensionSortDefn.SORT_ASC;
  sortType[1]=IDimensionSortDefn.SORT_ASC;
  levelNamesForFilter=new String[2];
  levelNamesForFilter[0]="String_Node_Str";
  levelNamesForFilter[1]="String_Node_Str";
  funcitons=new AggregationFunctionDefinition[1];
  funcitons[0]=new AggregationFunctionDefinition("String_Node_Str",IBuildInAggregation.TOTAL_SUM_FUNC);
  aggregations[1]=new AggregationDefinition(levelNamesForFilter,sortType,funcitons);
  sortType=new int[1];
  sortType[0]=IDimensionSortDefn.SORT_ASC;
  levelNamesForFilter=new String[1];
  levelNamesForFilter[0]="String_Node_Str";
  funcitons=new AggregationFunctionDefinition[1];
  funcitons[0]=new AggregationFunctionDefinition("String_Node_Str",IBuildInAggregation.TOTAL_SUM_FUNC);
  aggregations[2]=new AggregationDefinition(levelNamesForFilter,sortType,funcitons);
  sortType=new int[1];
  sortType[0]=IDimensionSortDefn.SORT_ASC;
  levelNamesForFilter=new String[1];
  levelNamesForFilter[0]="String_Node_Str";
  funcitons=new AggregationFunctionDefinition[1];
  funcitons[0]=new AggregationFunctionDefinition("String_Node_Str",IBuildInAggregation.TOTAL_SUM_FUNC);
  aggregations[3]=new AggregationDefinition(levelNamesForFilter,sortType,funcitons);
  IAggregationResultSet[] resultSet=cubeQueryExcutorHelper.execute(aggregations,new StopSign());
  CubeQueryExecutorHelper.saveAggregationResultSet(pathName,"String_Node_Str",resultSet);
  resultSet=CubeQueryExecutorHelper.loadAggregationResultSet(pathName,"String_Node_Str");
  assertEquals(resultSet[0].length(),2);
  assertEquals(resultSet[0].getAggregationDataType(0),DataType.DOUBLE_TYPE);
  assertEquals(resultSet[0].getLevelIndex("String_Node_Str"),0);
  assertEquals(resultSet[0].getLevelKeyDataType("String_Node_Str","String_Node_Str"),DataType.STRING_TYPE);
  resultSet[0].seek(0);
  assertEquals(resultSet[0].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[0].getAggregationValue(0),new Double(6));
  resultSet[0].seek(1);
  assertEquals(resultSet[0].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[0].getAggregationValue(0),new Double(22));
  assertEquals(resultSet[1].length(),4);
  assertEquals(resultSet[1].getAggregationDataType(0),DataType.DOUBLE_TYPE);
  assertEquals(resultSet[1].getLevelIndex("String_Node_Str"),-1);
  assertEquals(resultSet[1].getLevelIndex("String_Node_Str"),0);
  assertEquals(resultSet[1].getLevelIndex("String_Node_Str"),1);
  assertEquals(resultSet[1].getLevelKeyDataType("String_Node_Str","String_Node_Str"),DataType.STRING_TYPE);
  assertEquals(resultSet[1].getLevelKeyDataType("String_Node_Str","String_Node_Str"),DataType.INTEGER_TYPE);
  resultSet[1].seek(0);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[1].getLevelKeyValue(1)[0],new Integer(1));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(1));
  resultSet[1].seek(1);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[1].getLevelKeyValue(1)[0],new Integer(2));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(5));
  resultSet[1].seek(2);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[1].getLevelKeyValue(1)[0],new Integer(1));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(9));
  resultSet[1].seek(3);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[1].getLevelKeyValue(1)[0],new Integer(2));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(13));
  assertEquals(resultSet[2].length(),2);
  assertEquals(resultSet[2].getAggregationDataType(0),DataType.DOUBLE_TYPE);
  assertEquals(resultSet[2].getLevelIndex("String_Node_Str"),0);
  assertEquals(resultSet[2].getLevelKeyDataType("String_Node_Str","String_Node_Str"),DataType.STRING_TYPE);
  resultSet[2].seek(0);
  assertEquals(resultSet[2].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[2].getAggregationValue(0),new Double(6));
  resultSet[2].seek(1);
  assertEquals(resultSet[2].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[2].getAggregationValue(0),new Double(22));
  assertEquals(resultSet[3].length(),2);
  assertEquals(resultSet[3].getAggregationDataType(0),DataType.DOUBLE_TYPE);
  assertEquals(resultSet[3].getLevelIndex("String_Node_Str"),0);
  assertEquals(resultSet[3].getLevelKeyDataType("String_Node_Str","String_Node_Str"),DataType.STRING_TYPE);
  resultSet[3].seek(0);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[3].getAggregationValue(0),new Double(6));
  resultSet[3].seek(1);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[3].getAggregationValue(0),new Double(22));
}

Fixed version (ground truth):
public void testCube2Aggregation() throws IOException, BirtException {
  createCube2();
  CubeQueryExecutorHelper cubeQueryExcutorHelper=new CubeQueryExecutorHelper(CubeQueryExecutorHelper.loadCube("String_Node_Str",documentManager,new StopSign()));
  ISelection[][] filter=new ISelection[1][1];
  filter[0][0]=SelectionFactory.createRangeSelection(new Object[]{"String_Node_Str"},new Object[]{"String_Node_Str"},true,false);
  cubeQueryExcutorHelper.addFilter("String_Node_Str",filter[0]);
  AggregationDefinition[] aggregations=new AggregationDefinition[4];
  int[] sortType=new int[1];
  sortType[0]=IDimensionSortDefn.SORT_ASC;
  String[] levelNamesForFilter=new String[1];
  levelNamesForFilter[0]="String_Node_Str";
  AggregationFunctionDefinition[] funcitons=new AggregationFunctionDefinition[1];
  funcitons[0]=new AggregationFunctionDefinition("String_Node_Str",IBuildInAggregation.TOTAL_SUM_FUNC);
  aggregations[0]=new AggregationDefinition(levelNamesForFilter,sortType,funcitons);
  sortType=new int[2];
  sortType[0]=IDimensionSortDefn.SORT_ASC;
  sortType[1]=IDimensionSortDefn.SORT_ASC;
  levelNamesForFilter=new String[2];
  levelNamesForFilter[0]="String_Node_Str";
  levelNamesForFilter[1]="String_Node_Str";
  funcitons=new AggregationFunctionDefinition[1];
  funcitons[0]=new AggregationFunctionDefinition("String_Node_Str",IBuildInAggregation.TOTAL_SUM_FUNC);
  aggregations[1]=new AggregationDefinition(levelNamesForFilter,sortType,funcitons);
  sortType=new int[1];
  sortType[0]=IDimensionSortDefn.SORT_ASC;
  levelNamesForFilter=new String[1];
  levelNamesForFilter[0]="String_Node_Str";
  funcitons=new AggregationFunctionDefinition[1];
  funcitons[0]=new AggregationFunctionDefinition("String_Node_Str",IBuildInAggregation.TOTAL_SUM_FUNC);
  aggregations[2]=new AggregationDefinition(levelNamesForFilter,sortType,funcitons);
  sortType=new int[1];
  sortType[0]=IDimensionSortDefn.SORT_ASC;
  levelNamesForFilter=new String[1];
  levelNamesForFilter[0]="String_Node_Str";
  funcitons=new AggregationFunctionDefinition[1];
  funcitons[0]=new AggregationFunctionDefinition("String_Node_Str",IBuildInAggregation.TOTAL_SUM_FUNC);
  aggregations[3]=new AggregationDefinition(levelNamesForFilter,sortType,funcitons);
  IAggregationResultSet[] resultSet=cubeQueryExcutorHelper.execute(aggregations,new StopSign());
  CubeQueryExecutorHelper.saveAggregationResultSet(pathName,"String_Node_Str",resultSet);
  resultSet=CubeQueryExecutorHelper.loadAggregationResultSet(pathName,"String_Node_Str");
  assertEquals(resultSet[0].length(),2);
  assertEquals(resultSet[0].getAggregationDataType(0),DataType.DOUBLE_TYPE);
  assertEquals(resultSet[0].getLevelIndex("String_Node_Str"),0);
  assertEquals(resultSet[0].getLevelKeyDataType("String_Node_Str","String_Node_Str"),DataType.STRING_TYPE);
  resultSet[0].seek(0);
  assertEquals(resultSet[0].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[0].getAggregationValue(0),new Double(6));
  resultSet[0].seek(1);
  assertEquals(resultSet[0].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[0].getAggregationValue(0),new Double(22));
  assertEquals(resultSet[1].length(),4);
  assertEquals(resultSet[1].getAggregationDataType(0),DataType.DOUBLE_TYPE);
  assertEquals(resultSet[1].getLevelIndex("String_Node_Str"),-1);
  assertEquals(resultSet[1].getLevelIndex("String_Node_Str"),0);
  assertEquals(resultSet[1].getLevelIndex("String_Node_Str"),1);
  assertEquals(resultSet[1].getLevelKeyDataType("String_Node_Str","String_Node_Str"),DataType.STRING_TYPE);
  assertEquals(resultSet[1].getLevelKeyDataType("String_Node_Str","String_Node_Str"),DataType.INTEGER_TYPE);
  resultSet[1].seek(0);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[1].getLevelKeyValue(1)[0],new Integer(1));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(1));
  resultSet[1].seek(1);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[1].getLevelKeyValue(1)[0],new Integer(2));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(5));
  resultSet[1].seek(2);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[1].getLevelKeyValue(1)[0],new Integer(1));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(9));
  resultSet[1].seek(3);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[1].getLevelKeyValue(1)[0],new Integer(2));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(13));
  assertEquals(resultSet[2].length(),2);
  assertEquals(resultSet[2].getAggregationDataType(0),DataType.DOUBLE_TYPE);
  assertEquals(resultSet[2].getLevelIndex("String_Node_Str"),0);
  assertEquals(resultSet[2].getLevelKeyDataType("String_Node_Str","String_Node_Str"),DataType.STRING_TYPE);
  resultSet[2].seek(0);
  assertEquals(resultSet[2].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[2].getAggregationValue(0),new Double(6));
  resultSet[2].seek(1);
  assertEquals(resultSet[2].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[2].getAggregationValue(0),new Double(22));
  assertEquals(resultSet[3].length(),2);
  assertEquals(resultSet[3].getAggregationDataType(0),DataType.DOUBLE_TYPE);
  assertEquals(resultSet[3].getLevelIndex("String_Node_Str"),0);
  assertEquals(resultSet[3].getLevelKeyDataType("String_Node_Str","String_Node_Str"),DataType.STRING_TYPE);
  resultSet[3].seek(0);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[3].getAggregationValue(0),new Double(6));
  resultSet[3].seek(1);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[3].getAggregationValue(0),new Double(22));
  for (int i=0; i < resultSet.length; i++) {
    resultSet[i].close();
  }
}