Program: 70126
Project: 70126
Buggy source:
public void testMultipleAggregation1() throws IOException, DataException {
  AggregationDefinition[] aggregations=new AggregationDefinition[2];
  int[] sortTypes=new int[]{0,0};
  AggregationFunctionDefinition[] aggregationFunctions=new AggregationFunctionDefinition[1];
  aggregationFunctions[0]=new AggregationFunctionDefinition("String_Node_Str","String_Node_Str",IBuildInAggregation.TOTAL_RANK_FUNC);
  aggregationFunctions[0].setParaValue("String_Node_Str");
  DimLevel[] dimLevels=new DimLevel[]{this.dimLevels[0],this.dimLevels[2]};
  aggregations[0]=new AggregationDefinition(dimLevels,sortTypes,aggregationFunctions);
  dimLevels=new DimLevel[]{this.dimLevels[0],this.dimLevels[1]};
  aggregations[1]=new AggregationDefinition(dimLevels,sortTypes,aggregationFunctions);
  IAggregationResultSet[] resultSets=AggregationHelper.getInstance().execute(aggregationResultSet,aggregations,new StopSign());
  assertEquals(resultSets[0].length(),16);
  assertEquals(resultSets[0].getAggregationCount(),1);
  assertEquals(resultSets[0].getAggregationDataType(0),DataType.INTEGER_TYPE);
  assertEquals(resultSets[0].getAllLevels().length,4);
  assertEquals(resultSets[0].getLevel(0),this.dimLevels[0]);
  assertEquals(resultSets[0].getLevel(1),this.dimLevels[1]);
  assertEquals(resultSets[0].getLevel(2),this.dimLevels[2]);
  assertEquals(resultSets[0].getLevel(3),this.dimLevels[3]);
  assertEquals(resultSets[0].getLevelKeyColCount(0),1);
  assertEquals(resultSets[0].getLevelKeyColCount(1),1);
  Object[][] fieldValues=new Object[][]{{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(110),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(120),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(60),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(3),new Double(300),new Integer(5)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(4),new Double(150),new Integer(4)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(5),new Double(120),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(6),new Double(120),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(100),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(150),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(3),new Double(110),new Integer(3)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(60),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(300),new Integer(5)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(100),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(210),new Integer(4)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(45),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(243),new Integer(2)}};
  for (int i=0; i < fieldValues.length; i++) {
    resultSets[0].seek(i);
    for (int j=0; j < 4; j++) {
      assertEquals(resultSets[0].getLevelKeyValue(j)[0],fieldValues[i][j]);
    }
    assertEquals(resultSets[0].getAggregationValue(0),fieldValues[i][5]);
  }
  assertEquals(resultSets[1].length(),16);
  assertEquals(resultSets[0].getAggregationCount(),1);
  assertEquals(resultSets[0].getAggregationDataType(0),DataType.INTEGER_TYPE);
  assertEquals(resultSets[0].getAllLevels().length,4);
  assertEquals(resultSets[1].getLevel(0),this.dimLevels[0]);
  assertEquals(resultSets[1].getLevel(1),this.dimLevels[1]);
  assertEquals(resultSets[1].getLevelKeyColCount(0),1);
  assertEquals(resultSets[1].getLevelKeyColCount(1),1);
  fieldValues=new Object[][]{{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(110),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(120),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(60),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(3),new Double(300),new Integer(5)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(4),new Double(150),new Integer(4)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(5),new Double(120),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(6),new Double(120),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(100),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(150),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(3),new Double(110),new Integer(3)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(60),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(300),new Integer(5)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(100),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(210),new Integer(4)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(45),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(243),new Integer(2)}};
  for (int i=0; i < fieldValues.length; i++) {
    resultSets[0].seek(i);
    for (int j=0; j < 4; j++) {
      assertEquals(resultSets[0].getLevelKeyValue(j)[0],fieldValues[i][j]);
    }
    assertEquals(resultSets[0].getAggregationValue(0),fieldValues[i][5]);
  }
}

Fixed version (ground truth):
public void testMultipleAggregation1() throws IOException, DataException {
  AggregationDefinition[] aggregations=new AggregationDefinition[2];
  int[] sortTypes=new int[]{0,0};
  AggregationFunctionDefinition[] aggregationFunctions=new AggregationFunctionDefinition[1];
  aggregationFunctions[0]=new AggregationFunctionDefinition("String_Node_Str","String_Node_Str",IBuildInAggregation.TOTAL_RANK_FUNC);
  DimLevel[] dimLevels=new DimLevel[]{this.dimLevels[0],this.dimLevels[2]};
  aggregations[0]=new AggregationDefinition(dimLevels,sortTypes,aggregationFunctions);
  dimLevels=new DimLevel[]{this.dimLevels[0],this.dimLevels[1]};
  aggregations[1]=new AggregationDefinition(dimLevels,sortTypes,aggregationFunctions);
  IAggregationResultSet[] resultSets=AggregationHelper.getInstance().execute(aggregationResultSet,aggregations,new StopSign());
  assertEquals(resultSets[0].length(),16);
  assertEquals(resultSets[0].getAggregationCount(),1);
  assertEquals(resultSets[0].getAggregationDataType(0),DataType.INTEGER_TYPE);
  assertEquals(resultSets[0].getAllLevels().length,4);
  assertEquals(resultSets[0].getLevel(0),this.dimLevels[0]);
  assertEquals(resultSets[0].getLevel(1),this.dimLevels[1]);
  assertEquals(resultSets[0].getLevel(2),this.dimLevels[2]);
  assertEquals(resultSets[0].getLevel(3),this.dimLevels[3]);
  assertEquals(resultSets[0].getLevelKeyColCount(0),1);
  assertEquals(resultSets[0].getLevelKeyColCount(1),1);
  Object[][] fieldValues=new Object[][]{{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(110),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(120),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(60),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(3),new Double(300),new Integer(5)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(4),new Double(150),new Integer(4)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(5),new Double(120),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(6),new Double(120),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(100),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(150),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(3),new Double(110),new Integer(3)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(60),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(300),new Integer(5)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(100),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(210),new Integer(4)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(45),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(243),new Integer(2)}};
  for (int i=0; i < fieldValues.length; i++) {
    resultSets[0].seek(i);
    for (int j=0; j < 4; j++) {
      assertEquals(resultSets[0].getLevelKeyValue(j)[0],fieldValues[i][j]);
    }
    assertEquals(resultSets[0].getAggregationValue(0),fieldValues[i][5]);
  }
  assertEquals(resultSets[1].length(),16);
  assertEquals(resultSets[0].getAggregationCount(),1);
  assertEquals(resultSets[0].getAggregationDataType(0),DataType.INTEGER_TYPE);
  assertEquals(resultSets[0].getAllLevels().length,4);
  assertEquals(resultSets[1].getLevel(0),this.dimLevels[0]);
  assertEquals(resultSets[1].getLevel(1),this.dimLevels[1]);
  assertEquals(resultSets[1].getLevelKeyColCount(0),1);
  assertEquals(resultSets[1].getLevelKeyColCount(1),1);
  fieldValues=new Object[][]{{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(110),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(120),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(60),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(3),new Double(300),new Integer(5)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(4),new Double(150),new Integer(4)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(5),new Double(120),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(6),new Double(120),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(100),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(150),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(3),new Double(110),new Integer(3)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(60),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(300),new Integer(5)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(100),new Integer(2)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(210),new Integer(4)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(1),new Double(45),new Integer(1)},{"String_Node_Str","String_Node_Str","String_Node_Str",new Integer(2),new Double(243),new Integer(2)}};
  for (int i=0; i < fieldValues.length; i++) {
    resultSets[0].seek(i);
    for (int j=0; j < 4; j++) {
      assertEquals(resultSets[0].getLevelKeyValue(j)[0],fieldValues[i][j]);
    }
    assertEquals(resultSets[0].getAggregationValue(0),fieldValues[i][5]);
  }
}