Source:
public ScriptHandler prepareDistribution(PerfTest perfTest) throws IOException { File perfTestDistDirectory = getDistributionPath(perfTest); User user = perfTest.getCreatedUser(); String scm = perfTest.getScm(); FileEntry scriptEntry; if (isGitHubScript(scm)) { String gitHubConfigName = extractGitHubConfigName(scm); String scriptName = perfTest.getScriptName(); GitHubConfig gitHubConfig = gitHubFileEntryService.getGitHubConfig(user, gitHubConfigName); GitHub gitHub = gitHubFileEntryService.getGitHubClient(gitHubConfig); GHRepository ghRepository = gitHub.getRepository(gitHubConfig.getOwner() + "/" + gitHubConfig.getRepo()); gitHubFileEntryService.checkoutGitHubScript(user, ghRepository, gitHubConfig, scriptName); scriptEntry = gitHubFileEntryService.getOne(user, ghRepository, gitHubConfigName, scriptName); } else { scriptEntry = checkNotNull( fileEntryService.getOne(user, checkNotEmpty(perfTest.getScriptName(), "perfTest should have script name"), getSafe(valueOf(perfTest.getScriptRevision()))), "script should exist"); } ScriptHandler handler = scriptHandlerFactory.getHandler(scriptEntry); ProcessingResultPrintStream processingResult = new ProcessingResultPrintStream(new ByteArrayOutputStream()); handler.prepareDist(perfTest.getId(), user, scriptEntry, perfTestDistDirectory, config.getControllerProperties(), processingResult); LOGGER.info("File write is completed in {}", perfTestDistDirectory); if (!processingResult.isSuccess()) { File logDir = new File(getLogFileDirectory(perfTest), "distribution_log.txt"); try { FileUtils.writeByteArrayToFile(logDir, processingResult.getLogByteArray()); } catch (IOException e) { noOp(); } throw processException("Error while file distribution is prepared."); } return handler; }

Target:
public ScriptHandler prepareDistribution(PerfTest perfTest) throws IOException { File perfTestDistDirectory = getDistributionPath(perfTest); User user = perfTest.getCreatedUser(); String scm = perfTest.getScm(); FileEntry scriptEntry; if (isGitHubScript(scm)) { String gitHubConfigName = extractGitHubConfigName(scm); GitHubConfig gitHubConfig = gitHubFileEntryService.getGitHubConfig(user, gitHubConfigName); GitHub gitHub = gitHubFileEntryService.getGitHubClient(gitHubConfig); GHRepository ghRepository = gitHub.getRepository(gitHubConfig.getOwner() + "/" + gitHubConfig.getRepo()); gitHubFileEntryService.checkoutGitHubScript(perfTest, ghRepository, gitHubConfig); scriptEntry = gitHubFileEntryService.getOne(ghRepository, gitHubConfig, perfTest.getScriptName()); } else { scriptEntry = checkNotNull( fileEntryService.getOne(user, checkNotEmpty(perfTest.getScriptName(), "perfTest should have script name"), getSafe(valueOf(perfTest.getScriptRevision()))), "script should exist"); } ScriptHandler handler = scriptHandlerFactory.getHandler(scriptEntry); ProcessingResultPrintStream processingResult = new ProcessingResultPrintStream(new ByteArrayOutputStream()); handler.prepareDist(perfTest.getId(), user, scriptEntry, perfTestDistDirectory, config.getControllerProperties(), processingResult); LOGGER.info("File write is completed in {}", perfTestDistDirectory); if (!processingResult.isSuccess()) { File logDir = new File(getLogFileDirectory(perfTest), "distribution_log.txt"); try { FileUtils.writeByteArrayToFile(logDir, processingResult.getLogByteArray()); } catch (IOException e) { noOp(); } throw processException("Error while file distribution is prepared."); } return handler; }