Program: 125413
Project: 125413
Buggy source:
/** 
 * Test method for  {@link org.talend.repository.localprovider.model.LocalRepositoryFactory#deleteObjectPhysical(org.talend.core.model.general.Project,org.talend.core.model.repository.IRepositoryViewObject)}.
 * @throws PersistenceException
 * @throws IOException
 * @throws BusinessException
 */
@Test public void testDeleteObjectPhysical() throws PersistenceException, IOException, BusinessException {
  repositoryFactory.logOnProject(sampleProject);
  Property property=PropertiesFactory.eINSTANCE.createProperty();
  property.setAuthor(sampleProject.getAuthor());
  property.setVersion(VersionUtils.DEFAULT_VERSION);
  property.setLabel("String_Node_Str");
  property.setDisplayName("String_Node_Str");
  property.setStatusCode("String_Node_Str");
  property.setId(repositoryFactory.getNextId());
  DatabaseConnectionItem conItem=PropertiesFactory.eINSTANCE.createDatabaseConnectionItem();
  conItem.setProperty(property);
  DatabaseConnection dbcon=ConnectionFactory.eINSTANCE.createDatabaseConnection();
  conItem.setConnection(dbcon);
  assertNull(conItem.eResource());
  repositoryFactory.create(sampleProject,conItem,new Path("String_Node_Str"),false);
  assertNotNull(conItem.eResource());
  IProject project=ResourceUtils.getProject(sampleProject.getTechnicalLabel());
  checkFileExists(project,ERepositoryObjectType.METADATA_CONNECTIONS,"String_Node_Str","String_Node_Str",VersionUtils.DEFAULT_VERSION);
  IFile fileItem=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.METADATA_CONNECTIONS) + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ VersionUtils.DEFAULT_VERSION+ "String_Node_Str"));
  URI uri=URI.createPlatformResourceURI(fileItem.getFullPath().toString(),false);
  Resource resource=repositoryFactory.xmiResourceManager.resourceSet.getResource(uri,false);
  resource.unload();
  File file=new File(fileItem.getLocationURI());
  FileWriter fw=new FileWriter(file);
  fw.write("String_Node_Str");
  fw.close();
  Resource resource2;
  try {
    resource2=repositoryFactory.xmiResourceManager.resourceSet.getResource(uri,true);
    repositoryFactory.xmiResourceManager.resourceSet.getResources().add(resource2);
  }
 catch (  Exception e) {
    resource2=null;
  }
  repositoryFactory.deleteObjectPhysical(sampleProject,new RepositoryObject(property));
  checkFileNotExists(project,ERepositoryObjectType.METADATA_CONNECTIONS,"String_Node_Str","String_Node_Str",VersionUtils.DEFAULT_VERSION);
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.talend.repository.localprovider.model.LocalRepositoryFactory#deleteObjectPhysical(org.talend.core.model.general.Project,org.talend.core.model.repository.IRepositoryViewObject)}.
 * @throws PersistenceException
 * @throws IOException
 * @throws BusinessException
 */
@Test public void testDeleteObjectPhysical() throws PersistenceException, IOException, BusinessException {
  repositoryFactory.logOnProject(sampleProject);
  Property property=PropertiesFactory.eINSTANCE.createProperty();
  property.setAuthor(sampleProject.getAuthor());
  property.setVersion(VersionUtils.DEFAULT_VERSION);
  property.setLabel("String_Node_Str");
  property.setDisplayName("String_Node_Str");
  property.setStatusCode("String_Node_Str");
  property.setId(repositoryFactory.getNextId());
  DatabaseConnectionItem conItem=PropertiesFactory.eINSTANCE.createDatabaseConnectionItem();
  conItem.setProperty(property);
  DatabaseConnection dbcon=ConnectionFactory.eINSTANCE.createDatabaseConnection();
  conItem.setConnection(dbcon);
  assertNull(conItem.eResource());
  repositoryFactory.create(sampleProject,conItem,new Path("String_Node_Str"),false);
  assertNotNull(conItem.eResource());
  IProject project=ResourceUtils.getProject(sampleProject.getTechnicalLabel());
  checkFileExists(project,ERepositoryObjectType.METADATA_CONNECTIONS,"String_Node_Str","String_Node_Str",VersionUtils.DEFAULT_VERSION);
  IFile fileItem=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.METADATA_CONNECTIONS) + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ VersionUtils.DEFAULT_VERSION+ "String_Node_Str"));
  URI uri=URI.createPlatformResourceURI(fileItem.getFullPath().toString(),false);
  Resource resource=repositoryFactory.xmiResourceManager.resourceSet.getResource(uri,false);
  resource.unload();
  File file=new File(fileItem.getLocationURI());
  FileWriter fw=new FileWriter(file);
  fw.write("String_Node_Str");
  fw.close();
  Resource resource2;
  try {
    resource2=repositoryFactory.xmiResourceManager.resourceSet.getResource(uri,true);
    repositoryFactory.xmiResourceManager.resourceSet.getResources().add(resource2);
  }
 catch (  Exception e) {
    resource2=null;
  }
  repositoryFactory.deleteObjectPhysical(sampleProject,new RepositoryObject(property),false);
  checkFileNotExists(project,ERepositoryObjectType.METADATA_CONNECTIONS,"String_Node_Str","String_Node_Str",VersionUtils.DEFAULT_VERSION);
}