auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Map<String, Builder> processRunMetrics(HashMap<String, Metric> rawMetrics) { Map<String, Builder> newMetrics = new HashMap<>(); for (String key : rawMetrics.keySet()) { Metric metric = rawMetrics.get(key); Measurements measure = metric.getMeasurements(); MeasurementCase measureCase = measure.getMeasurementCase(); if (MeasurementCase.DOUBLE_VALUES.equals(measureCase)) { DoubleValues doubleValues = measure.getDoubleValues(); if (doubleValues.getDoubleValueList().size() > 0) { double sum = doubleValues .getDoubleValueList() .stream() .mapToDouble(Double::doubleValue) .sum(); double avg = sum / doubleValues.getDoubleValueList().size(); newMetrics.put(key + AVERAGE_KEY_TAG, createAvgMetric(avg, metric)); } } else if (MeasurementCase.NUMERIC_VALUES.equals(measureCase)) { NumericValues numValues = measure.getNumericValues(); if (numValues.getNumericValueList().size() > 0) { long sum = numValues .getNumericValueList() .stream() .mapToLong(Long::longValue) .sum(); double avg = (double) sum / numValues.getNumericValueList().size(); newMetrics.put(key + AVERAGE_KEY_TAG, createAvgMetric(avg, metric)); } } } return newMetrics; }

Target:
public Map<String, Builder> processRunMetrics(HashMap<String, Metric> rawMetrics) { Map<String, Builder> newMetrics = new HashMap<>(); for (String key : rawMetrics.keySet()) { Metric metric = rawMetrics.get(key); Measurements measure = metric.getMeasurements(); MeasurementCase measureCase = measure.getMeasurementCase(); if (MeasurementCase.DOUBLE_VALUES.equals(measureCase)) { DoubleValues doubleValues = measure.getDoubleValues(); if (doubleValues.getDoubleValueList().size() > 0) { double avg = doubleValues .getDoubleValueList() .stream() .collect(Collectors.summarizingDouble(Double::doubleValue)) .getAverage(); newMetrics.put(key + AVERAGE_KEY_TAG, createAvgMetric(avg, metric)); } } else if (MeasurementCase.NUMERIC_VALUES.equals(measureCase)) { NumericValues numValues = measure.getNumericValues(); if (numValues.getNumericValueList().size() > 0) { double avg = numValues .getNumericValueList() .stream() .collect(Collectors.summarizingLong(Long::longValue)) .getAverage(); newMetrics.put(key + AVERAGE_KEY_TAG, createAvgMetric(avg, metric)); } } } return newMetrics; }
Source:
private void handleSuccess(Map<String, Object> params, Task task) { LOGGER.debug("The actions from the task with name: and ID: were successfully executed", task.getName(), task.getId()); activityService.addSuccess(task); task.resetFailuresInRow(); taskService.save(task); eventRelay.sendEventMessage(new MotechEvent( createHandlerSuccessSubject(task.getName()), params )); }

Target:
private void handleSuccess(Map<String, Object> params, Task task) { LOGGER.debug("All actions from task: with ID: were successfully executed", task.getName(), task.getId()); activityService.addSuccess(task); task.resetFailuresInRow(); taskService.save(task); eventRelay.sendEventMessage(new MotechEvent( createHandlerSuccessSubject(task.getName()), params )); }
Source:
public IBuildPlan parseJob(HudsonModelJob job) throws HudsonException { IBuildPlan plan = createBuildPlan(); String jobUrl = job.getUrl(); if (this.hudsonUrlUtil.isNestedJob(jobUrl)) { plan.setId(jobUrl); } else { plan.setId(job.getName()); } plan.setName(this.hudsonUrlUtil.getDisplayName(jobUrl)); plan.setDescription(job.getDescription()); plan.setUrl(job.getUrl()); updateStateAndStatus(job, plan); updateHealth(job, plan); if (job.getLastBuild() != null) { IBuild build = parseBuild(job, job.getLastBuild()); plan.setLastBuild(build); } parseJobActions(plan.getParameterDefinitions(), job.getAction()); if (job instanceof HudsonMatrixMatrixProject) { List<HudsonMatrixMatrixConfiguration> childConfigs = ((HudsonMatrixMatrixProject) job) .getActiveConfiguration(); if (childConfigs != null && childConfigs.size() > 0) { for (HudsonMatrixMatrixConfiguration config : childConfigs) { IBuildPlan newPlan = parseJob(config); newPlan.setName(config.getDisplayName()); newPlan.setParent(plan); newPlan.setId(newPlan.getParent().getId() + newPlan.getId()); plan.getChildren().add(newPlan); } } } return plan; }

Target:
public IBuildPlan parseJob(HudsonModelJob job) throws HudsonException { IBuildPlan plan = createBuildPlan(); String jobUrl = job.getUrl(); if (this.hudsonUrlUtil.isNestedJob(jobUrl)) { plan.setId(jobUrl); } else { plan.setId(job.getName()); } plan.setName(this.hudsonUrlUtil.getDisplayName(jobUrl)); plan.setDescription(job.getDescription()); plan.setUrl(job.getUrl()); updateStateAndStatus(job, plan); updateHealth(job, plan); if (job.getLastBuild() != null) { IBuild build = parseBuild(job, job.getLastBuild()); plan.setLastBuild(build); } parseJobActions(plan.getParameterDefinitions(), job.getAction()); if (job instanceof HudsonMatrixMatrixProject) { List<HudsonMatrixMatrixConfiguration> childConfigs = ((HudsonMatrixMatrixProject) job) .getActiveConfiguration(); if (childConfigs != null) { for (HudsonMatrixMatrixConfiguration config : childConfigs) { IBuildPlan newPlan = parseJob(config); newPlan.setName(config.getDisplayName()); newPlan.setParent(plan); newPlan.setId(newPlan.getParent().getId() + newPlan.getId()); plan.getChildren().add(newPlan); } } } return plan; }
Source:
public MarketDataBox<ZonedDateTime> toZonedDateTime(MarketDataBox<LocalDate> dates) { if (dates.isScenarioValue()) { int nScenarios = dates.getScenarioCount(); ArgChecker.isTrue(nScenarios == localTimes.getScenarioCount(), "the number of scenarios must be the same"); List<ZonedDateTime> zonedDateTimes = IntStream.range(0, nScenarios) .mapToObj(i -> dates.getValue(i).atTime(localTimes.get(i)).atZone(zoneId)) .collect(Collectors.toList()); return MarketDataBox.ofScenarioValues(zonedDateTimes); } ZonedDateTime zonedDateTime = dates.getSingleValue().atTime(localTimes.get(0)).atZone(zoneId); return MarketDataBox.ofSingleValue(zonedDateTime); }

Target:
public MarketDataBox<ZonedDateTime> toZonedDateTime(MarketDataBox<LocalDate> dates) { if (dates.isScenarioValue()) { int nScenarios = dates.getScenarioCount(); int nTimes = localTimes.size(); List<ZonedDateTime> zonedDateTimes = IntStream.range(0, nScenarios) .mapToObj(scenarioIndex -> zonedDateTime(dates.getValue(scenarioIndex), nTimes, scenarioIndex)) .collect(Collectors.toList()); return MarketDataBox.ofScenarioValues(zonedDateTimes); } ZonedDateTime zonedDateTime = dates.getSingleValue().atTime(defaultLocalTime).atZone(zoneId); return MarketDataBox.ofSingleValue(zonedDateTime); }
Source:
public @ResponseBody MeaningfulUseAccurateAsOf getAccurateAsOfDate() { MeaningfulUseAccurateAsOfDTO dto = muManager.getMeaningfulUseAccurateAsOf(); MeaningfulUseAccurateAsOf muuAccurate = new MeaningfulUseAccurateAsOf(dto); if(StringUtils.isEmpty(muuAccurate.getId().toString()) && StringUtils.isEmpty(muuAccurate.getAccurateAsOfDate().toString())){ muuAccurate.getErrorMessages().add("Could not obtain the accurate as of date."); } return muuAccurate; }

Target:
public @ResponseBody AccurateAsOfDateResult getAccurateAsOfDate() throws EntityRetrievalException { MeaningfulUseAccurateAsOfDTO dto = muManager.getMeaningfulUseAccurateAsOf(); if(dto == null){ throw new EntityRetrievalException("Could not retrieve entity for MeaningfulUseAccurateAsOf"); } AccurateAsOfDateResult ar = new AccurateAsOfDateResult(dto.getAccurateAsOfDate().getTime()); return ar; }
Source:
private Metadata initializeMetadata(Data key, Object value) { try { Object keyMetadata = metadataInitializer.createFromData(key); Object valueMetadata; if (value instanceof Data) { valueMetadata = metadataInitializer.createFromData((Data) value); } else { valueMetadata = metadataInitializer.createFromObject(value); } if (keyMetadata != null || valueMetadata != null) { Metadata metadata = new Metadata(); metadata.setKeyMetadata(keyMetadata); metadata.setValueMetadata(valueMetadata); return metadata; } return null; } catch (IOException e) { return null; } }

Target:
private Metadata initializeMetadata(Data key, Object value) { try { Object keyMetadata = metadataInitializer.createFromData(key); Object valueMetadata; if (value instanceof Data) { valueMetadata = metadataInitializer.createFromData((Data) value); } else { valueMetadata = metadataInitializer.createFromObject(value); } if (keyMetadata != null || valueMetadata != null) { Metadata metadata = new Metadata(); metadata.setKeyMetadata(keyMetadata); metadata.setValueMetadata(valueMetadata); return metadata; } return null; } catch (IOException e) { return null; } catch (Exception e) { throw rethrow(e); } }
Source:
private void initSchema(Job job) throws IOException { if (schema != null) { return; } schema = PigSchemaConverter.parsePigSchema(getPropertyFromUDFContext(PARQUET_PIG_SCHEMA)); requiredFieldList = PigSchemaConverter.deserializeRequiredFieldList(getPropertyFromUDFContext(PARQUET_PIG_REQUIRED_FIELDS)); columnIndexAccess = Boolean.parseBoolean(getPropertyFromUDFContext(PARQUET_COLUMN_INDEX_ACCESS)); if (schema == null && requestedSchema != null) { schema = requestedSchema; } if (schema == null) { final GlobalMetaData globalMetaData = getParquetInputFormat().getGlobalMetaData(job); schema = getPigSchemaFromMultipleFiles(globalMetaData.getSchema(), globalMetaData.getKeyValueMetaData()); } if (isElephantBirdCompatible(job)) { convertToElephantBirdCompatibleSchema(schema); } }

Target:
private void initSchema(Job job) throws IOException { if (schema != null) { return; } if (schema == null && requestedSchema != null) { schema = requestedSchema; } if (schema == null) { final GlobalMetaData globalMetaData = getParquetInputFormat().getGlobalMetaData(job); schema = getPigSchemaFromMultipleFiles(globalMetaData.getSchema(), globalMetaData.getKeyValueMetaData()); } if (isElephantBirdCompatible(job)) { convertToElephantBirdCompatibleSchema(schema); } }
Source:
public static IParser getInstance() { if (instance == null) { instance = new GsonParser(); } return instance; }

Target:
public static IParser getInstance() { return new GsonParser(); }
Source:
public boolean getFaultDomainAwareStandbyEnabled() { return getBoolean(FAULT_DOMAIN_AWARE_STANDBY_ENABLED, false); }

Target:
public boolean getFaultDomainAwareStandbyEnabled() { return getBoolean(FAULT_DOMAIN_AWARE_STANDBY_ENABLED, FAULT_DOMAIN_AWARE_STANDBY_ENABLED_DEFAULT); }
Source:
private void testCreateInsertionFeature(String insertion, String insertionFeature) throws Exception { String urlInsertion = "/ats/program/" + getSawProgram().getArtId() + "/insertion"; String urlFeature = "/ats/program/" + getSawProgram().getArtId() + "/insertion/1234567800/feature"; JsonArray setup = postAndCheck(urlInsertion, Entity.entity(insertion, MediaType.APPLICATION_JSON_TYPE)); JsonArray array = postAndCheck(urlFeature, Entity.entity(insertionFeature, MediaType.APPLICATION_JSON_TYPE)); Assert.assertEquals(1, array.size()); JsonObject obj = getObjectNamed("JAX Insertion Feature", array); Assert.assertNotNull("Did not find value Jax Insertion Feature", obj); }

Target:
private void testCreateInsertionFeature(String insertion, String insertionFeature) throws Exception { String urlInsertion = "/ats/program/" + getSawProgram().getUuid() + "/insertion"; String urlFeature = "/ats/program/" + getSawProgram().getUuid() + "/insertion/1234567800/feature"; JsonArray setup = postAndCheck(urlInsertion, Entity.entity(insertion, MediaType.APPLICATION_JSON_TYPE)); JsonArray array = postAndCheck(urlFeature, Entity.entity(insertionFeature, MediaType.APPLICATION_JSON_TYPE)); Assert.assertEquals(1, array.size()); JsonObject obj = getObjectNamed("JAX Insertion Feature", array); Assert.assertNotNull("Did not find value Jax Insertion Feature", obj); }
Source:
public void setPublications() { try { List<Metacard> metacards = Security.getInstance() .runAsAdminWithException(() -> federationAdminService.getRegistryMetacards()); for (Metacard metacard : metacards) { String registryId = RegistryUtility.getRegistryId(metacard); if (registryId == null) { LOGGER.debug( "Warning metacard (id: {}} did not contain a registry id.", metacard.getId()); continue; } List<String> locations = RegistryUtility.getListOfStringAttribute( metacard, RegistryObjectMetacardType.PUBLISHED_LOCATIONS); if (!locations.isEmpty()) { publications.put(registryId, Collections.unmodifiableList(locations)); } else { publications.put(registryId, Collections.emptyList()); } } executorService.shutdown(); } catch (PrivilegedActionException | RuntimeException e) { LOGGER.debug( "Error reading from local catalog. Catalog is probably not up yet. Will try again later"); executorService.schedule(this::setPublications, RETRY_INTERVAL, TimeUnit.SECONDS); } }

Target:
public void setPublications() { try { List<Metacard> metacards = Security.getInstance() .runAsAdminWithException(() -> federationAdminService.getRegistryMetacards()); for (Metacard metacard : metacards) { String registryId = RegistryUtility.getRegistryId(metacard); if (registryId == null) { LOGGER.debug( "Warning metacard (id: {}} did not contain a registry id.", metacard.getId()); continue; } List<String> locations = RegistryUtility.getListOfStringAttribute( metacard, RegistryObjectMetacardType.PUBLISHED_LOCATIONS); if (!locations.isEmpty()) { publications.put(registryId, Collections.unmodifiableList(locations)); } else { publications.put(registryId, Collections.emptyList()); } } this.destroy(); } catch (PrivilegedActionException | RuntimeException e) { LOGGER.debug( "Error reading from local catalog. Catalog is probably not up yet. Will try again in seconds.", RETRY_INTERVAL); executorService.schedule(this::setPublications, RETRY_INTERVAL, TimeUnit.SECONDS); } }
Source:
protected SalesforceApi() { SSLContext sc; try { String protocol = SSLContext.getDefault().getProtocol(); if (!protocol.equals("TLSv1.2") || !protocol.equals("TLSv1.1")) { sc = SSLContext.getInstance("TLSv1.2"); sc.init(null, null, null); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); } } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (KeyManagementException e) { e.printStackTrace(); } }

Target:
protected SalesforceApi() { final SSLContext sc; try { final String protocol = SSLContext.getDefault().getProtocol(); if (!"TLSv1.2".equals(protocol)) { sc = SSLContext.getInstance("TLSv1.2"); sc.init(null, null, null); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); } } catch (Exception e) { throw new IllegalStateException("Unexpected JVM without TLS 1.2 support", e); } }
Source:
private Single<File> unzipAllFilesAndGetImportDatabaseFile(@NonNull File localZipFile, final boolean overwrite) { return Single.fromCallable(() -> { final SDCardFileManager external = persistenceManager.getExternalStorageManager(); StorageManager internal = persistenceManager.getInternalStorageManager(); if (overwrite) { Logger.info(ManualRestoreTask.this, "Deleting old files from external storage"); for (File f : external.listDirs()) { external.deleteRecursively(f); } } if (!external.unzip(localZipFile, overwrite)) { throw new IOException("Failed to unzip file: " + localZipFile); } Logger.info(ManualRestoreTask.this, "Importing shared preferences"); final File sdPrefs = external.getFile("shared_prefs"); final File prefs = internal.getFile(internal.getRoot().getParentFile(), "shared_prefs"); if (!internal.copy(sdPrefs, prefs, overwrite)) { throw new IOException("Failed to import settings"); } Logger.info(ManualRestoreTask.this, "Importing internal files"); final File internalDir = external.getFile("Internal"); if (!internal.copy(internalDir, internal.getRoot(), overwrite)) { Logger.error(ManualRestoreTask.this, "Failed to import local files"); } final File importDatabaseFile = external.getFile(DatabaseConstants.DATABASE_EXPORT_NAME); if (!importDatabaseFile.exists()) { throw new IOException("Failed to find our import database file"); } external.delete(localZipFile); return importDatabaseFile; }) .doOnSuccess(importDatabaseFile -> Logger.info(ManualRestoreTask.this, "Successfully unzipped our backup and configured all local files")); }

Target:
private Single<File> unzipAllFilesAndGetImportDatabaseFile(@NonNull File localZipFile, final boolean overwrite) { return Single.fromCallable(() -> { final SDCardFileManager external = persistenceManager.getExternalStorageManager(); StorageManager internal = persistenceManager.getInternalStorageManager(); if (!external.unzip(localZipFile, overwrite)) { throw new IOException("Failed to unzip file: " + localZipFile); } Logger.info(ManualRestoreTask.this, "Importing shared preferences"); final File sdPrefs = external.getFile("shared_prefs"); final File prefs = internal.getFile(internal.getRoot().getParentFile(), "shared_prefs"); if (!internal.copy(sdPrefs, prefs, overwrite)) { throw new IOException("Failed to import settings"); } Logger.info(ManualRestoreTask.this, "Importing internal files"); final File internalDir = external.getFile("Internal"); if (!internal.copy(internalDir, internal.getRoot(), overwrite)) { Logger.error(ManualRestoreTask.this, "Failed to import local files"); } final File importDatabaseFile = external.getFile(DatabaseConstants.DATABASE_EXPORT_NAME); if (!importDatabaseFile.exists()) { throw new IOException("Failed to find our import database file"); } external.delete(localZipFile); return importDatabaseFile; }) .doOnSuccess(importDatabaseFile -> Logger.info(ManualRestoreTask.this, "Successfully unzipped our backup and configured all local files")); }
Source:
public HelixManagerProperty getHelixManagerProperty(String zkAddress, String clusterName) { CloudConfig cloudConfig; HelixZkClient zkClient = null; try { HelixZkClient.ZkConnectionConfig connectionConfig = new HelixZkClient.ZkConnectionConfig(zkAddress); zkClient = DedicatedZkClientFactory.getInstance().buildZkClient(connectionConfig); ConfigAccessor configAccessor = new ConfigAccessor(zkClient); try { cloudConfig = configAccessor.getCloudConfig(clusterName) == null ? buildEmptyCloudConfig(clusterName) : configAccessor.getCloudConfig(clusterName); } catch (HelixException e) { cloudConfig = buildEmptyCloudConfig(clusterName); } } finally { if (zkClient != null && !zkClient.isClosed()) { zkClient.close(); } } Properties properties = new Properties(); try { InputStream stream = Thread.currentThread().getContextClassLoader() .getResourceAsStream(HELIX_PARTICIPANT_PROPERTY_FILE); properties.load(stream); } catch (IOException e) { String errMsg = String.format("failed to open Helix participant properties file: %s", HELIX_PARTICIPANT_PROPERTY_FILE); throw new IllegalArgumentException(errMsg, e); } LOG.info("HelixPropertyFactory successfully loaded helix participant properties: {}", properties); return new HelixManagerProperty(properties, cloudConfig); }

Target:
public HelixManagerProperty getHelixManagerProperty(String zkAddress, String clusterName) { CloudConfig cloudConfig = getCloudConfig(zkAddress, clusterName); Properties properties = new Properties(); try { InputStream stream = Thread.currentThread().getContextClassLoader() .getResourceAsStream(HELIX_PARTICIPANT_PROPERTY_FILE); properties.load(stream); } catch (IOException e) { String errMsg = String.format("failed to open Helix participant properties file: %s", HELIX_PARTICIPANT_PROPERTY_FILE); throw new IllegalArgumentException(errMsg, e); } LOG.info("HelixPropertyFactory successfully loaded helix participant properties: {}", properties); return new HelixManagerProperty(properties, cloudConfig); }
Source:
public boolean getSystemDefaultThemeBool(String theme) { if (context.getResources().getString(R.string.theme_dark_name).equals(theme)) { return true; } else if (context.getResources().getString(R.string.theme_default_name).equals(theme)) { return getSystemDefaultThemeBool(getSystemDefaultTheme()); } return false; }

Target:
public boolean getSystemDefaultThemeBool(String theme) { if (theme.equals(THEME_MODE_DARK)) { return true; } else if (theme.equals(THEME_MODE_DEFAULT)) { return getSystemDefaultThemeBool(getSystemDefaultTheme()); } return false; }
Source:
public void testPutSmallObject() throws NoSuchAlgorithmException, InvalidKeyException, IOException, XmlPullParserException, MinioException { MockWebServer server = new MockWebServer(); MockResponse response = new MockResponse(); response.addHeader("Date", SUN_29_JUN_2015_22_01_10_GMT); response.addHeader(LAST_MODIFIED, MON_04_MAY_2015_07_58_51_GMT); response.addHeader("ETag", MD5_HASH_STRING); response.setResponseCode(200); server.enqueue(response); server.start(); MinioClient client = new MinioClient(server.url("")); String inputString = HELLO_WORLD; ByteArrayInputStream data = new ByteArrayInputStream(inputString.getBytes(StandardCharsets.UTF_8)); client.putObject(BUCKET, "key", data, Long.valueOf(11), null, null, APPLICATION_OCTET_STREAM); }

Target:
public void testPutSmallObject() throws NoSuchAlgorithmException, InvalidKeyException, IOException, XmlPullParserException, MinioException { MockWebServer server = new MockWebServer(); MockResponse response = new MockResponse(); response.addHeader("Date", SUN_29_JUN_2015_22_01_10_GMT); response.addHeader(LAST_MODIFIED, MON_04_MAY_2015_07_58_51_GMT); response.addHeader("ETag", MD5_HASH_STRING); response.setResponseCode(200); server.enqueue(response); server.start(); MinioClient client = new MinioClient(server.url("")); String inputString = HELLO_WORLD; ByteArrayInputStream data = new ByteArrayInputStream(inputString.getBytes(StandardCharsets.UTF_8)); client.putObject(BUCKET, "key", data, 11L, null, null, APPLICATION_OCTET_STREAM); }
Source:
public void removeActiveBannerAd(@NonNull String placementId, @Nullable VungleBannerAd activeBannerAd) { Log.d(TAG, "try to removeActiveBannerAd: " + placementId); boolean didRemove = mVungleBanners.remove(placementId, activeBannerAd); if (didRemove && activeBannerAd != null) { Log.d(TAG, "removeActiveBannerAd: " + activeBannerAd + "; size=" + mVungleBanners.size()); activeBannerAd.detach(); } }

Target:
public void removeActiveBannerAd(@NonNull String placementId, @Nullable VungleBannerAd activeBannerAd) { Log.d(TAG, "try to removeActiveBannerAd: " + placementId); boolean didRemove = mVungleBanners.remove(placementId, activeBannerAd); if (didRemove && activeBannerAd != null) { Log.d(TAG, "removeActiveBannerAd: " + activeBannerAd + "; size=" + mVungleBanners.size()); activeBannerAd.detach(); activeBannerAd.destroyAd(); } }
Source:
private void outputModuleBinaryAndSourceMaps( List<JSModule> modules, B options) throws FlagUsageException, IOException { parsedModuleWrappers = parseModuleWrappers( config.moduleWrapper, modules); maybeCreateDirsForPath(config.moduleOutputPathPrefix); Writer mapFileOut = null; if (!(shouldGenerateMapPerModule(options) || config.useJsonStreams)) { mapFileOut = fileNameToOutputWriter2( expandSourceMapPath(options, null)); } for (JSModule m : modules) { if (config.useJsonStreams) { compiler.getSourceMap().reset(); StringBuilder output = new StringBuilder(); writeModuleOutput(output, m); JsonFileSpec jsonFile = new JsonFileSpec(output.toString(), getModuleOutputFileName(m)); StringBuilder moduleSourceMap = new StringBuilder(); compiler.getSourceMap().appendTo(moduleSourceMap, getModuleOutputFileName(m)); jsonFile.setSourceMap(moduleSourceMap.toString()); this.filesToStreamOut.add(jsonFile); } else { if (shouldGenerateMapPerModule(options)) { mapFileOut = fileNameToOutputWriter2(expandSourceMapPath(options, m)); } try (Writer writer = fileNameToLegacyOutputWriter( getModuleOutputFileName(m))) { if (options.sourceMapOutputPath != null) { compiler.getSourceMap().reset(); } writeModuleOutput(writer, m); if (options.sourceMapOutputPath != null) { compiler.getSourceMap().appendTo(mapFileOut, m.getName()); } } if (shouldGenerateMapPerModule(options) && mapFileOut != null) { mapFileOut.close(); mapFileOut = null; } } } if (mapFileOut != null) { mapFileOut.close(); } }

Target:
private void outputModuleBinaryAndSourceMaps( List<JSModule> modules, B options) throws FlagUsageException, IOException { parsedModuleWrappers = parseModuleWrappers( config.moduleWrapper, modules); maybeCreateDirsForPath(config.moduleOutputPathPrefix); Writer mapFileOut = null; if (!(shouldGenerateMapPerModule(options) || config.useJsonStreams)) { mapFileOut = fileNameToOutputWriter2( expandSourceMapPath(options, null)); } for (JSModule m : modules) { if (config.useJsonStreams) { this.filesToStreamOut.add(createJsonFileFromModule(m)); } else { if (shouldGenerateMapPerModule(options)) { mapFileOut = fileNameToOutputWriter2(expandSourceMapPath(options, m)); } try (Writer writer = fileNameToLegacyOutputWriter( getModuleOutputFileName(m))) { if (options.sourceMapOutputPath != null) { compiler.getSourceMap().reset(); } writeModuleOutput(writer, m); if (options.sourceMapOutputPath != null) { compiler.getSourceMap().appendTo(mapFileOut, m.getName()); } } if (shouldGenerateMapPerModule(options) && mapFileOut != null) { mapFileOut.close(); mapFileOut = null; } } } if (mapFileOut != null) { mapFileOut.close(); } }
Source:
public void addCustomButton(String title, String cssClass, CustomButtonAction action) { customButtons.add( new GeoServerAjaxFormLink(customButtons.newChildId()) { @Override protected void onClick(AjaxRequestTarget target, Form<?> form) { action.onClick(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); CharSequence dynamicExtraParameters = "var result = {'cmSelection': getSelection()};" + "return result;"; attributes.getDynamicExtraParameters().add(dynamicExtraParameters); } }.add(new AttributeAppender("class", cssClass, " ")) .add(new AttributeAppender("title", title, " "))); }

Target:
public void addCustomButton(String title, String cssClass, CustomButtonAction action) { customButtons.add( new AjaxLink<Object>(customButtons.newChildId()) { @Override public void onClick(AjaxRequestTarget target) { action.onClick(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); CharSequence dynamicExtraParameters = "var result = {'cmSelection': getSelection()};" + "return result;"; attributes.getDynamicExtraParameters().add(dynamicExtraParameters); } }.add(new AttributeAppender("class", cssClass, " ")) .add(new AttributeAppender("title", title, " "))); }
Source:
private void UpdateActionAvailability() { List tempVar = getSelectedItems(); ArrayList selectedItems = (ArrayList) ((tempVar != null) ? tempVar : new ArrayList()); boolean anyEngine = false; for (Object item : selectedItems) { NetworkView networkView = (NetworkView) item; if (StringHelper.stringsEqual(networkView.getname(), ENGINE_NETWORK)) { anyEngine = true; break; } } getEditCommand().setIsExecutionAllowed(selectedItems.size() == 1); getRemoveCommand().setIsExecutionAllowed(selectedItems.size() > 0 && !anyEngine); }

Target:
private void UpdateActionAvailability() { List tempVar = getSelectedItems(); ArrayList selectedItems = (ArrayList) ((tempVar != null) ? tempVar : new ArrayList()); boolean anyEngine = false; for (Object item : selectedItems) { Network network = (Network) item; if (StringHelper.stringsEqual(network.getName(), ENGINE_NETWORK)) { anyEngine = true; break; } } getEditCommand().setIsExecutionAllowed(selectedItems.size() == 1); getRemoveCommand().setIsExecutionAllowed(selectedItems.size() > 0 && !anyEngine); }
Source:
public void testEqualsIgnoreValueOrder_sameLengthSameValues() { MultivaluedHashMap map = new MultivaluedHashMap(); MultivaluedHashMap equalMap = new MultivaluedHashMap(); map.put(1, Arrays.asList(new Integer[]{1, 2, 3})); equalMap.put(1, Arrays.asList(new Integer[]{3, 2, 1})); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.put(2, Arrays.asList(new Integer[]{4, 5, 6})); equalMap.put(2, Arrays.asList(new Integer[]{5, 6, 4})); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.put("c", Arrays.asList(new String[]{"x", "y", "z"})); equalMap.put("c", Arrays.asList(new String[]{"z", "x", "y"})); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.clear(); map.put(1, Arrays.asList(new Integer[]{1, 2, 3, 4, 5})); map.put(2, Arrays.asList(new Integer[]{4, 5, 6, 7, 8})); equalMap.clear(); equalMap.put(1, Arrays.asList(new Integer[]{4, 3, 2, 6, 1})); equalMap.put(2, Arrays.asList(new Integer[]{6, 7, 4, 8, 5})); equalsIgnoreValueOrder_shouldReturnFalseForDifferentMaps(map, equalMap); }

Target:
public void testEqualsIgnoreValueOrder_sameLengthSameValues() { MultivaluedHashMap<Integer, Integer> map = new MultivaluedHashMap<>(); MultivaluedHashMap<Integer, Integer> equalMap = new MultivaluedHashMap<>(); map.put(1, Arrays.asList(1, 2, 3)); equalMap.put(1, Arrays.asList(3, 2, 1)); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.put(2, Arrays.asList(4, 5, 6)); equalMap.put(2, Arrays.asList(5, 6, 4)); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.put(3, Arrays.asList(7, 8, 9)); equalMap.put(3, Arrays.asList(9, 7, 8)); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.clear(); equalMap.clear(); map.put(1, Arrays.asList(1, 2, 3, 4, 5)); map.put(2, Arrays.asList(4, 5, 6, 7, 8)); equalMap.put(1, Arrays.asList(4, 3, 2, 5, 1)); equalMap.put(2, Arrays.asList(6, 7, 4, 8, 5)); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); }
Source:
public void addAll(List<T> entity) { LOG.debug("added search result"); this.getContainerDataSource().removeAllItems(); entity.stream().forEach(item -> this.getContainerDataSource().addItem(item)); }

Target:
public void addAll(List<T> entity) { getContainerDataSource().removeAllItems(); entity.forEach(getContainerDataSource()::addItem); }
Source:
private void formatDiff(@NonNull DiffEditorInput input) { IRepositoryCommit commit = input.getTip(); if (commit instanceof RepositoryCommit) { RepositoryCommit repoCommit = (RepositoryCommit) commit; if (!repoCommit.isStash() && repoCommit.getRevCommit().getParentCount() > 1) { input.setDocument(new Document()); setInput(input); return; } } IRepositoryCommit base = input.getBase(); Job job = new Job(UIText.DiffEditor_TaskGeneratingDiff) { @Override protected IStatus run(IProgressMonitor monitor) { FileDiff diffs[] = getDiffs(commit, base); DiffDocument document = new DiffDocument(); try (DiffRegionFormatter formatter = new DiffRegionFormatter( document)) { SubMonitor progress = SubMonitor.convert(monitor, diffs.length); for (FileDiff diff : diffs) { if (progress.isCanceled()) { break; } progress.subTask(diff.getPath()); try { formatter.write(diff); } catch (IOException ignore) { } progress.worked(1); } document.connect(formatter); } new UIJob(UIText.DiffEditor_TaskUpdatingViewer) { @Override public IStatus runInUIThread(IProgressMonitor uiMonitor) { if (UIUtils .isUsable(getSourceViewer().getTextWidget())) { input.setDocument(document); setInput(input); } return Status.OK_STATUS; } }.schedule(); return Status.OK_STATUS; } }; job.schedule(); }

Target:
private void formatDiff(@NonNull DiffEditorInput input) { IRepositoryCommit commit = input.getTip(); if (commit instanceof RepositoryCommit) { RepositoryCommit repoCommit = (RepositoryCommit) commit; if (!repoCommit.isStash() && repoCommit.getRevCommit().getParentCount() > 1) { input.setDocument(new Document()); setInput(input); return; } } IRepositoryCommit base = input.getBase(); Job job = new Job(UIText.DiffEditor_TaskGeneratingDiff) { @Override protected IStatus run(IProgressMonitor monitor) { FileDiff diffs[] = getDiffs(commit, base); DiffDocument document = new DiffDocument(); try (DiffRegionFormatter formatter = new DiffRegionFormatter( document)) { SubMonitor progress = SubMonitor.convert(monitor, diffs.length); for (FileDiff diff : diffs) { if (progress.isCanceled()) { break; } progress.subTask(diff.getPath()); try { formatter.write(diff); } catch (IOException ignore) { } progress.worked(1); } document.connect(formatter); } new UIJob(UIText.DiffEditor_TaskUpdatingViewer) { @Override public IStatus runInUIThread(IProgressMonitor uiMonitor) { if (UIUtils .isUsable(getSourceViewer().getTextWidget())) { input.setDocument(document); setInput(input); } return Status.OK_STATUS; } }.schedule(); return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { return JobFamilies.DIFF == family || super.belongsTo(family); } }; job.schedule(); }
Source:
private void processProcessHierarchy() { for (TempProcess tempProcess : this.processes) { if (this.processes.indexOf(tempProcess) == 0) { continue; } ProcessFieldedMetadata metadata = this.getProcessMetadataTab().initializeProcessDetails( tempProcess.getWorkpiece().getRootElement()); String docType = tempProcess.getWorkpiece().getRootElement().getType(); ImportService.fillProcessDetails(metadata, tempProcess.getMetadataNodes(), this.rulesetManagementInterface, docType , this.acquisitionStage, this.priorityList); try { metadata.preserve(); } catch (InvalidMetadataValueException | NoSuchMetadataFieldException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); } try { String atstsl = ProcessService.generateProcessTitle("", metadata.getRows(), this.processDataTab.getTitleDefinition(), tempProcess.getProcess()); String tiffHeader = ProcessService.generateTiffHeader(metadata.getRows(), atstsl, this.processDataTab.getTiffDefinition(), docType); addProperties(tempProcess.getProcess(), metadata.getRows(), docType, tiffHeader); updateTasks(tempProcess.getProcess()); } catch (ProcessGenerationException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); } } }

Target:
private void processProcessHierarchy() throws ProcessGenerationException { for (TempProcess tempProcess : this.processes) { Process process = tempProcess.getProcess(); List<ProcessDetail> processDetails; String docType; String tiffHeader; int index = this.processes.indexOf(tempProcess); if (index < this.processes.size() - 1) { ProcessService.setParentRelations(this.processes.get(index + 1).getProcess(), process); } if (this.processes.indexOf(tempProcess) == 0) { processDetails = processMetadataTab.getProcessDetailsElements(); docType = processDataTab.getDocType(); tiffHeader = processDataTab.getTiffHeaderImageDescription(); process.setSortHelperImages(processDataTab.getGuessedImages()); if (!ProcessValidator.isContentValid(process.getTitle(), processDetails, true)) { throw new ProcessGenerationException("Error creating process hierarchy: invalid process content!"); } processMetadataTab.preserve(); } else { ProcessFieldedMetadata metadata = this.getProcessMetadataTab().initializeProcessDetails( tempProcess.getWorkpiece().getRootElement()); docType = tempProcess.getWorkpiece().getRootElement().getType(); ImportService.fillProcessDetails(metadata, tempProcess.getMetadataNodes(), this.rulesetManagementInterface, docType, this.acquisitionStage, this.priorityList); try { metadata.preserve(); } catch (InvalidMetadataValueException | NoSuchMetadataFieldException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); } processDetails = metadata.getRows(); try { String atstsl = ProcessService.generateProcessTitle("", processDetails, ServiceManager.getImportService().getTitleDefinition(), process); tiffHeader = ProcessService.generateTiffHeader(processDetails, atstsl, ServiceManager.getImportService().getTiffDefinition(), docType); } catch (ProcessGenerationException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); tiffHeader = ""; } } addProperties(process, processDetails, docType, tiffHeader); updateTasks(process); } }
Source:
private List<ExtensionProxy> getExtensions() { return ExtensionsManager.getInstance().getProvidedExtensions(LOGGER_SERVICE); }

Target:
private List<ExtensionProxy> getExtensions() { if (extensions == null) { extensions = ExtensionsManager.getInstance().getProvidedExtensions(LOGGER_SERVICE); } return extensions; }
Source:
public void error( String message, Object... params ) { logger.error(new I18n(message), params); }

Target:
public void error( String message, Object... params ) { if (logger.isErrorEnabled()) { logger.error(new I18n(message), params); } }
Source:
private void internalMerge(SegmentStoreStatistics other) { long min = fMin.getLength(); long max = fMax.getLength(); fMin = min <= other.getMin() ? fMin : other.getMinSegment(); fMax = max >= other.getMax() ? fMax : other.getMaxSegment(); long oldNbSeg = fNbSegments; double oldAverage = fAverage; long otherSegments = other.getNbSegments(); fNbSegments += otherSegments; fTotal += other.getTotal(); fAverage = ((oldNbSeg * oldAverage) + (other.getAverage() * otherSegments)) / fNbSegments; double avg1Sq = oldAverage * oldAverage; double avg2sq = other.getAverage() * other.getAverage(); double avgtSq = fAverage * fAverage; double variance1 = fVariance / (oldNbSeg - 1); double variance2 = other.fVariance / (otherSegments - 1); fVariance = ((variance1 + avg1Sq - avgtSq) * (oldNbSeg - 1) + (variance2 + avg2sq - avgtSq) * (otherSegments - 1)); }

Target:
private void internalMerge(SegmentStoreStatistics other) { long min = fMin.getLength(); long max = fMax.getLength(); fMin = min <= other.getMin() ? fMin : other.getMinSegment(); fMax = max >= other.getMax() ? fMax : other.getMaxSegment(); long oldNbSeg = fNbSegments; double oldAverage = fAverage; long otherSegments = other.getNbSegments(); double otherAverage = other.getAverage(); fNbSegments += otherSegments; fTotal += other.getTotal(); fAverage = ((oldNbSeg * oldAverage) + (otherAverage * otherSegments)) / fNbSegments; double avg1Sq = oldAverage * oldAverage; double avg2sq = otherAverage * otherAverage; double avgtSq = fAverage * fAverage; double variance1 = fVariance / (oldNbSeg - 1); double variance2 = other.fVariance / (otherSegments - 1); fVariance = ((variance1 + avg1Sq - avgtSq) * (oldNbSeg - 1) + (variance2 + avg2sq - avgtSq) * (otherSegments - 1)); }
Source:
public void nameMangling_2_folder_reload() throws Exception { r.addStep(new Statement() { @Override public void evaluate() throws Throwable { OrganizationFolder foo = (OrganizationFolder) r.j.jenkins.getItem("foo"); foo.doReload(); assertDataMigrated(foo); } }); r.addStep(new Statement() { @Override public void evaluate() throws Throwable { TopLevelItem foo = r.j.jenkins.getItem("foo"); assertDataMigrated(foo); } }); }

Target:
public void nameMangling_2_folder_reload() throws Exception { r.addStep(new Statement() { @Override public void evaluate() throws Throwable { OrganizationFolder foo = r.j.jenkins.getItemByFullName("foo", OrganizationFolder.class); foo.doReload(); assertDataMigrated(foo); } }); r.addStep(new Statement() { @Override public void evaluate() throws Throwable { TopLevelItem foo = r.j.jenkins.getItem("foo"); assertDataMigrated(foo); } }); }
Source:
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { if (HttpResponseCodes.SC_BAD_REQUEST == responseContext.getStatus()) { Object entity = responseContext.getEntity(); if (entity != null && entity instanceof String) { String tmpEscapedMsg = StringEscapeUtils.escapeXml((String) entity); String escapedMsg = tmpEscapedMsg.replaceAll("/", "&#x2F;"); responseContext.setEntity(escapedMsg); } } }

Target:
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { if (HttpResponseCodes.SC_BAD_REQUEST == responseContext.getStatus()) { Object entity = responseContext.getEntity(); if (entity != null && entity instanceof String) { String escapedMsg = escapeXml((String) entity); responseContext.setEntity(escapedMsg); } } }
Source:
private final void checkExpectedProviders(MultiFallbackProvider subject, Class<? extends LocationProvider>... expectedProviders) { Collection<LocationProvider> providers = subject.getProviders(); assertEquals(expectedProviders.length, providers.size()); int i = 0; for (LocationProvider provider : providers) { Class<? extends LocationProvider> expected = expectedProviders[i]; assertTrue("provider instance class " + provider.getClass().getName() + " does not " + "match expected value " + expected.getName(), provider.getClass() .isAssignableFrom(expected)); i++; } }

Target:
private final void checkExpectedProviders(MultiFallbackProvider subject, Class<? extends LocationProvider>... expectedProviders) { Collection<LocationProvider> providers = subject.getProviders(); assertEquals(expectedProviders.length, providers.size()); Iterator<LocationProvider> providerIt = providers.iterator(); for (int i = 0; i < expectedProviders.length; i++) { Class<? extends LocationProvider> expected = expectedProviders[i]; if (!providerIt.hasNext()) { fail("providers list did not have expected value " + expected.getName()); } LocationProvider actual = providerIt.next(); assertTrue("provider instance class " + actual.getClass().getName() + " does not " + "match expected value " + expected.getName(), actual.getClass() .isAssignableFrom(expected)); } }
Source:
public <R, C extends ServiceConfiguration<?, R>> CacheConfigurationBuilder<K, V> updateServices(Class<C> clazz, UnaryOperator<R> update) { Collection<? extends ServiceConfiguration<?, R>> existing = getServices(clazz); if (existing.isEmpty()) { throw new IllegalStateException("Cannot updates service configurations. No services exist"); } else { CacheConfigurationBuilder<K, V> otherBuilder = withoutServices(clazz); for (ServiceConfiguration<?, R> configuration : existing) { otherBuilder = otherBuilder.withService(configuration.build(update.apply(configuration.derive()))); } return otherBuilder; } }

Target:
public <R, C extends ServiceConfiguration<?, R>> CacheConfigurationBuilder<K, V> updateServices(Class<C> clazz, UnaryOperator<R> update) { Collection<? extends ServiceConfiguration<?, R>> existing = getServices(clazz); if (existing.isEmpty()) { throw new IllegalStateException("Cannot update service configurations. No existing services of type: " + clazz); } else { CacheConfigurationBuilder<K, V> otherBuilder = withoutServices(clazz); for (ServiceConfiguration<?, R> configuration : existing) { ServiceConfiguration<?, ?> replacement = configuration.build(update.apply(configuration.derive())); if (replacement == null) { throw new NullPointerException(configuration.getClass().getSimpleName() + ".build(...) returned a null configuration instance"); } else { otherBuilder = otherBuilder.withService(replacement); } } return otherBuilder; } }
Source:
protected void executeCommand() { getParameters().setEntityInfo(getEntityInfo()); setSucceeded(true); if (!images.isEmpty()) { List<DiskImage> imageToRemove = new ArrayList<>(); for (DiskImage image : images) { if (image.getStorageIds().get(0).equals(getParameters().getStorageDomainId())) { List<Guid> storageIds = new ArrayList<>(); storageIds.add(getParameters().getStorageDomainId()); image.setStorageIds(storageIds); image.setStoragePoolId(getParameters().getStoragePoolId()); imageToRemove.add(image); } } RemoveAllVmImagesParameters removeAllVmImagesParameters = new RemoveAllVmImagesParameters(getVmId(), imageToRemove); removeAllVmImagesParameters.setParentCommand(getActionType()); removeAllVmImagesParameters.setEntityInfo(getParameters().getEntityInfo()); removeAllVmImagesParameters.setForceDelete(true); removeAllVmImagesParameters.setParentParameters(getParameters()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext(ActionType.RemoveAllVmImages, removeAllVmImagesParameters); if (vdcRetValue.getSucceeded()) { getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getInternalVdsmTaskIdList()); } else { getReturnValue().setFault(vdcRetValue.getFault()); setSucceeded(false); } } List<Guid> guids = new ArrayList<>(); guids.add(ovfEntityData.getEntityId()); vmAndTemplatesGenerationsDao.deleteOvfGenerations(guids); unregisteredOVFDataDao.removeEntity(ovfEntityData.getEntityId(), null); unregisteredDisksDao.removeUnregisteredDiskRelatedToVM(ovfEntityData.getEntityId(), null); }

Target:
protected void executeCommand() { getParameters().setEntityInfo(getEntityInfo()); setSucceeded(true); if (!images.isEmpty()) { List<DiskImage> imageToRemove = new ArrayList<>(); for (DiskImage image : images) { if (image.getStorageIds().get(0).equals(getParameters().getStorageDomainId())) { image.setStorageIds(Collections.singletonList(getParameters().getStorageDomainId())); image.setStoragePoolId(getParameters().getStoragePoolId()); imageToRemove.add(image); } } RemoveAllVmImagesParameters removeAllVmImagesParameters = new RemoveAllVmImagesParameters(getVmId(), imageToRemove); removeAllVmImagesParameters.setParentCommand(getActionType()); removeAllVmImagesParameters.setEntityInfo(getParameters().getEntityInfo()); removeAllVmImagesParameters.setForceDelete(true); removeAllVmImagesParameters.setParentParameters(getParameters()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext(ActionType.RemoveAllVmImages, removeAllVmImagesParameters); if (vdcRetValue.getSucceeded()) { getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getInternalVdsmTaskIdList()); } else { getReturnValue().setFault(vdcRetValue.getFault()); setSucceeded(false); } } vmAndTemplatesGenerationsDao.deleteOvfGenerations(Collections.singletonList(ovfEntityData.getEntityId())); unregisteredOVFDataDao.removeEntity(ovfEntityData.getEntityId(), null); unregisteredDisksDao.removeUnregisteredDiskRelatedToVM(ovfEntityData.getEntityId(), null); }
Source:
abstract void checkGlobalOutcome(ManagementClient managementClient, String operation, boolean mustBeUP, String probeName) throws IOException; @Deployment(name = EAR_ARCHIVE_NAME, managed = false) public static Archive<?> deployEar() { JavaArchive jarArchive = ShrinkWrap.create(JavaArchive.class, JAR_ARCHIVE_NAME) .addClass(HealthConfigSource.class) .addAsServiceProvider(ConfigSource.class, HealthConfigSource.class) .addAsResource(EmptyAsset.INSTANCE, "beans.xml"); WebArchive war = ShrinkWrap.create(WebArchive.class, WAR_ARCHIVE_NAME) .addClasses(TestApplication.class, TestApplication.Resource.class, MyProbe.class, MyLiveProbe.class, HealthSubDeploymentConfigSource.class) .addAsServiceProvider(ConfigSource.class, HealthSubDeploymentConfigSource.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); WebArchive testableArchive = Testable.archiveToTest(war); EnterpriseArchive ear = ShrinkWrap .create(EnterpriseArchive.class, EAR_ARCHIVE_NAME) .addAsModule(testableArchive) .addAsLibraries(jarArchive) .addAsResource(EmptyAsset.INSTANCE, "beans.xml") .addAsResource(MicroProfileHealthTestBase.class.getPackage(), "application.xml", "application.xml") .addManifest(); System.out.println(ear.toString(true)); return ear; }

Target:
abstract void checkGlobalOutcome(ManagementClient managementClient, String operation, boolean mustBeUP, String probeName) throws IOException; @Deployment(name = "MicroProfileHealthTestCase", managed = false) public static Archive<?> deploy() { WebArchive war = ShrinkWrap.create(WebArchive.class, "MicroProfileHealthTestCase.war") .addClasses(TestApplication.class, TestApplication.Resource.class, MyProbe.class, MyLiveProbe.class, HealthConfigSource.class) .addAsServiceProvider(ConfigSource.class, HealthConfigSource.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); return war; }
Source:
public void returnsItsUpdatedContent() throws Exception { final DyMemo memo = new DyMemo(this.emptyMkItemWithMemo()); memo.update( new Directives() .xpath("/memo") .add("uri").set("sample.uri") ); final XML xml = memo.read(); MatcherAssert.assertThat( XhtmlMatchers.xhtml(xml.toString()), XhtmlMatchers.hasXPaths( " ) ); }

Target:
public void returnsItsUpdatedContent() throws Exception { final DyMemo memo = new DyMemo(this.emptyMkItemWithMemo()); memo.update( new Directives() .xpath("/memo") .add("uri").set("sample.uri") ); MatcherAssert.assertThat( XhtmlMatchers.xhtml(memo.read().toString()), XhtmlMatchers.hasXPaths( " ) ); }
Source:
private boolean isFolderExisting(IFolder folder) { for (IPath fExistingFolder : fExistingFolders) { if (folder.getFullPath().equals(fExistingFolder)) { return true; } } return false; }

Target:
private boolean isFolderExisting(IFolder folder) { for (IPath existingFolder : fExistingFolders) { if (folder.getFullPath().equals(existingFolder)) { return true; } } return false; }
Source:
public AlterTableDesc() { this.properties = new KeyValueSet(); }

Target:
public AlterTableDesc() { init(); }