Program: 51342
Project: 51342
Buggy source:
public void testCompositeBatchLoadAggregation(){
  FastBatchingCellReader fbcr=new FastBatchingCellReader(null);
  FastBatchingCellReader.Batch summaryBatch=createBatch(fbcr,new String[]{tableTime,tableProductClass,tableProductClass},new String[]{fieldYear,fieldProductFamily,fieldProductDepartment},new String[][]{fieldValuesYear,fieldValuesProductFamily,fieldValueProductDepartment},cubeNameSales,measureUnitSales);
  FastBatchingCellReader.Batch detailedBatch=createBatch(fbcr,new String[]{tableTime,tableProductClass,tableProductClass,tableCustomer},new String[]{fieldYear,fieldProductFamily,fieldProductDepartment,fieldGender},new String[][]{fieldValuesYear,fieldValuesProductFamily,fieldValueProductDepartment,fieldValuesGender},cubeNameSales,measureUnitSales);
  final List<GroupingSet> groupingSets=new ArrayList<GroupingSet>();
  FastBatchingCellReader.CompositeBatch compositeBatch=fbcr.new CompositeBatch(detailedBatch){
    SegmentLoader getSegmentLoader(){
      return new SegmentLoader(){
        public void load(        List<GroupingSet> sets,        RolapAggregationManager.PinSet pinnedSegments){
          groupingSets.addAll(sets);
        }
      }
;
    }
  }
;
  compositeBatch.add(summaryBatch);
  compositeBatch.loadAggregation();
  assertEquals(2,groupingSets.size());
  GroupingSetsCollector detailedCollector=new GroupingSetsCollector(true);
  detailedBatch.loadAggregation(detailedCollector);
  List<GroupingSet> baseGroupingSet=detailedCollector.getGroupingSets();
  GroupingSetsCollector summaryCollector=new GroupingSetsCollector(true);
  summaryBatch.loadAggregation(summaryCollector);
  List<GroupingSet> groupingSet=summaryCollector.getGroupingSets();
  assertEquals(baseGroupingSet.get(0).getLevelBitKey(),groupingSets.get(0).getLevelBitKey());
  assertEquals(groupingSet.get(0).getLevelBitKey(),groupingSets.get(1).getLevelBitKey());
}

Fixed version (ground truth):
public void testCompositeBatchLoadAggregation(){
  FastBatchingCellReader fbcr=new FastBatchingCellReader(null);
  FastBatchingCellReader.Batch summaryBatch=createBatch(fbcr,new String[]{tableTime,tableProductClass,tableProductClass},new String[]{fieldYear,fieldProductFamily,fieldProductDepartment},new String[][]{fieldValuesYear,fieldValuesProductFamily,fieldValueProductDepartment},cubeNameSales,measureUnitSales);
  FastBatchingCellReader.Batch detailedBatch=createBatch(fbcr,new String[]{tableTime,tableProductClass,tableProductClass,tableCustomer},new String[]{fieldYear,fieldProductFamily,fieldProductDepartment,fieldGender},new String[][]{fieldValuesYear,fieldValuesProductFamily,fieldValueProductDepartment,fieldValuesGender},cubeNameSales,measureUnitSales);
  final List<GroupingSet> groupingSets=new ArrayList<GroupingSet>();
  FastBatchingCellReader.CompositeBatch compositeBatch=fbcr.new CompositeBatch(detailedBatch){
    SegmentLoader getSegmentLoader(){
      return new SegmentLoader(){
        public void load(        List<GroupingSet> sets,        RolapAggregationManager.PinSet pinnedSegments){
          groupingSets.addAll(sets);
          for (          GroupingSet groupingSet : sets) {
            groupingSet.setSegmentsFailed();
          }
        }
      }
;
    }
  }
;
  compositeBatch.add(summaryBatch);
  compositeBatch.loadAggregation();
  assertEquals(2,groupingSets.size());
  assertEquals(detailedBatch.constrainedColumnsBitKey,groupingSets.get(0).getLevelBitKey());
  assertEquals(summaryBatch.constrainedColumnsBitKey,groupingSets.get(1).getLevelBitKey());
}