Program: 63129
Project: 63129
Buggy source:
@Test public void testNonPartitionedCube() 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(0,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(1,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertTrue("String_Node_Str".equals(initialSegment.getStorageLocationIdentifier()) == false);
  assertEquals("String_Node_Str",initialSegment.getName());
  assertEquals(desc.getCubePartitionDesc().getPartitionDateStart(),cubeInstance.getAllocatedStartDate());
  assertEquals(0,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  cubeMgr.updateSegmentOnJobSucceed(cubeInstance,CubeBuildTypeEnum.BUILD,initialSegment.getName(),"String_Node_Str",System.currentTimeMillis(),111L,222L,333L);
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertEquals(0,cubeInstance.getAllocatedStartDate());
  assertEquals(0,cubeInstance.getAllocatedEndDate());
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  System.out.println("String_Node_Str");
  CubeSegment rebuildSegment=cubeMgr.appendSegments(cubeInstance,1364688000000L,1386806400000L);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(SegmentStatusEnum.NEW,cubeInstance.getBuildingSegments().get(0).getStatus());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.NEW).size());
  assertEquals(1,cubeInstance.getBuildingSegments().size());
  assertEquals(1,cubeInstance.getRebuildingSegments().size());
  assertEquals(0,cubeInstance.getAllocatedStartDate());
  assertEquals(0,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  cubeMgr.updateSegmentOnJobSucceed(cubeInstance,CubeBuildTypeEnum.BUILD,rebuildSegment.getName(),"String_Node_Str",System.currentTimeMillis(),111,222,333);
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(1,cubeInstance.getSegments().size());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertEquals(0,cubeInstance.getAllocatedStartDate());
  assertEquals(0,cubeInstance.getAllocatedEndDate());
  assertEquals("String_Node_Str",cubeInstance.getSegments().get(0).getLastBuildJobID());
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
}

Fixed version (ground truth):
@Test public void testNonPartitionedCube() 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(0,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(1,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertTrue("String_Node_Str".equals(initialSegment.getStorageLocationIdentifier()) == false);
  assertEquals("String_Node_Str",initialSegment.getName());
  assertEquals(desc.getCubePartitionDesc().getPartitionDateStart(),cubeInstance.getAllocatedStartDate());
  assertEquals(0,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  cubeMgr.updateSegmentOnJobSucceed(cubeInstance,CubeBuildTypeEnum.BUILD,initialSegment.getName(),"String_Node_Str",System.currentTimeMillis(),111L,222L,333L);
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertEquals(0,cubeInstance.getAllocatedStartDate());
  assertEquals(0,cubeInstance.getAllocatedEndDate());
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  System.out.println("String_Node_Str");
  CubeSegment rebuildSegment=cubeMgr.appendSegments(cubeInstance,1386806400000L);
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(SegmentStatusEnum.NEW,cubeInstance.getBuildingSegments().get(0).getStatus());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.NEW).size());
  assertEquals(1,cubeInstance.getBuildingSegments().size());
  assertEquals(1,cubeInstance.getRebuildingSegments().size());
  assertEquals(0,cubeInstance.getAllocatedStartDate());
  assertEquals(0,cubeInstance.getAllocatedEndDate());
  System.out.println("String_Node_Str");
  cubeMgr.updateSegmentOnJobSucceed(cubeInstance,CubeBuildTypeEnum.BUILD,rebuildSegment.getName(),"String_Node_Str",System.currentTimeMillis(),111,222,333);
  assertEquals(RealizationStatusEnum.READY,cubeInstance.getStatus());
  assertEquals(1,cubeInstance.getSegments().size());
  assertEquals(1,cubeInstance.getSegments(SegmentStatusEnum.READY).size());
  assertEquals(0,cubeInstance.getBuildingSegments().size());
  assertEquals(0,cubeInstance.getRebuildingSegments().size());
  assertEquals(0,cubeInstance.getAllocatedStartDate());
  assertEquals(0,cubeInstance.getAllocatedEndDate());
  assertEquals("String_Node_Str",cubeInstance.getSegments().get(0).getLastBuildJobID());
  System.out.println(JsonUtil.writeValueAsIndentString(cubeInstance));
}