Program: 119450
Project: 119450
Buggy source:
@Test public void testDqDemoComplete() throws Exception {
  Assert.assertTrue(dqResManager instanceof FileResourcesUnityManager);
  Iterator path=dqResManager.getPaths().iterator();
  String firstFilePath=((Path)path.next()).toPortableString();
  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 + demoName;
  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 currentContextItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.CONTEXT).size();
  Assert.assertTrue(currentContextItemsSize > 0);
  File tempContextItemsFolder=new File(rootPath + File.separator + contextItemPath);
  List<File> demoContextItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempContextItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoContextItemsFiles.size() > 0);
  Assert.assertEquals(demoContextItemsFiles.size(),currentContextItemsSize);
  int currentConnectionItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.METADATA).size();
  Assert.assertTrue(currentConnectionItemsSize > 0);
  File tempConnItemsFolder=new File(rootPath + File.separator + connectionItemPath);
  List<File> demoConItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempConnItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoConItemsFiles.size() > 0);
  Assert.assertEquals(demoConItemsFiles.size(),currentConnectionItemsSize);
  int currentRoutineItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.ROUTINES).size();
  Assert.assertTrue(currentRoutineItemsSize > 0);
  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.assertEquals(demoRoutineItemsFiles.size() - systemRoutineItemsSize,currentRoutineItemsSize);
  int currentBusinessItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.BUSINESS_PROCESS).size();
  Assert.assertTrue(currentBusinessItemsSize > 0);
  File tempBusinessItemsFolder=new File(rootPath + File.separator + bussniessProcessPath);
  List<File> demoBusinessItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempBusinessItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoBusinessItemsFiles.size() > 0);
  Assert.assertEquals(demoBusinessItemsFiles.size(),currentBusinessItemsSize);
  int currentDocItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.DOCUMENTATION).size();
  Assert.assertTrue(currentDocItemsSize > 0);
  File tempDocItemsFolder=new File(rootPath + File.separator + documentionPath);
  List<File> demoDocItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempDocItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoDocItemsFiles.size() > 0);
  Assert.assertEquals(demoDocItemsFiles.size(),currentDocItemsSize);
  int currentAnaItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT).size();
  Assert.assertTrue(currentAnaItemsSize > 0);
  File tempAnaItemsFolder=new File(rootPath + File.separator + tdqProfilingAnaPath);
  List<File> demoAnaItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempAnaItemsFolder,FileConstants.ANA_EXTENSION,true);
  Assert.assertTrue(demoAnaItemsFiles.size() > 0);
  Assert.assertEquals(demoAnaItemsFiles.size(),currentAnaItemsSize);
  int currentRepItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.TDQ_REPORT_ELEMENT).size();
  Assert.assertTrue(currentRepItemsSize > 0);
  File tempRepItemsFolder=new File(rootPath + File.separator + tdqProfilingRepPath);
  List<File> demoRepItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempRepItemsFolder,FileConstants.REP_EXTENSION,true);
  Assert.assertTrue(demoRepItemsFiles.size() > 0);
  Assert.assertEquals(demoRepItemsFiles.size(),currentRepItemsSize);
  int currentRuleSqlItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.TDQ_RULES_SQL).size();
  Assert.assertTrue(currentRuleSqlItemsSize > 0);
  File tempRuleSqlItemsFolder=new File(rootPath + File.separator + tdqLibrariesRuleSqlPath);
  List<File> demoRuleSqlItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempRuleSqlItemsFolder,FileConstants.RULE_EXTENSION,true);
  Assert.assertTrue(demoRuleSqlItemsFiles.size() > 0);
  Assert.assertEquals(demoRuleSqlItemsFiles.size(),currentRuleSqlItemsSize);
  int currentPatItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.TDQ_PATTERN_ELEMENT).size();
  Assert.assertTrue(currentPatItemsSize > 0);
  File tempPatItemsFolder=new File(rootPath + File.separator + tdqLibrariesPatternPath);
  List<File> demoPatItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempPatItemsFolder,FileConstants.PAT_EXTENSION,true);
  Assert.assertTrue(demoPatItemsFiles.size() > 0);
  Assert.assertEquals(demoPatItemsFiles.size(),currentPatItemsSize);
}

Fixed version (ground truth):
@Test public void testDqDemoComplete() throws Exception {
  Assert.assertTrue(dqResManager instanceof FileResourcesUnityManager);
  Iterator path=dqResManager.getPaths().iterator();
  String firstFilePath=((Path)path.next()).toPortableString();
  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 + demoName;
  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 currentContextItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.CONTEXT).size();
  Assert.assertTrue(currentContextItemsSize > 0);
  File tempContextItemsFolder=new File(rootPath + File.separator + contextItemPath);
  List<File> demoContextItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempContextItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoContextItemsFiles.size() > 0);
  Assert.assertEquals(demoContextItemsFiles.size(),currentContextItemsSize);
  int currentConnectionItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.METADATA).size();
  Assert.assertTrue(currentConnectionItemsSize > 0);
  File tempConnItemsFolder=new File(rootPath + File.separator + connectionItemPath);
  List<File> demoConItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempConnItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoConItemsFiles.size() > 0);
  Assert.assertEquals(demoConItemsFiles.size(),currentConnectionItemsSize);
  int currentRoutineItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.ROUTINES).size();
  Assert.assertTrue(currentRoutineItemsSize > 0);
  File tempRoutineItemsFolder=new File(rootPath + File.separator + routineItemPath);
  List<File> demoRoutineItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempRoutineItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoRoutineItemsFiles.size() > 0);
  Assert.assertEquals(demoRoutineItemsFiles.size(),currentRoutineItemsSize);
  int currentBusinessItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.BUSINESS_PROCESS).size();
  Assert.assertTrue(currentBusinessItemsSize > 0);
  File tempBusinessItemsFolder=new File(rootPath + File.separator + bussniessProcessPath);
  List<File> demoBusinessItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempBusinessItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoBusinessItemsFiles.size() > 0);
  Assert.assertEquals(demoBusinessItemsFiles.size(),currentBusinessItemsSize);
  int currentDocItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.DOCUMENTATION).size();
  Assert.assertTrue(currentDocItemsSize > 0);
  File tempDocItemsFolder=new File(rootPath + File.separator + documentionPath);
  List<File> demoDocItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempDocItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoDocItemsFiles.size() > 0);
  Assert.assertEquals(demoDocItemsFiles.size(),currentDocItemsSize);
  int currentAnaItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT).size();
  Assert.assertTrue(currentAnaItemsSize > 0);
  File tempAnaItemsFolder=new File(rootPath + File.separator + tdqProfilingAnaPath);
  List<File> demoAnaItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempAnaItemsFolder,FileConstants.ANA_EXTENSION,true);
  Assert.assertTrue(demoAnaItemsFiles.size() > 0);
  Assert.assertEquals(demoAnaItemsFiles.size(),currentAnaItemsSize);
  int currentRepItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.TDQ_REPORT_ELEMENT).size();
  Assert.assertTrue(currentRepItemsSize > 0);
  File tempRepItemsFolder=new File(rootPath + File.separator + tdqProfilingRepPath);
  List<File> demoRepItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempRepItemsFolder,FileConstants.REP_EXTENSION,true);
  Assert.assertTrue(demoRepItemsFiles.size() > 0);
  Assert.assertEquals(demoRepItemsFiles.size(),currentRepItemsSize);
  int currentRuleSqlItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.TDQ_RULES_SQL).size();
  Assert.assertTrue(currentRuleSqlItemsSize > 0);
  File tempRuleSqlItemsFolder=new File(rootPath + File.separator + tdqLibrariesRuleSqlPath);
  List<File> demoRuleSqlItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempRuleSqlItemsFolder,FileConstants.RULE_EXTENSION,true);
  Assert.assertTrue(demoRuleSqlItemsFiles.size() > 0);
  Assert.assertEquals(demoRuleSqlItemsFiles.size(),currentRuleSqlItemsSize);
  int currentPatItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.TDQ_PATTERN_ELEMENT).size();
  Assert.assertTrue(currentPatItemsSize > 0);
  File tempPatItemsFolder=new File(rootPath + File.separator + tdqLibrariesPatternPath);
  List<File> demoPatItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempPatItemsFolder,FileConstants.PAT_EXTENSION,true);
  Assert.assertTrue(demoPatItemsFiles.size() > 0);
  Assert.assertEquals(demoPatItemsFiles.size(),currentPatItemsSize);
}