auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void edit(final VmInterfaceModel iface) { driver.edit(iface); networkFilterParameterWidget.edit(iface.getNetworkFilterParameterListModel()); networkFilterParameterWidget.setEnabled(iface.isNetworkFilterParameterWidgetVisible()); networkFilterParameterWidget.setVisible(iface.isNetworkFilterParameterWidgetVisible()); hideMacWhenNotEnabled(iface); iface.getMAC().getPropertyChangedEvent().addListener((ev, sender, args) -> { if ("IsAvailable".equals(args.propertyName)) { hideMacWhenNotEnabled(iface); } }); }

Target:
public void edit(final VmInterfaceModel iface) { driver.edit(iface); networkFilterParameterWidget.edit(iface.getNetworkFilterParameterListModel()); networkFilterParameterWidget.setEnabled(iface.getNetworkFilterParameterListModel().getIsAvailable()); networkFilterParameterWidget.setVisible(iface.getNetworkFilterParameterListModel().getIsAvailable()); hideMacWhenNotEnabled(iface); iface.getMAC().getPropertyChangedEvent().addListener((ev, sender, args) -> { if ("IsAvailable".equals(args.propertyName)) { hideMacWhenNotEnabled(iface); } }); }
Source:
private void copyFiles() { try { String xmlSourceFolder = "src/test/resources/"; String catalogLargeFile = "catalogLarge.xml"; String catalogSmallFile = "catalogSmall.xml"; FileUtils.copyFile(new File(xmlSourceFolder + catalogLargeFile), new File(SOURCE_FOLDER_PATH + catalogLargeFile)); FileUtils.copyFile(new File(xmlSourceFolder + catalogSmallFile), new File(SOURCE_FOLDER_PATH + catalogSmallFile)); } catch (IOException e) { e.printStackTrace(); } }

Target:
public void copyFiles() throws IOException { URL largeXMLUrl = this.getClass().getResource("/" + CATALOG_LARGE_XML_FILE_NAME); URL smallXMLUrl = this.getClass().getResource("/" + CATALOG_SMALL_XML_FILE_NAME); FileUtils.copyFile(new File(largeXMLUrl.getFile()), new File(sourceFolder, CATALOG_LARGE_XML_FILE_NAME)); FileUtils.copyFile(new File(smallXMLUrl.getFile()), new File(sourceFolder, CATALOG_SMALL_XML_FILE_NAME)); }
Source:
FileStoreAttributeCache(Path file) throws IOException, InterruptedException { if (!Files.exists(file)) { throw new FileNotFoundException(file.toString()); } Path dir = Files.isDirectory(file) ? file : file.getParent(); Path probe = dir.resolve("probe-timestamp-resolution"); Files.createFile(probe); try { FileTime startTime = Files.getLastModifiedTime(probe); FileTime actTime = startTime; long sleepTime = 64; while (actTime.compareTo(startTime) <= 0) { TimeUnit.NANOSECONDS.sleep(sleepTime); try (OutputStream fos = Files.newOutputStream(probe)) { } actTime = Files.getLastModifiedTime(probe); sleepTime = sleepTime * 2; } fsTimestampResolution = Duration.between(startTime.toInstant(), actTime.toInstant()); } finally { Files.delete(probe); } }

Target:
FileStoreAttributeCache(Path file) throws IOException, InterruptedException { if (!Files.exists(file)) { throw new FileNotFoundException(file.toString()); } Path dir = Files.isDirectory(file) ? file : file.getParent(); Path probe = dir.resolve("probe-timestamp-resolution"); Files.createFile(probe); try { FileTime startTime = Files.getLastModifiedTime(probe); FileTime actTime = startTime; long sleepTime = 64; while (actTime.compareTo(startTime) <= 0) { TimeUnit.NANOSECONDS.sleep(sleepTime); try (OutputStream fos = Files.newOutputStream(probe)) { } actTime = Files.getLastModifiedTime(probe); if (sleepTime < 100_000_000L) { sleepTime = sleepTime * 2; } } fsTimestampResolution = Duration.between(startTime.toInstant(), actTime.toInstant()); } finally { Files.delete(probe); } }
Source:
protected Reader getReader() { logger.info("this.script: " + this.script); return new StringReader(script); }

Target:
protected Reader getReader() { return new StringReader(script); }
Source:
public void writeCrashReport(final File file) throws JSONException { HockeyLog.debug("Writing unhandled exception to: " + file.getAbsolutePath()); BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(file)); writeHeader(writer, FIELD_APP_PACKAGE, appPackage); writeHeader(writer, FIELD_APP_VERSION_CODE, appVersionCode); writeHeader(writer, FIELD_APP_VERSION_NAME, appVersionName); writeHeader(writer, FIELD_OS_VERSION, osVersion); writeHeader(writer, FIELD_OS_BUILD, osBuild); writeHeader(writer, FIELD_DEVICE_MANUFACTURER, deviceManufacturer); writeHeader(writer, FIELD_DEVICE_MODEL, deviceModel); writeHeader(writer, FIELD_THREAD_NAME, threadName); writeHeader(writer, FIELD_CRASH_REPORTER_KEY, reporterKey); writeHeader(writer, FIELD_APP_START_DATE, JSONDateUtils.toString(appStartDate)); writeHeader(writer, FIELD_APP_CRASH_DATE, JSONDateUtils.toString(appCrashDate)); if (isXamarinException) { writeHeader(writer, FIELD_FORMAT, FIELD_FORMAT_VALUE); } writer.write("\n"); if (throwableStackTrace.length() > STACKTRACE_MAX_LENGTH) { throwableStackTrace = throwableStackTrace.substring(0, throwableStackTrace.lastIndexOf('\n', STACKTRACE_MAX_LENGTH - 1) + 1); } writer.write(throwableStackTrace); writer.flush(); } catch (IOException e) { HockeyLog.error("Error saving crash report!", e); } finally { try { if (writer != null) { writer.close(); } } catch (IOException e1) { HockeyLog.error("Error saving crash report!", e1); } } }

Target:
public void writeCrashReport(final File file) throws JSONException { HockeyLog.debug("Writing unhandled exception to: " + file.getAbsolutePath()); BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(file)); writeHeader(writer, FIELD_APP_PACKAGE, appPackage); writeHeader(writer, FIELD_APP_VERSION_CODE, appVersionCode); writeHeader(writer, FIELD_APP_VERSION_NAME, appVersionName); writeHeader(writer, FIELD_OS_VERSION, osVersion); writeHeader(writer, FIELD_OS_BUILD, osBuild); writeHeader(writer, FIELD_DEVICE_MANUFACTURER, deviceManufacturer); writeHeader(writer, FIELD_DEVICE_MODEL, deviceModel); writeHeader(writer, FIELD_THREAD_NAME, threadName); writeHeader(writer, FIELD_CRASH_REPORTER_KEY, reporterKey); writeHeader(writer, FIELD_APP_START_DATE, JSONDateUtils.toString(appStartDate)); writeHeader(writer, FIELD_APP_CRASH_DATE, JSONDateUtils.toString(appCrashDate)); if (isXamarinException) { writeHeader(writer, FIELD_FORMAT, FIELD_FORMAT_VALUE); } writer.write("\n"); writer.write(throwableStackTrace); writer.flush(); } catch (IOException e) { HockeyLog.error("Error saving crash report!", e); } finally { try { if (writer != null) { writer.close(); } } catch (IOException e1) { HockeyLog.error("Error saving crash report!", e1); } } }
Source:
protected void assertValues(TestDescriptor d, String id, String name, String desc) { Assert.assertEquals(id, d.id); Assert.assertEquals(name, d.name); Assert.assertEquals(desc, d.desc); }

Target:
protected void assertValues(TestDescriptor d, String id, String name, String desc) { assertEquals(id, d.id); assertEquals(name, d.name); assertEquals(desc, d.desc); }
Source:
public void setUp() throws Exception { tmp = File.createTempFile("jgit_test_", "_tmp"); CleanupThread.deleteOnShutdown(tmp); if (!tmp.delete() || !tmp.mkdir()) { throw new IOException("Cannot create " + tmp); } mockSystemReader = new MockSystemReader(); SystemReader.setInstance(mockSystemReader); FS.getFileStoreAttributes(tmp.toPath().getParent()); FileBasedConfig jgitConfig = new FileBasedConfig( new File(tmp, "jgitconfig"), FS.DETECTED); jgitConfig.save(); FileBasedConfig systemConfig = new FileBasedConfig( new File(tmp, "systemgitconfig"), FS.DETECTED); FileBasedConfig userConfig = new FileBasedConfig( new File(tmp, "usergitconfig"), FS.DETECTED); userConfig.setBoolean(ConfigConstants.CONFIG_GC_SECTION, null, ConfigConstants.CONFIG_KEY_AUTODETACH, false); userConfig.save(); mockSystemReader.setJGitConfig(jgitConfig); mockSystemReader.setSystemGitConfig(systemConfig); mockSystemReader.setUserGitConfig(userConfig); ceilTestDirectories(getCeilings()); author = new PersonIdent("J. Author", "jauthor@example.com"); committer = new PersonIdent("J. Committer", "jcommitter@example.com"); final WindowCacheConfig c = new WindowCacheConfig(); c.setPackedGitLimit(128 * WindowCacheConfig.KB); c.setPackedGitWindowSize(8 * WindowCacheConfig.KB); c.setPackedGitMMAP(useMMAP); c.setDeltaBaseCacheLimit(8 * WindowCacheConfig.KB); c.install(); }

Target:
public void setUp() throws Exception { tmp = File.createTempFile("jgit_test_", "_tmp"); CleanupThread.deleteOnShutdown(tmp); if (!tmp.delete() || !tmp.mkdir()) { throw new IOException("Cannot create " + tmp); } mockSystemReader = new MockSystemReader(); SystemReader.setInstance(mockSystemReader); FS.getFileStoreAttributes(tmp.toPath().getParent()); FileBasedConfig jgitConfig = new FileBasedConfig( new File(tmp, "jgitconfig"), FS.DETECTED); FileBasedConfig systemConfig = new FileBasedConfig(jgitConfig, new File(tmp, "systemgitconfig"), FS.DETECTED); FileBasedConfig userConfig = new FileBasedConfig(systemConfig, new File(tmp, "usergitconfig"), FS.DETECTED); userConfig.setBoolean(ConfigConstants.CONFIG_GC_SECTION, null, ConfigConstants.CONFIG_KEY_AUTODETACH, false); userConfig.save(); mockSystemReader.setJGitConfig(jgitConfig); mockSystemReader.setSystemGitConfig(systemConfig); mockSystemReader.setUserGitConfig(userConfig); ceilTestDirectories(getCeilings()); author = new PersonIdent("J. Author", "jauthor@example.com"); committer = new PersonIdent("J. Committer", "jcommitter@example.com"); final WindowCacheConfig c = new WindowCacheConfig(); c.setPackedGitLimit(128 * WindowCacheConfig.KB); c.setPackedGitWindowSize(8 * WindowCacheConfig.KB); c.setPackedGitMMAP(useMMAP); c.setDeltaBaseCacheLimit(8 * WindowCacheConfig.KB); c.install(); }
Source:
public boolean match(final Message msg) { long m; try { if (msg instanceof IMAPMessage) { m = ((IMAPMessage) msg).getModSeq(); } else { return false; } } catch (MessagingException e) { return false; } return m >= modSeq; }

Target:
public boolean match(final Message msg) { throw new UnsupportedOperationException("This method should not be used. Only for override purpose."); }
Source:
public void start(Context context) { if (locationManager == null) { locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); } try { locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, minTime, minDistance, this); } catch (java.lang.SecurityException ex) { Log.i(TAG, "fail to request location update, ignore", ex); } catch (IllegalArgumentException ex) { Log.d(TAG, "network provider does not exist, " + ex.getMessage()); } try { locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, minTime, minDistance, this); } catch (java.lang.SecurityException ex) { Log.i(TAG, "fail to request location update, ignore", ex); } catch (IllegalArgumentException ex) { Log.d(TAG, "gps provider does not exist " + ex.getMessage()); } coordinateJsonObject = new JsonObject(); jsonObject = new JsonObject(); startJsonDataLogging(); }

Target:
public void start(Context context) { if (locationManager == null) { locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); } if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { if (getRecorderListener() != null) { String errorMsg = context.getString(R.string.rsb_system_feature_gps_text); getRecorderListener().onFail(this, new IllegalStateException(errorMsg)); } return; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { PackageManager pm = context.getPackageManager(); int hasPerm = pm.checkPermission(Manifest.permission.ACCESS_FINE_LOCATION, context.getPackageName()); if (hasPerm != PackageManager.PERMISSION_GRANTED) { if (getRecorderListener() != null) { String errorMsg = context.getString(R.string.rsb_permission_location_desc); getRecorderListener().onFail(this, new IllegalStateException(errorMsg)); } return; } } try { locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, minTime, minDistance, this); } catch (java.lang.SecurityException ex) { Log.i(TAG, "fail to request location update, ignore", ex); } catch (IllegalArgumentException ex) { Log.d(TAG, "gps provider does not exist " + ex.getMessage()); } coordinateJsonObject = new JsonObject(); jsonObject = new JsonObject(); startJsonDataLogging(); }
Source:
public boolean onCreateOptionsMenu(Menu menu) { MenuItem buttonSettings = menu.add(R.string.title_settings); buttonSettings.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); buttonSettings.setOnMenuItemClickListener(new MenuItem. OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { Intent settingsIntent = new Intent(AddEntryActivity.this, SettingsActivity.class); settingsIntent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsFragment.class.getName()); settingsIntent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true); AddEntryActivity.this.startActivity(settingsIntent); return false; } }); MenuItem buttonSignout = menu.add(R.string.title_signout); buttonSignout.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); buttonSignout.setOnMenuItemClickListener(new MenuItem. OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { ApiInterface.getInstance().logOut(); Intent logOut = new Intent(AddEntryActivity.this, LoginActivity.class); logOut.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(logOut); return false; } }); return true; }

Target:
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.items, menu); return super.onCreateOptionsMenu(menu); }
Source:
public Map<TaskName, Set<SystemStreamPartition>> group(final Set<SystemStreamPartition> ssps) { Map<TaskName, Set<SystemStreamPartition>> groupedMap = new HashMap<>(); if (ssps == null) { throw new SamzaException("ssp set cannot be null!"); } if (ssps.size() == 0) { throw new SamzaException("Cannot process stream task with no input system stream partitions"); } if (isPassthroughJobCoordinator) { final TaskName taskName = new TaskName(String.format("Task-%d", containerId)); groupedMap.put(taskName, ssps); } else { IntStream.range(0, taskCount).forEach(i -> { final TaskName taskName = new TaskName(String.format("Task-%s", String.valueOf(i))); groupedMap.put(taskName, ssps); }); } return groupedMap; }

Target:
public Map<TaskName, Set<SystemStreamPartition>> group(final Set<SystemStreamPartition> ssps) { Map<TaskName, Set<SystemStreamPartition>> groupedMap = new HashMap<>(); if (ssps == null) { throw new SamzaException("ssp set cannot be null!"); } if (ssps.size() == 0) { throw new SamzaException("Cannot process stream task with no input system stream partitions"); } processorNames.forEach(processorName -> { final TaskName taskName = new TaskName(String.format("Task-%s", processorName)); groupedMap.put(taskName, ssps); }); return groupedMap; }
Source:
static StatsSnapshot convertQuotaToStatsSnapshot(Map<String, Map<String, Long>> quotaMap) { Map<String, StatsSnapshot> accountValidSizeMap = new HashMap<>(); long totalSize = 0; for (Map.Entry<String, Map<String, Long>> entry : quotaMap.entrySet()) { long subTotalSize = 0; Map<String, StatsSnapshot> containerValidSizeMap = new HashMap<>(); for (Map.Entry<String, Long> innerEntry : entry.getValue().entrySet()) { subTotalSize += innerEntry.getValue(); containerValidSizeMap.put(innerEntry.getKey(), new StatsSnapshot(innerEntry.getValue(), null)); } totalSize += subTotalSize; accountValidSizeMap.put(entry.getKey(), new StatsSnapshot(subTotalSize, containerValidSizeMap)); } return new StatsSnapshot(totalSize, accountValidSizeMap); }

Target:
static StatsSnapshot convertQuotaToStatsSnapshot(Map<String, Map<String, Long>> quotaMap) { Map<String, StatsSnapshot> accountValidSizeMap = new HashMap<>(); long totalSize = 0; for (Map.Entry<String, Map<String, Long>> accountEntry : quotaMap.entrySet()) { long subTotalSize = 0; Map<String, StatsSnapshot> containerValidSizeMap = new HashMap<>(); for (Map.Entry<String, Long> containerEntry : accountEntry.getValue().entrySet()) { subTotalSize += containerEntry.getValue(); containerValidSizeMap.put(containerEntry.getKey(), new StatsSnapshot(containerEntry.getValue(), null)); } totalSize += subTotalSize; accountValidSizeMap.put(accountEntry.getKey(), new StatsSnapshot(subTotalSize, containerValidSizeMap)); } return new StatsSnapshot(totalSize, accountValidSizeMap); }
Source:
NativeSchemaIndexAccessor<DurationSchemaKey,NativeSchemaValue> makeAccessorWithSamplingConfig( IndexSamplingConfig samplingConfig ) throws IOException { TemporalIndexFiles.FileLayout<DurationSchemaKey> fileLayout = new TemporalIndexFiles.FileLayout<>( getIndexFile(), layout, ValueGroup.LOCAL_DATE_TIME ); return new TemporalIndexAccessor.PartAccessor<>( pageCache, fs, fileLayout, IMMEDIATE, monitor, schemaIndexDescriptor, indexId, samplingConfig ); }

Target:
NativeSchemaIndexAccessor<DurationSchemaKey,NativeSchemaValue> makeAccessorWithSamplingConfig( IndexSamplingConfig samplingConfig ) throws IOException { TemporalIndexFiles.FileLayout<DurationSchemaKey> fileLayout = new TemporalIndexFiles.FileLayout<>( getIndexFile(), layout, ValueGroup.DURATION ); return new TemporalIndexAccessor.PartAccessor<>( pageCache, fs, fileLayout, IMMEDIATE, monitor, schemaIndexDescriptor, indexId, samplingConfig ); }
Source:
public void setEndDate(Date endDate) { this.endDate = endDate != null ? (Date) endDate.clone() : null; }

Target:
public void setEndDate(Date endDate) { this.endDate = endDate != null ? new Date(endDate.getTime()) : null; }
Source:
private void pulseDigging() { float hardness = digging.getMaterialValues().getHardness() * 1000; hardness *= 5; long duration = System.currentTimeMillis() - diggingStarted; double completion = (double) duration / hardness; int stage = (int) (completion * 10); if (stage > 9) stage = 9; broadcastBlockBreakAnimation(digging, stage); }

Target:
private void pulseDigging() { ++diggingTicks; float hardness = digging.getMaterialValues().getHardness() * 20; hardness *= 5; double completion = (double) diggingTicks / hardness; int stage = (int) (completion * 10); if (stage > 9) stage = 9; broadcastBlockBreakAnimation(digging, stage); }
Source:
public static void main(String[] args) { List<CustomerDto> customers = new ArrayList<>(); CustomerDto customerOne = new CustomerDto("1", "Kelly", "Brown"); CustomerDto customerTwo = new CustomerDto("2", "Alfonso", "Bass"); customers.add(customerOne); customers.add(customerTwo); CustomerResource customerResource = new CustomerResource(customers); System.out.println("All customers:-"); List<CustomerDto> allCustomers = customerResource.getAllCustomers(); printCustomerDetails(allCustomers); System.out.println("----------------------------------------------------------"); System.out.println("Deleting customer with id {1}"); customerResource.delete(customerOne.getId()); allCustomers = customerResource.getAllCustomers(); printCustomerDetails(allCustomers); System.out.println("----------------------------------------------------------"); System.out.println("Adding customer three}"); CustomerDto customerThree = new CustomerDto("3", "Lynda", "Blair"); customerResource.save(customerThree); allCustomers = customerResource.getAllCustomers(); printCustomerDetails(allCustomers); }

Target:
public static void main(String[] args) { List<CustomerDto> customers = new ArrayList<>(); CustomerDto customerOne = new CustomerDto("1", "Kelly", "Brown"); CustomerDto customerTwo = new CustomerDto("2", "Alfonso", "Bass"); customers.add(customerOne); customers.add(customerTwo); CustomerResource customerResource = new CustomerResource(customers); LOGGER.info("All customers:-"); List<CustomerDto> allCustomers = customerResource.getAllCustomers(); printCustomerDetails(allCustomers); LOGGER.info("----------------------------------------------------------"); LOGGER.info("Deleting customer with id {1}"); customerResource.delete(customerOne.getId()); allCustomers = customerResource.getAllCustomers(); printCustomerDetails(allCustomers); LOGGER.info("----------------------------------------------------------"); LOGGER.info("Adding customer three}"); CustomerDto customerThree = new CustomerDto("3", "Lynda", "Blair"); customerResource.save(customerThree); allCustomers = customerResource.getAllCustomers(); printCustomerDetails(allCustomers); }
Source:
public String getGender() { return gender.name(); }

Target:
public Gender getGender() { return gender; }
Source:
public MqttBrokerConnection(String host, @Nullable Integer port, boolean secure, @Nullable String clientId) { this.host = host; this.secure = secure; if (clientId == null) { clientId = MqttClient.generateClientId(); assert clientId != null; } else if (clientId.length() > 23) { throw new IllegalArgumentException("Client ID cannot be longer than 23 characters"); } if (port != null && (port <= 0 || port > 65535)) { throw new IllegalArgumentException("Port is not within a valid range"); } this.port = port != null ? port : (secure ? 8883 : 1883); this.clientId = clientId; setReconnectStrategy(new PeriodicReconnectStrategy()); }

Target:
public MqttBrokerConnection(String host, @Nullable Integer port, boolean secure, @Nullable String clientId) { this.host = host; this.secure = secure; String newClientID = clientId; if (newClientID == null) { newClientID = MqttClient.generateClientId(); } else if (newClientID.length() > 23) { throw new IllegalArgumentException("Client ID cannot be longer than 23 characters"); } if (port != null && (port <= 0 || port > 65535)) { throw new IllegalArgumentException("Port is not within a valid range"); } this.port = port != null ? port : (secure ? 8883 : 1883); this.clientId = newClientID; setReconnectStrategy(new PeriodicReconnectStrategy()); }
Source:
public void shouldCreateEntry() throws OperationException { String entryId = "test_entry"; assertEquals("vocabulary", directoryService.getDirectorySchema(vocabularyName)); Session vocabularySession = directoryService.open(vocabularyName); assertTrue(!vocabularySession.hasEntry(entryId)); OperationContext context = new OperationContext(session); OperationChain chain = new OperationChain("shouldCreateEntry"); chain.add(CreateVocabularyEntry.ID).set("name", vocabularyName).set("id", entryId); service.run(context, chain); assertTrue(vocabularySession.hasEntry(entryId)); }

Target:
public void shouldCreateEntry() throws OperationException { String entryId = "test_entry"; assertEquals("vocabulary", directoryService.getDirectorySchema(vocabularyName)); Session vocabularySession = directoryService.open(vocabularyName); assertFalse(vocabularySession.hasEntry(entryId)); OperationContext context = new OperationContext(session); OperationChain chain = new OperationChain("shouldCreateEntry"); chain.add(CreateVocabularyEntry.ID).set("name", vocabularyName).set("id", entryId); service.run(context, chain); assertTrue(vocabularySession.hasEntry(entryId)); }
Source:
InterfaceTypeDefinition createInterface(Map<String, Object> input) { assertTrue(input.get("kind").equals("INTERFACE"), "wrong input"); InterfaceTypeDefinition.Builder interfaceTypeDefinition = InterfaceTypeDefinition.newInterfaceTypeDefinition().name((String) input.get("name")); interfaceTypeDefinition.description(toDescription(input)); if (input.containsKey("interfaces") && input.get("interfaces") != null) { interfaceTypeDefinition.implementz( ((List<Map<String, Object>>) input.get("interfaces")).stream() .map(this::createTypeIndirection) .collect(Collectors.toList()) ); } List<Map<String, Object>> fields = (List<Map<String, Object>>) input.get("fields"); interfaceTypeDefinition.definitions(createFields(fields)); return interfaceTypeDefinition.build(); }

Target:
InterfaceTypeDefinition createInterface(Map<String, Object> input) { assertTrue(input.get("kind").equals("INTERFACE"), () -> "wrong input"); InterfaceTypeDefinition.Builder interfaceTypeDefinition = InterfaceTypeDefinition.newInterfaceTypeDefinition().name((String) input.get("name")); interfaceTypeDefinition.description(toDescription(input)); if (input.containsKey("interfaces") && input.get("interfaces") != null) { interfaceTypeDefinition.implementz( FpKit.map( (List<Map<String, Object>>) input.get("interfaces"), this::createTypeIndirection ) ); } List<Map<String, Object>> fields = (List<Map<String, Object>>) input.get("fields"); interfaceTypeDefinition.definitions(createFields(fields)); return interfaceTypeDefinition.build(); }
Source:
private void setCompletedStatus(boolean completed) { mButton.setEnabled(!completed); mButton.setText(getString(completed ? R.string.completed : R.string.complete_this_guide)); }

Target:
private void setCompletedStatus(boolean completed) { mButton.setEnabled(!completed); mButton.setText(completed ? R.string.completed : (App.get().getSite().isIfixit() ? R.string.i_did_it_success : R.string.complete_this_guide)); }
Source:
public void getSupportFiles(OutputStream output, OrcsApi orcsApi) throws IOException { final ZipOutputStream zout = new ZipOutputStream(output); IResourceRegistry registry = orcsApi.getResourceRegistry(); ResourceToken tokens[] = {AtsRestTemplateTokens.BuiltEditorCss, AtsRestTemplateTokens.BuiltEditorJs}; for (ResourceToken token : tokens) { zout.putNextEntry(new ZipEntry(token.getName())); Lib.inputStreamToOutputStream(registry.getResource(token.getGuid()), zout); zout.closeEntry(); } zout.close(); }

Target:
public void getSupportFiles(OutputStream output, OrcsApi orcsApi) throws IOException { ZipOutputStream zout = null; try { zout = new ZipOutputStream(output); IResourceRegistry registry = orcsApi.getResourceRegistry(); ResourceToken tokens[] = {OseeTemplateTokens.BuiltEditorCss, OseeTemplateTokens.BuiltEditorJs}; for (ResourceToken token : tokens) { zout.putNextEntry(new ZipEntry(token.getName())); Lib.inputStreamToOutputStream(registry.getResource(token.getGuid()), zout); zout.closeEntry(); } } finally { Lib.close(zout); } }
Source:
private void checkProxy(List<? extends Proxy> proxies, Attribution attribution, Map<String, List<String>> creatorMap) { if (!proxies.isEmpty()) { for (Proxy proxy : proxies) { if (creatorMap.size() == 0 && isNotBlank(proxy.getDcCreator())) { creatorMap.putAll(createCreatorMap(proxy.getDcCreator())); } if (attribution.getTitle().size() == 0 && isNotBlank(proxy.getDcTitle())) { attribution.setTitle(concatLangawareMap(proxy.getDcTitle())); } if (attribution.getDate().size() == 0 && isNotBlank(proxy.getYear())) { attribution.setDate(concatLangawareMap(proxy.getYear())); } } } }

Target:
private void checkProxy(List<? extends Proxy> proxies, Attribution attribution, Map<String, List<String>> creatorMap) { if (! proxies.isEmpty()) { for (Proxy proxy : proxies) { if (creatorMap.isEmpty() && isNotBlank(proxy.getDcCreator())) { creatorMap.putAll(createCreatorMap(proxy.getDcCreator())); } if (attribution.getTitle().isEmpty() && isNotBlank(proxy.getDcTitle())) { attribution.setTitle(concatLangawareMap(proxy.getDcTitle())); } if (attribution.getDate().isEmpty() && isNotBlank(proxy.getYear())) { attribution.setDate(concatLangawareMap(proxy.getYear())); } } } }
Source:
protected JsonObject getBuild(String buildId, CloseableHttpClient httpclient, String authorization) throws IOException { String buildURL = getBuildsUrl(httpclient) + "?build_id=" + URLEncoder.encode(buildId, StandardCharsets.UTF_8.name()); HttpGet httpget = new HttpGet(buildURL); httpget.addHeader("accept", ContentType.APPLICATION_JSON.getMimeType()); httpget.addHeader("Authorization", authorization); JsonObject response = StreamsRestUtils.getGsonResponse(httpclient, httpget); JsonObject build = null; JsonArray builds = array(response, "builds"); for (JsonElement iterBuildElem : builds) { JsonObject iterBuild = iterBuildElem.getAsJsonObject(); if (jstring(iterBuild, "id").equals(buildId)) build = iterBuild; } return build; }

Target:
protected JsonObject getBuild(String buildId, CloseableHttpClient httpclient, String authorization) throws IOException { String buildURL = getBuildsUrl(httpclient) + "?build_id=" + URLEncoder.encode(buildId, StandardCharsets.UTF_8.name()); HttpGet httpget = new HttpGet(buildURL); httpget.addHeader("Authorization", authorization); JsonObject response = StreamsRestUtils.getGsonResponse(httpclient, httpget); JsonObject build = null; JsonArray builds = array(response, "builds"); for (JsonElement iterBuildElem : builds) { JsonObject iterBuild = iterBuildElem.getAsJsonObject(); if (jstring(iterBuild, "id").equals(buildId)) build = iterBuild; } return build; }
Source:
@Bean @Qualifier("YouviewQueryExecutor") KnownTypeQueryExecutor youviewQueryExecutor() { MongoLookupEntryStore lookupStore = new MongoLookupEntryStore(mongo.collection("lookup"), new NoLoggingPersistenceAuditLog(), readPreference); KnownTypeContentResolver mongoContentResolver = new MongoContentResolver(mongo, lookupStore); KnownTypeContentResolver cassandraContentResolver = new CassandraKnownTypeContentResolver(cassandra); AllFromPublishersEquivalentContentResolver allFromPublishersEquivalentContentResolver = new AllFromPublishersEquivalentContentResolver( mongoContentResolver, lookupStore ); KnownTypeQueryExecutor queryExecutor = new LookupResolvingQueryExecutor( cassandraContentResolver, allFromPublishersEquivalentContentResolver, lookupStore, cassandraEnabled ); queryExecutor = new UriFetchingQueryExecutor(localOrRemoteFetcher, queryExecutor, equivUpdater, ImmutableSet.of(FACEBOOK)); queryExecutor = new CurieResolvingQueryExecutor(queryExecutor); queryExecutor = new FilterActivelyPublishedOnlyQueryExecutor(queryExecutor); queryExecutor = new MergeOnOutputQueryExecutor(queryExecutor); queryExecutor = new FilterScheduleOnlyQueryExecutor(queryExecutor); return Boolean.parseBoolean(applicationsEnabled) ? new ApplicationConfigurationQueryExecutor(queryExecutor) : queryExecutor; }

Target:
KnownTypeQueryExecutor youviewQueryExecutor() { MongoLookupEntryStore lookupStore = new MongoLookupEntryStore( mongo.collection("lookup"), new NoLoggingPersistenceAuditLog(), readPreference ); KnownTypeContentResolver mongoContentResolver = new MongoContentResolver(mongo, lookupStore); KnownTypeContentResolver cassandraContentResolver = new CassandraKnownTypeContentResolver(cassandra); AllFromPublishersEquivalentContentResolver allFromPublishersEquivalentContentResolver = new AllFromPublishersEquivalentContentResolver(mongoContentResolver, lookupStore); KnownTypeQueryExecutor queryExecutor = new LookupResolvingQueryExecutor( cassandraContentResolver, allFromPublishersEquivalentContentResolver, lookupStore, cassandraEnabled ); queryExecutor = new UriFetchingQueryExecutor (localOrRemoteFetcher, queryExecutor, equivUpdater, ImmutableSet.of(FACEBOOK)); queryExecutor = new CurieResolvingQueryExecutor(queryExecutor); queryExecutor = new FilterActivelyPublishedOnlyQueryExecutor(queryExecutor); queryExecutor = new MergeOnOutputQueryExecutor(queryExecutor); queryExecutor = new FilterScheduleOnlyQueryExecutor(queryExecutor); return Boolean.parseBoolean(applicationsEnabled) ? new ApplicationConfigurationQueryExecutor(queryExecutor) : queryExecutor; }
Source:
public void onPositiveClick(CompileDialog dialog) { List<ChapterCard> toCompile = new ArrayList<>(); for (int i : dialog.getChapterInicies()) { toCompile.add(mChapterCardList.get(i)); mChapterCardList.get(i).destroyAudioPlayer(); } mChaptersCompiled = dialog.getChapterInicies(); CompileChapterTask task = new CompileChapterTask(COMPILE_CHAPTER_TASK, toCompile); mTaskFragment.executeRunnable(task, "Compiling Chapter", "Please wait...", false); }

Target:
public void onPositiveClick(CompileDialog dialog) { List<ChapterCard> toCompile = new ArrayList<>(); for (int i : dialog.getChapterIndicies()) { toCompile.add(mChapterCardList.get(i)); mChapterCardList.get(i).destroyAudioPlayer(); } mChaptersCompiled = dialog.getChapterIndicies(); CompileChapterTask task = new CompileChapterTask(COMPILE_CHAPTER_TASK, toCompile); mTaskFragment.executeRunnable(task, "Compiling Chapter", "Please wait...", false); }
Source:
protected void onInitialize() { super.onInitialize(); getForm().add(new EqualPasswordInputValidator(password, confirmPassword)); IModel<String> labelModel = getLabel(); password.add(new AttributeModifier("placeholder", new StringResourceModel("password.placeholder.enter", labelModel))); password.setLabel(labelModel); confirmPassword.add(new AttributeModifier("placeholder", new StringResourceModel("password.placeholder.confirm", labelModel))); confirmPassword.setLabel(new StringResourceModel("password.confirm.label", labelModel)); confirmPassword.add(AttributeModifier.append("style", "margin-top: 5px;")); }

Target:
protected void onInitialize() { super.onInitialize(); getForm().add(new EqualPasswordInputValidator(password, confirmPassword)); IModel<String> labelModel = getLabel(); password.add(new AttributeModifier("placeholder", new StringResourceModel("password.placeholder.enter", labelModel))); password.setLabel(labelModel); confirmPassword.add(new AttributeModifier("placeholder", new StringResourceModel("password.placeholder.confirm", labelModel))); confirmPassword.setLabel(new StringResourceModel("password.confirm.label", labelModel)); }
Source:
public BaseComponent[] transform(ProxiedPlayer player, BaseComponent... component) { if ( component == null || component.length < 1 || component[0] == null ) { return new BaseComponent[] { new TextComponent( "" ) }; } for ( BaseComponent root : component ) { if ( root.getExtra() != null && !root.getExtra().isEmpty() ) { List<BaseComponent> list = Lists.newArrayList( transform( player, root.getExtra().toArray( new BaseComponent[ root.getExtra().size() ] ) ) ); root.setExtra( list ); } if ( root instanceof ScoreComponent ) { transformScoreComponent( player, (ScoreComponent) root ); } } return component; }

Target:
public BaseComponent[] transform(ProxiedPlayer player, BaseComponent... component) { if ( component == null || component.length < 1 || ( component.length == 1 && component[0] == null ) ) { return new BaseComponent[] { new TextComponent( "" ) }; } for ( BaseComponent root : component ) { if ( root.getExtra() != null && !root.getExtra().isEmpty() ) { List<BaseComponent> list = Lists.newArrayList( transform( player, root.getExtra().toArray( new BaseComponent[ root.getExtra().size() ] ) ) ); root.setExtra( list ); } if ( root instanceof ScoreComponent ) { transformScoreComponent( player, (ScoreComponent) root ); } } return component; }
Source:
private long getCowVirtualSize(String id) throws IOException { byte[] imgContent = new byte[72]; ImageDownload downloadImage = getClient().images().download(id).execute(); try { int bytesRead = downloadImage.getInputStream().read(imgContent, 0, imgContent.length); if (bytesRead != imgContent.length) { throw new RuntimeException("Unable to read image header: " + bytesRead); } } finally { downloadImage.getInputStream().close(); } ByteBuffer b = ByteBuffer.wrap(imgContent); if (b.getInt() == 0x514649fb && b.getInt() == 2) { b.position(24); return b.getLong(); } throw new RuntimeException("Unable to recognize QCOW2 format"); }

Target:
private long getCowVirtualSize(String id) throws IOException { byte[] imgContent = new byte[72]; ImageDownload downloadImage = getClient().images().download(id).execute(); try { int bytesRead = downloadImage.getInputStream().read(imgContent, 0, imgContent.length); if (bytesRead != imgContent.length) { throw new RuntimeException("Unable to read image header: " + bytesRead); } } finally { downloadImage.getInputStream().close(); } ByteBuffer b = ByteBuffer.wrap(imgContent); if (b.getInt() == QCOW2_SIGNATURE && b.getInt() == QCOW2_VERSION) { b.position(QCOW2_SIZE_OFFSET); return b.getLong(); } throw new RuntimeException("Unable to recognize QCOW2 format"); }
Source:
public void testQuestionFormattingChanges() throws IOException { String fileContent = "one,two" + Const.EOL + "Question 1," + Sanitizer.sanitizeForCsv("Hi What do you think about Calculus, Differential Classes ?"); XlsxFileDownloadResult download = new XlsxFileDownloadResult( "/page/instructorFeedbackResultsDownload", null, null, "Normal name", fileContent, Const.FeedbackSessionResultsDownloadTypes.XLSX); assertEquals(2, download.getWorkBook().getSheetAt(0).getLastRowNum()); assertEquals(2, download.getWorkBook().getSheetAt(0).getRow(1).getLastCellNum()); assertEquals(2, download.getWorkBook().getSheetAt(0).getRow(2).getLastCellNum()); assertTrue(download.getWorkBook().getSheetAt(0).getRow(2).getRowStyle().getFont().getBold()); assertEquals(15, download.getWorkBook().getSheetAt(0).getRow(2).getRowStyle().getFont().getFontHeightInPoints()); }

Target:
public void testQuestionFormattingChanges() throws IOException { String fileContent = "one,two" + Const.EOL + "Question 1," + Sanitizer.sanitizeForCsv("Hi What do you think about Calculus, Differential Classes ?"); XlsxFileDownloadResult download = new XlsxFileDownloadResult( "/page/instructorFeedbackResultsDownload", null, null, "Normal name", fileContent, Const.FeedbackSessionResultsDownloadTypes.XLSX); XSSFSheet firstSheet = download.getWorkBook().getSheetAt(0); assertEquals(2, firstSheet.getLastRowNum()); assertEquals(2, firstSheet.getRow(1).getLastCellNum()); XSSFRow questionRow = firstSheet.getRow(2); assertEquals(2, questionRow.getLastCellNum()); assertTrue(questionRow.getRowStyle().getFont().getBold()); assertEquals(15, questionRow.getRowStyle().getFont().getFontHeightInPoints()); }
Source:
public void loadTwoNewItems_withOneItemPreexistsInDatabase_addsTwoRowsInEntryAndOnlyOneRowInItemTable() { String item1 = "{\"register\":\"register1\",\"text\":\"Register1 Text\", \"phase\":\"alpha\"}"; Response r = send(item1); assertThat(r.getStatus(), equalTo(204)); String item2 = "{\"register\":\"register2\",\"text\":\"Register2 Text\", \"phase\":\"alpha\"}"; r = send(item1 + "\n" + item2); assertThat(r.getStatus(), equalTo(204)); String canonicalItem1 = new String(canonicalJsonMapper.writeToBytes(canonicalJsonMapper.readFromBytes(item1.getBytes()))); String canonicalItem2 = new String(canonicalJsonMapper.writeToBytes(canonicalJsonMapper.readFromBytes(item2.getBytes()))); List<String> entries = testEntryDAO.getAllHex(); assertThat(entries.size(), equalTo(3)); assertThat(entries.get(0), equalTo(DigestUtils.sha256Hex(canonicalItem1))); assertThat(entries.get(1), equalTo(DigestUtils.sha256Hex(canonicalItem1))); assertThat(entries.get(2), equalTo(DigestUtils.sha256Hex(canonicalItem2))); List<TestDBItem> items = testItemDAO.getItems(); assertThat(items.size(), equalTo(2)); assertThat(items.get(0).sha256hex, equalTo(DigestUtils.sha256Hex(canonicalItem1))); assertThat(items.get(0).contents, equalTo(canonicalItem1.getBytes())); assertThat(items.get(1).sha256hex, equalTo(DigestUtils.sha256Hex(canonicalItem2))); assertThat(items.get(1).contents, equalTo(canonicalItem2.getBytes())); }

Target:
public void loadTwoNewItems_withOneItemPreexistsInDatabase_addsTwoRowsInEntryAndOnlyOneRowInItemTable() { String item1 = "{\"register\":\"register1\",\"text\":\"Register1 Text\", \"phase\":\"alpha\"}"; Response r = send(item1); assertThat(r.getStatus(), equalTo(204)); String item2 = "{\"register\":\"register2\",\"text\":\"Register2 Text\", \"phase\":\"alpha\"}"; r = send(item1 + "\n" + item2); assertThat(r.getStatus(), equalTo(204)); byte[] canonicalItem1 = canonicalJsonMapper.writeToBytes(canonicalJsonMapper.readFromBytes(item1.getBytes())); byte[] canonicalItem2 = canonicalJsonMapper.writeToBytes(canonicalJsonMapper.readFromBytes(item2.getBytes())); List<Entry> entries = testEntryDAO.getAllEntries(); assertThat(entries, contains( new Entry(1, DigestUtils.sha256Hex(canonicalItem1)), new Entry(2, DigestUtils.sha256Hex(canonicalItem1)), new Entry(3, DigestUtils.sha256Hex(canonicalItem2)) ) ); List<TestDBItem> items = testItemDAO.getItems(); assertThat(items, contains( new TestDBItem(canonicalItem1), new TestDBItem(canonicalItem2) ) ); }
Source:
protected boolean updateSelection(IStructuredSelection selection) { addAll(selectedDifferences, getSelectedDifferences(selection)); Iterable<Diff> terminalStateDiffs = filter(selectedDifferences, new Predicate<Diff>() { public boolean apply(Diff input) { return isInTerminalState(input); } }); if (!Iterables.isEmpty(terminalStateDiffs)) { return false; } if (this.adapterFactory != null) { contextualizeTooltip(); } return selection.toList().size() == selectedDifferences.size(); }

Target:
protected boolean updateSelection(IStructuredSelection selection) { addAll(selectedDifferences, getSelectedDifferences(selection)); Iterable<Diff> terminalStateDiffs = filter(selectedDifferences, EMFComparePredicates.hasState(DifferenceState.MERGED, DifferenceState.DISCARDED)); if (!Iterables.isEmpty(terminalStateDiffs)) { return false; } if (this.adapterFactory != null) { contextualizeTooltip(); } return selection.toList().size() == selectedDifferences.size(); }
Source:
private String customizeCompilationMessage(String text) { try { int lineStart = text.indexOf(":") + ":".length(), lineEnd = text.indexOf(":", lineStart), columnStart = lineEnd + ":".length(), columnEnd = text.indexOf(":", columnStart); String fileName = text.substring(0, text.indexOf(":")).trim(); int lineNumber = Integer.valueOf(text.substring(lineStart, lineEnd).trim()), columnNumber = Integer.valueOf(text.substring(columnStart, columnEnd).trim()); String customText = "<a href='javascript:openCM(\"" + fileName + "\"," + lineNumber + "," + columnNumber + ");'>"; customText += text.substring(0, columnEnd); customText += "</a>"; customText += text.substring(columnEnd); text = customText; } catch (IndexOutOfBoundsException ex) { } catch (NumberFormatException ex) { } return text; }

Target:
private String customizeCompilationMessage(String text) { try { int lineStart = text.indexOf(":") + ":".length(); int lineEnd = text.indexOf(":", lineStart); int columnStart = lineEnd + ":".length(); int columnEnd = text.indexOf(":", columnStart); String fileName = text.substring(0, text.indexOf(":")).trim(); int lineNumber = Integer.valueOf(text.substring(lineStart, lineEnd).trim()); int columnNumber = Integer.valueOf(text.substring(columnStart, columnEnd).trim()); String customText = "<a href='javascript:openCM(\"" + fileName + "\"," + lineNumber + "," + columnNumber + ");'>"; customText += text.substring(0, columnEnd); customText += "</a>"; customText += text.substring(columnEnd); text = customText; } catch (IndexOutOfBoundsException ex) { } catch (NumberFormatException ex) { } return text; }
Source:
protected void refreshServiceTaskList(ServiceTaskSummary serviceTaskSummary) { serviceTaskService.call((String serviceTaskName) -> { notificationEvent.fire(new NotificationEvent(getRemoveTaskSuccess() + serviceTaskName)); refreshData(); }).removeServiceTask(serviceTaskSummary); }

Target:
protected void refreshServiceTaskList(ServiceTaskSummary serviceTaskSummary) { serviceTaskService.call((String serviceTaskName) -> { notificationEvent.fire(new NotificationEvent(getRemoveTaskSuccess(serviceTaskName))); refreshData(); }).removeServiceTask(serviceTaskSummary); }
Source:
private boolean isHealthCheckDeactivated() { if (!healthCheckDeactivated) { healthCheckDeactivated = Duration.between(timeCreated, Instant.now()).compareTo(HEALTH_CHECK_DEACTIVATION_PERIOD) < 0; } return healthCheckDeactivated; }

Target:
private boolean isHealthCheckDeactivated() { if (!healthCheckDeactivated) { return false; } boolean shouldBeDeactivated = healthCheckDeactivated && isWithinDeactivationWindow(); healthCheckDeactivated = shouldBeDeactivated; return shouldBeDeactivated; }
Source:
public int getVisibility(IBinding member) { if (member instanceof ICPPSpecialization) { return getSpecializedBinding().getVisibility(((ICPPSpecialization)member).getSpecializedBinding()); } try { PDOMCPPMemberBlock members = new PDOMCPPMemberBlock(getLinkage(), record + MEMBERLIST); return members.getVisibility(member); } catch (CoreException e) { CCorePlugin.log(e); return v_public; } }

Target:
public int getVisibility(IBinding member) { if (member instanceof ICPPSpecialization) { return getSpecializedBinding().getVisibility(((ICPPSpecialization)member).getSpecializedBinding()); } try { PDOMCPPMemberBlock members = new PDOMCPPMemberBlock(getLinkage(), record + MEMBERLIST); return members.getVisibility(member); } catch (CoreException e) { CCorePlugin.log(e); return v_private; } }
Source:
public EventProcessorClient createEventProcessor() { String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() .consumerGroup("consumer-group") .checkpointStore(new InMemoryCheckpointStore()) .processEvent(eventContext -> { System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() + " and " + "sequence number of event = " + eventContext.getEventData().getSequenceNumber()); }) .processError(errorContext -> { System.out.printf("Error occurred in partition processor for partition {}, {}", errorContext.getPartitionContext().getPartitionId(), errorContext.getThrowable()); }) .connectionString(connectionString) .buildEventProcessorClient(); return eventProcessorClient; }

Target:
public EventProcessorClient createEventProcessor() { String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() .consumerGroup("consumer-group") .checkpointStore(new InMemoryCheckpointStore()) .processEvent(eventContext -> { System.out.println("Partition id = " + eventContext.getPartitionContext().getPartitionId() + "and sequence number of event = " + eventContext.getEventData().getSequenceNumber()); }) .processError(errorContext -> { System.out.printf("Error occurred in partition processor for partition {}, {}", errorContext.getPartitionContext().getPartitionId(), errorContext.getThrowable()); }) .connectionString(connectionString) .buildEventProcessorClient(); return eventProcessorClient; }
Source:
public void shouldGetAllDistinctStages() throws Exception { PipelineConfig pipelineCfgOne = configFileHelper.addPipeline("pipeline-one", "stage"); PipelineConfig pipelineCfgTwo = configFileHelper.addPipeline("pipeline-two", "stage"); Pipeline p1Run1 = dbHelper.schedulePipeline(pipelineCfgOne, new TimeProvider()); dbHelper.passStage(p1Run1.findStage("stage")); Pipeline p1Run2 = dbHelper.schedulePipeline(pipelineCfgOne, new TimeProvider()); dbHelper.passStage(p1Run2.findStage("stage")); Pipeline p2Run1 = dbHelper.schedulePipeline(pipelineCfgTwo, new TimeProvider()); dbHelper.passStage(p2Run1.findStage("stage")); Pipeline p2Run2 = dbHelper.schedulePipeline(pipelineCfgTwo, new TimeProvider()); dbHelper.passStage(p2Run2.findStage("stage")); List<StageConfigIdentifier> stages = stageService.getAllDistinctStages(); assertThat(stages.size(), is(3)); assertStageWithPipeline(stages.get(0), "dev", "mingle"); assertStageWithPipeline(stages.get(1), "stage", "pipeline-one"); assertStageWithPipeline(stages.get(2), "stage", "pipeline-two"); }

Target:
public void shouldGetAllDistinctStages() throws Exception { PipelineConfig pipelineCfgOne = configFileHelper.addPipeline("pipeline-one", "stage"); PipelineConfig pipelineCfgTwo = configFileHelper.addPipeline("pipeline-two", "stage"); Pipeline p1Run1 = dbHelper.schedulePipeline(pipelineCfgOne, new TimeProvider()); dbHelper.passStage(p1Run1.findStage("stage")); Pipeline p1Run2 = dbHelper.schedulePipeline(pipelineCfgOne, new TimeProvider()); dbHelper.passStage(p1Run2.findStage("stage")); Pipeline p2Run1 = dbHelper.schedulePipeline(pipelineCfgTwo, new TimeProvider()); dbHelper.passStage(p2Run1.findStage("stage")); Pipeline p2Run2 = dbHelper.schedulePipeline(pipelineCfgTwo, new TimeProvider()); dbHelper.passStage(p2Run2.findStage("stage")); List<StageConfigIdentifier> stages = stageService.getAllDistinctStages(); assertThat(stages.size(), is(3)); assertStageWithPipeline(stages.get(0), STAGE_NAME, PIPELINE_NAME); assertStageWithPipeline(stages.get(1), "stage", "pipeline-one"); assertStageWithPipeline(stages.get(2), "stage", "pipeline-two"); }