Program: 63132
Project: 63132
Buggy source:
@Test public void testInitialAndAppend() throws ParseException, IOException {
  CubeDescManager cubeDescMgr=getCubeDescManager();
  CubeDesc desc=cubeDescMgr.getCubeDesc("String_Node_Str");
  createNewCube(desc);
  SimpleDateFormat f=new SimpleDateFormat("String_Node_Str");
  f.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  long dateEnd=f.parse("String_Node_Str").getTime();
  CubeInstance cubeInstance=cubeMgr.getCube("String_Node_Str");
  assertEquals(RealizationStatusEnum.DISABLED,cubeInstance.getStatus());
  assertEquals(0,cubeInstance.getSegments().size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  CubeSegment initialSegment=cubeMgr.appendSegments(cubeInstance,desc.getCubePartitionDesc().getPartitionDateStart(),dateEnd);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.DISABLED,cubeInstance.getStatus());
  assertEquals(SegmentStatusEnum.NEW,cubeInstance.getBuildingSegments().get(0).getStatus());
  assertEquals(1,cubeInstance.getSegments().size());
  assertEquals(1,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertTrue("String_Node_Str".equals(initialSegment.getStorageLocationIdentifier()) == false);
  assertEquals(desc.getCubePartitionDesc().getPartitionDateStart(),cubeInstance.getAllocatedStartDate());
  assertEquals(dateEnd,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  cubeMgr.updateSegmentOnJobSucceed(cubeInstance,CubeBuildTypeEnum.BUILD,initialSegment.getName(),"String_Node_Str",System.currentTimeMillis(),111L,222L,333L);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertEquals(desc.getCubePartitionDesc().getPartitionDateStart(),cubeInstance.getAllocatedStartDate());
  assertEquals(dateEnd,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  long dateEnd2=f.parse("String_Node_Str").getTime();
  CubeSegment incrementalSegment=cubeMgr.appendSegments(cubeInstance,dateEnd,dateEnd2);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(2,cubeInstance.getSegments().size());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.NEW).size());
  assertEquals(1,cubeInstance.getBuildingSegments().size());
  assertEquals(desc.getCubePartitionDesc().getPartitionDateStart(),cubeInstance.getAllocatedStartDate());
  assertEquals(dateEnd2,cubeInstance.getAllocatedEndDate());
  assertEquals(dateEnd,cubeInstance.getBuildingSegments().get(0).getDateRangeStart());
  assertEquals(dateEnd2,cubeInstance.getBuildingSegments().get(0).getDateRangeEnd());
  System.out.println("String_Node_Str");
  cubeMgr.updateSegmentOnJobSucceed(cubeInstance,CubeBuildTypeEnum.BUILD,incrementalSegment.getName(),"String_Node_Str",System.currentTimeMillis(),111L,222L,333L);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(2,cubeInstance.getSegments().size());
  assertEquals(2,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(desc.getCubePartitionDesc().getPartitionDateStart(),cubeInstance.getAllocatedStartDate());
  assertEquals(dateEnd2,cubeInstance.getAllocatedEndDate());
}

Fixed version (ground truth):
@Test public void testInitialAndAppend() throws ParseException, IOException {
  CubeDescManager cubeDescMgr=getCubeDescManager();
  CubeDesc desc=cubeDescMgr.getCubeDesc("String_Node_Str");
  createNewCube(desc);
  SimpleDateFormat f=new SimpleDateFormat("String_Node_Str");
  f.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  long dateEnd=f.parse("String_Node_Str").getTime();
  CubeInstance cubeInstance=cubeMgr.getCube("String_Node_Str");
  assertEquals(RealizationStatusEnum.DISABLED,cubeInstance.getStatus());
  assertEquals(0,cubeInstance.getSegments().size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  CubeSegment initialSegment=cubeMgr.appendSegments(cubeInstance,dateEnd);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.DISABLED,cubeInstance.getStatus());
  assertEquals(SegmentStatusEnum.NEW,cubeInstance.getBuildingSegments().get(0).getStatus());
  assertEquals(1,cubeInstance.getSegments().size());
  assertEquals(1,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertTrue("String_Node_Str".equals(initialSegment.getStorageLocationIdentifier()) == false);
  assertEquals(desc.getCubePartitionDesc().getPartitionDateStart(),cubeInstance.getAllocatedStartDate());
  assertEquals(dateEnd,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  cubeMgr.updateSegmentOnJobSucceed(cubeInstance,CubeBuildTypeEnum.BUILD,initialSegment.getName(),"String_Node_Str",System.currentTimeMillis(),111L,222L,333L);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertEquals(desc.getCubePartitionDesc().getPartitionDateStart(),cubeInstance.getAllocatedStartDate());
  assertEquals(dateEnd,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  long dateEnd2=f.parse("String_Node_Str").getTime();
  CubeSegment incrementalSegment=cubeMgr.appendSegments(cubeInstance,dateEnd2);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(2,cubeInstance.getSegments().size());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.NEW).size());
  assertEquals(1,cubeInstance.getBuildingSegments().size());
  assertEquals(desc.getCubePartitionDesc().getPartitionDateStart(),cubeInstance.getAllocatedStartDate());
  assertEquals(dateEnd2,cubeInstance.getAllocatedEndDate());
  assertEquals(dateEnd,cubeInstance.getBuildingSegments().get(0).getDateRangeStart());
  assertEquals(dateEnd2,cubeInstance.getBuildingSegments().get(0).getDateRangeEnd());
  System.out.println("String_Node_Str");
  cubeMgr.updateSegmentOnJobSucceed(cubeInstance,CubeBuildTypeEnum.BUILD,incrementalSegment.getName(),"String_Node_Str",System.currentTimeMillis(),111L,222L,333L);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(2,cubeInstance.getSegments().size());
  assertEquals(2,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(desc.getCubePartitionDesc().getPartitionDateStart(),cubeInstance.getAllocatedStartDate());
  assertEquals(dateEnd2,cubeInstance.getAllocatedEndDate());
}