auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testBootWriteReadShutdown() throws Exception { Assert.assertTrue(BookKeeperClusterUtils.startAllBookiesWithVersion(docker, currentVersion)); String zookeeper = BookKeeperClusterUtils.zookeeperConnectString(docker); BookKeeper bk = new BookKeeper(zookeeper); long ledgerId; try (LedgerHandle writelh = bk.createLedger(BookKeeper.DigestType.CRC32, PASSWD)) { ledgerId = writelh.getId(); for (int i = 0; i < 100; i++) { writelh.addEntry(("entry-" + i).getBytes()); } } Thread.sleep(10000); try (LedgerHandle readlh = bk.openLedger(ledgerId, BookKeeper.DigestType.CRC32, PASSWD)) { long lac = readlh.getLastAddConfirmed(); int i = 0; Enumeration<LedgerEntry> entries = readlh.readEntries(0, lac); while (entries.hasMoreElements()) { LedgerEntry e = entries.nextElement(); String readBack = new String(e.getEntry()); Assert.assertEquals(readBack, "entry-" + i++); } Assert.assertEquals(i, 100); } bk.close(); if (!BookKeeperClusterUtils.stopAllBookies(docker)) { Thread.sleep(20000); Assert.fail("A bookie failed to stop"); } }

Target:
public void testBootWriteReadShutdown() throws Exception { Assert.assertTrue(BookKeeperClusterUtils.startAllBookiesWithVersion(docker, currentVersion)); String zookeeper = BookKeeperClusterUtils.zookeeperConnectString(docker); BookKeeper bk = new BookKeeper(zookeeper); long ledgerId; try (LedgerHandle writelh = bk.createLedger(BookKeeper.DigestType.CRC32, PASSWD)) { ledgerId = writelh.getId(); for (int i = 0; i < 100; i++) { writelh.addEntry(("entry-" + i).getBytes()); } } try (LedgerHandle readlh = bk.openLedger(ledgerId, BookKeeper.DigestType.CRC32, PASSWD)) { long lac = readlh.getLastAddConfirmed(); int i = 0; Enumeration<LedgerEntry> entries = readlh.readEntries(0, lac); while (entries.hasMoreElements()) { LedgerEntry e = entries.nextElement(); String readBack = new String(e.getEntry()); Assert.assertEquals(readBack, "entry-" + i++); } Assert.assertEquals(i, 100); } bk.close(); Assert.assertTrue(BookKeeperClusterUtils.stopAllBookies(docker)); }
Source:
public RefractiveReflectiveBlocksNode(Context context) { renderQueues = context.get(RenderQueuesHelper.class); worldRenderer = context.get(WorldRenderer.class); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new LookThrough(playerCamera)); requiresFBO(new FBOConfig(REFRACTIVE_REFLECTIVE_FBO, FULL_SCALE, FBO.Type.HDR).useNormalBuffer(), displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(REFRACTIVE_REFLECTIVE_FBO, displayResolutionDependentFBOs)); update(); displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(CHUNK_MATERIAL)); chunkMaterial = getMaterial(CHUNK_MATERIAL); }

Target:
public RefractiveReflectiveBlocksNode(Context context) { renderQueues = context.get(RenderQueuesHelper.class); worldRenderer = context.get(WorldRenderer.class); playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new LookThrough(playerCamera)); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); requiresFBO(new FBOConfig(REFRACTIVE_REFLECTIVE_FBO, FULL_SCALE, FBO.Type.HDR).useNormalBuffer(), displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(REFRACTIVE_REFLECTIVE_FBO, displayResolutionDependentFBOs)); update(); displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(CHUNK_MATERIAL)); chunkMaterial = getMaterial(CHUNK_MATERIAL); }
Source:
default int concurrentGetRangesThreadPoolSize() { return poolSize() * servers().thrift().size(); }

Target:
default int concurrentGetRangesThreadPoolSize() { return poolSize() * servers().numberOfHosts(); }
Source:
public void add(int value) { short key = Util.highbits(value); short low = Util.lowbits(value); if (key != currentKey) { if (Util.compareUnsigned(key, currentKey) < 0) { throw new IllegalStateException("Must write in ascending key order"); } flush(); } int valueIndex = valuesCount++; if (valueIndex > 0 && Util.compareUnsigned(low, values[valueIndex - 1]) <= 0) { throw new IllegalStateException("Must write in ascending order."); } if (valueIndex >= values.length) { valuesCount = values.length; throw new IllegalStateException( String.format("Exceeded limit of %d values per container.", values.length)); } currentKey = key; values[valueIndex] = low; }

Target:
public void add(int value) { short key = Util.highbits(value); short low = Util.lowbits(value); if (key != currentKey) { if (Util.compareUnsigned(key, currentKey) < 0) { throw new IllegalStateException("Must write in ascending key order"); } flush(); } int valueIndex = valuesCount++; if (valueIndex > 0 && Util.compareUnsigned(low, values[valueIndex - 1]) <= 0) { throw new IllegalStateException("Must write in ascending order."); } if (valueIndex >= values.length) { valuesCount = values.length; throw new IndexOutOfBoundsException( String.format("Exceeded limit of %d values per container.", values.length)); } currentKey = key; values[valueIndex] = low; }
Source:
public static double inverseBetaCdf( @SqlType(StandardTypes.DOUBLE) double a, @SqlType(StandardTypes.DOUBLE) double b, @SqlType(StandardTypes.DOUBLE) double p) { checkCondition(p >= 0 && p <= 1, INVALID_FUNCTION_ARGUMENT, "p must be 0 >= p >= 1"); checkCondition(a > 0 && b > 0, INVALID_FUNCTION_ARGUMENT, "a, b must be > 0"); BetaDistribution dist = new BetaDistribution(a, b); return dist.inverseCumulativeProbability(p); }

Target:
public static double inverseBetaCdf( @SqlType(StandardTypes.DOUBLE) double a, @SqlType(StandardTypes.DOUBLE) double b, @SqlType(StandardTypes.DOUBLE) double p) { checkCondition(p >= 0 && p <= 1, INVALID_FUNCTION_ARGUMENT, "p must be in the interval [0, 1]"); checkCondition(a > 0, INVALID_FUNCTION_ARGUMENT, "a must be > 0"); checkCondition(b > 0, INVALID_FUNCTION_ARGUMENT, "b must be > 0"); BetaDistribution distribution = new BetaDistribution(null, a, b, BetaDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY); return distribution.inverseCumulativeProbability(p); }
Source:
public void onMatch(RelOptRuleCall call) { if (call.rel(0) instanceof VoltLogicalCalc && call.rel(1) instanceof VoltLogicalTableScan) { VoltLogicalCalc calc = call.rel(0); VoltLogicalTableScan tableScan = call.rel(1); RelDistribution tableDist = tableScan.getTable().getDistribution(); if (tableDist.getType() != RelDistribution.Type.SINGLETON) { if (calc.getProgram().getCondition() == null || !isSinglePartitioned(calc.getProgram(), calc.getProgram().getCondition(), tableDist.getKeys())) { throw new UnsupportedOperationException("MP query not supported in Calcite planner."); } } call.transformTo(calc.copy(calc.getTraitSet().replace(tableDist), calc.getInputs())); } else { RelNode child = call.rel(1); RelDistribution childDist = child.getTraitSet().getTrait(RelDistributionTraitDef.INSTANCE); if (childDist != RelDistributions.ANY) { SingleRel node = call.rel(0); call.transformTo(node.copy(node.getTraitSet().replace(childDist), node.getInputs())); } } }

Target:
@Override public void onMatch(RelOptRuleCall call) { if (call.rel(0) instanceof VoltLogicalCalc && call.rel(1) instanceof VoltLogicalTableScan) { VoltLogicalCalc calc = call.rel(0); VoltLogicalTableScan tableScan = call.rel(1); RelDistribution tableDist = tableScan.getTable().getDistribution(); if (tableDist.getType() == RelDistribution.Type.RANDOM_DISTRIBUTED) { throw new PlannerFallbackException("MP query not supported in Calcite planner."); } if (tableDist.getType() != RelDistribution.Type.SINGLETON && (calc.getProgram().getCondition() == null || ! isSinglePartitioned(calc.getProgram(), calc.getProgram().getCondition(), tableDist.getKeys()))) { throw new PlannerFallbackException("MP query not supported in Calcite planner."); } call.transformTo(calc.copy(calc.getTraitSet().replace(tableDist), calc.getInputs())); } else { RelNode child = call.rel(1); RelDistribution childDist = child.getTraitSet().getTrait(RelDistributionTraitDef.INSTANCE); if (childDist != RelDistributions.ANY) { SingleRel node = call.rel(0); call.transformTo(node.copy(node.getTraitSet().replace(childDist), node.getInputs())); } } }
Source:
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) { checkJsoInHeaders(msg); checkJsoInCookies(msg); checkJsoInBody(msg); }

Target:
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) { checkJsoInHeaders(msg, msg.getResponseHeader().getHeaders()); checkJsoInCookies(msg, msg.getResponseHeader().getHttpCookies(null)); checkJsoInBody(msg, msg.getResponseBody()); }
Source:
private Mono<Void> doHandle(ServerWebExchange exchange) { return Mono.just(exchange) .doOnSubscribe(s -> this.activeCount.incrementAndGet()) .flatMap(this::extractRequestBody) .switchIfEmpty(Mono.just(exchange.getRequest().getQueryParams())) .map(body -> new HttpEntity<>(body, exchange.getRequest().getHeaders())) .map(entity -> buildMessage(entity, exchange)) .flatMap(requestMessage -> { if (this.expectReply) { return sendAndReceiveMessageReactive(requestMessage) .flatMap(replyMessage -> populateResponse(exchange, replyMessage)); } else { send(requestMessage); return setStatusCode(exchange); } }) .doOnTerminate((e, t) -> this.activeCount.decrementAndGet()); }

Target:
private Mono<Void> doHandle(ServerWebExchange exchange) { return extractRequestBody(exchange) .doOnSubscribe(s -> this.activeCount.incrementAndGet()) .map(body -> new HttpEntity<>(body, exchange.getRequest().getHeaders())) .map(entity -> buildMessage(entity, exchange)) .flatMap(requestMessage -> { if (this.expectReply) { return sendAndReceiveMessageReactive(requestMessage) .flatMap(replyMessage -> populateResponse(exchange, replyMessage)); } else { send(requestMessage); return setStatusCode(exchange); } }) .doOnTerminate((e, t) -> this.activeCount.decrementAndGet()); }
Source:
protected void onBasicMessage(AvailDataMessage msg) { AvailData availData = msg.getAvailData(); if (log.isTraceEnabled()) { log.trace("Message received with [" + availData.getData().size() + "] avails."); } List<SingleAvail> data = availData.getData(); List<Data> alertData = null; Set<String> activeAvailabilityIds = cacheManager.getActiveAvailabilityIds(); for (SingleAvail a : data) { String fullMetricId = AVAILABILITY + "-" + a.getId(); if (isNeeded(activeAvailabilityIds, fullMetricId)) { if (null == alertData) { alertData = new ArrayList<>(data.size()); } alertData.add(Data.forAvailability(a.getTenantId(), fullMetricId, a.getTimestamp(), AvailabilityType.valueOf(a.getAvail()))); } } if (null == alertData) { if (log.isTraceEnabled()) { log.trace("Forwarding 0 of [" + data.size() + "] avails to Alerts Engine..."); } } else { if (log.isDebugEnabled()) { log.debug("Forwarding [" + alertData.size() + "] of [" + data.size() + "] avails to Alerts Engine " + "(filtered [" + (data.size() - alertData.size()) + "])..."); } try { alerts.sendData(alertData); } catch (Exception e) { throw new RuntimeException(e); } } }

Target:
protected void onBasicMessage(AvailDataMessage msg) { AvailData availData = msg.getAvailData(); if (log.isTraceEnabled()) { log.trace("Message received with [" + availData.getData().size() + "] avails."); } List<SingleAvail> data = availData.getData(); List<Data> alertData = null; Set<DataIdKey> activeAvailabilityIds = cacheManager.getActiveAvailabilityIds(); for (SingleAvail a : data) { String fullMetricId = AVAILABILITY + "-" + a.getId(); if (isNeeded(activeAvailabilityIds, new DataIdKey(a.getTenantId(), fullMetricId))) { if (null == alertData) { alertData = new ArrayList<>(data.size()); } alertData.add(Data.forAvailability(a.getTenantId(), fullMetricId, a.getTimestamp(), AvailabilityType.valueOf(a.getAvail()))); } } if (null == alertData) { if (log.isTraceEnabled()) { log.trace("Forwarding 0 of [" + data.size() + "] avails to Alerts Engine..."); } } else { if (log.isDebugEnabled()) { log.debug("Forwarding [" + alertData.size() + "] of [" + data.size() + "] avails to Alerts Engine " + "(filtered [" + (data.size() - alertData.size()) + "])..."); } try { alerts.sendData(alertData); } catch (Exception e) { throw new RuntimeException(e); } } }
Source:
public void iterateReader() { String ionText = "1 2 3 4"; IonReader ionReader = system().newReader(ionText); Iterator<IonValue> iterate = system().iterate(ionReader); assertTrue(iterate.hasNext()); assertEquals(1, ((IonInt) iterate.next()).intValue()); assertTrue(iterate.hasNext()); assertEquals(2, ((IonInt) iterate.next()).intValue()); assertTrue(iterate.hasNext()); assertEquals(3, ((IonInt) iterate.next()).intValue()); assertTrue(iterate.hasNext()); assertEquals(4, ((IonInt) iterate.next()).intValue()); assertFalse(iterate.hasNext()); }

Target:
public void iterateReader() throws IOException { String ionText = "1 2 3 4"; IonReader ionReader = system().newReader(ionText); Iterator<IonValue> iterate = system().iterate(ionReader); assertTrue(iterate.hasNext()); assertEquals(1, ((IonInt) iterate.next()).intValue()); assertTrue(iterate.hasNext()); assertEquals(2, ((IonInt) iterate.next()).intValue()); assertTrue(iterate.hasNext()); assertEquals(3, ((IonInt) iterate.next()).intValue()); assertTrue(iterate.hasNext()); assertEquals(4, ((IonInt) iterate.next()).intValue()); assertFalse(iterate.hasNext()); ionReader.close(); }
Source:
public static HCatSchema toHiveSchema(Schema schema, HCatSchema tableSchema) { List<HCatFieldSchema> fields = Lists.newArrayList(); for (Schema.Field field : schema.getFields()) { String name = field.getName(); try { HCatFieldSchema hCatFieldSchema = tableSchema.get(name); Preconditions.checkNotNull(hCatFieldSchema, "Missing field %s in table schema", name); PrimitiveTypeInfo hiveType = hCatFieldSchema.getTypeInfo(); PrimitiveTypeInfo type = getType(name, field.getSchema()); if (!hiveType.equals(type)) { LOG.warn("The given schema for the field does not match the schema from the table. " + "The schema for field will be used.", type, name, hiveType, hiveType, name); } fields.add(hCatFieldSchema); } catch (HCatException e) { LOG.error("Failed to create HCatFieldSchema field of type from schema", name, field.getSchema().getType(), e); Throwables.propagate(e); } } return new HCatSchema(fields); }

Target:
public static HCatSchema toHiveSchema(Schema schema, HCatSchema tableSchema) { List<HCatFieldSchema> fields = Lists.newArrayList(); for (Schema.Field field : schema.getFields()) { String name = field.getName(); try { HCatFieldSchema hCatFieldSchema = tableSchema.get(name); Preconditions.checkNotNull(hCatFieldSchema, "Missing field %s in table schema", name); PrimitiveTypeInfo hiveType = hCatFieldSchema.getTypeInfo(); PrimitiveTypeInfo type = getType(name, field.getSchema()); if (!hiveType.equals(type)) { LOG.warn("The given schema for the field does not match the schema from the table. " + "The schema for field will be used.", type, name, hiveType, hiveType, name); } fields.add(hCatFieldSchema); } catch (HCatException e) { throw new IllegalArgumentException( String.format("Failed to create HCatFieldSchema field %s of type %s from schema", name, field.getSchema().getType()), e); } } return new HCatSchema(fields); }
Source:
public void analyzeSentimentStringListWithOptions() { List<String> documents = Arrays.asList( "The hotel was dark and unclean.", "The restaurant had amazing gnocchi." ); textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", (TextAnalyticsRequestOptions) null).subscribe( response -> { TextDocumentBatchStatistics batchStatistics = response.getStatistics(); System.out.printf("Batch statistics, transaction count: %s, valid document count: %s.%n", batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); response.forEach(analyzeSentimentResult -> { System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId()); DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment(); System.out.printf("Recognized document sentiment: %s.%n", documentSentiment.getSentiment()); documentSentiment.getSentences().forEach(sentenceSentiment -> System.out.printf("Recognized sentence sentiment: %s, positive score: %.2f, " + "neutral score: %.2f, negative score: %.2f.%n", sentenceSentiment.getSentiment(), sentenceSentiment.getConfidenceScores().getPositive(), sentenceSentiment.getConfidenceScores().getNeutral(), sentenceSentiment.getConfidenceScores().getNegative())); }); }); END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-String-TextAnalyticsRequestOptions }

Target:
public void analyzeSentimentStringListWithOptions() { List<String> documents = Arrays.asList( "The hotel was dark and unclean.", "The restaurant had amazing gnocchi." ); textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", new TextAnalyticsRequestOptions().setIncludeStatistics(true)).subscribe( response -> { TextDocumentBatchStatistics batchStatistics = response.getStatistics(); System.out.printf("Batch statistics, transaction count: %s, valid document count: %s.%n", batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); response.forEach(analyzeSentimentResult -> { System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId()); DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment(); System.out.printf("Recognized document sentiment: %s.%n", documentSentiment.getSentiment()); documentSentiment.getSentences().forEach(sentenceSentiment -> System.out.printf("Recognized sentence sentiment: %s, positive score: %.2f, " + "neutral score: %.2f, negative score: %.2f.%n", sentenceSentiment.getSentiment(), sentenceSentiment.getConfidenceScores().getPositive(), sentenceSentiment.getConfidenceScores().getNeutral(), sentenceSentiment.getConfidenceScores().getNegative())); }); }); END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-String-TextAnalyticsRequestOptions }
Source:
public Map<String, List<Message>> validateProjectData(final Workbook workbook, final String programUUID) { final Map<String, List<Message>> errors = new HashMap<String, List<Message>>(); this.checkForExistingTrialInstance(this.ontologyDataManager, workbook, errors, programUUID); this.setRequiredFields(this.ontologyDataManager, workbook); final List<Message> requiredVariableValueErrors = this.checkForEmptyRequiredVariables(workbook); if (!requiredVariableValueErrors.isEmpty()) { errors.put(Constants.OBSERVATION_DATA_ERRORS, requiredVariableValueErrors); } return errors; }

Target:
public Map<String, List<Message>> validateProjectData(final Workbook workbook, final String programUUID) { final Map<String, List<Message>> errors = new HashMap<String, List<Message>>(); this.checkForExistingTrialInstance(workbook, errors, programUUID); this.setRequiredFields(workbook); final List<Message> requiredVariableValueErrors = this.checkForEmptyRequiredVariables(workbook); if (!requiredVariableValueErrors.isEmpty()) { errors.put(Constants.OBSERVATION_DATA_ERRORS, requiredVariableValueErrors); } return errors; }
Source:
void downloadArchiveForMixedValidAndInvalidExperimentAccessions() throws Exception { ResultActions result = this.mockMvc.perform(get(ARCHIVE_DOWNLOAD_LIST_URL) .param("accession", EXPERIMENT_ACCESSION_LIST.get(0)) .param("accession", EXPERIMENT_ACCESSION_LIST.get(1)) .param("accession", INVALID_EXPERIMENT_ACCESSION_LIST.get(0)) .param("accession", INVALID_EXPERIMENT_ACCESSION_LIST.get(1))); byte[] contentByte = result.andReturn().getResponse().getContentAsByteArray(); ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(contentByte)); String expectedArchiveName = MessageFormat.format( ARCHIVE_NAME, EXPERIMENT_ACCESSION_LIST.size(), "experiment"); result.andExpect(status().isOk()) .andExpect(content().string(containsString(zipInputStream.getNextEntry().getName()))) .andExpect(header().string(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + expectedArchiveName)) .andExpect(content().contentType("application/zip")); }

Target:
void downloadArchiveForMixedValidAndInvalidExperimentAccessions() throws Exception { ResultActions result = this.mockMvc.perform(get(ARCHIVE_DOWNLOAD_LIST_URL) .param("accession", EXPERIMENT_ACCESSION_LIST.get(0)) .param("accession", EXPERIMENT_ACCESSION_LIST.get(1)) .param("accession", INVALID_EXPERIMENT_ACCESSION_LIST.get(0)) .param("accession", INVALID_EXPERIMENT_ACCESSION_LIST.get(1))); String expectedArchiveName = MessageFormat.format( ARCHIVE_NAME, EXPERIMENT_ACCESSION_LIST.size(), "experiment"); byte[] contentByte = result.andReturn().getResponse().getContentAsByteArray(); ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(contentByte)); ImmutableList<String> sourceFileNames = getSourceValidFileNames(); ArrayList<String> contentFileNames = new ArrayList<>(); ZipEntry entry; while ((entry = zipInputStream.getNextEntry()) != null) { contentFileNames.add(Paths.get(entry.getName()).getFileName().toString()); } assertThat(sourceFileNames.containsAll(contentFileNames)).isTrue(); result.andExpect(status().isOk()) .andExpect(header().string(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + expectedArchiveName)) .andExpect(content().contentType("application/zip")); }
Source:
public View display(Context context, int position, View v) { if (v == null) v = inflateFromId(context, R.layout.item_search); TextView appName = (TextView) v.findViewById(R.id.item_search_text); String text = context.getString(R.string.ui_item_search); ImageView image = (ImageView) v.findViewById(R.id.item_search_icon); if(searchPojo.direct) { text = context.getString(R.string.ui_item_visit); appName.setText(enrichText(String.format(text, "{" + this.pojo.name + "}"))); image.setImageResource(R.drawable.ic_public); } else { appName.setText(enrichText(String.format(text, this.pojo.name, "{" + searchPojo.query + "}"))); image.setImageResource(R.drawable.search); } image.setColorFilter(getThemeFillColor(context), PorterDuff.Mode.SRC_IN); return v; }

Target:
public View display(Context context, int position, View v) { if (v == null) v = inflateFromId(context, R.layout.item_search); TextView appName = (TextView) v.findViewById(R.id.item_search_text); ImageView image = (ImageView) v.findViewById(R.id.item_search_icon); if(searchPojo.direct) { String text = context.getString(R.string.ui_item_visit); appName.setText(enrichText(String.format(text, "{" + this.pojo.name + "}"))); image.setImageResource(R.drawable.ic_public); } else { String text = context.getString(R.string.ui_item_search); appName.setText(enrichText(String.format(text, this.pojo.name, "{" + searchPojo.query + "}"))); image.setImageResource(R.drawable.search); } image.setColorFilter(getThemeFillColor(context), PorterDuff.Mode.SRC_IN); return v; }
Source:
private void testContent() throws Exception { ______TS("Typical case: large session with no sections"); resultsPage = loginToInstructorFeedbackResultsPageWithViewType("CFResultsUiT.instr", "Session with no sections", true, "question"); resultsPage.verifyStatus(Const.StatusMessages.FEEDBACK_RESULTS_QUESTIONVIEWWARNING); ______TS("Typical case: standard session results"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Open Session"); resultsPage.clickCollapseExpandButton(); resultsPage.verifyHtml("/instructorFeedbackResultsPageOpen.html"); ______TS("Typical case: standard session results: helper view"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.helper1", "Open Session"); resultsPage.loadResultQuestionPanel(1); resultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageOpenViewForHelperOne.html"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.helper2", "Open Session"); resultsPage.loadResultQuestionPanel(1); resultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageOpenViewForHelperTwo.html"); ______TS("Typical case: empty session"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Empty Session"); resultsPage.loadResultQuestionPanel(1); resultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageEmpty.html"); }

Target:
private void testContent() throws Exception { ______TS("Typical case: large session with no sections"); resultsPage = loginToInstructorFeedbackResultsPageWithViewType("CFResultsUiT.instr", "Session with no sections", true, "question"); resultsPage.verifyStatus(Const.StatusMessages.FEEDBACK_RESULTS_QUESTIONVIEWWARNING); ______TS("Typical case: standard session results"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Open Session"); resultsPage.clickCollapseExpandButtonAndWaitForPanelsToExpand(); resultsPage.verifyHtml("/instructorFeedbackResultsPageOpen.html"); ______TS("Typical case: standard session results: helper view"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.helper1", "Open Session"); resultsPage.loadResultQuestionPanel(1); resultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageOpenViewForHelperOne.html"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.helper2", "Open Session"); resultsPage.loadResultQuestionPanel(1); resultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageOpenViewForHelperTwo.html"); ______TS("Typical case: empty session"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Empty Session"); resultsPage.loadResultQuestionPanel(1); resultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageEmpty.html"); }
Source:
public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(PreferenceConstants.DIAGRAM_FONT)) { updateListner.updateFonts(); } }

Target:
public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(PreferenceConstants.DIAGRAM_FONT)) { updateListener.updateFonts(); } }
Source:
private Set<String> processPoolUpdates( Map<String, EventBuilder> poolEvents, List<PoolUpdate> updatedPools) { Set<String> entitlementsToRegen = Util.newSet(); for (PoolUpdate updatedPool : updatedPools) { Pool existingPool = updatedPool.getPool(); log.info("Pool changed: {}", updatedPool.toString()); if (existingPool.isMarkedForDelete()) { log.warn("Deleting pool as requested by rules: {}", existingPool.getId()); deletePool(existingPool); continue; } this.poolCurator.merge(existingPool); this.poolCurator.flush(); if (updatedPool.getQuantityChanged()) { List<Pool> existingPools = new ArrayList<Pool>(); existingPools.add(existingPool); this.deleteExcessEntitlements(existingPools); } if (updatedPool.getDatesChanged() || updatedPool.getProductsChanged() || updatedPool.getBrandingChanged()) { List<String> entitlements = poolCurator .retrieveFreeEntitlementIdsOfPool(existingPool, true); entitlementsToRegen.addAll(entitlements); } EventBuilder builder = poolEvents.get(existingPool.getId()); if (builder != null) { Event event = builder.setNewEntity(existingPool).buildEvent(); sink.queueEvent(event); } else { log.warn("Pool updated without an event builder: {}", existingPool); } } return entitlementsToRegen; }

Target:
private Set<String> processPoolUpdates( Map<String, EventBuilder> poolEvents, List<PoolUpdate> updatedPools) { Set<String> entitlementsToRegen = Util.newSet(); for (PoolUpdate updatedPool : updatedPools) { Pool existingPool = updatedPool.getPool(); log.info("Pool changed: {}", updatedPool.toString()); if (existingPool.isMarkedForDelete()) { log.warn("Deleting pool as requested by rules: {}", existingPool.getId()); deletePool(existingPool); continue; } this.poolCurator.merge(existingPool); this.poolCurator.flush(); if (updatedPool.getQuantityChanged()) { List<Pool> existingPools = Arrays.asList(existingPool); this.deleteExcessEntitlements(existingPools); } if (updatedPool.getDatesChanged() || updatedPool.getProductsChanged() || updatedPool.getBrandingChanged()) { List<String> entitlements = poolCurator .retrieveFreeEntitlementIdsOfPool(existingPool, true); entitlementsToRegen.addAll(entitlements); } EventBuilder builder = poolEvents.get(existingPool.getId()); if (builder != null) { Event event = builder.setNewEntity(existingPool).buildEvent(); sink.queueEvent(event); } else { log.warn("Pool updated without an event builder: {}", existingPool); } } return entitlementsToRegen; }
Source:
static long Proc (long handle, long arg0, long user_data) { long webView = 0; boolean indirectWebView = false; if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_view_get_type ())) { webView = handle; } else if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_frame_get_type ())) { if (WEBKIT2) { } else { webView = WebKitGTK.webkit_web_frame_get_web_view (handle); } } else if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_context_get_type ())) { webView = user_data; user_data = DOWNLOAD_REQUESTED; indirectWebView = true; } else if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_download_get_type ())) { webView = WebKitGTK.webkit_download_get_web_view(handle); indirectWebView = true; } else { return 0; } assert webView != 0 : "Webview shouldn't be null here"; Browser browser = FindBrowser (webView); if (browser == null) return 0; WebKit webkit = (WebKit)browser.webBrowser; if (webView == handle || indirectWebView) { return webkit.webViewProc (handle, arg0, user_data); } else { return webkit.webFrameProc (handle, arg0, user_data); } }

Target:
static long Proc (long handle, long arg0, long user_data) { long webView = 0; boolean indirectWebView = false; if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_view_get_type ())) { webView = handle; } else if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_frame_get_type ())) { if (WEBKIT2) { } else { webView = WebKitGTK.webkit_web_frame_get_web_view (handle); } } else if (WEBKIT2 && OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_context_get_type ())) { webView = user_data; user_data = DOWNLOAD_REQUESTED; indirectWebView = true; } else if (WEBKIT2 && OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_download_get_type ())) { webView = WebKitGTK.webkit_download_get_web_view(handle); indirectWebView = true; } else { return 0; } assert webView != 0 : "Webview shouldn't be null here"; Browser browser = FindBrowser (webView); if (browser == null) return 0; WebKit webkit = (WebKit)browser.webBrowser; if (webView == handle || indirectWebView) { return webkit.webViewProc (handle, arg0, user_data); } else { return webkit.webFrameProc (handle, arg0, user_data); } }
Source:
protected Map<String, String> getConfiguration() { return ImmutableMap.copyOf(configuration); }

Target:
protected ImmutableMap<String, String> getConfiguration() { return ImmutableMap.copyOf(configuration); }
Source:
public BytecodeNode visitSpecialForm(SpecialFormExpression specialForm, Context context) { BytecodeGenerator generator; switch (specialForm.getForm()) { case IF: generator = new IfCodeGenerator(); break; case NULL_IF: generator = new NullIfCodeGenerator(); break; case SWITCH: generator = new SwitchCodeGenerator(); break; case IS_NULL: generator = new IsNullCodeGenerator(); break; case COALESCE: generator = new CoalesceCodeGenerator(); break; case IN: generator = new InCodeGenerator(functionManager); break; case AND: generator = new AndCodeGenerator(); break; case OR: generator = new OrCodeGenerator(); break; case DEREFERENCE: generator = new DereferenceCodeGenerator(); break; case ROW_CONSTRUCTOR: generator = new RowConstructorCodeGenerator(); break; case BIND: generator = new BindCodeGenerator(compiledLambdaMap, context.getLambdaInterface().get()); break; default: throw new IllegalStateException("Can not compile special form: " + specialForm.getForm()); } BytecodeGeneratorContext generatorContext = new BytecodeGeneratorContext( RowExpressionCompiler.this, context.getScope(), callSiteBinder, cachedInstanceBinder, functionManager); return generator.generateExpression(null, generatorContext, specialForm.getType(), specialForm.getArguments(), context.getOutputBlockVariable()); }

Target:
public BytecodeNode visitSpecialForm(SpecialFormExpression specialForm, Context context) { SpecialFormBytecodeGenerator generator; switch (specialForm.getForm()) { case IF: generator = new IfCodeGenerator(); break; case NULL_IF: generator = new NullIfCodeGenerator(); break; case SWITCH: generator = new SwitchCodeGenerator(); break; case IS_NULL: generator = new IsNullCodeGenerator(); break; case COALESCE: generator = new CoalesceCodeGenerator(); break; case IN: generator = new InCodeGenerator(functionManager); break; case AND: generator = new AndCodeGenerator(); break; case OR: generator = new OrCodeGenerator(); break; case DEREFERENCE: generator = new DereferenceCodeGenerator(); break; case ROW_CONSTRUCTOR: generator = new RowConstructorCodeGenerator(); break; case BIND: generator = new BindCodeGenerator(compiledLambdaMap, context.getLambdaInterface().get()); break; default: throw new IllegalStateException("Cannot compile special form: " + specialForm.getForm()); } BytecodeGeneratorContext generatorContext = new BytecodeGeneratorContext( RowExpressionCompiler.this, context.getScope(), callSiteBinder, cachedInstanceBinder, functionManager); return generator.generateExpression(generatorContext, specialForm.getType(), specialForm.getArguments(), context.getOutputBlockVariable()); }
Source:
private void depositDuration(String depositUUID, Map<String, String> status) { String strDepositStartTime = status.get(DepositField.startTime.name()); Long depositStartTime = Long.parseLong(strDepositStartTime); long depositEndTime = System.currentTimeMillis(); long depositTotalTime = depositEndTime - depositStartTime; GaugeFactory.createDurationGauge(MetricRegistry.name("deposit " + depositUUID, "deposit-duration"), depositTotalTime); String strDepositEndTime = Long.toString(depositEndTime); depositStatusFactory.set(depositUUID, DepositField.endTime, strDepositEndTime); }

Target:
private void depositDuration(String depositUUID, Map<String, String> status) { String strDepositStartTime = status.get(DepositField.startTime.name()); Long depositStartTime = Long.parseLong(strDepositStartTime); long depositEndTime = System.currentTimeMillis(); long depositTotalTime = depositEndTime - depositStartTime; depositHist.update(depositTotalTime); String strDepositEndTime = Long.toString(depositEndTime); depositStatusFactory.set(depositUUID, DepositField.endTime, strDepositEndTime); }
Source:
public boolean migrateIfNeeded() { SQLiteDatabase db = app.getDbOpenHelper().getWritableDatabase(); Cursor cur; try { cur = db.rawQuery("SELECT * FROM bookmarks", null); } catch (SQLiteException ex) { return false; } int rowsFound = 0; cur.moveToFirst(); while (!cur.isAfterLast()) { Site site = new Site(cur.getString(COL_INDEX_SITE)); PageTitle title = new PageTitle(cur.getString(COL_INDEX_TITLE), site); Date timestamp = new Date(cur.getLong(COL_INDEX_TIME)); SavedPage page = new SavedPage(title, timestamp); app.getPersister(SavedPage.class).upsert(page, null); Log.d("Wikipedia", "Migrated " + title.getDisplayText()); rowsFound += 1; cur.moveToNext(); } cur.close(); db.execSQL("DROP TABLE IF EXISTS bookmarks"); return rowsFound != 0; }

Target:
public boolean migrateIfNeeded() { SQLiteDatabase db = app.getDbOpenHelper().getWritableDatabase(); Cursor cur; try { cur = db.rawQuery("SELECT * FROM bookmarks", null); } catch (SQLiteException ex) { return false; } int rowsFound = 0; cur.moveToFirst(); while (!cur.isAfterLast()) { Site site = new Site(cur.getString(COL_INDEX_SITE)); PageTitle title = new PageTitle(cur.getString(COL_INDEX_TITLE), site); Date timestamp = new Date(cur.getLong(COL_INDEX_TIME)); SavedPage page = new SavedPage(title, timestamp); app.getPersister(SavedPage.class).upsert(page); Log.d("Wikipedia", "Migrated " + title.getDisplayText()); rowsFound += 1; cur.moveToNext(); } cur.close(); db.execSQL("DROP TABLE IF EXISTS bookmarks"); return rowsFound != 0; }
Source:
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { return ClusterConnection.getClusterConnectionInfo(); }

Target:
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { return getStore(extensionContext).get(STORE_KEY_CLUSTER_CONNECTION_INFO, ClusterConnectionInfo.class); }
Source:
private void upgradeCustomSystemProperties(ImportMigrationContext context) { Properties importedProps = new Properties(); Properties currentProps; try { File fileOnSystem = Paths.get(System.getProperty("ddf.home")) .toRealPath(LinkOption.NOFOLLOW_LINKS) .resolve(Paths.get("etc", "custom.system.properties")) .toFile(); importedProps.load( context .getEntry(PlatformMigratable.CUSTOM_SYSTEM_PROPERTIES_PATH) .getInputStream() .orElseThrow(IOException::new)); currentProps = new Properties(fileOnSystem); currentProps .entrySet() .stream() .filter( e -> !importedProps.containsKey(e.getKey()) || SYSTEM_PROPERTIES_TO_PRESERVE.contains(e.getKey())) .forEach(e -> importedProps.put(e.getKey(), e.getValue())); importedProps.save(fileOnSystem); } catch (IOException e) { LOGGER.warn("Failed to upgrade system properties", e); } }

Target:
void upgradeCustomSystemProperties(ImportMigrationContext context) throws IOException { Properties importedProps = new Properties(); Properties currentProps; File fileOnSystem = Paths.get(System.getProperty("ddf.home")) .toRealPath(LinkOption.NOFOLLOW_LINKS) .resolve(Paths.get("etc", "custom.system.properties")) .toFile(); currentProps = new Properties(fileOnSystem); importedProps.load( context .getEntry(PlatformMigratable.CUSTOM_SYSTEM_PROPERTIES_PATH) .getInputStream() .orElseThrow(IOException::new)); currentProps .entrySet() .stream() .filter(e -> propertyShouldNotBeOverwritten(e, importedProps)) .forEach(e -> importedProps.put(e.getKey(), e.getValue())); importedProps.save(fileOnSystem); }
Source:
public Libc load() { try { if (isGraalBuildTime()) { LOG.info("Using Graal-native functions for Graal build time"); return new GraalLibc(); } if (isGraalRunTime()) { LOG.info("Using Graal-native functions for Graal run time"); return new GraalLibc(); } return new JnrLibc(); } catch (Throwable t) { LOG.info( "Unable to load JNR native implementation. This could be normal if JNR is excluded from the classpath", t); return new EmptyLibc(); } }

Target:
public Libc load() { try { if (isGraal()) { LOG.info("Using Graal-specific native functions"); return new GraalLibc(); } return new JnrLibc(); } catch (Throwable t) { LOG.info( "Unable to load JNR native implementation. This could be normal if JNR is excluded from the classpath", t); return new EmptyLibc(); } }
Source:
public static void main(String[] args) { CreateDatabase createDatabase = new CreateDatabase(); try { createDatabase.init(args); Instance instance = createDatabase.getInstance(); createDatabase.createDatabase(instance); } catch (Exception e) { e.printStackTrace(); } finally { createDatabase.close(); } }

Target:
public static void main(String[] args) throws IOException { CreateDatabase createDatabase = new CreateDatabase(); try { createDatabase.init(args); Instance instance = createDatabase.getInstance(); createDatabase.createDatabase(instance); } catch (Exception e) { e.printStackTrace(); } finally { createDatabase.close(); } }
Source:
public Pair<Long, Long> find(byte bucket, byte[] begin, boolean reverse) throws IOException { Scan s = new Scan(); byte[] arr = {bucket}; s.setReversed(reverse).setFilter(new PrefixFilter(arr)); if(begin != null) { s.withStartRow(begin); } HBaseTxnFinder.ScanTimestampIterator si = new HBaseTxnFinder.ScanTimestampIterator(region.getScanner(s)); if(si.hasNext()) { return si.next; } else { return null; } }

Target:
public Pair<Long, Long> find(byte bucket, byte[] begin, boolean reverse) throws IOException { Scan hbaseScan = new Scan(); hbaseScan.addColumn(V2TxnDecoder.FAMILY, V2TxnDecoder.STATE_QUALIFIER_BYTES) .setReversed(reverse) .readAllVersions() .setFilter(new PrefixFilter(new byte[]{bucket})); if (begin != null) { hbaseScan.withStartRow(begin); } HBaseTxnFinder.ScanTimestampIterator si = new ScanTimestampIterator(region.getScanner(hbaseScan)); if (si.hasNext()) { return si.next; } else { return null; } }
Source:
public void processKafkaMessages() throws Exception { final String[] serverlist = m_config.servers.split(","); m_config.password = CLIConfig.readPasswordIfNeeded(m_config.user, m_config.password, "Enter password: "); final ClientConfig c_config = new ClientConfig(m_config.user, m_config.password, null); if (m_config.ssl != null && !m_config.ssl.trim().isEmpty()) { c_config.setTrustStoreConfigFromPropertyFile(m_config.ssl); c_config.enableSSL(); } c_config.setProcedureCallTimeout(0); m_client = getClient(c_config, serverlist, m_config.port); if (m_config.useSuppliedProcedure) { m_loader = new CSVTupleDataLoader((ClientImpl) m_client, m_config.procedure, new KafkaBulkLoaderCallback()); } else { m_loader = new CSVBulkDataLoader((ClientImpl) m_client, m_config.table, m_config.batch, m_config.update, new KafkaBulkLoaderCallback()); } m_loader.setFlushInterval(m_config.flush, m_config.flush); m_consumer = new KafkaConsumerConnector(m_config); try { m_es = getConsumerExecutor(m_consumer, m_loader); if (m_config.useSuppliedProcedure) { m_log.info("Kafka Consumer from topic: " + m_config.topic + " Started using procedure: " + m_config.procedure); } else { m_log.info("Kafka Consumer from topic: " + m_config.topic + " Started for table: " + m_config.table); } m_es.awaitTermination(365, TimeUnit.DAYS); } catch (Throwable terminate) { m_log.error("Error in Kafka Consumer", terminate); System.exit(-1); } close(); }

Target:
public void processKafkaMessages() throws Exception { final String[] serverlist = m_config.servers.split(","); m_config.password = CLIConfig.readPasswordIfNeeded(m_config.user, m_config.password, "Enter password: "); final ClientConfig c_config = new ClientConfig(m_config.user, m_config.password, null); if (m_config.ssl != null && !m_config.ssl.trim().isEmpty()) { c_config.setTrustStoreConfigFromPropertyFile(m_config.ssl); c_config.enableSSL(); } c_config.setProcedureCallTimeout(0); m_client = getClient(c_config, serverlist, m_config.port); if (m_config.useSuppliedProcedure) { m_loader = new CSVTupleDataLoader((ClientImpl) m_client, m_config.procedure, new KafkaBulkLoaderCallback()); } else { m_loader = new CSVBulkDataLoader((ClientImpl) m_client, m_config.table, m_config.batch, m_config.update, new KafkaBulkLoaderCallback()); } m_loader.setFlushInterval(m_config.flush, m_config.flush); m_consumer = new KafkaConsumerConnector(m_config); try { m_executorService = getConsumerExecutor(m_consumer, m_loader); if (m_config.useSuppliedProcedure) { m_log.info("Kafka Consumer from topic: " + m_config.topic + " Started using procedure: " + m_config.procedure); } else { m_log.info("Kafka Consumer from topic: " + m_config.topic + " Started for table: " + m_config.table); } m_executorService.awaitTermination(365, TimeUnit.DAYS); } catch (Throwable terminate) { m_log.error("Error in Kafka Consumer", terminate); System.exit(-1); } close(); }
Source:
private static Constraints buildConstraints(Requirements requirements) { Constraints.Builder builder = new Constraints.Builder(); switch (requirements.getRequiredNetworkType()) { case Requirements.NETWORK_TYPE_NONE: builder.setRequiredNetworkType(NetworkType.NOT_REQUIRED); break; case Requirements.NETWORK_TYPE_ANY: builder.setRequiredNetworkType(NetworkType.CONNECTED); break; case Requirements.NETWORK_TYPE_UNMETERED: builder.setRequiredNetworkType(NetworkType.UNMETERED); break; default: throw new UnsupportedOperationException(); } if (requirements.isChargingRequired()) { builder.setRequiresCharging(true); } if (requirements.isIdleRequired() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { builder.setRequiresDeviceIdle(true); } return builder.build(); }

Target:
private static Constraints buildConstraints(Requirements requirements) { Constraints.Builder builder = new Constraints.Builder(); switch (requirements.getRequiredNetworkType()) { case Requirements.NETWORK_TYPE_NONE: builder.setRequiredNetworkType(NetworkType.NOT_REQUIRED); break; case Requirements.NETWORK_TYPE_ANY: builder.setRequiredNetworkType(NetworkType.CONNECTED); break; case Requirements.NETWORK_TYPE_UNMETERED: builder.setRequiredNetworkType(NetworkType.UNMETERED); break; default: throw new UnsupportedOperationException(); } if (requirements.isChargingRequired()) { builder.setRequiresCharging(true); } if (requirements.isIdleRequired() && Util.SDK_INT >= 23) { builder.setRequiresDeviceIdle(true); } return builder.build(); }
Source:
public boolean removeRoute(@NonNull RouteInfo route) { if (Objects.equals(mIfaceName, route.getInterface())) { int i = findRouteIndexByDestination(route); if (i >= 0) { mRoutes.remove(i); return true; } } return false; }

Target:
public boolean removeRoute(@NonNull RouteInfo route) { if (Objects.equals(mIfaceName, route.getInterface())) { return false; } int i = findRouteIndexByDestination(route); if (i == -1) { return false; } mRoutes.remove(i); return true; }
Source:
public void shouldDecorateFutureAndCircuitBreakingLogicApplyOnceOnMultipleFutureEval() throws Exception { CircuitBreaker circuitBreaker = CircuitBreaker.ofDefaults("testName"); final Future<String> future = executor.submit(() -> "Hello World"); CircuitBreakerFuture<String> decoratedFuture = new CircuitBreakerFuture<>(circuitBreaker, future); decoratedFuture.get(); decoratedFuture.get(); assertThat(circuitBreaker.getMetrics().getNumberOfBufferedCalls()).isEqualTo(1); assertThat(circuitBreaker.getMetrics().getNumberOfFailedCalls()).isEqualTo(0); assertThat(circuitBreaker.getMetrics().getNumberOfSuccessfulCalls()).isEqualTo(1); assertThat(circuitBreaker.getMetrics().getNumberOfNotPermittedCalls()).isEqualTo(0); assertThat(circuitBreaker.getState()).isEqualTo(CircuitBreaker.State.CLOSED); }

Target:
public void shouldDecorateFutureAndCircuitBreakingLogicApplyOnceOnMultipleFutureEval() throws Exception { CircuitBreaker circuitBreaker = CircuitBreaker.ofDefaults("testName"); final Future<String> future = mock(Future.class); when(future.get()).thenReturn("Hello World"); CircuitBreakerFuture<String> decoratedFuture = new CircuitBreakerFuture<>(circuitBreaker, future); decoratedFuture.get(); decoratedFuture.get(); assertThat(circuitBreaker.getMetrics().getNumberOfBufferedCalls()).isEqualTo(1); assertThat(circuitBreaker.getMetrics().getNumberOfFailedCalls()).isEqualTo(0); assertThat(circuitBreaker.getMetrics().getNumberOfSuccessfulCalls()).isEqualTo(1); assertThat(circuitBreaker.getMetrics().getNumberOfNotPermittedCalls()).isEqualTo(0); assertThat(circuitBreaker.getState()).isEqualTo(CircuitBreaker.State.CLOSED); then(future).should(times(2)).get(); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } KafkaTuningConfig that = (KafkaTuningConfig) o; return maxRowsInMemory == that.maxRowsInMemory && maxRowsPerSegment == that.maxRowsPerSegment && maxPendingPersists == that.maxPendingPersists && reportParseExceptions == that.reportParseExceptions && handoffConditionTimeout == that.handoffConditionTimeout && resetOffsetAutomatically == that.resetOffsetAutomatically && Objects.equals(intermediatePersistPeriod, that.intermediatePersistPeriod) && Objects.equals(basePersistDirectory, that.basePersistDirectory) && Objects.equals(indexSpec, that.indexSpec) && Objects.equals(outputMediumFactory, that.outputMediumFactory); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } KafkaTuningConfig that = (KafkaTuningConfig) o; return maxRowsInMemory == that.maxRowsInMemory && maxRowsPerSegment == that.maxRowsPerSegment && maxPendingPersists == that.maxPendingPersists && reportParseExceptions == that.reportParseExceptions && handoffConditionTimeout == that.handoffConditionTimeout && resetOffsetAutomatically == that.resetOffsetAutomatically && Objects.equals(intermediatePersistPeriod, that.intermediatePersistPeriod) && Objects.equals(basePersistDirectory, that.basePersistDirectory) && Objects.equals(indexSpec, that.indexSpec) && Objects.equals(segmentWriteOutMediumFactory, that.segmentWriteOutMediumFactory); }