Program: 119446
Project: 119446
Buggy source:
@Test public void testBdEeDemoComplete() throws Exception {
  Assert.assertTrue(eeResManager instanceof FileResourcesUnityManager);
  Iterator path=eeResManager.getPaths().iterator();
  String firstFilePath=((Path)path.next()).toPortableString();
  String eeDemoName=demoName.substring(0,demoName.indexOf("String_Node_Str"));
  String tempFolderPath=firstFilePath.substring(0,firstFilePath.indexOf(TEMP_FOLDER_SUFFIEX) + TEMP_FOLDER_SUFFIEX.length());
  Assert.assertTrue(new File(tempFolderPath).exists());
  String rootPath=tempFolderPath + File.separator + eeDemoName;
  Assert.assertTrue(new File(rootPath).exists());
  File tempJobsFolder=new File(rootPath + File.separator + processItemPath);
  List<File> demoJobItemFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempJobsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoJobItemFiles.size() > 0);
  int currentJobItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.PROCESS).size();
  Assert.assertTrue(currentJobItemsSize > 0);
  Assert.assertEquals(demoJobItemFiles.size(),currentJobItemsSize);
  int currentMrItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.PROCESS_MR).size();
  File tempMrItemsFolder=new File(rootPath + File.separator + processMrPath);
  List<File> demoMrItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempMrItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoMrItemsFiles.size() > 0);
  Assert.assertTrue(currentMrItemsSize > 0);
  Assert.assertEquals(demoMrItemsFiles.size(),currentMrItemsSize);
  int currentContextItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.CONTEXT).size();
  File tempContextItemsFolder=new File(rootPath + File.separator + contextItemPath);
  List<File> demoContextItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempContextItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoContextItemsFiles.size() > 0);
  Assert.assertTrue(currentContextItemsSize > 0);
  Assert.assertEquals(demoContextItemsFiles.size(),currentContextItemsSize);
  int currentRoutineItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.ROUTINES).size();
  int systemRoutineItemsSize=13;
  File tempRoutineItemsFolder=new File(rootPath + File.separator + routineItemPath);
  List<File> demoRoutineItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempRoutineItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoRoutineItemsFiles.size() > 0);
  Assert.assertTrue(currentRoutineItemsSize > 0);
  Assert.assertEquals(demoRoutineItemsFiles.size() - systemRoutineItemsSize,currentRoutineItemsSize);
  int currentConnectionItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.METADATA).size();
  int currentHadoopConnItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.valueOf(ERepositoryObjectType.class,"String_Node_Str")).size();
  File tempConnItemsFolder=new File(rootPath + File.separator + connectionItemPath);
  List<File> demoConItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempConnItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoConItemsFiles.size() > 0);
  Assert.assertTrue(currentConnectionItemsSize > 0);
  Assert.assertEquals(demoConItemsFiles.size(),currentConnectionItemsSize);
  int currentSqlPatternSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.SQLPATTERNS).size();
  File tempSqlPatternFolder=new File(rootPath + File.separator + sqlPatternPath);
  List<File> demoSqlPatternFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempSqlPatternFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoSqlPatternFiles.size() > 0);
  Assert.assertTrue(currentSqlPatternSize == 0);
  int currentDocItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.DOCUMENTATION).size();
  File tempDocItemsFolder=new File(rootPath + File.separator + documentionPath);
  List<File> demoDocItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempDocItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoDocItemsFiles.size() > 0);
  Assert.assertTrue(currentDocItemsSize > 0);
  Assert.assertEquals(demoDocItemsFiles.size(),currentDocItemsSize);
}

Fixed version (ground truth):
@Test public void testBdEeDemoComplete() throws Exception {
  Assert.assertTrue(eeResManager instanceof FileResourcesUnityManager);
  Iterator path=eeResManager.getPaths().iterator();
  String firstFilePath=((Path)path.next()).toPortableString();
  String eeDemoName=demoName.substring(0,demoName.indexOf("String_Node_Str"));
  String tempFolderPath=firstFilePath.substring(0,firstFilePath.indexOf(TEMP_FOLDER_SUFFIEX) + TEMP_FOLDER_SUFFIEX.length());
  Assert.assertTrue(new File(tempFolderPath).exists());
  String rootPath=tempFolderPath + File.separator + eeDemoName;
  Assert.assertTrue(new File(rootPath).exists());
  File tempJobsFolder=new File(rootPath + File.separator + processItemPath);
  List<File> demoJobItemFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempJobsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoJobItemFiles.size() > 0);
  int currentJobItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.PROCESS).size();
  Assert.assertTrue(currentJobItemsSize > 0);
  Assert.assertEquals(demoJobItemFiles.size(),currentJobItemsSize);
  int currentMrItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.PROCESS_MR).size();
  File tempMrItemsFolder=new File(rootPath + File.separator + processMrPath);
  List<File> demoMrItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempMrItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoMrItemsFiles.size() > 0);
  Assert.assertTrue(currentMrItemsSize > 0);
  Assert.assertEquals(demoMrItemsFiles.size(),currentMrItemsSize);
  int currentContextItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.CONTEXT).size();
  File tempContextItemsFolder=new File(rootPath + File.separator + contextItemPath);
  List<File> demoContextItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempContextItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoContextItemsFiles.size() > 0);
  Assert.assertTrue(currentContextItemsSize > 0);
  Assert.assertEquals(demoContextItemsFiles.size(),currentContextItemsSize);
  int currentRoutineItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.ROUTINES).size();
  File tempRoutineItemsFolder=new File(rootPath + File.separator + routineItemPath);
  List<File> demoRoutineItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempRoutineItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoRoutineItemsFiles.size() > 0);
  Assert.assertTrue(currentRoutineItemsSize > 0);
  Assert.assertEquals(demoRoutineItemsFiles.size(),currentRoutineItemsSize);
  int currentConnectionItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.METADATA).size();
  int currentHadoopConnItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.valueOf(ERepositoryObjectType.class,"String_Node_Str")).size();
  File tempConnItemsFolder=new File(rootPath + File.separator + connectionItemPath);
  List<File> demoConItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempConnItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoConItemsFiles.size() > 0);
  Assert.assertTrue(currentConnectionItemsSize > 0);
  Assert.assertEquals(demoConItemsFiles.size(),currentConnectionItemsSize);
  int currentDocItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.DOCUMENTATION).size();
  File tempDocItemsFolder=new File(rootPath + File.separator + documentionPath);
  List<File> demoDocItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempDocItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoDocItemsFiles.size() > 0);
  Assert.assertTrue(currentDocItemsSize > 0);
  Assert.assertEquals(demoDocItemsFiles.size(),currentDocItemsSize);
}