Program: 74436
Project: 74436
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(new LevelFilter(dimLevel21,filter[0]));
  cubeQueryExcutorHelper.setComputedMeasure(new ComputedMeasureHelper());
  AggregationDefinition[] aggregations=new AggregationDefinition[4];
  int[] sortType=new int[1];
  sortType[0]=IDimensionSortDefn.SORT_ASC;
  DimLevel[] levelsForFilter=new DimLevel[]{dimLevel21};
  AggregationFunctionDefinition[] funcitons=new AggregationFunctionDefinition[2];
  funcitons[0]=new AggregationFunctionDefinition("String_Node_Str",IBuildInAggregation.TOTAL_SUM_FUNC);
  funcitons[1]=new AggregationFunctionDefinition("String_Node_Str",IBuildInAggregation.TOTAL_SUM_FUNC);
  AggregationFunctionDefinition[] funcitonsWithParameterCol=new AggregationFunctionDefinition[3];
  funcitonsWithParameterCol[0]=new AggregationFunctionDefinition("String_Node_Str",IBuildInAggregation.TOTAL_SUM_FUNC);
  funcitonsWithParameterCol[1]=new AggregationFunctionDefinition(null,"String_Node_Str",new DimLevel("String_Node_Str","String_Node_Str"),"String_Node_Str",IBuildInAggregation.TOTAL_WEIGHTEDAVE_FUNC);
  aggregations[0]=new AggregationDefinition(levelsForFilter,sortType,funcitons);
  sortType=new int[2];
  sortType[0]=IDimensionSortDefn.SORT_ASC;
  sortType[1]=IDimensionSortDefn.SORT_ASC;
  levelsForFilter=new DimLevel[]{dimLevel31};
  aggregations[1]=new AggregationDefinition(levelsForFilter,sortType,funcitons);
  aggregations[2]=new AggregationDefinition(null,null,funcitons);
  aggregations[3]=new AggregationDefinition(levelsForFilter,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(dimLevel21),0);
  assertEquals(resultSet[0].getLevelKeyDataType(dimLevel21,"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));
  assertEquals(resultSet[0].getAggregationValue(1),new Double(10));
  resultSet[0].seek(1);
  assertEquals(resultSet[0].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[0].getAggregationValue(0),new Double(22));
  assertEquals(resultSet[0].getAggregationValue(1),new Double(26));
  assertEquals(resultSet[1].length(),8);
  assertEquals(resultSet[1].getAggregationDataType(0),DataType.DOUBLE_TYPE);
  assertEquals(resultSet[1].getLevelIndex(dimLevel31),0);
  assertEquals(resultSet[1].getLevelKeyDataType(dimLevel31,"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(dimLevel31),-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(dimLevel31),0);
  assertEquals(resultSet[3].getLevelKeyDataType(dimLevel31,"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();
  }
}

Fixed version (ground truth):
public void testCube1Aggregation() throws IOException, DataException, BirtException {
  CubeQueryExecutorHelper cubeQueryExcutorHelper=new CubeQueryExecutorHelper(CubeQueryExecutorHelper.loadCube("String_Node_Str",documentManager,new StopSign()),new ComputedMeasureHelper());
  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(new LevelFilter(dimLevel21,filter[0]));
  AggregationDefinition[] aggregations=new AggregationDefinition[4];
  int[] sortType=new int[1];
  sortType[0]=IDimensionSortDefn.SORT_ASC;
  DimLevel[] levelsForFilter=new DimLevel[]{dimLevel21};
  AggregationFunctionDefinition[] funcitons=new AggregationFunctionDefinition[2];
  funcitons[0]=new AggregationFunctionDefinition("String_Node_Str",IBuildInAggregation.TOTAL_SUM_FUNC);
  funcitons[1]=new AggregationFunctionDefinition("String_Node_Str",IBuildInAggregation.TOTAL_SUM_FUNC);
  AggregationFunctionDefinition[] funcitonsWithParameterCol=new AggregationFunctionDefinition[3];
  funcitonsWithParameterCol[0]=new AggregationFunctionDefinition("String_Node_Str",IBuildInAggregation.TOTAL_SUM_FUNC);
  funcitonsWithParameterCol[1]=new AggregationFunctionDefinition(null,"String_Node_Str",new DimLevel("String_Node_Str","String_Node_Str"),"String_Node_Str",IBuildInAggregation.TOTAL_WEIGHTEDAVE_FUNC);
  aggregations[0]=new AggregationDefinition(levelsForFilter,sortType,funcitons);
  sortType=new int[2];
  sortType[0]=IDimensionSortDefn.SORT_ASC;
  sortType[1]=IDimensionSortDefn.SORT_ASC;
  levelsForFilter=new DimLevel[]{dimLevel31};
  aggregations[1]=new AggregationDefinition(levelsForFilter,sortType,funcitons);
  aggregations[2]=new AggregationDefinition(null,null,funcitons);
  aggregations[3]=new AggregationDefinition(levelsForFilter,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(dimLevel21),0);
  assertEquals(resultSet[0].getLevelKeyDataType(dimLevel21,"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));
  assertEquals(resultSet[0].getAggregationValue(1),new Double(10));
  resultSet[0].seek(1);
  assertEquals(resultSet[0].getLevelKeyValue(0)[0],"String_Node_Str");
  assertEquals(resultSet[0].getAggregationValue(0),new Double(22));
  assertEquals(resultSet[0].getAggregationValue(1),new Double(26));
  assertEquals(resultSet[1].length(),8);
  assertEquals(resultSet[1].getAggregationDataType(0),DataType.DOUBLE_TYPE);
  assertEquals(resultSet[1].getLevelIndex(dimLevel31),0);
  assertEquals(resultSet[1].getLevelKeyDataType(dimLevel31,"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(dimLevel31),-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(dimLevel31),0);
  assertEquals(resultSet[3].getLevelKeyDataType(dimLevel31,"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();
  }
}