Program: 125406
Project: 125406
Buggy source:
private void testRoutinepropagateFileName(LocalRepositoryFactory factory,String path) throws PersistenceException {
  IProject project=ResourceUtils.getProject(sampleProject);
  RoutineItem routineItem=createTempRoutineItem(factory,path);
  FolderItem folderItem=factory.getFolderItem(sampleProject,ERepositoryObjectType.ROUTINES,new Path(path));
  assertNotNull(routineItem.getParent());
  assertTrue(routineItem.getParent().equals(folderItem));
  String routineId=routineItem.getProperty().getId();
  routineItem.getContent().setInnerContent("String_Node_Str".getBytes());
  factory.save(sampleProject,routineItem);
  factory.unloadUnlockedResources();
  routineItem=(RoutineItem)factory.getLastVersion(sampleProject,routineId).getProperty().getItem();
  String content=new String(routineItem.getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  routineItem.getProperty().setLabel("String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  factory.save(sampleProject,routineItem);
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  routineItem.getProperty().setVersion("String_Node_Str");
  routineItem.getContent().setInnerContent("String_Node_Str".getBytes());
  factory.save(sampleProject,routineItem);
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  factory.unloadUnlockedResources();
  List<IRepositoryViewObject> objects=factory.getAllVersion(sampleProject,routineId,false);
  for (  IRepositoryViewObject object : objects) {
    assertTrue(object instanceof RepositoryObject);
    content=new String(((RoutineItem)object.getProperty().getItem()).getContent().getInnerContent());
    assertTrue(content.equals("String_Node_Str" + object.getProperty().getVersion()));
    folderItem=factory.getFolderItem(sampleProject,ERepositoryObjectType.ROUTINES,new Path(path));
    assertNotNull(object.getProperty().getItem().getParent());
    assertTrue(object.getProperty().getItem().getParent().equals(folderItem));
  }
  routineItem=(RoutineItem)factory.getLastVersion(sampleProject,routineId).getProperty().getItem();
  folderItem=factory.getFolderItem(sampleProject,ERepositoryObjectType.ROUTINES,new Path(path));
  assertNotNull(routineItem.getParent());
  assertTrue(routineItem.getParent().equals(folderItem));
  routineItem.getProperty().setLabel("String_Node_Str");
  factory.save(sampleProject,routineItem);
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  routineItem.getProperty().setVersion("String_Node_Str");
  routineItem.getContent().setInnerContent("String_Node_Str".getBytes());
  factory.save(sampleProject,routineItem);
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  objects=factory.getAllVersion(sampleProject,routineId,false);
  for (  IRepositoryViewObject object : objects) {
    assertTrue(object instanceof RepositoryObject);
    content=new String(((RoutineItem)object.getProperty().getItem()).getContent().getInnerContent());
    assertTrue(content.equals("String_Node_Str" + object.getProperty().getVersion()));
    folderItem=factory.getFolderItem(sampleProject,ERepositoryObjectType.ROUTINES,new Path(path));
    assertNotNull(object.getProperty().getItem().getParent());
    assertTrue(object.getProperty().getItem().getParent().equals(folderItem));
  }
  routineItem=(RoutineItem)factory.getLastVersion(sampleProject,routineId).getProperty().getItem();
  folderItem=factory.getFolderItem(sampleProject,ERepositoryObjectType.ROUTINES,new Path(path));
  assertNotNull(routineItem.getParent());
  assertTrue(routineItem.getParent().equals(folderItem));
  routineItem.getProperty().setVersion("String_Node_Str");
  routineItem.getProperty().setLabel("String_Node_Str");
  routineItem.getContent().setInnerContent("String_Node_Str".getBytes());
  factory.save(sampleProject,routineItem);
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  objects=factory.getAllVersion(sampleProject,routineId,false);
  for (  IRepositoryViewObject object : objects) {
    assertTrue(object instanceof RepositoryObject);
    content=new String(((RoutineItem)object.getProperty().getItem()).getContent().getInnerContent());
    assertTrue(content.equals("String_Node_Str" + object.getProperty().getVersion()));
    folderItem=factory.getFolderItem(sampleProject,ERepositoryObjectType.ROUTINES,new Path(path));
    assertNotNull(object.getProperty().getItem().getParent());
    assertTrue(object.getProperty().getItem().getParent().equals(folderItem));
  }
  factory.deleteObjectPhysical(sampleProject,factory.getLastVersion(sampleProject,routineId));
}

Fixed version (ground truth):
private void testRoutinepropagateFileName(LocalRepositoryFactory factory,String path) throws PersistenceException {
  IProject project=ResourceUtils.getProject(sampleProject);
  RoutineItem routineItem=createTempRoutineItem(factory,path);
  FolderItem folderItem=factory.getFolderItem(sampleProject,ERepositoryObjectType.ROUTINES,new Path(path));
  assertNotNull(routineItem.getParent());
  assertTrue(routineItem.getParent().equals(folderItem));
  String routineId=routineItem.getProperty().getId();
  routineItem.getContent().setInnerContent("String_Node_Str".getBytes());
  factory.save(sampleProject,routineItem);
  factory.unloadUnlockedResources();
  routineItem=(RoutineItem)factory.getLastVersion(sampleProject,routineId).getProperty().getItem();
  String content=new String(routineItem.getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  routineItem.getProperty().setLabel("String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  factory.save(sampleProject,routineItem);
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  routineItem.getProperty().setVersion("String_Node_Str");
  routineItem.getContent().setInnerContent("String_Node_Str".getBytes());
  factory.save(sampleProject,routineItem);
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  factory.unloadUnlockedResources();
  List<IRepositoryViewObject> objects=factory.getAllVersion(sampleProject,routineId,false);
  for (  IRepositoryViewObject object : objects) {
    assertTrue(object instanceof RepositoryObject);
    content=new String(((RoutineItem)object.getProperty().getItem()).getContent().getInnerContent());
    assertTrue(content.equals("String_Node_Str" + object.getProperty().getVersion()));
    folderItem=factory.getFolderItem(sampleProject,ERepositoryObjectType.ROUTINES,new Path(path));
    assertNotNull(object.getProperty().getItem().getParent());
    assertTrue(object.getProperty().getItem().getParent().equals(folderItem));
  }
  routineItem=(RoutineItem)factory.getLastVersion(sampleProject,routineId).getProperty().getItem();
  folderItem=factory.getFolderItem(sampleProject,ERepositoryObjectType.ROUTINES,new Path(path));
  assertNotNull(routineItem.getParent());
  assertTrue(routineItem.getParent().equals(folderItem));
  routineItem.getProperty().setLabel("String_Node_Str");
  factory.save(sampleProject,routineItem);
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  routineItem.getProperty().setVersion("String_Node_Str");
  routineItem.getContent().setInnerContent("String_Node_Str".getBytes());
  factory.save(sampleProject,routineItem);
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  objects=factory.getAllVersion(sampleProject,routineId,false);
  for (  IRepositoryViewObject object : objects) {
    assertTrue(object instanceof RepositoryObject);
    content=new String(((RoutineItem)object.getProperty().getItem()).getContent().getInnerContent());
    assertTrue(content.equals("String_Node_Str" + object.getProperty().getVersion()));
    folderItem=factory.getFolderItem(sampleProject,ERepositoryObjectType.ROUTINES,new Path(path));
    assertNotNull(object.getProperty().getItem().getParent());
    assertTrue(object.getProperty().getItem().getParent().equals(folderItem));
  }
  routineItem=(RoutineItem)factory.getLastVersion(sampleProject,routineId).getProperty().getItem();
  folderItem=factory.getFolderItem(sampleProject,ERepositoryObjectType.ROUTINES,new Path(path));
  assertNotNull(routineItem.getParent());
  assertTrue(routineItem.getParent().equals(folderItem));
  routineItem.getProperty().setVersion("String_Node_Str");
  routineItem.getProperty().setLabel("String_Node_Str");
  routineItem.getContent().setInnerContent("String_Node_Str".getBytes());
  factory.save(sampleProject,routineItem);
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,path,"String_Node_Str","String_Node_Str");
  objects=factory.getAllVersion(sampleProject,routineId,false);
  for (  IRepositoryViewObject object : objects) {
    assertTrue(object instanceof RepositoryObject);
    content=new String(((RoutineItem)object.getProperty().getItem()).getContent().getInnerContent());
    assertTrue(content.equals("String_Node_Str" + object.getProperty().getVersion()));
    folderItem=factory.getFolderItem(sampleProject,ERepositoryObjectType.ROUTINES,new Path(path));
    assertNotNull(object.getProperty().getItem().getParent());
    assertTrue(object.getProperty().getItem().getParent().equals(folderItem));
  }
  factory.deleteObjectPhysical(sampleProject,factory.getLastVersion(sampleProject,routineId),false);
}