auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void scanFile(InputFile inputFile) { PythonFile pythonFile = SonarQubePythonFile.create(inputFile); PythonVisitorContext visitorContext; try { AstNode astNode = parser.parse(pythonFile.content()); PyFileInputTree parse = new PythonTreeMaker().fileInput(astNode); visitorContext = new PythonVisitorContext(astNode, parse, pythonFile); List<PythonSubscriptionCheck> checksBasedOnTree = checks.all().stream() .filter(check -> check instanceof PythonSubscriptionCheck) .map(check -> (PythonSubscriptionCheck) check) .collect(Collectors.toList()); SubscriptionVisitor.analyze(checksBasedOnTree, visitorContext, parse); saveMeasures(inputFile, visitorContext); } catch (RecognitionException e) { visitorContext = new PythonVisitorContext(pythonFile, e); LOG.error("Unable to parse file: " + inputFile.toString()); LOG.error(e.getMessage()); context.newAnalysisError() .onFile(inputFile) .at(inputFile.newPointer(e.getLine(), 0)) .message(e.getMessage()) .save(); } for (PythonCheck check : checks.all()) { check.scanFile(visitorContext); } saveIssues(inputFile, visitorContext.getIssues()); new PythonHighlighter(context, inputFile).scanFile(visitorContext); }

Target:
private void scanFile(InputFile inputFile) { PythonFile pythonFile = SonarQubePythonFile.create(inputFile); PythonVisitorContext visitorContext; try { AstNode astNode = parser.parse(pythonFile.content()); PyFileInputTree parse = new PythonTreeMaker().fileInput(astNode); visitorContext = new PythonVisitorContext(astNode, parse, pythonFile); saveMeasures(inputFile, visitorContext); } catch (RecognitionException e) { visitorContext = new PythonVisitorContext(pythonFile, e); LOG.error("Unable to parse file: " + inputFile.toString()); LOG.error(e.getMessage()); context.newAnalysisError() .onFile(inputFile) .at(inputFile.newPointer(e.getLine(), 0)) .message(e.getMessage()) .save(); } List<PythonSubscriptionCheck> checksBasedOnTree = new ArrayList<>(); for (PythonCheck check : checks.all()) { if (check instanceof PythonSubscriptionCheck) { checksBasedOnTree.add((PythonSubscriptionCheck) check); } else { check.scanFile(visitorContext); } } SubscriptionVisitor.analyze(checksBasedOnTree, visitorContext); saveIssues(inputFile, visitorContext.getIssues()); new PythonHighlighter(context, inputFile).scanFile(visitorContext); }
Source:
private synchronized boolean checkAndSubmitNextTask() { boolean submittedNewTask = false; if ((future == null) || future.isCancelled() || future.isDone()) { if ((future != null) && future.isDone()) { try { TaskResult result = future.get(); if (result.getException() != null) { log.error("Caught exception running task: ", currentTask.taskType(), result.getException()); } } catch (InterruptedException | ExecutionException e) { log.warn("{} task encountered exception.", currentTask.taskType(), e); } } currentTask = new MetricsCollectingTaskDecorator( new ShardSyncTask(shardDetector, leaseRefresher, initialPositionInStream, cleanupLeasesUponShardCompletion, ignoreUnexpectedChildShards, shardSyncIdleTimeMillis, hierarchichalShardSyncer, metricsFactory), metricsFactory); future = executorService.submit(currentTask); submittedNewTask = true; if (log.isDebugEnabled()) { log.debug("Submitted new task.", currentTask.taskType()); } } else { if (log.isDebugEnabled()) { log.debug("Previous task still pending. Not submitting new task.", currentTask.taskType()); } } return submittedNewTask; }

Target:
private synchronized boolean checkAndSubmitNextTask() { boolean submittedNewTask = false; if ((future == null) || future.isCancelled() || future.isDone()) { if ((future != null) && future.isDone()) { try { TaskResult result = future.get(); if (result.getException() != null) { log.error("Caught exception running task: ", currentTask.taskType(), result.getException()); } } catch (InterruptedException | ExecutionException e) { log.warn("{} task encountered exception.", currentTask.taskType(), e); } } currentTask = new MetricsCollectingTaskDecorator( new ShardSyncTask(shardDetector, leaseRefresher, initialPositionInStream, cleanupLeasesUponShardCompletion, ignoreUnexpectedChildShards, shardSyncIdleTimeMillis, hierarchicalShardSyncer, metricsFactory), metricsFactory); future = executorService.submit(currentTask); submittedNewTask = true; if (log.isDebugEnabled()) { log.debug("Submitted new task.", currentTask.taskType()); } } else { if (log.isDebugEnabled()) { log.debug("Previous task still pending. Not submitting new task.", currentTask.taskType()); } } return submittedNewTask; }
Source:
private static void validateListOfSuppressionXpathFilterIncompatibleChecks(Node subSection) { final boolean found = XmlUtil.findChildElementsByTag(subSection, "ul").stream() .anyMatch(node -> { final Set<String> checks = XmlUtil.getChildrenElements(node).stream() .map(Node::getTextContent) .collect(Collectors.toSet()); return XpathRegressionTest.INCOMPATIBLE_CHECK_NAMES.equals(checks); }); assertTrue(found, "Incompatible check list should match XpathRegressionTest.INCOMPATIBLE_CHECK_NAMES"); }

Target:
private static void validateListOfSuppressionXpathFilterIncompatibleChecks(Node subSection) { assertWithMessage( "Incompatible check list should match XpathRegressionTest.INCOMPATIBLE_CHECK_NAMES") .that(getListById(subSection, "SuppressionXpathFilter_IncompatibleChecks")) .isEqualTo(XpathRegressionTest.INCOMPATIBLE_CHECK_NAMES); assertWithMessage( "Javadoc check list should match XpathRegressionTest.INCOMPATIBLE_JAVADOC_CHECK_NAMES") .that(getListById(subSection, "SuppressionXpathFilter_JavadocChecks")) .isEqualTo(XpathRegressionTest.INCOMPATIBLE_JAVADOC_CHECK_NAMES); }
Source:
public void removeNodeSource(final String sourceName) { rmdbManagerBuffer.setNodeSourceRemovedFlag(sourceName); final Collection<RMNodeData> relatedNodes = getNodesByNodeSource(sourceName); logger.debug("Removing nodes linked to the node source " + sourceName + " from the database"); removeNodes(relatedNodes); executeReadWriteTransaction(new SessionWork<Void>() { @Override public Void doInTransaction(Session session) { logger.debug("Removing the node source " + sourceName + " from the database"); session.getNamedQuery("deleteNodeSourceDataByName").setParameter("name", sourceName).executeUpdate(); return null; } }); }

Target:
public void removeNodeSource(final String sourceName) { rmdbManagerBuffer.removeKnownNodeSourceAndPendingUpdates(sourceName); final Collection<RMNodeData> relatedNodes = getNodesByNodeSource(sourceName); logger.info("Removing nodes linked to the node source " + sourceName + " from the database"); removeNodes(relatedNodes); executeReadWriteTransaction(new SessionWork<Void>() { @Override public Void doInTransaction(Session session) { logger.info("Removing the node source " + sourceName + " from the database"); session.getNamedQuery("deleteNodeSourceDataByName").setParameter("name", sourceName).executeUpdate(); return null; } }); }
Source:
private void verifyDetail(String expected, WebElement detailField) { if (expected.isEmpty()) { assertTrue(isElementPresent(By.id("not-specified"))); } else { assertEquals(expected, detailField.getText()); } }

Target:
private void verifyDetail(String expected, WebElement detailField) { if (expected.isEmpty()) { assertEquals(NOT_SPECIFIED_LABEL, detailField.getText()); } else { assertEquals(expected, detailField.getText()); } }
Source:
public String toString() { return "Time period " + seconds + " s."; }

Target:
public String toString() { return "Time period " + seconds + " s (factor " + FACTOR + " was used)."; }
Source:
public boolean execute(CommandSender sender, String[] args) { if(args.length == 0) { if(!(sender instanceof Player)) { sender.sendMessage(ChatColor.RED + "Non-players need to specify a player to look up"); return true; } sender.sendMessage(ChatColor.GREEN + "You are currently in the shard '" + MercuryAPI.serverName() + "'"); return true; } else { if(!(sender.isOp() || (sender instanceof ConsoleCommandSender))) { sender.sendMessage(ChatColor.RED + "You cannot look up the shard of another player!"); return true; } PlayerDetails details; UUID player = UUID.fromString(args[0]); if(player != null) { details = MercuryAPI.getServerforAccount(player); } else { details = MercuryAPI.getServerforPlayer(args[0]); } if(details == null) { sender.sendMessage(ChatColor.RED + "Player not found!"); return true; } else { sender.sendMessage(ChatColor.GREEN + args[0] + " is on the shard '" + details.getServerName() + "'"); return true; } } }

Target:
public boolean execute(CommandSender sender, String[] args) { if(args.length == 0) { if(!(sender instanceof Player)) { sender.sendMessage(ChatColor.RED + "Non-players need to specify a player to look up."); return true; } sender.sendMessage(ChatColor.GREEN + "[BetterShards] You are currently in the shard '" + MercuryAPI.serverName() + "'."); return true; } else { if(!(sender.isOp() || (sender instanceof ConsoleCommandSender))) { sender.sendMessage(ChatColor.RED + "You cannot look up the shard of another player!"); return true; } PlayerDetails details; UUID player = null; try { player = UUID.fromString(args[0]); } catch (IllegalArgumentException iaex) if(player != null) { details = MercuryAPI.getServerforAccount(player); } else { details = MercuryAPI.getServerforPlayer(args[0]); } if(details == null) { sender.sendMessage(ChatColor.RED + "Player not found!"); return true; } else { sender.sendMessage(ChatColor.GREEN + args[0] + " is on the shard '" + details.getServerName() + "'."); return true; } } }
Source:
public final SerializableError getError() { return SerializableError.of( "Refer to the server logs with this errorId: " + getErrorId(), this.getClass()); }

Target:
public SerializableError getError() { return SerializableError.of( "Refer to the server logs with this errorId: " + getErrorId(), this.getClass()); }
Source:
public int getKeyBufferValueSize() { return Long.BYTES + Byte.BYTES; }

Target:
public int getKeyBufferValueSize() { return Long.BYTES; }
Source:
public boolean performNextOperation(int completedChildCount) { if (getParameters().getLiveDiskMigrateStage() == LiveDiskMigrateStage.IMAGE_PLACEHOLDER_CREATION) { updateStage(LiveDiskMigrateStage.VM_REPLICATE_START); replicateDiskStart(); updateStage(LiveDiskMigrateStage.IMAGE_DATA_SYNC_EXEC_START); syncImageData(); updateStage(LiveDiskMigrateStage.IMAGE_DATA_SYNC_EXEC_END); return true; } if (getParameters().getLiveDiskMigrateStage() == LiveDiskMigrateStage.IMAGE_DATA_SYNC_EXEC_END) { completeLiveMigration(); updateStage(LiveDiskMigrateStage.SOURCE_IMAGE_DELETION); removeImage(getParameters().getSourceStorageDomainId()); return false; } return false; }

Target:
public boolean performNextOperation(int completedChildCount) { if (getParameters().getLiveDiskMigrateStage() == LiveDiskMigrateStage.IMAGE_PLACEHOLDER_CREATION) { updateStage(LiveDiskMigrateStage.VM_REPLICATE_DISK_START); replicateDiskStart(); updateStage(LiveDiskMigrateStage.IMAGE_DATA_SYNC_EXEC_START); syncImageData(); updateStage(LiveDiskMigrateStage.IMAGE_DATA_SYNC_EXEC_END); return true; } if (getParameters().getLiveDiskMigrateStage() == LiveDiskMigrateStage.IMAGE_DATA_SYNC_EXEC_END) { updateStage(LiveDiskMigrateStage.VM_REPLICATE_DISK_FINISH); completeLiveMigration(); updateStage(LiveDiskMigrateStage.SOURCE_IMAGE_DELETION); removeImage(getParameters().getSourceStorageDomainId()); return false; } return false; }
Source:
private void checkoutCommit(RevCommit commit) throws IOException { try { monitor.beginTask( "Rewinding to commit " + commit.getShortMessage(), ProgressMonitor.UNKNOWN); RevCommit head = walk.parseCommit(repo.resolve(Constants.HEAD)); DirCacheCheckout dco = new DirCacheCheckout(repo, head.getTree() .getId(), repo.lockDirCache(), commit.getTree().getId()); dco.setFailOnConflict(true); dco.checkout(); walk.release(); RefUpdate refUpdate = repo.updateRef(Constants.HEAD, true); refUpdate.setExpectedOldObjectId(head); refUpdate.setNewObjectId(commit); Result res = refUpdate.forceUpdate(); switch (res) { case FAST_FORWARD: case NO_CHANGE: case FORCED: break; default: throw new IOException("Could not rewind to upstream commit"); } } finally { monitor.endTask(); } }

Target:
private void checkoutCommit(RevCommit commit) throws IOException { try { monitor.beginTask( "Rewinding to commit " + commit.getShortMessage(), ProgressMonitor.UNKNOWN); RevCommit head = walk.parseCommit(repo.resolve(Constants.HEAD)); DirCacheCheckout dco = new DirCacheCheckout(repo, head.getTree(), repo.lockDirCache(), commit.getTree()); dco.setFailOnConflict(true); dco.checkout(); RefUpdate refUpdate = repo.updateRef(Constants.HEAD, true); refUpdate.setExpectedOldObjectId(head); refUpdate.setNewObjectId(commit); Result res = refUpdate.forceUpdate(); switch (res) { case FAST_FORWARD: case NO_CHANGE: case FORCED: break; default: throw new IOException("Could not rewind to upstream commit"); } } finally { walk.release(); monitor.endTask(); } }
Source:
public double getSetupTime(Config conf) { String aoSystem = (String) conf.getItemValue(AOConstants.AO_SYSTEM_KEY); String guideStarType = (String) conf.getItemValue(AOConstants.AO_GUIDE_STAR_TYPE_KEY); String slitWidth = (String) conf.getItemValue(GNIRSConstants.SLIT_WIDTH_KEY); if (conf.containsItem(AOConstants.AO_SYSTEM_KEY) && aoSystem.equals(SPComponentType.AO_ALTAIR.narrowType) && guideStarType.equals(AltairParams.GuideStarType.LGS.displayValue())) { return getSetupTimeLgs(); } if (slitWidth.equals(GNIRSParams.SlitWidth.IFU)) { return getSetupTimeIfu(); } else { return getSetupTime(); } }

Target:
public double getSetupTime(Config conf) { if (conf.containsItem(AOConstants.AO_SYSTEM_KEY)) { GuideStarType guideStarType = (GuideStarType) conf.getItemValue(AOConstants.AO_GUIDE_STAR_TYPE_KEY); if (guideStarType.equals(AltairParams.GuideStarType.LGS)) { return getSetupTimeLgs(); } } SlitWidth slitWidth = (SlitWidth) conf.getItemValue(GNIRSConstants.SLIT_WIDTH_KEY); if (slitWidth.equals(GNIRSParams.SlitWidth.IFU)) { return getSetupTimeIfu(); } else { return getSetupTime(); } }
Source:
public void statisticsGeneratorStepShouldCalculateStats() throws IOException, InterruptedException { jobOptions.getPipelineOptions().put(JobParametersNames.INPUT_VCF, SMALL_VCF_FILE); mongoRule.importDump(getResourceUrl(MONGO_DUMP), jobOptions.getDbName()); VariantSource source = configureVariantSource(); configureTempOutput(); File statsFile = getStatsFile(source); assertFalse(statsFile.exists()); JobExecution jobExecution = jobLauncherTestUtils.launchStep(PopulationStatisticsFlow.CALCULATE_STATISTICS); assertEquals(ExitStatus.COMPLETED, jobExecution.getExitStatus()); assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus()); assertTrue(statsFile.exists()); }

Target:
public void statisticsGeneratorStepShouldCalculateStats() throws IOException, InterruptedException { jobOptions.getPipelineOptions().put(JobParametersNames.INPUT_VCF, SMALL_VCF_FILE); mongoRule.restoreDump(getResourceUrl(MONGO_DUMP), jobOptions.getDbName()); VariantSource source = configureVariantSource(); configureTempOutput(); File statsFile = getStatsFile(source); assertFalse(statsFile.exists()); JobExecution jobExecution = jobLauncherTestUtils.launchStep(PopulationStatisticsFlow.CALCULATE_STATISTICS); assertEquals(ExitStatus.COMPLETED, jobExecution.getExitStatus()); assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus()); assertTrue(statsFile.exists()); }
Source:
public CommandCallback getCallback() { return getParameters().isUseCinderCommandCallback() ? new GenericCinderCommandCallback<RemoveVmCommand<T>>() : null; }

Target:
public CommandCallback getCallback() { return getParameters().isUseCommandCallback() ? new ConcurrentChildCommandsExecutionCallback() : null; }
Source:
public boolean voteMatch(AffMatchAffiliation affiliation, AffMatchOrganization organization) { List<String> affSections = organizationSectionsSplitter.splitToSections(affiliation.getOrganizationName()); String filteredOrgName = filterName(organization.getName()); if (StringUtils.isEmpty(filteredOrgName)) { return false; } Set<String> orgWords = Sets.newHashSet(StringUtils.split(filteredOrgName)); for (String affSection : affSections) { String filteredAffSectionName = filterName(affSection); if (StringUtils.isEmpty(filteredAffSectionName)) { continue; } Set<String> affWords = Sets.newHashSet(StringUtils.split(filteredAffSectionName)); if (voteSectionMatch(affWords, orgWords)) { return true; } } return false; }

Target:
public boolean voteMatch(AffMatchAffiliation affiliation, AffMatchOrganization organization) { String filteredOrgName = stringFilter.filterCharsAndShortWords(organization.getName(), charsToFilter, wordToRemoveMaxLength); if (StringUtils.isEmpty(filteredOrgName)) { return false; } Set<String> orgWords = Sets.newHashSet(StringUtils.split(filteredOrgName)); List<String> affSections = organizationSectionsSplitter.splitToSections(affiliation.getOrganizationName()); for (String affSection : affSections) { String filteredAffSectionName = stringFilter.filterCharsAndShortWords(affSection, charsToFilter, wordToRemoveMaxLength); if (StringUtils.isEmpty(filteredAffSectionName)) { continue; } Set<String> affWords = Sets.newHashSet(StringUtils.split(filteredAffSectionName)); if (voteSectionMatch(affWords, orgWords)) { return true; } } return false; }
Source:
private void checkTimeout(long timeout, TimeUnit unit) { if (timeout < 0) { throw new IllegalArgumentException("'timeout' most be >= 0. It was: " + timeout); } if (unit == null) { throw new IllegalArgumentException("Non-null 'unit' required"); } }

Target:
private void checkTimeout(long timeout, TimeUnit unit) { if (timeout <= 0) { throw new IllegalArgumentException("'timeout' must be > 0. It was: " + timeout); } if (unit == null) { throw new IllegalArgumentException("Non-null 'unit' required"); } }
Source:
public void testDefault() throws Exception { CSVAssert csv = csvAssert(document); csv.has("repository").isEquals("test"); csv.has("uid").isEquals(document.getId()); csv.has("path").isEquals("/myDoc"); csv.has("type").isEquals("File"); csv.has("state").isEquals("project"); csv.has("parentRef").isEquals(document.getParentRef().toString()); csv.has("isCheckedOut").isTrue(); csv.has("isVersion").isFalse(); csv.has("isProxy").isFalse(); csv.has("isTrashed").isFalse(); csv.has("changeToken").isNull(); csv.has("title").isEquals("myDoc"); csv.has("dc:description").isEquals("There is a , in the description"); csv.has("dc:contributors").isEquals("John" + LIST_DELIMITER + "Jane"); csv.has("dc:nature").isEquals("article"); csv.has("dc:nature[label]").isEquals("Article EN"); csv.has("dc:subjects[label]").isEquals("Art" + LIST_DELIMITER + NULL_PROPERTY_LABEL); }

Target:
public void testDefault() throws Exception { CSVAssert csv = csvAssert(document); csv.has("repository").isEquals("test"); csv.has("uid").isEquals(document.getId()); csv.has("path").isEquals("/myDoc"); csv.has("type").isEquals("File"); csv.has("state").isEquals("project"); csv.has("parentRef").isEquals(document.getParentRef().toString()); csv.has("isCheckedOut").isTrue(); csv.has("isVersion").isFalse(); csv.has("isProxy").isFalse(); csv.has("isTrashed").isFalse(); csv.has("changeToken").isNull(); csv.has("title").isEquals("myDoc"); csv.has("dc:description").isEquals("There is a , in the description"); csv.has("dc:contributors").isEquals("John\nJane"); csv.has("dc:nature").isEquals("article"); csv.has("dc:nature[label]").isEquals("Article EN"); csv.has("dc:subjects[label]").isEquals("Art\nnull property"); }
Source:
public PortfolioItemSummary summarize() { StringBuilder buf = new StringBuilder(96); CmsLeg mainLeg = product.getCmsLeg(); buf.append(SummarizerUtils.datePeriod(mainLeg.getStartDate().getUnadjusted(), mainLeg.getEndDate().getUnadjusted())); buf.append(' '); buf.append(SummarizerUtils.amount(mainLeg.getCurrency(), mainLeg.getNotional().getInitialValue())); buf.append(' '); if (mainLeg.getPayReceive().isReceive()) { buf.append("Rec "); summarizeMainLeg(mainLeg, buf); buf.append(getPremium().isPresent() ? " / Pay Premium" : (product.getPayLeg().isPresent() ? " / Pay Periodic" : "")); } else { buf.append("Rec "); buf.append(getPremium().isPresent() ? "Premium" : (product.getPayLeg().isPresent() ? "Periodic" : "")); buf.append(" / Pay "); summarizeMainLeg(mainLeg, buf); } buf.append(" : "); buf.append(SummarizerUtils.dateRange(mainLeg.getStartDate().getUnadjusted(), mainLeg.getEndDate().getUnadjusted())); return SummarizerUtils.summary(this, ProductType.CMS, buf.toString(), mainLeg.getCurrency()); }

Target:
public PortfolioItemSummary summarize() { StringBuilder buf = new StringBuilder(96); CmsLeg mainLeg = product.getCmsLeg(); buf.append(SummarizerUtils.datePeriod(mainLeg.getStartDate().getUnadjusted(), mainLeg.getEndDate().getUnadjusted())); buf.append(' '); buf.append(SummarizerUtils.amount(mainLeg.getCurrency(), mainLeg.getNotional().getInitialValue())); buf.append(' '); if (mainLeg.getPayReceive().isReceive()) { buf.append("Rec "); summarizeMainLeg(mainLeg, buf); buf.append(getPremium().isPresent() ? " / Pay Premium" : (product.getPayLeg().isPresent() ? " / Pay Periodic" : "")); } else { buf.append( getPremium().isPresent() ? "Rec Premium / Pay " : (product.getPayLeg().isPresent() ? "Rec Periodic / Pay " : "")); summarizeMainLeg(mainLeg, buf); } buf.append(" : "); buf.append(SummarizerUtils.dateRange(mainLeg.getStartDate().getUnadjusted(), mainLeg.getEndDate().getUnadjusted())); return SummarizerUtils.summary(this, ProductType.CMS, buf.toString(), mainLeg.getCurrency()); }
Source:
public void testGenerateComplexTypedefStruct() throws IOException, ParserException, TypeRenamingConflictException, ResponseTypeNotFoundException, ParseException, TemplateModelException { final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); Map<String,Object> testMap = new HashMap<>(); final Struct structEntry = new Struct("ds3_list_all_my_buckets_result_response", null, ImmutableList.of( new StructMember( new PrimitiveType("ds3_bucket_response*", true), "buckets"), new StructMember( new PrimitiveType("ds3_user_response*", false), "owner") ), true); testMap.put("structEntry", structEntry); final CCodeGenerator codeGenerator = new CCodeGenerator(); codeGenerator.processTemplate(testMap, "header-templates/TypedefStruct.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); final String expectedOutput = "typedef struct {" + "\n" + " ds3_bucket_response** buckets;" + "\n" + " size_t num_buckets;" + "\n" + " ds3_user_response* owner;" + "\n" + "}ds3_list_all_my_buckets_result_response;" + "\n"; assertEquals(expectedOutput, output); }

Target:
public void testGenerateComplexTypedefStruct() throws IOException, ParserException, TypeRenamingConflictException, ResponseTypeNotFoundException, ParseException, TemplateModelException { final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); final Map<String,Object> testMap = new HashMap<>(); final Struct structEntry = new Struct("ds3_list_all_my_buckets_result_response", null, ImmutableList.of( new StructMember( new PrimitiveType("ds3_bucket_response*", true), "buckets"), new StructMember( new PrimitiveType("ds3_user_response*", false), "owner") ), true); testMap.put("structEntry", structEntry); final CCodeGenerator codeGenerator = new CCodeGenerator(); codeGenerator.processTemplate(testMap, "header-templates/TypedefStruct.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); final String expectedOutput = "typedef struct {" + "\n" + " ds3_bucket_response** buckets;" + "\n" + " size_t num_buckets;" + "\n" + " ds3_user_response* owner;" + "\n" + "}ds3_list_all_my_buckets_result_response;" + "\n"; assertEquals(expectedOutput, output); }
Source:
static HaxeFunctionDescription buildForMethod(HaxeCallExpression expression) { final HaxeGenericSpecialization specialization = expression.getSpecialization(); final boolean isStaticExtension = expression.resolveIsStaticExtension(); final PsiElement target = ((HaxeReference)expression.getExpression()).resolve(); if (target instanceof HaxeMethod) { final HaxeClass targetParent = (HaxeClass)((HaxeMethod)target).getContainingClass(); final HaxeClassResolveResult resolveResult = HaxeClassResolveResult.create(targetParent, specialization); return build((HaxeMethod)target, resolveResult, specialization, isStaticExtension); } return null; }

Target:
static HaxeFunctionDescription buildForMethod(HaxeCallExpression expression) { final HaxeGenericSpecialization specialization = expression.getSpecialization(); final boolean isStaticExtension = expression.resolveIsStaticExtension(); final HaxeReference reference = (HaxeReference)expression.getExpression(); final PsiElement target = reference.resolve(); if (target instanceof HaxeMethod) { final HaxeClass haxeClass = (HaxeClass)((HaxeMethod)target).getContainingClass(); final HaxeClassResolveResult resolveResult = HaxeClassResolveResult.create(haxeClass, specialization); return build((HaxeMethod)target, resolveResult, isStaticExtension); } return null; }
Source:
private void versioningDocFromHeaderIfExists(HttpHeaders headers) { isVersioning = false; List<String> versionHeader = headers.getRequestHeader(RestConstants.X_VERSIONING_OPTION); List<String> sourceHeader = headers.getRequestHeader(RestConstants.SOURCE); if (versionHeader != null && !versionHeader.isEmpty()) { VersioningOption versioningOption = VersioningOption.valueOf(versionHeader.get(0).toUpperCase()); if (versioningOption != null && !versioningOption.equals(VersioningOption.NONE)) { doc.putContextData(VersioningService.VERSIONING_OPTION, versioningOption); isVersioning = true; } } else if (sourceHeader != null && !sourceHeader.isEmpty()) { doc.putContextData(CoreSession.SOURCE, sourceHeader.get(0).toUpperCase()); isVersioning = true; } }

Target:
private void versioningDocFromHeaderIfExists(HttpHeaders headers) { isVersioning = false; List<String> versionHeader = headers.getRequestHeader(RestConstants.X_VERSIONING_OPTION); List<String> sourceHeader = headers.getRequestHeader(RestConstants.SOURCE); if (versionHeader != null && !versionHeader.isEmpty()) { VersioningOption versioningOption = VersioningOption.valueOf(versionHeader.get(0).toUpperCase()); if (versioningOption != null && !versioningOption.equals(VersioningOption.NONE)) { doc.putContextData(VersioningService.VERSIONING_OPTION, versioningOption); isVersioning = true; } } else if (sourceHeader != null && !sourceHeader.isEmpty()) { doc.putContextData(CoreSession.SOURCE, sourceHeader.get(0)); isVersioning = true; } }
Source:
@Override public void publish(Payload<?, ?, ?, ?> requestPayload, String tag) { publish(requestPayload, null, tag); }

Target:
public void publish(Payload<?, ?, ?, ?> requestPayload, String tag) { publish(requestPayload, null, tag); }
Source:
public void testThumbnailFactoryContribution() throws IOException { DocumentModel root = session.getRootDocument(); DocumentModel folder = session.createDocumentModel(root.getPathAsString(), "Folder", "Folder"); folder.addFacet(FacetNames.FOLDERISH); session.createDocument(folder); session.save(); ThumbnailAdapter folderThumbnail = folder.getAdapter(ThumbnailAdapter.class); Assert.assertEquals("folderish", folderThumbnail.getThumbnail(session).getString()); DocumentModel doc = session.createDocumentModel(root.getPathAsString(), "File", "File"); session.createDocument(doc); session.save(); ThumbnailAdapter docThumbnail = doc.getAdapter(ThumbnailAdapter.class); Assert.assertEquals("default", docThumbnail.getThumbnail(session).getString()); }

Target:
public void testThumbnailFactoryContribution() throws IOException { DocumentModel root = session.getRootDocument(); DocumentModel folder = session.createDocumentModel(root.getPathAsString(), "Folder", "Folder"); folder.addFacet(FacetNames.FOLDERISH); session.createDocument(folder); session.save(); ThumbnailAdapter folderThumbnail = folder.getAdapter(ThumbnailAdapter.class); assertEquals("folderish", folderThumbnail.getThumbnail(session).getString()); DocumentModel doc = session.createDocumentModel(root.getPathAsString(), "File", "File"); session.createDocument(doc); session.save(); ThumbnailAdapter docThumbnail = doc.getAdapter(ThumbnailAdapter.class); assertEquals("default", docThumbnail.getThumbnail(session).getString()); }
Source:
private void setArrivalFilter(int selection) { ArrivalFilter newFilter = ArrivalFilter.fromInt(selection); boolean switchedFromOnlyDepartures = mArrivalFilter == ArrivalFilter.ONLY_DEPARTURES && newFilter != ArrivalFilter.ONLY_DEPARTURES; mArrivalFilter = newFilter; ObaContract.Stops.setArrivalFilter(getActivity(), mStopUri, ArrivalFilter.fromInt(selection)); refreshSituations(UIUtils.getAllSituations(getArrivalsLoader().getLastGoodResponse(), mRoutesFilter)); refreshLocal(); if (mArrivalFilter == ArrivalFilter.ONLY_DEPARTURES || switchedFromOnlyDepartures) { setEmptyText(UIUtils.getNoArrivalsMessage(Application.get().getApplicationContext(), getArrivalsLoader().getMinutesAfter(), false, false, mArrivalFilter)); } Button footerButton = (Button) mFooter.findViewById(R.id.load_more_arrivals); Button emptyButton = (Button) mEmptyList.findViewById(R.id.load_more_arrivals); if (mArrivalFilter == ArrivalFilter.ONLY_DEPARTURES) { footerButton.setText(R.string.stop_info_load_more_departures); emptyButton.setText(R.string.stop_info_load_more_departures); } if (switchedFromOnlyDepartures) { footerButton.setText(R.string.stop_info_load_more_arrivals); emptyButton.setText(R.string.stop_info_load_more_arrivals); } }

Target:
private void setArrivalFilter(int selection) { ArrivalFilter newFilter = ArrivalFilter.fromInt(selection); setArrivalFilter(newFilter); }
Source:
private BrokerConfig createBrokerConfig( RuntimeIdentity runtimeId, Collection<PluginMeta> pluginsMeta, List<EnvVar> envVars, String image, Pod pod) { BrokerConfig data = new BrokerConfig(); data.configMapName = generateUniqueName(CONFIG_MAP_NAME_SUFFIX); data.configMapVolume = generateUniqueName(BROKER_VOLUME); data.configMap = newConfigMap(data.configMapName, pluginsMeta); data.container = newContainer(runtimeId, envVars, image, data.configMapVolume); data.machineName = Names.machineName(pod, data.container); data.machineConfig = new InternalMachineConfig(); data.machineConfig.getVolumes().put(PLUGINS_VOLUME_NAME, new VolumeImpl().withPath("/plugins")); return data; }

Target:
private BrokerConfig createBrokerConfig( RuntimeIdentity runtimeId, Collection<PluginMeta> pluginsMeta, List<EnvVar> envVars, String image, Pod pod) { BrokerConfig brokerConfig = new BrokerConfig(); brokerConfig.configMapName = generateUniqueName(CONFIG_MAP_NAME_SUFFIX); brokerConfig.configMapVolume = generateUniqueName(BROKER_VOLUME); brokerConfig.configMap = newConfigMap(brokerConfig.configMapName, pluginsMeta); brokerConfig.container = newContainer(runtimeId, envVars, image, brokerConfig.configMapVolume); brokerConfig.machineName = Names.machineName(pod, brokerConfig.container); brokerConfig.machineConfig = new InternalMachineConfig(); brokerConfig .machineConfig .getVolumes() .put(PLUGINS_VOLUME_NAME, new VolumeImpl().withPath("/plugins")); return brokerConfig; }
Source:
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { if (signature == null) { return null ; } if(signature.contains(this.ownerClass())) { this.setIsClassSelfReferenced(true); return super.visitField(access, name, desc, signature, value); } typeSignatureByFieldName.put(name, signature); GenericFieldVisitor visitor = new GenericFieldVisitor(); new SignatureReader(signature).acceptType(visitor); Optional<String> declaredType = visitor.declaredType(); if (declaredType.isPresent() && genericTypesOfClass.contains(declaredType.get())) { genericFields.put(name, declaredType.get()); } return super.visitField(access, name, desc, signature, value); }

Target:
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { if (signature == null) { return null ; } typeSignatureByFieldName.put(name, signature); GenericFieldVisitor visitor = new GenericFieldVisitor(); new SignatureReader(signature).acceptType(visitor); Optional<String> declaredType = visitor.declaredType(); if (declaredType.isPresent() && genericTypesOfClass.contains(declaredType.get())) { genericFields.put(name, declaredType.get()); } return super.visitField(access, name, desc, signature, value); }
Source:
public void executeCommand() { Guid jobId = Guid.newGuid(); persistBlockJobPlaceholder(jobId); persistCommand(getParameters().getParentCommand(), true); try { VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.Merge, createVDSParameters(jobId)); if (vdsReturnValue.getSucceeded()) { setSucceeded(true); log.debug("Merge started successfully, job Id is: {}", (Guid)vdsReturnValue.getReturnValue()); } else { log.error("Failed to start Merge on VDS"); setCommandStatus(CommandStatus.FAILED); } } catch (EngineException e) { log.error("Exception caught while sending Merge command", e); setSucceeded(true); } }

Target:
public void executeCommand() { Guid jobId = Guid.newGuid(); persistBlockJobPlaceholder(jobId); persistCommand(getParameters().getParentCommand(), true); try { VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.Merge, createVDSParameters(jobId)); if (vdsReturnValue.getSucceeded()) { setSucceeded(true); log.debug("Merge started successfully, job Id is: {}", (Guid)vdsReturnValue.getReturnValue()); } else { log.error("Failed to start Merge on VDS"); DbFacade.getInstance().getVmJobDao().remove(jobId); setCommandStatus(CommandStatus.FAILED); } } catch (EngineException e) { log.error("Exception caught while sending Merge command", e); setSucceeded(true); } }
Source:
private String discoverNodeName() { if (DiscoveryMode.KUBERNETES_API.equals(config.getMode())) { try { String podName = System.getenv("POD_NAME"); if (podName == null) { podName = System.getenv("HOSTNAME"); } if (podName == null) { podName = InetAddress.getLocalHost().getHostName(); } String nodeName = client.nodeName(podName); if (nodeName != null) { getLogger().info(String.format("Kubernetes plugin extracted node name: %s", nodeName)); return nodeName; } } catch (Exception e) { getLogger().finest(e); } getLogger().warning("Cannot fetch name of the node, NODE_AWARE feature is disabled"); } return "unknown"; }

Target:
private String discoverNodeName() { if (DiscoveryMode.KUBERNETES_API.equals(config.getMode())) { try { String nodeName = client.nodeName(podName()); if (nodeName != null) { getLogger().info(String.format("Kubernetes plugin discovered node name: %s", nodeName)); return nodeName; } } catch (Exception e) { getLogger().finest(e); } getLogger().warning("Cannot fetch name of the node, NODE_AWARE feature is disabled"); } return "unknown"; }
Source:
private static String findNewQualityGateName(Context context) throws SQLException { if (isQualityGateNameAvailable(context, SONARQUBE_WAY_QUALITY_GATE_OUTDATED)) { return SONARQUBE_WAY_QUALITY_GATE_OUTDATED; } for (int i = 0; i < 10; i++) { String newName = SONARQUBE_WAY_QUALITY_GATE_OUTDATED + " " + RANDOM.nextInt(1000); if (isQualityGateNameAvailable(context, newName)) { return newName; } } throw new IllegalStateException(format("There are too many quality profiles starting with [%s]", SONARQUBE_WAY_QUALITY_GATE_OUTDATED)); }

Target:
private String findNewQualityGateName(Context context) throws SQLException { if (isQualityGateNameAvailable(context, SONARQUBE_WAY_QUALITY_GATE_OUTDATED)) { return SONARQUBE_WAY_QUALITY_GATE_OUTDATED; } String newName = SONARQUBE_WAY_QUALITY_GATE_OUTDATED + " " + system2.now(); if (isQualityGateNameAvailable(context, newName)) { return newName; } throw new IllegalStateException(format("There are already two quality profiles with name [%s,%s]", SONARQUBE_WAY_QUALITY_GATE_OUTDATED, newName)); }
Source:
public synchronized void await(final Lambda pred) { if ((Boolean)TransactionManager.apply(new Lambda() { public Object apply(final Object unit) { TransactionManager.own(box); if (!(Boolean)pred.apply(box.getValue())) { updates = new LinkedList<Object>(); box.addReactor(Waiter.this); return true; } return false; } })) { Object val; do { if (updates.isEmpty()) { try { wait(); } catch (InterruptedException e) { Logging.warning("interrupted during wait()"); } } val = updates.remove(); } while (!(Boolean)pred.apply(val)); TransactionManager.apply(new Lambda() { public Object apply(final Object unit) { TransactionManager.own(box); box.removeReactor(Waiter.this); return null; } }); } }

Target:
public synchronized void await(final Lambda pred) { if ((Boolean)TransactionManager.apply(new Lambda() { public Object apply(final Object unit) { TransactionManager.own(box); if (!(Boolean)pred.apply(box.getValue())) { updates = new LinkedList<Object>(); box.addReactor(Waiter.this); return true; } return false; } })) { Object val; do { while (updates.isEmpty()) { try { wait(); } catch (InterruptedException e) { Logging.warning("interrupted during wait()"); } } val = updates.remove(); } while (!(Boolean)pred.apply(val)); TransactionManager.apply(new Lambda() { public Object apply(final Object unit) { TransactionManager.own(box); box.removeReactor(Waiter.this); return null; } }); } }
Source:
public String getItemString(ITmfEvent event) { final String EMPTY_STRING = ""; for (ITmfEventAspect<?> aspect : fAspects) { String eventString = NonNullUtils.nullToEmptyString(aspect.resolve(event)); if(eventString != EMPTY_STRING) { return eventString; } } return EMPTY_STRING; }

Target:
public String getItemString(ITmfEvent event) { for (ITmfEventAspect<?> aspect : fAspects) { String eventString = NonNullUtils.nullToEmptyString(aspect.resolve(event)); if (eventString != EMPTY_STRING) { return eventString; } } return EMPTY_STRING; }
Source:
private void confirmProjectProperties() { new DefaultShell(PROJECT_PROPERTIES); Button applyAndCloseButton = getApplyAndCloseButton(); assertTrue("Apply and Close Button should be enabled.", applyAndCloseButton.isEnabled()); applyAndCloseButton.click(); new WaitWhile(new JobIsRunning(), TimePeriod.getCustom(20), false); new WaitWhile(new ShellIsActive(PROJECT_PROPERTIES)); }

Target:
private void confirmProjectProperties() { new DefaultShell(PROJECT_PROPERTIES); Button applyAndCloseButton = getApplyAndCloseButton(); assertTrue("Apply and Close Button should be enabled.", applyAndCloseButton.isEnabled()); applyAndCloseButton.click(); new WaitWhile(new JobIsRunning(), TimePeriod.getCustom(20), false); new WaitWhile(new ShellIsAvailable(PROJECT_PROPERTIES)); }
Source:
protected void addListItem(ListItemBlock item) { if (item != null) { count++; } }

Target:
protected void addListItem(ListItemBlock item) { checkNotNull(item); count++; }
Source:
public void testStringToByteArray() { deployStream( "stringToBytes", "source --outputType=application/octet-stream | sink"); MessageTest test = new MessageTest() { @Override public void test(Message<?> message) throws MessagingException { assertTrue(byte[].class.isAssignableFrom(message.getPayload().getClass())); assertEquals(MimeType.valueOf("text/plain;charset=UTF-8"), contentTypeResolver.resolve(message.getHeaders())); try { assertEquals("hello", new String((byte[]) message.getPayload(), "UTF-8")); } catch (UnsupportedEncodingException e) { } } }; Message<String> msg = MessageBuilder.withPayload("hello"). copyHeaders(Collections.singletonMap(MessageHeaders.CONTENT_TYPE, "text/plain;charset=UTF-8")).build(); sendMessageAndVerifyOutput("stringToBytes", msg, test); }

Target:
public void testStringToByteArray() { deployStream( "stringToBytes", "source --outputType=application/octet-stream | sink"); MessageTest test = new MessageTest() { @Override public void test(Message<?> message) throws MessagingException { assertTrue(byte[].class.isAssignableFrom(message.getPayload().getClass())); assertEquals(MimeType.valueOf("text/plain;charset=UTF-8"), contentTypeResolver.resolve(message.getHeaders())); try { assertEquals("hello\u00F6\u00FF", new String((byte[]) message.getPayload(), "UTF-8")); } catch (UnsupportedEncodingException e) { } } }; Message<String> msg = MessageBuilder.withPayload("hello\u00F6\u00FF"). copyHeaders(Collections.singletonMap(MessageHeaders.CONTENT_TYPE, "text/plain;charset=UTF-8")).build(); sendMessageAndVerifyOutput("stringToBytes", msg, test); }
Source:
@Override public void createNewItem(final String userId, final String authId, final String itemId, final School.ItemType itemType, final String parentId, final Authenticator authChecker) throws AuthenticationException { if (identityService == null) { identityService = Identity.IdentityService.newBlockingStub(getRpcChannel()); } final Identity.IdentityRequest request = Identity.IdentityRequest.newBuilder() .setAuthId(authId) .setUserId(userId) .setItemId(itemId) .setItemType(itemType) .build(); final Identity.IdentityCreationRequest.Builder creationRequestBuilder = Identity.IdentityCreationRequest.newBuilder() .setItemRequest(request); if (parentId == null && School.ItemType.COURSE != itemType && School.ItemType.BANK_PROBLEM != itemType) { throw new AuthenticationException("Parent Id can only be null when inserting a course", AuthenticationException.NO_AUTH_SENT); } if (parentId != null) { creationRequestBuilder.setParentItemId(parentId); } Message.DefaultResponse response = null; try { final Identity.IdentityCreationRequest creationRequest = creationRequestBuilder.build(); response = identityService.createNewItem(getNewRpcController(), creationRequest); if (response.hasException()) { final AuthenticationException authExcep = new AuthenticationException("Exception with authentication server", AuthenticationException.OTHER); authExcep.setProtoException(response.getException()); throw authExcep; } } catch (ServiceException e) { throw new AuthenticationException(e); } }

Target:
@Override public void createNewItem(final String userId, final String authId, final String itemId, final School.ItemType itemType, final String parentId, final Authenticator authChecker) throws AuthenticationException { if (identityService == null) { identityService = Identity.IdentityService.newBlockingStub(getRpcChannel()); } final Identity.IdentityRequest request = Identity.IdentityRequest.newBuilder() .setAuthId(authId) .setUserId(userId) .setItemId(itemId) .setItemType(itemType) .build(); final Identity.IdentityCreationRequest.Builder creationRequestBuilder = Identity.IdentityCreationRequest.newBuilder() .setItemRequest(request); if (parentId == null && School.ItemType.COURSE != itemType && School.ItemType.BANK_PROBLEM != itemType) { throw new AuthenticationException("Parent Id can only be null when inserting a course", AuthenticationException.NO_AUTH_SENT); } if (parentId != null) { creationRequestBuilder.setParentItemId(parentId); } Message.DefaultResponse response = null; try { final Identity.IdentityCreationRequest creationRequest = creationRequestBuilder.build(); response = identityService.createNewItem(getNewRpcController(), creationRequest); if (response.hasException()) { final AuthenticationException authExcep = new AuthenticationException("Exception with authentication server", AuthenticationException.OTHER); authExcep.setProtoException(response.getException()); throw authExcep; } } catch (ServiceException e) { throw new AuthenticationException("Service exception occurred when talking to the identity database.", e); } }
Source:
public ThriftClient(ThriftClientManager clientManager, Class<T> clientType, ThriftClientConfig clientConfig, String clientName) { this(clientManager, clientType, defaultChannelFactory, clientConfig, clientName); }

Target:
public ThriftClient( ThriftClientManager clientManager, Class<T> clientType, ThriftClientConfig clientConfig, String clientName) { this(clientManager, clientType, clientConfig, clientName, defaultChannelFactory); }
Source:
public BlockUseHandler getItemHandler() { return e -> { e.cancel(); Block b = e.getClickedBlock().get(); Player p = e.getPlayer(); if (p.hasPermission("slimefun.inventory.bypass") || (SlimefunPlugin.getProtectionManager().hasPermission( p, b.getLocation(), ProtectableAction.ACCESS_INVENTORIES)) && Slimefun.hasUnlocked(e.getPlayer(), item, false) ) { SlimefunPlugin.getGPSNetwork().getResourceManager().scan(p, b, 0); } else { SlimefunPlugin.getLocalization().sendMessage(p, "inventory.no-access", true); } }; }

Target:
public BlockUseHandler getItemHandler() { return e -> { e.cancel(); Block b = e.getClickedBlock().get(); Player p = e.getPlayer(); if (p.hasPermission("slimefun.gps.bypass") || (SlimefunPlugin.getProtectionManager().hasPermission( p, b.getLocation(), ProtectableAction.ACCESS_INVENTORIES)) ) { SlimefunPlugin.getGPSNetwork().getResourceManager().scan(p, b, 0); } else { SlimefunPlugin.getLocalization().sendMessage(p, "inventory.no-access", true); } }; }
Source:
public void checkWorkspaceActions() { workspaces.clickOnWorkspaceConfigureButton(workspaceName1); workspaceDetails.waitToolbarTitleName(workspaceName1); workspaceConfig.waitConfigForm(); seleniumWebDriver.navigate().back(); workspaces.waitWorkspaceIsPresent(workspaceName1); dashboard.selectWorkspacesItemOnDashboard(); workspaces.clickOnWorkspaceAddProjectButton(workspaceName2); workspaceDetails.waitToolbarTitleName(workspaceName2); workspaceProjects.waitProjectIsPresent(WEB_JAVA_SPRING); seleniumWebDriver.navigate().back(); workspaces.waitWorkspaceIsPresent(workspaceName1); workspaces.waitWorkspaceStatusIs(workspaceName1, Statuses.STOPPED); workspaces.waitWorkspaceStatusIs(workspaceName2, Statuses.STOPPED); workspaces.waitWorkspaceStatusIs(workspaceName3, Statuses.STOPPED); dashboard.selectWorkspacesItemOnDashboard(); Assert.assertEquals(workspaces.getWorkspaceStatus(workspaceName3), Statuses.STOPPED); workspaces.clickOnWorkspaceActionsButton(workspaceName3); workspaces.waitWorkspaceStatusIs(workspaceName3, Statuses.RUNNING); }

Target:
public void checkWorkspaceActions() { workspaces.clickOnWorkspaceConfigureButton(workspaceName1); workspaceDetails.waitToolbarTitleName(workspaceName1); workspaceConfig.waitConfigForm(); dashboard.selectWorkspacesItemOnDashboard(); workspaces.waitWorkspaceIsPresent(workspaceName1); workspaces.clickOnWorkspaceAddProjectButton(workspaceName2); workspaceDetails.waitToolbarTitleName(workspaceName2); workspaceProjects.waitProjectIsPresent(WEB_JAVA_SPRING); dashboard.selectWorkspacesItemOnDashboard(); workspaces.waitWorkspaceIsPresent(workspaceName1); workspaces.waitWorkspaceStatusIs(workspaceName1, Statuses.STOPPED); workspaces.waitWorkspaceStatusIs(workspaceName2, Statuses.STOPPED); workspaces.waitWorkspaceStatusIs(workspaceName3, Statuses.STOPPED); Assert.assertEquals(workspaces.getWorkspaceStatus(workspaceName3), Statuses.STOPPED); workspaces.clickOnWorkspaceActionsButton(workspaceName3); workspaces.waitWorkspaceStatusIs(workspaceName3, Statuses.RUNNING); }
Source:
public static void main(String[] args) throws Exception { CamelContext context = new DefaultCamelContext(); context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("direct:greetings").to("stream:out"); } }); context.start(); context.getRoutes().stream().forEach((r) -> System.out.println(r)); context.stop(); }

Target:
public static void main(String[] args) throws Exception { CamelContext context = new DefaultCamelContext(); context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("stream:in").to("direct:greetings"); from("direct:greetings").to("stream:out"); } }); context.start(); context.getRoutes().stream().forEach((r) -> System.out.println(r)); context.stop(); }
Source:
public void url_validURIs() { String[] validUrls = { "*", "http://foo/bar/baz", "realm://foo.bar/~/default" }; for (String url : validUrls) { PermissionRequest request = new PermissionRequest(UserCondition.userId("id"), url, AccessLevel.ADMIN); assertEquals(url, request.getUrl()); } }

Target:
public void url_validURIs() { String[] validUrls = { "*", "http://foo/bar/baz", "https://foo/bar/baz", "realm://foo.bar/~/default", "realms://foo.bar/~/default" }; for (String url : validUrls) { PermissionRequest request = new PermissionRequest(UserCondition.userId("id"), url, AccessLevel.ADMIN); assertEquals(url, request.getUrl()); } }
Source:
public static void detectLogo() throws Exception { String localFilePath = "resources/googlework_short.mp4"; detectLogo(localFilePath); }

Target:
public static void detectLogo() throws Exception { String localFilePath = "path/to/your/video.mp4"; detectLogo(localFilePath); }