auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onRestoreInstanceState(Bundle savedInstanceStateBundle) { if (savedInstanceStateBundle == null) { return; } if (!savedInstanceStateBundle.containsKey(STABLE_ID_MAP)) { return; } mStableIdMap = (HashMap<Long, Boolean>) savedInstanceStateBundle.getSerializable(STABLE_ID_MAP); int i = 0; while (i < mHelperItemList.size()) { if (getHelperItem(i) instanceof ParentWrapper) { ParentWrapper parentWrapper = (ParentWrapper) getHelperItem(i); if (mStableIdMap.containsKey(parentWrapper.getStableId())) { parentWrapper.setExpanded(mStableIdMap.get(parentWrapper.getStableId())); if (parentWrapper.isExpanded() && !parentWrapper.getParentObject().isInitiallyExpanded()) { List<Object> childObjectList = parentWrapper.getParentObject().getChildObjectList(); if (childObjectList != null) { for (int j = 0; j < childObjectList.size(); j++) { i++; mHelperItemList.add(i, childObjectList.get(j)); } } } else if (!parentWrapper.isExpanded() && parentWrapper.getParentObject().isInitiallyExpanded()) { List<Object> childObjectList = parentWrapper.getParentObject().getChildObjectList(); for (int j = 0; j < childObjectList.size(); j++) { mHelperItemList.remove(i + 1); } } } else { parentWrapper.setExpanded(false); } } i++; } notifyDataSetChanged(); }

Target:
public void onRestoreInstanceState(Bundle savedInstanceStateBundle) { if (savedInstanceStateBundle == null) { return; } if (!savedInstanceStateBundle.containsKey(STABLE_ID_MAP)) { return; } mStableIdMap = (HashMap<Long, Boolean>) savedInstanceStateBundle.getSerializable(STABLE_ID_MAP); int i = 0; while (i < mHelperItemList.size()) { Object helperItem = getHelperItem(i); if (helperItem instanceof ParentWrapper) { ParentWrapper parentWrapper = (ParentWrapper) helperItem; if (mStableIdMap.containsKey(parentWrapper.getStableId())) { parentWrapper.setExpanded(mStableIdMap.get(parentWrapper.getStableId())); if (parentWrapper.isExpanded() && !parentWrapper.getParentObject().isInitiallyExpanded()) { List<Object> childObjectList = parentWrapper.getParentObject().getChildObjectList(); if (childObjectList != null) { for (int j = 0; j < childObjectList.size(); j++) { i++; mHelperItemList.add(i, childObjectList.get(j)); } } } else if (!parentWrapper.isExpanded() && parentWrapper.getParentObject().isInitiallyExpanded()) { List<Object> childObjectList = parentWrapper.getParentObject().getChildObjectList(); for (int j = 0; j < childObjectList.size(); j++) { mHelperItemList.remove(i + 1); } } } else { parentWrapper.setExpanded(false); } } i++; } notifyDataSetChanged(); }
Source:
protected boolean checkDisksNotInBackupStorage() { Map<Guid, Guid> diskIdToDestSdId = getVm().getDiskMap() .values() .stream() .collect(Collectors.toMap(Disk::getId, disk -> disk.getDiskStorageType() == DiskStorageType.IMAGE ? ((DiskImage) disk).getStorageIds().get(0) : Guid.Empty)); for (Map.Entry diskToSd : diskIdToDestSdId.entrySet()) { StorageDomainStatic destDomain = storageDomainStaticDao.get(((DiskImage) diskToSd).getStorageIds().get(0)); if (destDomain.isBackup()) { return false; } } return true; }

Target:
protected boolean checkDisksNotInBackupStorage() { Disk disk = getVm().getDiskMap() .values() .stream() .filter(vmDisk -> vmDisk.getDiskStorageType() == DiskStorageType.IMAGE && storageDomainStaticDao.get(((DiskImage) vmDisk).getStorageIds().get(0)).isBackup()) .findFirst() .orElse(null); if (disk != null) { return false; } return true; }
Source:
public MantaClient(final ConfigContext config) { dumpConfig(config); final String mantaURL = config.getMantaURL(); final String account = config.getMantaUser(); ConfigContext.validate(config); this.url = mantaURL; this.config = config; this.home = ConfigContext.deriveHomeDirectoryFromUser(account); final KeyPairFactory keyPairFactory = new KeyPairFactory(config); final KeyPair keyPair = keyPairFactory.createKeyPair(); final Signer.Builder builder = new Signer.Builder(keyPair); if (ObjectUtils.firstNonNull(config.disableNativeSignatures(), false)) { builder.providerCode("stdlib"); } final ThreadLocalSigner signer = new ThreadLocalSigner(builder); this.connectionFactory = new MantaConnectionFactory(config, keyPair, signer); this.connectionContext = new MantaApacheHttpClientContext(this.connectionFactory); if (BooleanUtils.isTrue(config.isClientEncryptionEnabled())) { this.httpHelper = new EncryptionHttpHelper(connectionContext, connectionFactory, config); } else { this.httpHelper = new StandardHttpHelper(connectionContext, connectionFactory, config); } this.uriSigner = new UriSigner(this.config, keyPair, signer); }

Target:
public MantaClient(final ConfigContext config) { dumpConfig(config); final String mantaURL = config.getMantaURL(); final String account = config.getMantaUser(); ConfigContext.validate(config); this.url = mantaURL; this.config = config; this.home = ConfigContext.deriveHomeDirectoryFromUser(account); final KeyPairFactory keyPairFactory = new KeyPairFactory(config); final KeyPair keyPair = keyPairFactory.createKeyPair(); final Signer.Builder builder = new Signer.Builder(keyPair); if (ObjectUtils.firstNonNull( config.disableNativeSignatures(), DefaultsConfigContext.DEFAULT_DISABLE_NATIVE_SIGNATURES)) { builder.providerCode("stdlib"); } final ThreadLocalSigner signer = new ThreadLocalSigner(builder); this.connectionFactory = new MantaConnectionFactory(config, keyPair, signer); this.connectionContext = new MantaApacheHttpClientContext(this.connectionFactory); if (BooleanUtils.isTrue(config.isClientEncryptionEnabled())) { this.httpHelper = new EncryptionHttpHelper(connectionContext, connectionFactory, config); } else { this.httpHelper = new StandardHttpHelper(connectionContext, connectionFactory, config); } this.uriSigner = new UriSigner(this.config, keyPair, signer); }
Source:
public InfoboxChoiceModal openInfoboxChoiceModal() { infoboxButton.click(); return new InfoboxChoiceModal(webDriver); }

Target:
public InfoboxChoiceModal openInfoboxChoiceModal() { webDriverWait.until(ExpectedConditions.elementToBeClickable(infoboxButton)); infoboxButton.click(); return new InfoboxChoiceModal(webDriver); }
Source:
private static long nanosBetween(long start, long end) { return Math.abs(end - start); }

Target:
private static long nanosBetween(long start, long end) { return max(0, end - start); }
Source:
private boolean passCheck() { if (G.enableDeviceCheck()) { deviceCheck(); } else { switch (G.protectionLevel()) { case "p0": return true; case "p1": final String oldpwd = G.profile_pwd(); if (oldpwd.length() == 0) { return true; } else { requestPassword(); } break; case "p2": final String pwd = G.sPrefs.getString("LockPassword", ""); if (pwd.length() == 0) { return true; } else { requestPassword(); } case "p3": if(FingerprintUtil.isAndroidSupport() && G.isFingerprintEnabled()){ requestFingerprint(); } } } return false; }

Target:
private boolean passCheck() { if (G.enableDeviceCheck()) { deviceCheck(); } else { switch (G.protectionLevel()) { case "p0": return true; case "p1": final String oldpwd = G.profile_pwd(); if (oldpwd.length() == 0) { return true; } else { requestPassword(); } break; case "p2": final String pwd = G.sPrefs.getString("LockPassword", ""); if (pwd.length() == 0) { return true; } else { requestPassword(); } break; case "p3": if(FingerprintUtil.isAndroidSupport() && G.isFingerprintEnabled()){ requestFingerprint(); } } } return false; }
Source:
protected DataObjectSupport(Storage storage, Configuration configuration, Path path, InputSplit inputSplit) { Assert.notNull(storage, "Storage must be set"); Assert.notNull(storage, "Configuration must be set"); Assert.isTrue(!(path == null && inputSplit == null), "Either path or input split must be set"); Assert.isTrue(!(path == null && inputSplit == null), "Either path or input split must be set"); this.storage = storage; this.configuration = configuration; this.path = path; this.inputSplit = inputSplit; }

Target:
protected DataObjectSupport(Storage storage, Configuration configuration, Path path, InputSplit inputSplit) { Assert.notNull(storage, "Storage must be set"); Assert.notNull(configuration, "Configuration must be set"); Assert.isTrue(!(path == null && inputSplit == null), "Either path or input split must be set"); Assert.isTrue(!(path != null && inputSplit != null), "Either path or input split must be set"); this.storage = storage; this.configuration = configuration; this.path = path; this.inputSplit = inputSplit; }
Source:
protected void startTransferThread() { try { final byte[] keyBytes = key.getBytes("UTF-8"); Runnable transferFromQueueToSystem = () -> { while (!Thread.currentThread().isInterrupted()) { try { byte[] serializedLogEvent = logQueue.take(); metrics.logMessagesBytes.inc(serializedLogEvent.length); metrics.logMessagesCount.inc(); OutgoingMessageEnvelope outgoingMessageEnvelope = new OutgoingMessageEnvelope(systemStream, keyBytes, serializedLogEvent); systemProducer.send(SOURCE, outgoingMessageEnvelope); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Throwable t) { log.error("Error sending " + appenderName +" event to SystemProducer", t); } } }; transferThread = new Thread(transferFromQueueToSystem); transferThread.setDaemon(true); transferThread.setName("Samza " + appenderName + " Producer " + transferThread.getName()); transferThread.start(); } catch (UnsupportedEncodingException e) { throw new SamzaException(String.format( "Container name: %s could not be encoded to bytes. %s cannot proceed.", key, appenderName), e); } }

Target:
private void startTransferThread() { try { final byte[] keyBytes = key.getBytes("UTF-8"); Runnable transferFromQueueToSystem = () -> { while (!Thread.currentThread().isInterrupted()) { try { byte[] serializedLogEvent = logQueue.take(); metrics.logMessagesBytesSent.inc(serializedLogEvent.length); metrics.logMessagesCountSent.inc(); OutgoingMessageEnvelope outgoingMessageEnvelope = new OutgoingMessageEnvelope(systemStream, keyBytes, serializedLogEvent); systemProducer.send(SOURCE, outgoingMessageEnvelope); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Throwable t) { metrics.logMessagesErrors.inc(); log.error("Error sending " + getName() + " event to SystemProducer", t); } } }; transferThread = new Thread(transferFromQueueToSystem); transferThread.setDaemon(true); transferThread.setName("Samza " + getName() + " Producer " + transferThread.getName()); transferThread.start(); } catch (UnsupportedEncodingException e) { throw new SamzaException(String.format( "Container name: %s could not be encoded to bytes. %s cannot proceed.", key, getName()), e); } }
Source:
public void testEquals() { String value = "someValue"; String type = "someType"; float confidenceLevel = 0.9f; TypedId typedId = new TypedId(value, type, confidenceLevel); assertNotEquals(null, typedId); assertNotEquals("string", typedId); assertNotEquals(typedId, new TypedId("otherValue", type, confidenceLevel)); assertNotEquals(typedId, new TypedId(value, "otherType", confidenceLevel)); assertNotEquals(typedId, new TypedId(value, type, 0.8f)); assertEquals(typedId, new TypedId(value, type, confidenceLevel)); }

Target:
public void testEquals() { String value = "someValue"; String type = "someType"; float confidenceLevel = 0.9f; TypedId typedId = new TypedId(value, type, confidenceLevel); assertNotNull(typedId); assertNotEquals("string", typedId); assertNotEquals(typedId, new TypedId("otherValue", type, confidenceLevel)); assertNotEquals(typedId, new TypedId(value, "otherType", confidenceLevel)); assertNotEquals(typedId, new TypedId(value, type, 0.8f)); assertEquals(typedId, new TypedId(value, type, confidenceLevel)); }
Source:
void showNotification(Notification notification) { Platform.runLater(() -> { triggerTimeoutAction(); notificationPane.setGraphic(notification.getIcon()); notificationPane.setText(notification.getMessage()); notificationPane.getActions().clear(); notificationPane.getActions().add(new Action(notification.getButtonLabel(), actionEvent -> { notification.getButtonRunnable().run(); hideNotification(); })); notificationPaneTimer = new TickingTimer("Notification Timer", notification.getTimeoutDuration(), integer -> {}, () -> Platform.runLater(this::triggerTimeoutAction), TimeUnit.SECONDS); notificationPane.setOnHiding(event -> Platform.runLater(() -> { if (this.notification.isPresent()) { determineAndRunTimeoutAction(); hideNotification(); } })); notificationPane.show(); notificationPaneTimer.start(); this.notification = Optional.of(notification); }); }

Target:
void showNotification(Notification notification) { Platform.runLater(() -> { if (notificationPane.isShowing()) { triggerTimeoutAction(); } notificationPane.setGraphic(notification.getIcon()); notificationPane.setText(notification.getMessage()); notificationPane.getActions().clear(); notificationPane.getActions().add(new Action(notification.getButtonLabel(), actionEvent -> { notification.getButtonRunnable().run(); hideNotification(); })); notificationPaneTimer = new TickingTimer("Notification Timer", notification.getTimeoutDuration(), integer -> {}, () -> Platform.runLater(this::triggerTimeoutAction), TimeUnit.SECONDS); notificationPane.setOnHiding(event -> triggerTimeoutAction()); notificationPane.show(); notificationPaneTimer.start(); this.notification = Optional.of(notification); }); }
Source:
protected boolean onOK(Metadata trailers) { ProcessingStatus status = requestManager.onOK(); if (status == ProcessingStatus.INLALID) { onError(INVALID_RESPONSE, trailers); return true; } if (status == ProcessingStatus.SUCCESS || status == ProcessingStatus.NOT_RETRYABLE) { completionFuture.set(Arrays.asList(requestManager.buildResponse())); return true; } long nextBackOff = getNextBackoff(); if (nextBackOff == BackOff.STOP) { rpc.getRpcMetrics().markRetriesExhasted(); completionFuture.set(Arrays.asList(requestManager.buildResponse())); operationSpan.addAnnotation("MutationCount", ImmutableMap.of("failureCount", AttributeValue.longAttributeValue(requestManager.getRetryRequest().getEntriesCount()))); return true; } performRetry(nextBackOff); operationSpan.addAnnotation("MutationCount", ImmutableMap.of("retryCount", AttributeValue.longAttributeValue(requestManager.getRetryRequest().getEntriesCount()))); return false; }

Target:
protected boolean onOK(Metadata trailers) { ProcessingStatus status = requestManager.onOK(); if (status == ProcessingStatus.INVALID) { onError(INVALID_RESPONSE, trailers); return true; } if (status == ProcessingStatus.SUCCESS || status == ProcessingStatus.NOT_RETRYABLE) { completionFuture.set(Arrays.asList(requestManager.buildResponse())); return true; } long nextBackOff = getNextBackoff(); if (nextBackOff == BackOff.STOP) { rpc.getRpcMetrics().markRetriesExhasted(); completionFuture.set(Arrays.asList(requestManager.buildResponse())); operationSpan.addAnnotation("MutationCount", ImmutableMap.of("failureCount", AttributeValue.longAttributeValue(requestManager.getRetryRequest().getEntriesCount()))); return true; } performRetry(nextBackOff); operationSpan.addAnnotation("MutationCount", ImmutableMap.of("retryCount", AttributeValue.longAttributeValue(requestManager.getRetryRequest().getEntriesCount()))); return false; }
Source:
private void registerRequestMetrics(MeterRegistry registry, IEventBus eventBus) { FunctionCounter.builder("requests.completed", eventBus, bus -> bus.getFinishedMessages(Request.TAG)) .description("The approximate total number of requests that have completed execution") .register(registry); Gauge.builder("requests.processing", eventBus, bus -> bus.getProcessingMessages(Request.TAG)) .description("The approximate number of requests that are currently under execution") .register(registry); Gauge.builder("requests.queued", eventBus, bus -> bus.getInQueueMessages(Request.TAG)) .description("The approximate number of requests that are queued for execution") .register(registry); }

Target:
private void registerRequestMetrics(MeterRegistry registry, IEventBus eventBus) { FunctionCounter.builder("requests.completed", eventBus, bus -> bus.getCompletedMessages(Request.TAG)) .description("The total number of requests that have completed execution") .register(registry); Gauge.builder("requests.processing", eventBus, bus -> bus.getProcessingMessages(Request.TAG)) .description("The approximate number of requests that are currently under execution") .register(registry); Gauge.builder("requests.queued", eventBus, bus -> bus.getInQueueMessages(Request.TAG)) .description("The approximate number of requests that are queued for execution") .register(registry); FunctionCounter.builder("requests.succeeded", eventBus, bus -> bus.getSucceededMessages(Request.TAG)) .description("The total number of requests that have successfully completed execution") .register(registry); FunctionCounter.builder("requests.failed", eventBus, bus -> bus.getFailedMessages(Request.TAG)) .description("The total number of requests that have failed execution") .register(registry); }
Source:
public void setConfig(Map<String, Object> config) { if (config instanceof RubyHashMapDecorator) { this.config.clear(); this.config.putAll(config); } else { this.config = config; } }

Target:
public final void setConfig(Map<String, Object> config) { if (configFinalized) { throw new IllegalStateException("It is only allowed to set the config in the constructor!"); } this.config = config; }
Source:
protected void handleResponse(CommandContext ctx, OperationResponse response, boolean composite) throws CommandLineException { displayResponseHeaders(ctx, response); handleAttachedFile(ctx, response); }

Target:
protected void handleResponse(CommandContext ctx, OperationResponse response, boolean composite) throws CommandLineException { handleResponse(ctx, response.getResponseNode(), composite); handleAttachedFile(ctx, response); }
Source:
private Collection<Key> getRegisteredKeys() { List<Key> result = new ArrayList<Key>(); for (Iterator<Key> i = cacheMap.keySet().iterator(); i.hasNext();) { result.add(i.next()); } return result; }

Target:
private Collection<Key> getRegisteredKeys() { return new ArrayList<Key>(cacheMap.keySet()); }
Source:
public int get(PageId pageId, int pageOffset, int bytesToRead, byte[] buffer, int offsetInBuffer) { Preconditions.checkArgument(pageOffset <= mPageSize, "Read exceeds page boundary: offset=%s size=%s", pageOffset, mPageSize); Preconditions.checkArgument(bytesToRead <= buffer.length - offsetInBuffer, "buffer does not have enough space: bufferLength=%s offsetInBuffer=%s bytesToRead=%s", buffer.length, offsetInBuffer, bytesToRead); LOG.debug("get({},pageOffset={}) enters", pageId, pageOffset); if (mState.get() == NOT_IN_USE) { Metrics.GET_NOT_READY_ERRORS.inc(); Metrics.GET_ERRORS.inc(); return 0; } boolean hasPage; ReadWriteLock pageLock = getPageLock(pageId); try (LockResource r = new LockResource(pageLock.readLock())) { try (LockResource r2 = new LockResource(mMetaLock.readLock())) { hasPage = mMetaStore.hasPage(pageId); } if (!hasPage) { LOG.debug("get({},pageOffset={}) fails due to page not found", pageId, pageOffset); return 0; } int bytesRead = getPage(pageId, pageOffset, bytesToRead, buffer, offsetInBuffer); if (bytesRead <= 0) { Metrics.GET_ERRORS.inc(); Metrics.GET_STORE_READ_ERRORS.inc(); try (LockResource r2 = new LockResource(mMetaLock.writeLock())) { mMetaStore.removePage(pageId); } catch (PageNotFoundException e) { Metrics.CLEANUP_GET_ERRORS.inc(); } return -1; } LOG.debug("get({},pageOffset={}) exits", pageId, pageOffset); return bytesRead; } }

Target:
public int get(PageId pageId, int pageOffset, int bytesToRead, byte[] buffer, int offsetInBuffer) { Preconditions.checkArgument(pageOffset <= mPageSize, "Read exceeds page boundary: offset=%s size=%s", pageOffset, mPageSize); Preconditions.checkArgument(bytesToRead <= buffer.length - offsetInBuffer, "buffer does not have enough space: bufferLength=%s offsetInBuffer=%s bytesToRead=%s", buffer.length, offsetInBuffer, bytesToRead); LOG.debug("get({},pageOffset={}) enters", pageId, pageOffset); if (mState.get() == NOT_IN_USE) { Metrics.GET_NOT_READY_ERRORS.inc(); Metrics.GET_ERRORS.inc(); return -1; } boolean hasPage; ReadWriteLock pageLock = getPageLock(pageId); try (LockResource r = new LockResource(pageLock.readLock())) { try (LockResource r2 = new LockResource(mMetaLock.readLock())) { hasPage = mMetaStore.hasPage(pageId); } if (!hasPage) { LOG.debug("get({},pageOffset={}) fails due to page not found", pageId, pageOffset); return 0; } int bytesRead = getPage(pageId, pageOffset, bytesToRead, buffer, offsetInBuffer); if (bytesRead <= 0) { Metrics.GET_ERRORS.inc(); Metrics.GET_STORE_READ_ERRORS.inc(); try (LockResource r2 = new LockResource(mMetaLock.writeLock())) { mMetaStore.removePage(pageId); } catch (PageNotFoundException e) { Metrics.CLEANUP_GET_ERRORS.inc(); } return -1; } LOG.debug("get({},pageOffset={}) exits", pageId, pageOffset); return bytesRead; } }
Source:
@Override default Stream<T> shuffle() { return Collections.shuffle(this, Stream::ofAll); }

Target:
default Stream<T> shuffle() { return Collections.shuffle(this, Stream::ofAll); }
Source:
public MultipleCurrencyParameterSensitivity presentValueCurveSensitivity( final Swap<? extends Payment, ? extends Payment> swap, final CurveBuildingBlockBundle blockBundle, final GeneralSmileInterpolator interpolator) { MultipleCurrencyParameterSensitivity firstSense; MultipleCurrencyParameterSensitivity secondSense; if (swap.getFirstLeg().getNthPayment(0) instanceof CouponIbor) { firstSense = presentValueCurveSensitivity((CouponIbor) swap.getFirstLeg() .getNthPayment(0), interpolator); for (int j = 1; j < swap.getFirstLeg().getNumberOfPayments(); j++) { firstSense = firstSense .plus(presentValueCurveSensitivity((CouponIbor) swap.getFirstLeg().getNthPayment(j), interpolator)); } } else { firstSense = MQSBC.fromInstrument(swap.getFirstLeg(), _curves, blockBundle); } if (swap.getSecondLeg().getNthPayment(0) instanceof CouponIbor) { secondSense = presentValueCurveSensitivity((CouponIbor) swap.getSecondLeg() .getNthPayment(0), interpolator); for (int j = 1; j < swap.getSecondLeg().getNumberOfPayments(); j++) { secondSense = secondSense.plus(presentValueCurveSensitivity((CouponIbor) swap.getSecondLeg().getNthPayment(j), interpolator)); } } else { secondSense = MQSBC.fromInstrument(swap.getSecondLeg(), _curves, blockBundle); } MultipleCurrencyParameterSensitivity res = firstSense.plus(secondSense); return res; }

Target:
public MultipleCurrencyParameterSensitivity presentValueCurveSensitivity( final Swap<? extends Payment, ? extends Payment> swap, final CurveBuildingBlockBundle blockBundle, final GeneralSmileInterpolator interpolator) { ArgumentChecker.notNull(swap, "swap"); ArgumentChecker.notNull(blockBundle, "blockBundle"); ArgumentChecker.notNull(interpolator, "interpolator"); MultipleCurrencyParameterSensitivity firstSense; MultipleCurrencyParameterSensitivity secondSense; if (swap.getFirstLeg().getNthPayment(0) instanceof CouponIbor) { firstSense = presentValueCurveSensitivity((CouponIbor) swap.getFirstLeg() .getNthPayment(0), interpolator); for (int j = 1; j < swap.getFirstLeg().getNumberOfPayments(); j++) { firstSense = firstSense .plus(presentValueCurveSensitivity((CouponIbor) swap.getFirstLeg().getNthPayment(j), interpolator)); } } else { firstSense = MQSBC.fromInstrument(swap.getFirstLeg(), _curves, blockBundle); } if (swap.getSecondLeg().getNthPayment(0) instanceof CouponIbor) { secondSense = presentValueCurveSensitivity((CouponIbor) swap.getSecondLeg() .getNthPayment(0), interpolator); for (int j = 1; j < swap.getSecondLeg().getNumberOfPayments(); j++) { secondSense = secondSense.plus(presentValueCurveSensitivity((CouponIbor) swap.getSecondLeg().getNthPayment(j), interpolator)); } } else { secondSense = MQSBC.fromInstrument(swap.getSecondLeg(), _curves, blockBundle); } MultipleCurrencyParameterSensitivity res = firstSense.plus(secondSense); return res; }
Source:
public void normalOperationShouldNotReconfigureKafkaConsumer() { final PartitionData pd = new PartitionData(null, 100L); for (long i = 0; i < 100; ++i) { pd.addEventFromKafka(100L + i + 1, ("test_" + i).getBytes()); } pd.takeEventsToStream(currentTimeMillis(), 1000, 0L); assertEquals(100L, pd.getUnconfirmed()); for (long i = 0; i < 10; ++i) { final PartitionData.CommitResult cr = pd.onCommitOffset(110L + i * 10L); assertEquals(10L, cr.committedCount); assertFalse(cr.seekOnKafka); assertEquals(90L - i * 10L, pd.getUnconfirmed()); } }

Target:
public void normalOperationShouldNotReconfigureKafkaConsumer() { final PartitionData pd = new PartitionData(null, 100L); for (long i = 0; i < 100; ++i) { pd.addEventFromKafka(100L + i + 1, ("test_" + i).getBytes(UTF_8)); } pd.takeEventsToStream(currentTimeMillis(), 1000, 0L); assertEquals(100L, pd.getUnconfirmed()); for (long i = 0; i < 10; ++i) { final PartitionData.CommitResult cr = pd.onCommitOffset(110L + i * 10L); assertEquals(10L, cr.committedCount); assertFalse(cr.seekOnKafka); assertEquals(90L - i * 10L, pd.getUnconfirmed()); } }
Source:
protected By buildMobileNativeBy() { AnnotatedElement annotatedElement = annotatedElementContainer.getAnnotated(); HowToUseLocators howToUseLocators = annotatedElement.getAnnotation(HowToUseLocators.class); Optional<HowToUseLocators> howToUseLocatorsOptional = ofNullable(howToUseLocators); By result = null; if (isAndroid()) { return buildMobileBy(howToUseLocatorsOptional.map(HowToUseLocators::androidAutomation).orElse(null), getBys(AndroidFindBy.class, AndroidFindBys.class, AndroidFindAll.class)); } if (isIOSXcuit() || isIOS()) { result = buildMobileBy(howToUseLocatorsOptional.map(HowToUseLocators::iOSXCUITAutomation).orElse(null), getBys(iOSXCUITFindBy.class, iOSXCUITFindBys.class, iOSXCUITFindAll.class)); } if (isWindows()) { return buildMobileBy(howToUseLocatorsOptional.map(HowToUseLocators::windowsAutomation).orElse(null), getBys(WindowsFindBy.class, WindowsFindBys.class, WindowsFindAll.class)); } return ofNullable(result).orElse(null); }

Target:
protected By buildMobileNativeBy() { AnnotatedElement annotatedElement = annotatedElementContainer.getAnnotated(); HowToUseLocators howToUseLocators = annotatedElement.getAnnotation(HowToUseLocators.class); Optional<HowToUseLocators> howToUseLocatorsOptional = ofNullable(howToUseLocators); if (isAndroid()) { return buildMobileBy(howToUseLocatorsOptional.map(HowToUseLocators::androidAutomation).orElse(null), getBys(AndroidFindBy.class, AndroidFindBys.class, AndroidFindAll.class)); } if (isIOSXcuit() || isIOS()) { return buildMobileBy(howToUseLocatorsOptional.map(HowToUseLocators::iOSXCUITAutomation).orElse(null), getBys(iOSXCUITFindBy.class, iOSXCUITFindBys.class, iOSXCUITFindAll.class)); } if (isWindows()) { return buildMobileBy(howToUseLocatorsOptional.map(HowToUseLocators::windowsAutomation).orElse(null), getBys(WindowsFindBy.class, WindowsFindBys.class, WindowsFindAll.class)); } return null; }
Source:
protected String[] getRequiredUpdateFields() { return new String[] { "action", "model" }; }

Target:
protected String[] getRequiredUpdateFields() { return new String[] {}; }
Source:
public void test_setUrl_remote_with_post() { secondsToWaitTillFail = 35; String url = "<LINK_0>"; assumeTrue("Skipping test due to bad internet connection", checkInternet(url)); testLog.append("checkInternet() passed"); String expectedTitle = "Bug List"; Runnable browserSetFunc = () -> { testLog.append("Setting Browser url to:" + url); boolean opSuccess = browser.setUrl( url, "emailassigned_to1=foo&bug_severity=enhancement&bug_status=NEW", null); assertTrue("Expecting setUrl() to return true", opSuccess); }; validateTitleChanged(expectedTitle, browserSetFunc); int numChars = browser.getText().length(); assertTrue("Response data contained " + numChars + " chars.", numChars > 10000); }

Target:
public void test_setUrl_remote_with_post() { secondsToWaitTillFail = 35; String url = "<LINK_0>"; assumeTrue("Skipping test due to bad internet connection", checkInternet(url)); testLog.append("checkInternet() passed"); String expectedTitle = "Bug List"; Runnable browserSetFunc = () -> { testLog.append("Setting Browser url to:" + url); boolean opSuccess = browser.setUrl( url, "bug_severity=enhancement&bug_status=NEW&email1=rgrunber&emailassigned_to1=1&emailtype1=substring", null); assertTrue("Expecting setUrl() to return true", opSuccess); }; validateTitleChanged(expectedTitle, browserSetFunc); System.out.println("Debugging on remote : " + browser.getText()); int numChars = browser.getText().length(); assertTrue("Response data contained " + numChars + " chars.", numChars > 10000); }
Source:
protected void fillTimeEventContextMenu(@NonNull IMenuManager menuManager) { ISelection selection = getSite().getSelectionProvider().getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection sSel = (IStructuredSelection) selection; if (sSel.getFirstElement() instanceof ITimeGraphEntry) { Object entryObject = sSel.toArray()[1]; if (entryObject instanceof ITimeEvent) { ITimeGraphEntry entry = (ITimeGraphEntry) sSel.getFirstElement(); while (!(entry instanceof TraceEntry)) { entry = entry.getParent(); if (entry == null) { return; } } TraceEntry tEntry = (TraceEntry) entry; ITmfTrace trace = tEntry.getTrace(); Iterable<@NonNull ITmfCallsiteResolver> analyses = TmfTraceUtils.getAnalysisModulesOfClass(trace, ITmfCallsiteResolver.class); for (ITmfCallsiteResolver analysis : analyses) { long timestamp = getTimeGraphViewer().getSelectionBegin(); IContributionItem contribItem = createOpenSouceCodeAction(analysis, getDiscriminator((ITimeEvent)(entryObject), timestamp), timestamp); if (contribItem != null) { menuManager.add(contribItem); } } } } } }

Target:
protected void fillTimeEventContextMenu(@NonNull IMenuManager menuManager) { ISelection selection = getSite().getSelectionProvider().getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection sSel = (IStructuredSelection) selection; if (sSel.getFirstElement() instanceof ITimeGraphEntry) { Object entryObject = sSel.toArray()[1]; if (entryObject instanceof TimeEvent) { TimeEvent timeEvent = (TimeEvent) entryObject; ITimeGraphEntry entry = (ITimeGraphEntry) sSel.getFirstElement(); while (!(entry instanceof TraceEntry)) { entry = entry.getParent(); if (entry == null) { return; } } TraceEntry tEntry = (TraceEntry) entry; ITmfTrace trace = tEntry.getTrace(); CallsiteDataProvider csdp = DataProviderManager.getInstance().getDataProvider(trace, CallsiteDataProvider.ID, CallsiteDataProvider.class); if(csdp == null) { return; } long timestamp = getTimeGraphViewer().getSelectionBegin(); Map<String, Object> map = new HashMap<>(); map.put(DataProviderParameterUtils.REQUESTED_TIME_KEY, Collections.singletonList(timestamp)); map.put(DataProviderParameterUtils.REQUESTED_ITEMS_KEY, Collections.singletonList(getCpu(timeEvent, timestamp))); Map<@NonNull String, @NonNull String> model = csdp.fetchTooltip(map, new NullProgressMonitor()).getModel(); IContributionItem contribItem = createOpenSouceCodeAction(model); if (contribItem != null) { menuManager.add(contribItem); } } } } }
Source:
public boolean isSlaveAggregatorIdsValid(VdsNetworkInterface bond, List<VdsNetworkInterface> interfaces) { Integer bondAggregatorId = bond.getAdAggregatorId(); if (bondAggregatorId == null) { return true; } String bondName = bond.getName(); for (VdsNetworkInterface slave : interfaces) { if (bondName.equals(slave.getBondName())) { if (!bondAggregatorId.equals(slave.getAdAggregatorId())) { return false; } } } return true; }

Target:
private boolean isSlaveAggregatorIdsValid(VdsNetworkInterface bond, List<VdsNetworkInterface> interfaces) { Integer bondAggregatorId = bond.getAdAggregatorId(); if (bondAggregatorId == null) { return true; } return isAggregatorsEqual(bond, interfaces); }
Source:
private Set<EnumFacing> floodFill(int pos) { Set<EnumFacing> set = EnumSet.<EnumFacing>noneOf(EnumFacing.class); Queue<Integer> queue = Queues.<Integer>newArrayDeque(); queue.add(IntegerCache.getInteger(pos)); this.opaqueBlocksBitSet.set(pos, true); while (!queue.isEmpty()) { int i = ((Integer) queue.poll()).intValue(); RenderVariables.addEdges(i, set); for (EnumFacing enumfacing : EnumFacing.values()) { int j = RenderVariables.getNeighborIndexAtFace(i, enumfacing); if (j >= 0 && !this.opaqueBlocksBitSet.get(j)) { this.opaqueBlocksBitSet.set(j, true); queue.add(IntegerCache.getInteger(j)); } } } return set; }

Target:
private Set<EnumFacing> floodFill(int pos) { Set<EnumFacing> set = EnumSet.<EnumFacing>noneOf(EnumFacing.class); Queue<Integer> queue = Queues.<Integer>newArrayDeque(); queue.add(IntegerCache.getInteger(pos)); this.opaqueBlocksBitSet.set(pos, true); while (!queue.isEmpty()) { int i = queue.poll(); RenderVariables.addEdges(i, set); for (EnumFacing enumfacing : EnumFacing.values()) { int j = RenderVariables.getNeighborIndexAtFace(i, enumfacing); if (j >= 0 && !this.opaqueBlocksBitSet.get(j)) { this.opaqueBlocksBitSet.set(j, true); queue.add(IntegerCache.getInteger(j)); } } } return set; }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { fieldName = getArguments().getString(NAME); listener.setActionBarTitle(fieldName); sendCurrentDate(); } }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { fieldName = getArguments().getString(NAME); changeListener.setActionBarTitle(fieldName); sendCurrentDate(); } }
Source:
private void refreshChannelAdapters() { Set<String> groups = redisOperations.boundSetOps(CONSUMER_GROUPS_KEY_PREFIX + bindingName).members(); for (String group : groups) { if (!adapters.containsKey(group)) { String channel = String.format("%s.%s", this.bindingName, group); adapters.put(group, createProducerEndpoint(channel, accessor)); } } }

Target:
private void refreshChannelAdapters() { Set<String> groups = redisOperations.boundZSetOps(CONSUMER_GROUPS_KEY_PREFIX + bindingName).rangeByScore(1, Double.MAX_VALUE); for (String group : groups) { if (!adapters.containsKey(group)) { String channel = String.format("%s.%s", this.bindingName, group); adapters.put(group, createProducerEndpoint(channel, accessor)); } } }
Source:
void handleResponse(ResponseInfo responseInfo) { checkExpiredInflightRequests(); completeOperationIfDone(); DeleteRequest deleteRequest = (DeleteRequest) responseInfo.getRequest(); InflightRequestInfo inflightRequestInfo = inflightRequestInfos.remove(deleteRequest.getCorrelationId()); if (inflightRequestInfo != null) { ReplicaId replica = inflightRequestInfo.replica; if (responseInfo.getError() != null) { updateOnRouterErrorCode(replica, RouterErrorCode.OperationTimedOut); } else { try { DeleteResponse deleteResponse = DeleteResponse.readFrom(new DataInputStream(new ByteBufferInputStream(responseInfo.getResponse()))); if (deleteResponse.getCorrelationId() != deleteRequest.getCorrelationId()) { logger.error("The correlation id in the DeleteResponse " + deleteResponse.getCorrelationId() + " is not the same as the correlation id in the associated DeleteRequest: " + deleteRequest .getCorrelationId()); operationException = new RouterException("Received wrong response that is not for the corresponding request.", RouterErrorCode.UnexpectedInternalError); completeOperation(); return; } else { updateOnServerErrorCode(replica, deleteResponse.getError()); } } catch (IOException e) { logger.error("Unable to recover a deleteResponse from received stream."); updateOnRouterErrorCode(replica, RouterErrorCode.UnexpectedInternalError); } } completeOperationIfDone(); } }

Target:
void handleResponse(ResponseInfo responseInfo) { DeleteRequest deleteRequest = (DeleteRequest) responseInfo.getRequest(); InflightRequestInfo inflightRequestInfo = inflightRequestInfos.remove(deleteRequest.getCorrelationId()); if (inflightRequestInfo == null) { return; } ReplicaId replica = inflightRequestInfo.replica; if (responseInfo.getError() != null) { responseHandler.onRequestResponseException(replica, new IOException(("NetworkClient error."))); updateOperationState(replica, RouterErrorCode.OperationTimedOut); } else { try { DeleteResponse deleteResponse = DeleteResponse.readFrom(new DataInputStream(new ByteBufferInputStream(responseInfo.getResponse()))); if (deleteResponse.getCorrelationId() != deleteRequest.getCorrelationId()) { logger.error("The correlation id in the DeleteResponse " + deleteResponse.getCorrelationId() + " is not the same as the correlation id in the associated DeleteRequest: " + deleteRequest .getCorrelationId()); setOperationException( new RouterException("Received wrong response that is not for the corresponding request.", RouterErrorCode.UnexpectedInternalError)); updateOperationState(replica, RouterErrorCode.UnexpectedInternalError); return; } else { responseHandler.onRequestResponseError(replica, deleteResponse.getError()); processServerError(replica, deleteResponse.getError()); } } catch (IOException e) { logger.error("Unable to recover a deleteResponse from received stream."); updateOperationState(replica, RouterErrorCode.UnexpectedInternalError); } } checkAndMaybeComplete(); }
Source:
private void createMessage(BriefObjectMetadata metadata, String username, Boolean force) { PID pid = metadata.getPid(); Datastream originalDs = metadata.getDatastreamObject(ORIGINAL_FILE.getId()); Datastream hasThumbnail = metadata.getDatastreamObject(THUMBNAIL_SMALL.getId()); if (originalDs == null && hasThumbnail == null) { return; } PID originalPid = (originalDs != null) ? DatastreamPids.getOriginalFilePid(pid) : pid; Document msg = makeEnhancementOperationBody(username, originalPid, force); messageSender.sendMessage(msg); }

Target:
private void createMessage(BriefObjectMetadata metadata, String username, Boolean force) { PID pid = metadata.getPid(); Datastream originalDs = metadata.getDatastreamObject(ORIGINAL_FILE.getId()); PID originalPid = (originalDs != null) ? DatastreamPids.getOriginalFilePid(pid) : pid; Document msg = makeEnhancementOperationBody(username, originalPid, force); messageSender.sendMessage(msg); }
Source:
public void setEnabled(boolean enabled, Composite parent) { super.setEnabled(enabled, parent); group.setEnabled(enabled); for (Control element : group.getChildren()) { element.setEnabled(enabled); } }

Target:
public void setEnabled(boolean enabled, Composite parent) { super.setEnabled(enabled, parent); group.setEnabled(enabled); for (Control child : group.getChildren()) { child.setEnabled(enabled); } }
Source:
public void testValueLoaderWithLocking() throws Exception { CountDownLatch waitUntilThread1LocksValueGetter = new CountDownLatch(1); Future<String> thread1 = fork(() -> cache.get("test", () -> { waitUntilThread1LocksValueGetter.countDown(); TimeUnit.MILLISECONDS.sleep(10); return "thread1"; })); Future<String> thread2 = fork(() -> { waitUntilThread1LocksValueGetter.await(); return cache.get("test", () -> "thread2"); }); String valueObtainedByThread1 = thread1.get(); String valueObtainedByThread2 = thread2.get(); Cache.ValueWrapper valueAfterGetterIsDone = cache.get("test"); assertNotNull(valueAfterGetterIsDone); assertEquals("thread1", valueAfterGetterIsDone.get()); assertEquals("thread1", valueObtainedByThread1); assertEquals("thread1", valueObtainedByThread2); }

Target:
public void testValueLoaderWithLocking() throws Exception { CountDownLatch waitUntilThread1LocksValueGetter = new CountDownLatch(1); Future<String> thread1 = fork(() -> cache.get("test", () -> { waitUntilThread1LocksValueGetter.countDown(); return "thread1"; })); Future<String> thread2 = fork(() -> { waitUntilThread1LocksValueGetter.await(30, TimeUnit.SECONDS); return cache.get("test", () -> "thread2"); }); String valueObtainedByThread1 = thread1.get(); String valueObtainedByThread2 = thread2.get(); Cache.ValueWrapper valueAfterGetterIsDone = cache.get("test"); assertNotNull(valueAfterGetterIsDone); assertEquals("thread1", valueAfterGetterIsDone.get()); assertEquals("thread1", valueObtainedByThread1); assertEquals("thread1", valueObtainedByThread2); }
Source:
public TranslatedExpression<T> translate(FunctionMetadata functionMetadata, RowExpression original, TranslatedExpression<T>... translatedArguments) { return translate(functionMetadata, original, Arrays.asList(translatedArguments)); }

Target:
public TranslatedExpression<T> translate(FunctionMetadata functionMetadata, RowExpression original, TranslatedExpression<T>... translatedArguments) throws Throwable { return translate(functionMetadata, original, ImmutableList.copyOf(translatedArguments)); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PrestoWarning that = (PrestoWarning) o; return code == that.code && Objects.equals(message, that.message); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PrestoWarning that = (PrestoWarning) o; return Objects.equals(warningCode, that.warningCode) && Objects.equals(message, that.message); }
Source:
public void getVisitType(final GetVisitTypeCallbackListener callbackListener) { RestApi restApi = RestServiceBuilder.createService(RestApi.class); Call<Results<VisitType>> call = restApi.getVisitType(); call.enqueue(new Callback<Results<VisitType>>() { @Override public void onResponse(Call<Results<VisitType>> call, Response<Results<VisitType>> response) { if (response.isSuccessful()) { callbackListener.onGetVisitTypeResponse(response.body().getResults().get(0)); } else { callbackListener.onErrorResponse(response.message()); } } @Override public void onFailure(Call<Results<VisitType>> call, Throwable t) { callbackListener.onErrorResponse(t.getMessage()); } }); }

Target:
public void getVisitType(final GetVisitTypeCallbackListener callbackListener) { Call<Results<VisitType>> call = restApi.getVisitType(); call.enqueue(new Callback<Results<VisitType>>() { @Override public void onResponse(Call<Results<VisitType>> call, Response<Results<VisitType>> response) { if (response.isSuccessful()) { callbackListener.onGetVisitTypeResponse(response.body().getResults().get(0)); } else { callbackListener.onErrorResponse(response.message()); } } @Override public void onFailure(Call<Results<VisitType>> call, Throwable t) { callbackListener.onErrorResponse(t.getMessage()); } }); }
Source:
public void updateHandler(IIssue issue, String handler, Date modifyDate) { int oldActor = getUserID(issue.getAssignto()); IQueryValueSet valueSet = new MySQLQuerySet(); valueSet.addTableName("mantis_bug_table"); valueSet.addInsertValue("handler_id", Integer.toString(getUserID(handler))); int oldStatus = ITSEnum.getStatus(issue.getStatus()); if (oldStatus != ITSEnum.ASSIGNED_STATUS) { valueSet.addInsertValue("status", Integer.toString(ITSEnum.ASSIGNED_STATUS)); } valueSet.addEqualCondition("id", Long.toString(issue.getIssueID())); String updateQuery = valueSet.getUpdateQuery(); getControl().execute(updateQuery); String newActor = getUserID(handler) + ""; String oldActorString = ""; if (oldActor > 0) { oldActorString = String.valueOf(oldActor); } HistoryObject history = new HistoryObject( issue.getIssueID(), issue.getIssueType(), HistoryObject.TYPE_HANDLER, oldActorString, newActor, System.currentTimeMillis()); history.save(); }

Target:
public void updateHandler(IIssue issue, String handler, Date modifyDate) { int oldActor = getUserID(issue.getAssignto()); IQueryValueSet valueSet = new MySQLQuerySet(); valueSet.addTableName("mantis_bug_table"); valueSet.addInsertValue("handler_id", Integer.toString(getUserID(handler))); int oldStatus = ITSEnum.getStatus(issue.getStatus()); if (oldStatus != ITSEnum.ASSIGNED_STATUS) { valueSet.addInsertValue("status", Integer.toString(ITSEnum.ASSIGNED_STATUS)); } valueSet.addEqualCondition("id", Long.toString(issue.getIssueID())); String updateQuery = valueSet.getUpdateQuery(); getControl().execute(updateQuery); String newUsername = getUserID(handler) + ""; String oldActorString = ""; if (oldActor > 0) { oldActorString = String.valueOf(oldActor); } HistoryObject handlerHistory = new HistoryObject( issue.getIssueID(), issue.getIssueType(), HistoryObject.TYPE_HANDLER, oldActorString, newUsername, System.currentTimeMillis()); handlerHistory.save(); }
Source:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Kind.CALL_EXPR, ctx -> { PyCallExpressionTree callExpression = (PyCallExpressionTree) ctx.syntaxNode(); List<PyArgumentTree> arguments = callExpression.arguments() != null ? callExpression.arguments().arguments() : Collections.emptyList(); String qualifiedName = getQualifiedName(callExpression, ctx); if (CRYPTOGRAPHY.matcher(qualifiedName).matches()) { new CryptographyModuleCheck().checkArguments(ctx, arguments); } else if (CRYPTO.matcher(qualifiedName).matches()) { new CryptoModuleCheck().checkArguments(ctx, arguments); } else if (CRYPTODOME.matcher(qualifiedName).matches()) { new CryptodomeModuleCheck().checkArguments(ctx, arguments); } }); }

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Kind.CALL_EXPR, ctx -> { PyCallExpressionTree callExpression = (PyCallExpressionTree) ctx.syntaxNode(); List<PyArgumentTree> arguments = callExpression.arguments(); String qualifiedName = getQualifiedName(callExpression, ctx); if (CRYPTOGRAPHY.matcher(qualifiedName).matches()) { new CryptographyModuleCheck().checkArguments(ctx, arguments); } else if (CRYPTO.matcher(qualifiedName).matches()) { new CryptoModuleCheck().checkArguments(ctx, arguments); } else if (CRYPTODOME.matcher(qualifiedName).matches()) { new CryptodomeModuleCheck().checkArguments(ctx, arguments); } }); }
Source:
public void beforeMethod() throws Exception { _gSetupTool.addCluster(_clusterName, true); _manager = HelixManagerFactory .getZKHelixManager(_clusterName, "Admin", InstanceType.ADMINISTRATOR, ZK_ADDR); _manager.connect(); _gSetupTool.addInstanceToCluster(_clusterName, _instanceName); _participant = new MockParticipantManager(ZK_ADDR, _clusterName, _instanceName); StateModelFactory<StateModel> stateModelFactory = new MasterSlaveStateModelFactory(_instanceName, 0); StateMachineEngine stateMach = _participant.getStateMachineEngine(); stateMach.registerStateModelFactory("MasterSlave", stateModelFactory); Map<String, TaskFactory> taskFactoryReg = new HashMap<>(); _participant.getStateMachineEngine().registerStateModelFactory(TaskConstants.STATE_MODEL_NAME, new TaskStateModelFactory(_participant, taskFactoryReg)); _participant.syncStart(); _controller = new ClusterControllerManager(ZK_ADDR, _clusterName, null); _controller.syncStart(); }

Target:
public void beforeMethod() throws Exception { _gSetupTool.addCluster(CLUSTER_NAME, true); _manager = HelixManagerFactory .getZKHelixManager(CLUSTER_NAME, "Admin", InstanceType.ADMINISTRATOR, ZK_ADDR); _manager.connect(); _gSetupTool.addInstanceToCluster(CLUSTER_NAME, INSTANCE_NAME); _participant = new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, INSTANCE_NAME); StateModelFactory<StateModel> stateModelFactory = new MasterSlaveStateModelFactory(INSTANCE_NAME); StateMachineEngine stateMach = _participant.getStateMachineEngine(); stateMach.registerStateModelFactory(MASTER_SLAVE_STATE_MODEL, stateModelFactory); Map<String, TaskFactory> taskFactoryReg = new HashMap<>(); _participant.getStateMachineEngine().registerStateModelFactory(TaskConstants.STATE_MODEL_NAME, new TaskStateModelFactory(_participant, taskFactoryReg)); _participant.syncStart(); _controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, null); _controller.syncStart(); }
Source:
public Config getConfig() { return (Config) getFromMetricsMessage(GROUP_NAME_FOR_DIAGNOSTICS_MANAGER, CONFIG); }

Target:
public Config getConfig() { return new MapConfig((Map<String, String>) getFromMetricsMessage(GROUP_NAME_FOR_DIAGNOSTICS_MANAGER, CONFIG_METRIC_NAME)); }