Program: 75838
Project: 75838
Buggy source:
public void testCube1Aggregation() throws IOException, DataException, BirtException {
  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[1];
  levelNamesForFilter[0]="String_Node_Str";
  aggregations[1]=new AggregationDefinition(levelNamesForFilter,sortType,funcitons);
  aggregations[2]=new AggregationDefinition(null,null,funcitons);
  aggregations[3]=new AggregationDefinition(levelNamesForFilter,sortType,null);
  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(),8);
  assertEquals(resultSet[1].getAggregationDataType(0),DataType.DOUBLE_TYPE);
  assertEquals(resultSet[1].getLevelIndex("String_Node_Str"),0);
  assertEquals(resultSet[1].getLevelKeyDataType("String_Node_Str","String_Node_Str"),DataType.INTEGER_TYPE);
  resultSet[1].seek(0);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(1));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(0));
  resultSet[1].seek(1);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(2));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(1));
  resultSet[1].seek(2);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(3));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(2));
  resultSet[1].seek(3);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(4));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(3));
  resultSet[1].seek(4);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(5));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(4));
  resultSet[1].seek(5);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(6));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(5));
  resultSet[1].seek(6);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(7));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(6));
  resultSet[1].seek(7);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(8));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(7));
  assertEquals(resultSet[2].length(),1);
  assertEquals(resultSet[2].getAggregationDataType(0),DataType.DOUBLE_TYPE);
  assertEquals(resultSet[2].getLevelIndex("String_Node_Str"),-1);
  resultSet[1].seek(0);
  assertEquals(resultSet[2].getLevelKeyValue(0),null);
  assertEquals(resultSet[2].getAggregationValue(0),new Double(28));
  assertEquals(resultSet[3].length(),8);
  assertEquals(resultSet[3].getAggregationDataType(0),DataType.UNKNOWN_TYPE);
  assertEquals(resultSet[3].getLevelIndex("String_Node_Str"),0);
  assertEquals(resultSet[3].getLevelKeyDataType("String_Node_Str","String_Node_Str"),DataType.INTEGER_TYPE);
  resultSet[3].seek(0);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(1));
  assertEquals(resultSet[3].getAggregationValue(0),null);
  resultSet[3].seek(1);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(2));
  resultSet[3].seek(2);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(3));
  assertEquals(resultSet[3].getAggregationValue(0),null);
  resultSet[3].seek(3);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(4));
  resultSet[3].seek(4);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(5));
  assertEquals(resultSet[3].getAggregationValue(0),null);
  resultSet[3].seek(5);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(6));
  resultSet[3].seek(6);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(7));
  resultSet[3].seek(7);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(8));
}

Fixed version (ground truth):
public void testCube1Aggregation() throws IOException, DataException, BirtException {
  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[1];
  levelNamesForFilter[0]="String_Node_Str";
  aggregations[1]=new AggregationDefinition(levelNamesForFilter,sortType,funcitons);
  aggregations[2]=new AggregationDefinition(null,null,funcitons);
  aggregations[3]=new AggregationDefinition(levelNamesForFilter,sortType,null);
  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(),8);
  assertEquals(resultSet[1].getAggregationDataType(0),DataType.DOUBLE_TYPE);
  assertEquals(resultSet[1].getLevelIndex("String_Node_Str"),0);
  assertEquals(resultSet[1].getLevelKeyDataType("String_Node_Str","String_Node_Str"),DataType.INTEGER_TYPE);
  resultSet[1].seek(0);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(1));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(0));
  resultSet[1].seek(1);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(2));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(1));
  resultSet[1].seek(2);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(3));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(2));
  resultSet[1].seek(3);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(4));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(3));
  resultSet[1].seek(4);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(5));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(4));
  resultSet[1].seek(5);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(6));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(5));
  resultSet[1].seek(6);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(7));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(6));
  resultSet[1].seek(7);
  assertEquals(resultSet[1].getLevelKeyValue(0)[0],new Integer(8));
  assertEquals(resultSet[1].getAggregationValue(0),new Double(7));
  assertEquals(resultSet[2].length(),1);
  assertEquals(resultSet[2].getAggregationDataType(0),DataType.DOUBLE_TYPE);
  assertEquals(resultSet[2].getLevelIndex("String_Node_Str"),-1);
  resultSet[2].seek(0);
  assertEquals(resultSet[2].getLevelKeyValue(0),null);
  assertEquals(resultSet[2].getAggregationValue(0),new Double(28));
  assertEquals(resultSet[3].length(),8);
  assertEquals(resultSet[3].getAggregationDataType(0),DataType.UNKNOWN_TYPE);
  assertEquals(resultSet[3].getLevelIndex("String_Node_Str"),0);
  assertEquals(resultSet[3].getLevelKeyDataType("String_Node_Str","String_Node_Str"),DataType.INTEGER_TYPE);
  resultSet[3].seek(0);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(1));
  assertEquals(resultSet[3].getAggregationValue(0),null);
  resultSet[3].seek(1);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(2));
  resultSet[3].seek(2);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(3));
  assertEquals(resultSet[3].getAggregationValue(0),null);
  resultSet[3].seek(3);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(4));
  resultSet[3].seek(4);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(5));
  assertEquals(resultSet[3].getAggregationValue(0),null);
  resultSet[3].seek(5);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(6));
  resultSet[3].seek(6);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(7));
  resultSet[3].seek(7);
  assertEquals(resultSet[3].getLevelKeyValue(0)[0],new Integer(8));
  for (int i=0; i < resultSet.length; i++) {
    resultSet[i].close();
  }
}