Program: 75687
Project: 75687
Buggy source:
private void testFactTableSaveAndLoad3(IDocumentManager documentManager) throws IOException, BirtException {
  long startTime=System.currentTimeMillis();
  Dimension[] dimensions=new Dimension[3];
  String[] levelNames=new String[1];
  levelNames[0]="String_Node_Str";
  DimensionForTest iterator=new DimensionForTest(levelNames);
  int[] data=new int[BigLevelsAndFactTableDataset.dimensionPositionLength[0]];
  for (int i=0; i < data.length; i++) {
    data[i]=i;
  }
  iterator.setLevelMember(0,data);
  ILevelDefn[] levelDefs=new ILevelDefn[1];
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  dimensions[0]=(Dimension)DimensionFactory.createDimension("String_Node_Str",documentManager,iterator,levelDefs,false);
  IHierarchy hierarchy=dimensions[0].getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  assertEquals(dimensions[0].length(),BigLevelsAndFactTableDataset.dimensionPositionLength[0]);
  levelNames=new String[1];
  levelNames[0]="String_Node_Str";
  ;
  iterator=new DimensionForTest(levelNames);
  data=new int[BigLevelsAndFactTableDataset.dimensionPositionLength[1]];
  for (int i=0; i < data.length; i++) {
    data[i]=i;
  }
  iterator.setLevelMember(0,data);
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  dimensions[1]=(Dimension)DimensionFactory.createDimension("String_Node_Str",documentManager,iterator,levelDefs,false);
  hierarchy=dimensions[1].getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  assertEquals(dimensions[1].length(),BigLevelsAndFactTableDataset.dimensionPositionLength[1]);
  levelNames=new String[1];
  levelNames[0]="String_Node_Str";
  ;
  iterator=new DimensionForTest(levelNames);
  data=new int[BigLevelsAndFactTableDataset.dimensionPositionLength[2]];
  for (int i=0; i < data.length; i++) {
    data[i]=i;
  }
  iterator.setLevelMember(0,data);
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  dimensions[2]=(Dimension)DimensionFactory.createDimension("String_Node_Str",documentManager,iterator,levelDefs,false);
  hierarchy=dimensions[2].getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  assertEquals(dimensions[2].length(),BigLevelsAndFactTableDataset.dimensionPositionLength[2]);
  IDatasetIterator facttableIterator=new BigLevelsAndFactTableDataset();
  String[] measureColumnName=new String[2];
  measureColumnName[0]="String_Node_Str";
  measureColumnName[1]="String_Node_Str";
  System.out.println("String_Node_Str" + (System.currentTimeMillis() - startTime) / 1000);
  startTime=System.currentTimeMillis();
  System.out.println("String_Node_Str");
  FactTableAccessor factTableConstructor=new FactTableAccessor(documentManager);
  FactTable factTable=factTableConstructor.saveFactTable(NamingUtil.getFactTableName("String_Node_Str"),facttableIterator,dimensions,measureColumnName,new StopSign());
  System.out.println("String_Node_Str" + (System.currentTimeMillis() - startTime) / 1000);
  factTable=factTableConstructor.load(NamingUtil.getFactTableName("String_Node_Str"),new StopSign());
  System.out.println("String_Node_Str");
  startTime=System.currentTimeMillis();
  assertEquals(factTable.getDimensionInfo()[0].dimensionName,"String_Node_Str");
  assertEquals(factTable.getDimensionInfo()[0].dimensionLength,BigLevelsAndFactTableDataset.dimensionPositionLength[0]);
  assertEquals(factTable.getDimensionInfo()[1].dimensionName,"String_Node_Str");
  assertEquals(factTable.getDimensionInfo()[1].dimensionLength,BigLevelsAndFactTableDataset.dimensionPositionLength[1]);
  assertEquals(factTable.getDimensionInfo()[2].dimensionName,"String_Node_Str");
  assertEquals(factTable.getDimensionInfo()[2].dimensionLength,BigLevelsAndFactTableDataset.dimensionPositionLength[2]);
  assertEquals(factTable.getMeasureInfo()[0].measureName,"String_Node_Str");
  assertEquals(factTable.getMeasureInfo()[0].dataType,DataType.INTEGER_TYPE);
  assertEquals(factTable.getMeasureInfo()[1].measureName,"String_Node_Str");
  assertEquals(factTable.getMeasureInfo()[1].dataType,DataType.DOUBLE_TYPE);
  String[] dimensionNames=new String[3];
  dimensionNames[0]="String_Node_Str";
  dimensionNames[1]="String_Node_Str";
  dimensionNames[2]="String_Node_Str";
  IDiskArray[] dimensionPosition=new IDiskArray[3];
  dimensionPosition[0]=new BufferedPrimitiveDiskArray();
  dimensionPosition[0].add(new Integer(10));
  dimensionPosition[0].add(new Integer(99));
  dimensionPosition[1]=new BufferedPrimitiveDiskArray();
  dimensionPosition[1].add(new Integer(10));
  dimensionPosition[1].add(new Integer(99));
  dimensionPosition[2]=new BufferedPrimitiveDiskArray();
  dimensionPosition[2].add(new Integer(1));
  dimensionPosition[2].add(new Integer(9));
  FactTableRowIterator facttableRowIterator=new FactTableRowIterator(factTable,dimensionNames,dimensionPosition,new StopSign());
  assertTrue(facttableRowIterator != null);
  while (facttableRowIterator.next()) {
    System.out.print(facttableRowIterator.getDimensionPosition(0) + "String_Node_Str" + facttableRowIterator.getDimensionPosition(1)+ "String_Node_Str"+ facttableRowIterator.getDimensionPosition(2)+ "String_Node_Str");
    System.out.println(facttableRowIterator.getMeasure(0) + "String_Node_Str" + facttableRowIterator.getMeasure(1));
  }
  System.out.println("String_Node_Str" + (System.currentTimeMillis() - startTime) / 1000);
}

Fixed version (ground truth):
private void testFactTableSaveAndLoad3(IDocumentManager documentManager) throws IOException, BirtException {
  long startTime=System.currentTimeMillis();
  Dimension[] dimensions=new Dimension[3];
  String[] levelNames=new String[1];
  levelNames[0]="String_Node_Str";
  DimensionForTest iterator=new DimensionForTest(levelNames);
  int[] data=new int[BigLevelsAndFactTableDataset.dimensionPositionLength[0]];
  for (int i=0; i < data.length; i++) {
    data[i]=i;
  }
  iterator.setLevelMember(0,data);
  ILevelDefn[] levelDefs=new ILevelDefn[1];
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  dimensions[0]=(Dimension)DimensionFactory.createDimension("String_Node_Str",documentManager,iterator,levelDefs,false);
  IHierarchy hierarchy=dimensions[0].getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  assertEquals(dimensions[0].length(),BigLevelsAndFactTableDataset.dimensionPositionLength[0]);
  levelNames=new String[1];
  levelNames[0]="String_Node_Str";
  ;
  iterator=new DimensionForTest(levelNames);
  data=new int[BigLevelsAndFactTableDataset.dimensionPositionLength[1]];
  for (int i=0; i < data.length; i++) {
    data[i]=i;
  }
  iterator.setLevelMember(0,data);
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  dimensions[1]=(Dimension)DimensionFactory.createDimension("String_Node_Str",documentManager,iterator,levelDefs,false);
  hierarchy=dimensions[1].getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  assertEquals(dimensions[1].length(),BigLevelsAndFactTableDataset.dimensionPositionLength[1]);
  levelNames=new String[1];
  levelNames[0]="String_Node_Str";
  ;
  iterator=new DimensionForTest(levelNames);
  data=new int[BigLevelsAndFactTableDataset.dimensionPositionLength[2]];
  for (int i=0; i < data.length; i++) {
    data[i]=i;
  }
  iterator.setLevelMember(0,data);
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  dimensions[2]=(Dimension)DimensionFactory.createDimension("String_Node_Str",documentManager,iterator,levelDefs,false);
  hierarchy=dimensions[2].getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  assertEquals(dimensions[2].length(),BigLevelsAndFactTableDataset.dimensionPositionLength[2]);
  IDatasetIterator facttableIterator=new BigLevelsAndFactTableDataset();
  String[] measureColumnName=new String[2];
  measureColumnName[0]="String_Node_Str";
  measureColumnName[1]="String_Node_Str";
  System.out.println("String_Node_Str" + (System.currentTimeMillis() - startTime) / 1000);
  startTime=System.currentTimeMillis();
  System.out.println("String_Node_Str");
  FactTableAccessor factTableConstructor=new FactTableAccessor(documentManager);
  FactTable factTable=factTableConstructor.saveFactTable(NamingUtil.getFactTableName("String_Node_Str"),CubeUtility.getKeyColNames(dimensions),facttableIterator,dimensions,measureColumnName,new StopSign());
  System.out.println("String_Node_Str" + (System.currentTimeMillis() - startTime) / 1000);
  factTable=factTableConstructor.load(NamingUtil.getFactTableName("String_Node_Str"),new StopSign());
  System.out.println("String_Node_Str");
  startTime=System.currentTimeMillis();
  assertEquals(factTable.getDimensionInfo()[0].dimensionName,"String_Node_Str");
  assertEquals(factTable.getDimensionInfo()[0].dimensionLength,BigLevelsAndFactTableDataset.dimensionPositionLength[0]);
  assertEquals(factTable.getDimensionInfo()[1].dimensionName,"String_Node_Str");
  assertEquals(factTable.getDimensionInfo()[1].dimensionLength,BigLevelsAndFactTableDataset.dimensionPositionLength[1]);
  assertEquals(factTable.getDimensionInfo()[2].dimensionName,"String_Node_Str");
  assertEquals(factTable.getDimensionInfo()[2].dimensionLength,BigLevelsAndFactTableDataset.dimensionPositionLength[2]);
  assertEquals(factTable.getMeasureInfo()[0].measureName,"String_Node_Str");
  assertEquals(factTable.getMeasureInfo()[0].dataType,DataType.INTEGER_TYPE);
  assertEquals(factTable.getMeasureInfo()[1].measureName,"String_Node_Str");
  assertEquals(factTable.getMeasureInfo()[1].dataType,DataType.DOUBLE_TYPE);
  String[] dimensionNames=new String[3];
  dimensionNames[0]="String_Node_Str";
  dimensionNames[1]="String_Node_Str";
  dimensionNames[2]="String_Node_Str";
  IDiskArray[] dimensionPosition=new IDiskArray[3];
  dimensionPosition[0]=new BufferedPrimitiveDiskArray();
  dimensionPosition[0].add(new Integer(10));
  dimensionPosition[0].add(new Integer(99));
  dimensionPosition[1]=new BufferedPrimitiveDiskArray();
  dimensionPosition[1].add(new Integer(10));
  dimensionPosition[1].add(new Integer(99));
  dimensionPosition[2]=new BufferedPrimitiveDiskArray();
  dimensionPosition[2].add(new Integer(1));
  dimensionPosition[2].add(new Integer(9));
  FactTableRowIterator facttableRowIterator=new FactTableRowIterator(factTable,dimensionNames,dimensionPosition,new StopSign());
  assertTrue(facttableRowIterator != null);
  while (facttableRowIterator.next()) {
    System.out.print(facttableRowIterator.getDimensionPosition(0) + "String_Node_Str" + facttableRowIterator.getDimensionPosition(1)+ "String_Node_Str"+ facttableRowIterator.getDimensionPosition(2)+ "String_Node_Str");
    System.out.println(facttableRowIterator.getMeasure(0) + "String_Node_Str" + facttableRowIterator.getMeasure(1));
  }
  System.out.println("String_Node_Str" + (System.currentTimeMillis() - startTime) / 1000);
}