Program: 75933
Project: 75933
Buggy source:
/** 
 * Test grand total
 * @throws Exception
 */
public void testAggrSort() throws Exception {
  this.createCube();
  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");
  ILevelDefinition level11=hier1.createLevel("String_Node_Str");
  ILevelDefinition level12=hier1.createLevel("String_Node_Str");
  ILevelDefinition level13=hier1.createLevel("String_Node_Str");
  IDimensionDefinition dim2=rowEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier2=dim2.createHierarchy("String_Node_Str");
  ILevelDefinition level21=hier2.createLevel("String_Node_Str");
  createSortTestBindings(cqd);
  CubeSortDefinition sorter1=new CubeSortDefinition();
  sorter1.setExpression("String_Node_Str");
  sorter1.setAxisQualifierLevel(null);
  sorter1.setAxisQualifierValue(null);
  sorter1.setTargetLevel(level21);
  sorter1.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter2=new CubeSortDefinition();
  sorter2.setExpression("String_Node_Str");
  sorter2.setAxisQualifierLevel(new ILevelDefinition[]{level21});
  sorter2.setAxisQualifierValue(new Object[]{"String_Node_Str"});
  sorter2.setTargetLevel(level12);
  sorter2.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter3=new CubeSortDefinition();
  sorter3.setExpression("String_Node_Str");
  sorter3.setAxisQualifierLevel(new ILevelDefinition[]{level21});
  sorter3.setAxisQualifierValue(new Object[]{"String_Node_Str"});
  sorter3.setTargetLevel(level11);
  sorter3.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter4=new CubeSortDefinition();
  sorter4.setExpression("String_Node_Str");
  sorter4.setAxisQualifierLevel(null);
  sorter4.setAxisQualifierValue(null);
  sorter4.setTargetLevel(level13);
  sorter4.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter5=new CubeSortDefinition();
  sorter5.setExpression("String_Node_Str");
  sorter5.setAxisQualifierLevel(null);
  sorter5.setAxisQualifierValue(null);
  sorter5.setTargetLevel(level11);
  sorter5.setSortDirection(ISortDefinition.SORT_DESC);
  cqd.addSort(sorter1);
  cqd.addSort(sorter2);
  cqd.addSort(sorter3);
  cqd.addSort(sorter4);
  cqd.addSort(sorter5);
  DataEngine engine=DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,null,null,null));
  IPreparedCubeQuery pcq=engine.prepare(cqd,null);
  ICubeQueryResults queryResults=pcq.execute(null);
  CubeCursor cursor=queryResults.getCubeCursor();
  List columnEdgeBindingNames=new ArrayList();
  columnEdgeBindingNames.add("String_Node_Str");
  columnEdgeBindingNames.add("String_Node_Str");
  columnEdgeBindingNames.add("String_Node_Str");
  printCube(cursor,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"},"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test grand total
 * @throws Exception
 */
public void testAggrSort() 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");
  ILevelDefinition level11=hier1.createLevel("String_Node_Str");
  ILevelDefinition level12=hier1.createLevel("String_Node_Str");
  ILevelDefinition level13=hier1.createLevel("String_Node_Str");
  IDimensionDefinition dim2=rowEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier2=dim2.createHierarchy("String_Node_Str");
  ILevelDefinition level21=hier2.createLevel("String_Node_Str");
  createSortTestBindings(cqd);
  CubeSortDefinition sorter1=new CubeSortDefinition();
  sorter1.setExpression("String_Node_Str");
  sorter1.setAxisQualifierLevel(null);
  sorter1.setAxisQualifierValue(null);
  sorter1.setTargetLevel(level21);
  sorter1.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter2=new CubeSortDefinition();
  sorter2.setExpression("String_Node_Str");
  sorter2.setAxisQualifierLevel(new ILevelDefinition[]{level21});
  sorter2.setAxisQualifierValue(new Object[]{"String_Node_Str"});
  sorter2.setTargetLevel(level12);
  sorter2.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter3=new CubeSortDefinition();
  sorter3.setExpression("String_Node_Str");
  sorter3.setAxisQualifierLevel(new ILevelDefinition[]{level21});
  sorter3.setAxisQualifierValue(new Object[]{"String_Node_Str"});
  sorter3.setTargetLevel(level11);
  sorter3.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter4=new CubeSortDefinition();
  sorter4.setExpression("String_Node_Str");
  sorter4.setAxisQualifierLevel(null);
  sorter4.setAxisQualifierValue(null);
  sorter4.setTargetLevel(level13);
  sorter4.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter5=new CubeSortDefinition();
  sorter5.setExpression("String_Node_Str");
  sorter5.setAxisQualifierLevel(null);
  sorter5.setAxisQualifierValue(null);
  sorter5.setTargetLevel(level11);
  sorter5.setSortDirection(ISortDefinition.SORT_DESC);
  cqd.addSort(sorter1);
  cqd.addSort(sorter2);
  cqd.addSort(sorter3);
  cqd.addSort(sorter4);
  cqd.addSort(sorter5);
  DataEngine engine=DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,null,null,null));
  this.createCube(engine);
  IPreparedCubeQuery pcq=engine.prepare(cqd,null);
  ICubeQueryResults queryResults=pcq.execute(null);
  CubeCursor cursor=queryResults.getCubeCursor();
  List columnEdgeBindingNames=new ArrayList();
  columnEdgeBindingNames.add("String_Node_Str");
  columnEdgeBindingNames.add("String_Node_Str");
  columnEdgeBindingNames.add("String_Node_Str");
  printCube(cursor,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"},"String_Node_Str","String_Node_Str");
}