auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void setVmQuotaPercentage(VirtualMachineTO to, VirtualMachineProfile vmProfile) { if (to.getLimitCpuUse()) { VirtualMachine vm = vmProfile.getVirtualMachine(); HostVO host = _hostDao.findById(vm.getHostId()); if (host == null) { throw new CloudRuntimeException("Host with id: " + vm.getHostId() + " not found"); } s_logger.debug("Limiting CPU usage for VM " + vm.getId() + " on host " + host.getId()); double hostMaxSpeed = getHostCPUSpeed(host); double maxSpeed = getVmSpeed(to); try { BigDecimal percent = new BigDecimal(maxSpeed / hostMaxSpeed); percent = percent.setScale(2, RoundingMode.HALF_DOWN); to.setCpuQuotaPercentage(percent.doubleValue()); s_logger.debug("Host " + host.getId() + " max CPU speed = " + hostMaxSpeed + "MHz, VM " + vm.getId() + "max CPU speed = " + maxSpeed + "MHz. Setting CPU quota percentage as: " + percent.doubleValue()); } catch (NumberFormatException e) { s_logger.error("Error calculating vm quota percentage, it wll not be set: " + e.getMessage()); } } }

Target:
protected void setVmQuotaPercentage(VirtualMachineTO to, VirtualMachineProfile vmProfile) { if (to.getLimitCpuUse()) { VirtualMachine vm = vmProfile.getVirtualMachine(); HostVO host = _hostDao.findById(vm.getHostId()); if (host == null) { throw new CloudRuntimeException("Host with id: " + vm.getHostId() + " not found"); } s_logger.debug("Limiting CPU usage for VM: " + vm.getUuid() + " on host: " + host.getUuid()); double hostMaxSpeed = getHostCPUSpeed(host); double maxSpeed = getVmSpeed(to); try { BigDecimal percent = new BigDecimal(maxSpeed / hostMaxSpeed); percent = percent.setScale(2, RoundingMode.HALF_DOWN); if (percent.compareTo(new BigDecimal(1)) == 1) { s_logger.debug("VM " + vm.getUuid() + " CPU MHz exceeded host " + host.getUuid() + " CPU MHz, limiting VM CPU to the host maximum"); percent = new BigDecimal(1); } to.setCpuQuotaPercentage(percent.doubleValue()); s_logger.debug("Host: " + host.getUuid() + " max CPU speed = " + hostMaxSpeed + "MHz, VM: " + vm.getUuid() + "max CPU speed = " + maxSpeed + "MHz. Setting CPU quota percentage as: " + percent.doubleValue()); } catch (NumberFormatException e) { s_logger.error("Error calculating VM: " + vm.getUuid() + " quota percentage, it wll not be set. Error: " + e.getMessage(), e); } } }
Source:
public void testSortNodes_Stage() throws Exception { final Diagram<Graph<DefinitionSet, Node>, Metadata> diagram = mock(Diagram.class); final Graph<DefinitionSet, Node> graph = mock(Graph.class); when(diagram.getGraph()).thenReturn(graph); final List<Node> nodes = new LinkedList<>(); when(graph.nodes()).thenReturn(nodes); final Node root = createNode(CaseManagementDiagram.class); final Node start = createNode(StartNoneEvent.class); final Node end = createNode(EndNoneEvent.class); final Node stage1 = createNode(AdHocSubprocess.class); final Node stage2 = createNode(AdHocSubprocess.class); nodes.add(root); nodes.add(start); nodes.add(end); nodes.add(stage1); nodes.add(stage2); createChildEdge(root, end); createChildEdge(root, start); createChildEdge(root, stage2); createChildEdge(root, stage1); createSequenceFlow(start, stage1); createSequenceFlow(stage1, stage2); createSequenceFlow(stage2, end); tested.sortNodes(diagram); final List<Edge> rEdges = root.getOutEdges(); assertEquals(4, rEdges.size()); assertEquals(start, rEdges.get(0).getTargetNode()); assertEquals(stage1, rEdges.get(1).getTargetNode()); assertEquals(stage2, rEdges.get(2).getTargetNode()); assertEquals(end, rEdges.get(3).getTargetNode()); }

Target:
public void testSortNodes_Stage() { final Diagram<Graph<DefinitionSet, Node>, Metadata> diagram = mock(Diagram.class); final Graph<DefinitionSet, Node> graph = mock(Graph.class); when(diagram.getGraph()).thenReturn(graph); final List<Node> nodes = new LinkedList<>(); when(graph.nodes()).thenReturn(nodes); final Node root = createNode(CaseManagementDiagram.class); final Node start = createNode(StartNoneEvent.class); final Node end = createNode(EndNoneEvent.class); final Node stage1 = createNode(AdHocSubprocess.class); final Node stage2 = createNode(AdHocSubprocess.class); nodes.add(root); nodes.add(start); nodes.add(end); nodes.add(stage1); nodes.add(stage2); createChildEdge(root, end); createChildEdge(root, start); createChildEdge(root, stage2); createChildEdge(root, stage1); createSequenceFlow(start, stage1); createSequenceFlow(stage1, stage2); createSequenceFlow(stage2, end); tested.sortNodes(diagram); final List<Edge> rEdges = root.getOutEdges(); assertEquals(4, rEdges.size()); assertEquals(start, rEdges.get(0).getTargetNode()); assertEquals(stage1, rEdges.get(1).getTargetNode()); assertEquals(stage2, rEdges.get(2).getTargetNode()); assertEquals(end, rEdges.get(3).getTargetNode()); }
Source:
public static Object[][] adsVelesErrorTracking() { final String TURN_ON_VELES = "?InstantGlobals.wgAdDriverVelesBidderCountries=[XX]"; return new Object[][]{ { new Page(WIKI_SPECIAL, "SyntheticTests/RTB/Prebid.js/Veles/Both/Leaderboard" + TURN_ON_VELES), ImmutableMap.builder() .put(AdsContent.TOP_LB, "") .put(AdsContent.INCONTENT_PLAYER, "") .build(), ImmutableMap.builder() .put(".*output=vast.*", new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.REQUEST_TIMEOUT)) .build() }, { new Page(WIKI_SPECIAL, "Project43_Wikia" + TURN_ON_VELES), ImmutableMap.builder() .put(AdsContent.TOP_LB, "0.00") .build(), ImmutableMap.builder() .build() } }; }

Target:
public static Object[][] adsVelesErrorTracking() { return new Object[][]{ { new Page(WIKI_SPECIAL, "SyntheticTests/RTB/Prebid.js/Veles/Both/Leaderboard?" + AdsVeles.TURN_ON_QUERY_PARAM), ImmutableMap.builder() .put(AdsContent.TOP_LB, "") .put(AdsContent.INCONTENT_PLAYER, "") .build(), ImmutableMap.builder() .put(".*output=vast.*", new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.REQUEST_TIMEOUT)) .build() }, { new Page(WIKI_SPECIAL, "Project43_Wikia?" + AdsVeles.TURN_ON_QUERY_PARAM), ImmutableMap.builder() .put(AdsContent.TOP_LB, "0.00") .build(), ImmutableMap.builder() .build() } }; }
Source:
public void blockingRejectedExecution() throws Exception { Scheduler blockingSchedulerSpy = spy(blocking); RejectingScheduler rejectingSchedulerSpy = new RejectingScheduler(blockingSchedulerSpy); flow = flowBuilder.get().processors(blockingProcessor) .processingStrategyFactory((context, prefix) -> new ProactorStreamEmitterProcessingStrategy(DEFAULT_BUFFER_SIZE, 1, () -> cpuLight, () -> rejectingSchedulerSpy, () -> cpuIntensive, 1, 2, true)) .build(); flow.initialise(); flow.start(); rejectingSchedulerSpy.reset(); processFlow(testEvent()); probe(() -> { assertThat(rejectingSchedulerSpy.getRejections(), is(greaterThanOrEqualTo(10))); return true; }); assertThat(threads, hasSize(1)); assertThat(threads.stream().filter(name -> name.startsWith(IO)).count(), equalTo(1l)); assertThat(threads, not(hasItem(startsWith(CPU_LIGHT)))); assertThat(threads, not(hasItem(startsWith(CPU_INTENSIVE)))); assertThat(threads, not(hasItem(startsWith(CUSTOM)))); }

Target:
public void blockingRejectedExecution() throws Exception { Scheduler blockingSchedulerSpy = spy(blocking); RejectingScheduler rejectingSchedulerSpy = new RejectingScheduler(blockingSchedulerSpy); flow = flowBuilder.get().processors(blockingProcessor) .processingStrategyFactory((context, prefix) -> new ProactorStreamEmitterProcessingStrategy(DEFAULT_BUFFER_SIZE, 1, () -> cpuLight, () -> rejectingSchedulerSpy, () -> cpuIntensive, 1, 2, true)) .build(); flow.initialise(); flow.start(); rejectingSchedulerSpy.reset(); processFlow(testEvent()); verify(blockingSchedulerSpy, times(1)).submit(any(Callable.class)); probe(() -> { assertThat(rejectingSchedulerSpy.getRejections(), is(greaterThanOrEqualTo(REJECTION_COUNT))); return true; }); assertThat(threads, hasSize(1)); assertThat(threads.stream().filter(name -> name.startsWith(IO)).count(), equalTo(1l)); assertThat(threads, not(hasItem(startsWith(CPU_LIGHT)))); assertThat(threads, not(hasItem(startsWith(CPU_INTENSIVE)))); assertThat(threads, not(hasItem(startsWith(CUSTOM)))); }
Source:
public static byte[] digestWithSalt(String password, byte[] salt, String algorithm) { try { MessageDigest md = MessageDigest.getInstance(algorithm); String temp_password = (password == null ? "" : password); md.update(temp_password.getBytes("UTF-8")); md.update(salt); return md.digest(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(algorithm, e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }

Target:
public static byte[] digestWithSalt(String password, byte[] salt, String algorithm) { try { MessageDigest md = MessageDigest.getInstance(algorithm); if (password == null) { password = ""; } md.update(password.getBytes("UTF-8")); md.update(salt); return md.digest(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(algorithm, e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
Source:
@Test public void unexpectedSignatureFromAdapters() throws Exception { try { Moshi moshi = new Moshi.Builder() .add(new UnexpectedSignatureFromJsonAdapter()).build(); } catch (IllegalArgumentException expected){ assertThat(expected.getMessage()).contains( "<any access modifier> void toJson(JsonWriter writer, T value) throws <any>;", "pointFromJson" ); } }

Target:
@Test public void unexpectedSignatureFromAdapters() throws Exception { Moshi.Builder builder = new Moshi.Builder(); try { builder.add(new UnexpectedSignatureFromJsonAdapter()).build(); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessage("Unexpected signature for void " + "com.squareup.moshi.AdapterMethodsTest$UnexpectedSignatureFromJsonAdapter.pointFromJson" + "(java.lang.String).\n" + "@FromJson method signatures may have one of the following structures:\n" + " <any access modifier> void fromJson(JsonReader jsonReader) throws <any>;\n" + " <any access modifier> R fromJson(T value) throws <any>;\n"); } }
Source:
public void testDeleteWithDelay() throws Exception { int delay = 200; File[] files = initFiles(10, monitoredDirectory, "file00"); observer.checkAndNotify(); init(); addDelay(delay); Stream.of(files) .forEach( f -> { fileDelete(f); observer.checkAndNotify(); }); runThreads(observer::checkAndNotify, 3); Thread.sleep(delay + delayBuf); verify(fileListener, never()).onFileCreate(any(File.class), any(Synchronization.class)); verify(fileListener, never()).onFileChange(any(File.class), any(Synchronization.class)); verify(fileListener, times(files.length)) .onFileDelete(any(File.class), any(Synchronization.class)); }

Target:
public void testDeleteWithDelay() throws Exception { File[] files = initFiles(10, monitoredDirectory, "file00"); observer.checkAndNotify(); init(); initSemaphore(files.length); delayLatch = new CountDownLatch(1); Stream.of(files) .forEach( f -> { fileDelete(f); observer.checkAndNotify(); }); artificialDelay.release(files.length); delayLatch.await(timeout, TimeUnit.MILLISECONDS); verify(fileListener, never()).onFileCreate(any(File.class), any(Synchronization.class)); verify(fileListener, never()).onFileChange(any(File.class), any(Synchronization.class)); verify(fileListener, times(1)).onFileDelete(any(File.class), any(Synchronization.class)); delayLatch = new CountDownLatch(files.length - 1); observer.checkAndNotify(); delayLatch.await(timeout, TimeUnit.MILLISECONDS); verify(fileListener, never()).onFileCreate(any(File.class), any(Synchronization.class)); verify(fileListener, never()).onFileChange(any(File.class), any(Synchronization.class)); verify(fileListener, times(files.length)) .onFileDelete(any(File.class), any(Synchronization.class)); assertThat(artificialDelay.getQueueLength(), is(0)); }
Source:
public long skip(long n) throws IOException { long k = count - pos; if (n < k) { k = n < 0 ? 0 : n; } pos += k; return k; }

Target:
public long skip(long n) throws IOException { if (n <= 0) { return 0; } long remaining = count - pos; if(remaining < n) { n = remaining; } pos += n; return n; }
Source:
public ActionResult execute() { String searchKey = getNonNullRequestParamValue(Const.ParamsNames.ADMIN_SEARCH_KEY); List<InstructorAttributes> instructors = logic.searchInstructorsInWholeSystem(searchKey).instructorList; List<InstructorData> instructorDataList = new ArrayList<>(); for (InstructorAttributes instructor : instructors) { InstructorData instructorData = new InstructorData(instructor); instructorData.setKey(StringHelper.encrypt(instructor.getKey())); if (instructor.getGoogleId() != null) { AccountAttributes account = logic.getAccount(instructor.getGoogleId()); if (account != null) { String institute = StringHelper.isEmpty(account.institute) ? "None" : account.institute; instructorData.setInstitute(institute); } } instructorDataList.add(instructorData); } InstructorsData instructorsData = new InstructorsData(); instructorsData.setInstructors(instructorDataList); instructorsData.getInstructors().forEach(InstructorData::hideInformationForSearch); return new JsonResult(instructorsData); }

Target:
public ActionResult execute() { String searchKey = getNonNullRequestParamValue(Const.ParamsNames.ADMIN_SEARCH_KEY); List<InstructorAttributes> instructors = logic.searchInstructorsInWholeSystem(searchKey).instructorList; List<InstructorData> instructorDataList = new ArrayList<>(); for (InstructorAttributes instructor : instructors) { InstructorData instructorData = new InstructorData(instructor); instructorData.addAdditionalInformationForAdminSearch( StringHelper.encrypt(instructor.getKey()), getInstituteFromGoogleId(instructor.getGoogleId())); instructorData.hideInformationForSearch(); instructorDataList.add(instructorData); } InstructorsData instructorsData = new InstructorsData(); instructorsData.setInstructors(instructorDataList); return new JsonResult(instructorsData); }
Source:
private InterpreterContext getInterpreterContext() { AngularObjectRegistry registry = null; ResourcePool resourcePool = null; if (this.interpreter != null) { registry = this.interpreter.getInterpreterGroup().getAngularObjectRegistry(); resourcePool = this.interpreter.getInterpreterGroup().getResourcePool(); } Credentials credentials = note.getCredentials(); if (subject != null) { UserCredentials userCredentials; try { userCredentials = credentials.getUserCredentials(subject.getUser()); } catch (IOException e) { LOGGER.error("Unable to get Usercredentials. Working with empty UserCredentials", e); userCredentials = new UserCredentials(); } subject.setUserCredentials(userCredentials); } return InterpreterContext.builder() .setNoteId(note.getId()) .setNoteName(note.getName()) .setParagraphId(getId()) .setReplName(intpText) .setParagraphTitle(title) .setParagraphText(text) .setAuthenticationInfo(subject) .setLocalProperties(localProperties) .setConfig(config) .setGUI(settings) .setNoteGUI(getNoteGui()) .setAngularObjectRegistry(registry) .setResourcePool(resourcePool) .build(); }

Target:
private InterpreterContext getInterpreterContext() { AngularObjectRegistry registry = null; ResourcePool resourcePool = null; if (this.interpreter != null) { registry = this.interpreter.getInterpreterGroup().getAngularObjectRegistry(); resourcePool = this.interpreter.getInterpreterGroup().getResourcePool(); } Credentials credentials = note.getCredentials(); if (subject != null) { UserCredentials userCredentials; try { userCredentials = credentials.getUserCredentials(subject.getUser()); } catch (IOException e) { LOGGER.warn("Unable to get Usercredentials. Working with empty UserCredentials", e); userCredentials = new UserCredentials(); } subject.setUserCredentials(userCredentials); } return InterpreterContext.builder() .setNoteId(note.getId()) .setNoteName(note.getName()) .setParagraphId(getId()) .setReplName(intpText) .setParagraphTitle(title) .setParagraphText(text) .setAuthenticationInfo(subject) .setLocalProperties(localProperties) .setConfig(config) .setGUI(settings) .setNoteGUI(getNoteGui()) .setAngularObjectRegistry(registry) .setResourcePool(resourcePool) .build(); }
Source:
public List<E> getInwardEdges(V target) { return vertexInMap.get(target).edges; }

Target:
public List<E> getInwardEdges(V target) { return vertexMap.get(target).inEdges; }
Source:
public List<String> validateQuestionDetails(String courseId) { List<String> errors = new ArrayList<>(); if (generateOptionsFor == FeedbackParticipantType.NONE) { if (numOfMcqChoices < Const.FeedbackQuestion.MCQ_MIN_NUM_OF_CHOICES) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_NOT_ENOUGH_CHOICES + Const.FeedbackQuestion.MCQ_MIN_NUM_OF_CHOICES + "."); } boolean isEmptyMcqOptionEntered = false; for (String mcqText : mcqChoices) { if (mcqText.trim().equals("")) { isEmptyMcqOptionEntered = true; break; } } if (isEmptyMcqOptionEntered) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_EMPTY_MCQ_OPTION); } if (hasAssignedWeights && mcqChoices.size() != mcqWeights.size()) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } if (!hasAssignedWeights && (!mcqWeights.isEmpty() || mcqOtherWeight != 0)) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } if (hasAssignedWeights && !otherEnabled && mcqOtherWeight != 0) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } if (hasAssignedWeights && !mcqWeights.isEmpty()) { for (double weight : mcqWeights) { if (weight < 0) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } } if (otherEnabled && mcqOtherWeight < 0) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } } } return errors; }

Target:
public List<String> validateQuestionDetails(String courseId) { List<String> errors = new ArrayList<>(); if (generateOptionsFor == FeedbackParticipantType.NONE) { if (numOfMcqChoices < Const.FeedbackQuestion.MCQ_MIN_NUM_OF_CHOICES) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_NOT_ENOUGH_CHOICES + Const.FeedbackQuestion.MCQ_MIN_NUM_OF_CHOICES + "."); } boolean isEmptyMcqOptionEntered = mcqChoices.stream().anyMatch(mcqText -> mcqText.trim().equals("")); if (isEmptyMcqOptionEntered) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_EMPTY_MCQ_OPTION); } if (hasAssignedWeights && mcqChoices.size() != mcqWeights.size()) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } if (!hasAssignedWeights && (!mcqWeights.isEmpty() || mcqOtherWeight != 0)) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } if (hasAssignedWeights && !otherEnabled && mcqOtherWeight != 0) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } if (hasAssignedWeights && !mcqWeights.isEmpty()) { for (double weight : mcqWeights) { if (weight < 0) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } } if (otherEnabled && mcqOtherWeight < 0) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } } } return errors; }
Source:
public Blob run(Blob blob) throws IOException { String mimetype = blob.getMimeType(); if ("application/pdf".equals(mimetype)) { return blob; } Blob result; if (blob instanceof StringBlob && !"text/plain".equals(mimetype)) { if (!"text/html".equals(mimetype)) { blob = convertBlobToMimeType(blob, "text/html"); } Path tempDirectory = Framework.createTempDirectory("blobs"); blob = replaceURLsByAbsolutePaths(blob, tempDirectory); result = convertBlobToMimeType(blob, "application/pdf"); FileUtils.deleteQuietly(tempDirectory.toFile()); } else { result = convertBlobToMimeType(blob, "application/pdf"); } adjustBlobName(blob, result); return result; }

Target:
public Blob run(Blob blob) throws IOException { String mimetype = blob.getMimeType(); if (MimetypeRegistry.PDF_MIMETYPE.equals(mimetype)) { return blob; } Blob result; if (MediaType.TEXT_PLAIN.equals(mimetype)) { result = convertBlobToMimeType(blob, MimetypeRegistry.PDF_MIMETYPE); } else { if (!MediaType.TEXT_HTML.equals(mimetype)) { String filename = blob.getFilename(); blob = convertBlobToMimeType(blob, MediaType.TEXT_HTML); blob.setFilename(filename); } Path tempDirectory = Framework.createTempDirectory("blobs"); blob = replaceURLsByAbsolutePaths(blob, tempDirectory); result = convertBlobToMimeType(blob, MimetypeRegistry.PDF_MIMETYPE); org.apache.commons.io.FileUtils.deleteQuietly(tempDirectory.toFile()); } adjustBlobName(blob, result); return result; }
Source:
List<String> getTestClasses() { return testClasses; }

Target:
List<String> getTestClasses() { return Collections.unmodifiableList(testClasses); }
Source:
public void complexDependencyPlanExecutionTest() { final Plan plan = PlanImpl.newBuilder() .addEvaluatorToDelete("SERVER", EVAL_PREFIX + 1) .addEvaluatorToDelete("SERVER", EVAL_PREFIX + 3) .addEvaluatorToDelete("WORKER", EVAL_PREFIX + 7) .addEvaluatorToAdd("SERVER", EVAL_PREFIX + 2) .addEvaluatorToAdd("WORKER", EVAL_PREFIX + 5) .addEvaluatorToAdd("WORKER", EVAL_PREFIX + 6) .addTransferStep("SERVER", new TransferStepImpl(EVAL_PREFIX + 4, EVAL_PREFIX + 2, new DataInfoImpl(1))) .addTransferStep("WORKER", new TransferStepImpl(EVAL_PREFIX + 8, EVAL_PREFIX + 9, new DataInfoImpl(1))) .build(); final Future<PlanResult> result = planExecutor.execute(plan); final int planSize = plan.getPlanSize(); try { final PlanResultImpl summary = (PlanResultImpl) result.get(); assertEquals(planSize, summary.getNumExecutedOps()); } catch (final Exception e) { e.printStackTrace(); } }

Target:
public void complexDependencyPlanExecutionTest() { final Plan plan = PlanImpl.newBuilder() .addEvaluatorToDelete("SERVER", EVAL_PREFIX + 1) .addEvaluatorToDelete("SERVER", EVAL_PREFIX + 2) .addEvaluatorToDelete("WORKER", EVAL_PREFIX + 3) .addTransferStep("WORKER", new TransferStepImpl(EVAL_PREFIX + 4, EVAL_PREFIX + 5, new DataInfoImpl(1))) .addEvaluatorToAdd("SERVER", EVAL_PREFIX + 6) .addEvaluatorToAdd("WORKER", EVAL_PREFIX + 7) .addEvaluatorToAdd("WORKER", EVAL_PREFIX + 8) .addTransferStep("SERVER", new TransferStepImpl(EVAL_PREFIX + 9, EVAL_PREFIX + 6, new DataInfoImpl(1))) .build(); final Future<PlanResult> result = planExecutor.execute(plan); final int planSize = plan.getPlanSize(); try { final PlanResult summary = result.get(20, TimeUnit.SECONDS); assertEquals(planSize, summary.getNumExecutedOps()); } catch (final TimeoutException e) { fail("Failed to execute the plan. Timeout occurred."); e.printStackTrace(); } catch (final InterruptedException | ExecutionException e) { fail("Failed to execute the plan. Exception occurred."); e.printStackTrace(); } }
Source:
public void testConfigurationProvider() { try { ServerConfiguration configuration = ConfigurationFileLoader.loadConfiguration(); assertEquals(configuration.getProperty(TestConfigurationProvider.PROPERTY_1_NAME, null), TestConfigurationProvider.PROPERTY_1_VALUE); assertEquals(configuration.getProperty(TestConfigurationProvider.PROPERTY_2_NAME, null), TestConfigurationProvider.PROPERTY_2_VALUE); assertEquals(configuration.getProperty(TestConfigurationProvider.PROPERTY_3_NAME, null), TestConfigurationProvider.PROPERTY_3_VALUE); assertEquals(configuration.getProperty(AdditionalTestConfigurationProvider.PROPERTY_NAME, null), AdditionalTestConfigurationProvider.PROPERTY_VALUE); } catch (Exception e) { fail("Error in test", e); } }

Target:
public void testConfigurationProvider() { try { final ServerConfiguration configuration = ConfigurationFileLoader.loadConfiguration(); assertEquals(configuration.getProperty(TestConfigurationProvider.PROPERTY_1_NAME, null), TestConfigurationProvider.PROPERTY_1_VALUE); assertEquals(configuration.getProperty(TestConfigurationProvider.PROPERTY_2_NAME, null), TestConfigurationProvider.PROPERTY_2_VALUE); assertEquals(configuration.getProperty(TestConfigurationProvider.PROPERTY_3_NAME, null), TestConfigurationProvider.PROPERTY_3_VALUE); assertEquals(configuration.getProperty(AdditionalTestConfigurationProvider.PROPERTY_NAME, null), AdditionalTestConfigurationProvider.PROPERTY_VALUE); } catch (Exception e) { fail("Error in test", e); } }
Source:
private void fetchWpSettings() { WordPress.getRestClientUtilsV1_1().getGeneralSettings( mSite.getSiteId(), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { AppLog.d(AppLog.T.API, "Received response to Settings REST request."); credentialsVerified(true); mRemoteSettings.localTableId = mSite.getId(); deserializeDotComRestResponse(mSite, response); if (!mRemoteSettings.equals(mSettings)) { final Map<String, String> currentPostFormats = mSettings.postFormats; boolean location = mSettings.location; boolean optimizedImage = mSettings.optimizedImage; int maxImageWidth = mSettings.maxImageWidth; int imageQualitySetting = mSettings.imageQualitySetting; boolean optimizedVideo = mSettings.optimizedVideo; int maxVideoWidth = mSettings.maxVideoWidth; int videoEncoderBitrate = mSettings.videoEncoderBitrate; mSettings.copyFrom(mRemoteSettings); mSettings.postFormats = currentPostFormats; mSettings.location = location; mSettings.optimizedImage = optimizedImage; mSettings.maxImageWidth = maxImageWidth; mSettings.imageQualitySetting = imageQualitySetting; mSettings.optimizedVideo = optimizedVideo; mSettings.maxVideoWidth = maxVideoWidth; mSettings.videoEncoderBitrate = videoEncoderBitrate; mJpSettings.jetpackProtectWhitelist.clear(); mJpSettings.jetpackProtectWhitelist.addAll(mRemoteJpSettings.jetpackProtectWhitelist); SiteSettingsTable.saveSettings(mSettings); notifyUpdatedOnUiThread(null); } if (mSite.isJetpackConnected()) { fetchJetpackMonitorSettings(); fetchJetpackProtectAndSsoSettings(); } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.w(AppLog.T.API, "Error response to Settings REST request: " + error); notifyUpdatedOnUiThread(error); } }); }

Target:
private void fetchWpSettings() { WordPress.getRestClientUtilsV1_1().getGeneralSettings( mSite.getSiteId(), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { AppLog.d(AppLog.T.API, "Received response to Settings REST request."); credentialsVerified(true); mRemoteSettings.localTableId = mSite.getId(); deserializeDotComRestResponse(mSite, response); if (!mRemoteSettings.equals(mSettings)) { final Map<String, String> currentPostFormats = mSettings.postFormats; boolean location = mSettings.location; mSettings.copyFrom(mRemoteSettings); mSettings.postFormats = currentPostFormats; mSettings.location = location; SiteSettingsTable.saveSettings(mSettings); } notifyUpdatedOnUiThread(null); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.w(AppLog.T.API, "Error response to Settings REST request: " + error); notifyUpdatedOnUiThread(error); } }); }
Source:
private static String getMultiArchPath() { String cpu = Platform.ARCH; String kernel = Platform.iskFreeBSD() ? "-kfreebsd" : (Platform.isGNU() ? "" : "-linux"); String libc = "-gnu"; if (Platform.isIntel()) { cpu = (Platform.is64Bit() ? "x86_64" : "i386"); } else if (Platform.isPPC()) { cpu = (Platform.is64Bit() ? "powerpc64" : "powerpc"); } else if (Platform.isARM()) { cpu = "arm"; libc = "-gnueabi"; } else if (Platform.isMIPS()) { cpu = (Platform.is64Bit() ? "mips64el" : "mipsel"); } return cpu + kernel + libc; }

Target:
private static String getMultiArchPath() { String cpu = Platform.ARCH; String kernel = Platform.iskFreeBSD() ? "-kfreebsd" : (Platform.isGNU() ? "" : "-linux"); String libc = "-gnu"; if (Platform.isIntel()) { cpu = (Platform.is64Bit() ? "x86_64" : "i386"); } else if (Platform.isPPC()) { cpu = (Platform.is64Bit() ? "powerpc64" : "powerpc"); } else if (Platform.isARM()) { cpu = "arm"; libc = "-gnueabi"; } else if (Platform.ARCH.equals("mips64el")) { libc = "-gnuabi64"; } return cpu + kernel + libc; }
Source:
public void setup() throws Exception { context.put(ModuleManager.class, moduleManager); mockTime = mock(EngineTime.class); context.put(Time.class, mockTime); NetworkSystemImpl networkSystem = new NetworkSystemImpl(mockTime, context); context.put(Game.class, new Game()); context.put(NetworkSystem.class, networkSystem); EntitySystemSetupUtil.addReflectionBasedLibraries(context); EntitySystemSetupUtil.addEntityManagementRelatedClasses(context); engineEntityManager = context.get(EngineEntityManager.class); BlockManager blockManagerLocal = context.get(BlockManager.class); BiomeManager biomeManager = context.get(BiomeManager.class); Path savePath = PathManager.getInstance().getSavePath("world1"); context.put(StorageManager.class, new ReadWriteStorageManager(savePath, moduleManager.getEnvironment(), engineEntityManager, blockManagerLocal, biomeManager)); componentSystemManager = new ComponentSystemManager(context); context.put(ComponentSystemManager.class, componentSystemManager); LoadPrefabs prefabLoadStep = new LoadPrefabs(context); boolean complete = false; prefabLoadStep.begin(); while (!complete) { complete = prefabLoadStep.step(); } context.get(ComponentSystemManager.class).initialise(); }

Target:
public void setup() throws Exception { context.put(ModuleManager.class, moduleManager); mockTime = mock(EngineTime.class); context.put(Time.class, mockTime); NetworkSystemImpl networkSystem = new NetworkSystemImpl(mockTime, context); context.put(Game.class, new Game()); context.put(NetworkSystem.class, networkSystem); EntitySystemSetupUtil.addReflectionBasedLibraries(context); EntitySystemSetupUtil.addEntityManagementRelatedClasses(context); engineEntityManager = context.get(EngineEntityManager.class); BlockManager mockBlockManager = context.get(BlockManager.class); BiomeManager biomeManager = context.get(BiomeManager.class); Path savePath = PathManager.getInstance().getSavePath("world1"); context.put(StorageManager.class, new ReadWriteStorageManager(savePath, moduleManager.getEnvironment(), engineEntityManager, mockBlockManager, biomeManager)); componentSystemManager = new ComponentSystemManager(context); context.put(ComponentSystemManager.class, componentSystemManager); LoadPrefabs prefabLoadStep = new LoadPrefabs(context); boolean complete = false; prefabLoadStep.begin(); while (!complete) { complete = prefabLoadStep.step(); } context.get(ComponentSystemManager.class).initialise(); }
Source:
private static Set<UUID> getAvailablePlayerUUIDs(Path playersDirectory) { Set<UUID> ret = new HashSet<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(playersDirectory, "*.dat")) { for (Path entry : stream) { try { String name = entry.getFileName().toString().replaceAll("\\.dat$", ""); ret.add(UUID.fromString(name)); } catch (IllegalArgumentException ex) { } } } catch (IOException ex) { SpongeImpl.getLogger().error("Could not get the available UUIDs", ex); } return ret; }

Target:
private static Set<UUID> getAvailablePlayerUUIDs(Path playersDirectory) { Set<UUID> ret = new HashSet<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(playersDirectory, "*.dat")) { for (Path entry : stream) { try { String name = DAT_FILENAME_SUFFIX.matcher(entry.getFileName().toString()).replaceAll(""); ret.add(UUID.fromString(name)); } catch (IllegalArgumentException ex) { } } } catch (IOException ex) { SpongeImpl.getLogger().error("Could not get the available UUIDs", ex); } return ret; }
Source:
public String getDescription() { return "Transform files representing a structured table under an Alluxio directory." + "\n\n" + "Files are coalesced and converted to parquet format." + "\n\n" + "Definition is in format like 'write(hive).option(hive.num.files, 100)'."; }

Target:
public String getDescription() { return "Transform files representing a structured table under an Alluxio directory." + "\n\n" + "Files are coalesced and converted to parquet format." + "\n\n" + "Definition is in format like 'write(hive).option(hive.num.files, 100)'," + "currently, the only modification you can do to the example definition is " + "the number of files in the option."; }
Source:
public static List<KeyRange> generateAllSaltingRanges(int bucketNum) { List<KeyRange> allRanges = Lists.<KeyRange>newArrayListWithExpectedSize(bucketNum); byte[] bound = new byte[] {0}; for (int i=0; i<bucketNum; i++) { byte[] boundCopy = Arrays.copyOf(bound, bound.length); allRanges.add(SALTING_COLUMN.getDataType().getKeyRange( boundCopy, true, boundCopy, true)); ByteUtil.nextKey(bound, 1); } return allRanges; }

Target:
public static List<KeyRange> generateAllSaltingRanges(int bucketNum) { List<KeyRange> allRanges = Lists.<KeyRange>newArrayListWithExpectedSize(bucketNum); for (int i=0; i<bucketNum; i++) { byte[] saltByte = new byte[] {(byte) i}; allRanges.add(SALTING_COLUMN.getDataType().getKeyRange( saltByte, true, saltByte, true)); } return allRanges; }
Source:
public void gosecUtilsConstructorTest() throws Exception { assertThat(gosecSsoUtils.userName.equals("anyUser")).isTrue(); }

Target:
public void gosecUtilsConstructorTest() throws Exception { assertThat(gosecSsoUtils.ssoHost).isEqualTo("www.google.com"); assertThat(gosecSsoUtils.userName).isEqualTo("anyUser"); assertThat(gosecSsoUtils.passWord).isEqualTo("anyPassWord"); }
Source:
private boolean valuesChanged( int[] propertyIds, SchemaDescriptor.PropertySchemaType propertySchemaType ) { if ( propertySchemaType == COMPLETE_ALL_TOKENS ) { for ( int propertyId : propertyIds ) { if ( knownProperties.get( propertyId ).type == Changed ) { return true; } } return false; } else { for ( int propertyId : propertyIds ) { if ( knownProperties.get( propertyId ).type != UnChanged ) { return true; } } return false; } }

Target:
private boolean valuesChanged( int[] propertyIds, SchemaDescriptor.PropertySchemaType propertySchemaType ) { if ( propertySchemaType == COMPLETE_ALL_TOKENS ) { for ( int propertyId : propertyIds ) { if ( knownProperties.get( propertyId ).type == Changed ) { return true; } } return false; } else { for ( int propertyId : propertyIds ) { PropertyValueType type = knownProperties.get( propertyId ).type; if ( type != UnChanged && type != NoValue ) { return true; } } return false; } }
Source:
public void cassandraKvsInitializesAsynchronously() { KeyValueService asyncInitializedKvs = CassandraKeyValueServiceImpl.create( MetricsManagers.createForTests(), CassandraContainer.KVS_CONFIG, CassandraKeyValueServiceRuntimeConfig::getDefault, CassandraContainer.LEADER_CONFIG, CassandraMutationTimestampProviders.legacyModeForTestsOnly(), true, FakeQosClient.INSTANCE); assertThat(asyncInitializedKvs.isInitialized()).isFalse(); startCassandra(); Awaitility.await().atMost(25, TimeUnit.SECONDS).until(asyncInitializedKvs::isInitialized); }

Target:
public void cassandraKvsInitializesAsynchronously() throws IOException, InterruptedException { KeyValueService asyncInitializedKvs = CASSANDRA.getAsyncInitializeableKvs(); assertThat(asyncInitializedKvs.isInitialized()).isFalse(); CASSANDRA.initialize(); Awaitility.await().atMost(35, TimeUnit.SECONDS).until(asyncInitializedKvs::isInitialized); }
Source:
public void testAllProvidersArePopulated() { List<String> providers = Arrays.asList( AuthUI.FACEBOOK_PROVIDER, AuthUI.GOOGLE_PROVIDER, AuthUI.EMAIL_PROVIDER); new GoogleProvider(null, null); AuthMethodPickerActivity authMethodPickerActivity = createActivity(providers); assertEquals(providers.size(), ((LinearLayout) authMethodPickerActivity.findViewById(R.id.btn_holder)) .getChildCount()); Button emailButton = (Button) authMethodPickerActivity.findViewById(R.id.email_provider); assertEquals(View.VISIBLE, emailButton.getVisibility()); }

Target:
public void testAllProvidersArePopulated() { List<String> providers = Arrays.asList( AuthUI.FACEBOOK_PROVIDER, AuthUI.GOOGLE_PROVIDER, AuthUI.EMAIL_PROVIDER); AuthMethodPickerActivity authMethodPickerActivity = createActivity(providers); assertEquals(providers.size(), ((LinearLayout) authMethodPickerActivity.findViewById(R.id.btn_holder)) .getChildCount()); Button emailButton = (Button) authMethodPickerActivity.findViewById(R.id.email_provider); assertEquals(View.VISIBLE, emailButton.getVisibility()); }
Source:
public void validate() throws IndexBuilderException { for (Term term: TAXON_REQUIRED) if (!this.termLocations.containsKey(term)) throw new IndexBuilderException("CSV file does not contain required term " + term); }

Target:
public void validate() throws IndexBuilderException { for (Term term: TAXON_REQUIRED) { if (!this.termLocations.containsKey(term)) throw new IndexBuilderException("CSV file does not contain required term " + term); } }
Source:
public void beforeCheckpoint(long windowId) { logger.debug("checkpointedWindowId checkpointed at {}", Codec.getStringWindowId(checkpointedWindowId), Codec.getStringWindowId(windowId)); if (checkpointedWindowId == 0) { checkpointedWindowId = windowId; logger.debug("firstRun={} checkpointedWindowId={}", firstRun, Codec.getStringWindowId(checkpointedWindowId)); } }

Target:
public void beforeCheckpoint(long windowId) { if (checkpointedWindowId == 0) { checkpointedWindowId = windowId; } logger.debug("{}, windowId={}", this, Codec.getStringWindowId(windowId)); }
Source:
public String toString() { return this.getReadId() + "-" + this.getOffset() + "_" + (this.getMateId()) + " " + "readSeq: " + (this.thisReadSequence != null ? this.thisReadSequence.toString() : "") + " " + "mateReadSeq: " + (this.mateReadSequence != null ? this.mateReadSequence.toString() : ""); }

Target:
public String toString() { return this.getReadId() + "-" + this.getOffset() + "_" + (this.getMateId()) + " " + "readSeq: " + (this.thisReadSequence != null ? this.thisReadSequence.toString() : "null") + " " + "mateReadSeq: " + (this.mateReadSequence != null ? this.mateReadSequence.toString() : "null"); }
Source:
public KualiAddress() { super(); this.active = true; this.objectId = UUID.randomUUID().toString(); }

Target:
public KualiAddress() { super(); active = true; }
Source:
protected void checkForLostData(AvailabilityStrategyContext context, List<Address> newMembers) { CacheTopology stableTopology = context.getStableTopology(); List<Address> stableMembers = stableTopology.getMembers(); List<Address> lostMembers = new ArrayList<>(stableMembers); lostMembers.removeAll(newMembers); if (isDataLost(stableTopology.getCurrentCH(), newMembers)) { log.errorf("Cache %s lost data because of abrupt leavers %s", lostMembers); } if (lostMembers.size() >= Math.ceil(stableMembers.size() / 2d)) { log.errorf("Cache %s lost a majority of members (%d out of %d), possible split brain causing data inconsistency", lostMembers.size(), stableMembers.size()); } }

Target:
protected void checkForLostData(AvailabilityStrategyContext context, List<Address> newMembers) { CacheTopology stableTopology = context.getStableTopology(); List<Address> stableMembers = stableTopology.getMembers(); List<Address> lostMembers = new ArrayList<>(stableMembers); lostMembers.removeAll(newMembers); if (isDataLost(stableTopology.getCurrentCH(), newMembers)) { log.lostDataBecauseOfAbruptLeavers(context.getCacheName(), lostMembers); } if (lostMembers.size() >= Math.ceil(stableMembers.size() / 2d)) { log.minorityPartition(context.getCacheName(), lostMembers.size(), stableMembers.size()); } }
Source:
public void setup() { j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy() .grant(Jenkins.MANAGE).everywhere().to("bob") .grant(Jenkins.READ, Item.READ, Item.EXTENDED_READ).everywhere().to("alice")); }

Target:
public void setup() { j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy() .grant(Jenkins.ADMINISTER).everywhere().to("bob") .grant(Jenkins.READ, Item.READ, Item.EXTENDED_READ).everywhere().to("alice")); }
Source:
public int compareTo(IItemDescriptor<T> o) { if (o == null) { return -1; } int comp = (getRank() - o.getRank()) * -1; if (comp == 0) { comp = getID().compareTo(o.getID()); } return comp; }

Target:
public int compareTo(IItemDescriptor<T> o) { Preconditions.checkNotNull(o); int comp = getRank() - o.getRank(); if (comp == 0) { comp = getID().compareTo(o.getID()); } return comp; }
Source:
public StudentsData() { }

Target:
public StudentsData() { this.students = new ArrayList<>(); }
Source:
private Configuration getConfig() { Configuration conf = new Configuration(false); conf.set(SqsApplication.SQSDEV_CREDS_FILENAME_PROPERTY, SQS_OPERATOR_CREDS_FILENAME); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); String pre = "dt.operator.fileOut.prop."; conf.set( pre + "filePath", FILE_DIR); pre = "dt.operator.sqsIn.prop."; conf.set( pre + "subject", currentQueueName); return conf; }

Target:
private Configuration getConfig() { Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); String pre = "dt.operator.fileOut.prop."; conf.set(pre + "filePath", FILE_DIR); pre = "dt.operator.sqsIn.prop."; conf.set(pre + "subject", currentQueueName); conf.set(pre + "aws.endpoint", "http://localhost:9324"); return conf; }
Source:
protected void onResume() { super.onResume(); disposable = realm.where(Person.class).findAllAsync().asFlowable() .flatMap(new Function<RealmResults<Person>, Publisher<Person>>() { @Override public Publisher<Person> apply(RealmResults<Person> persons) throws Exception { return Flowable.fromIterable(persons); } }) .zipWith(Flowable.interval(1, TimeUnit.SECONDS), new BiFunction<Person, Long, Person>() { @Override public Person apply(Person person, Long tick) throws Exception { return person; } }) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer<Person>() { @Override public void accept(Person person) throws Exception { TextView personView = new TextView(AnimationActivity.this); personView.setText(person.getName()); container.addView(personView); } }); }

Target:
protected void onResume() { super.onResume(); disposable = realm.where(Person.class).findAllAsync().asFlowable() .flatMap(persons -> Flowable.fromIterable(persons)) .zipWith(Flowable.interval(1, TimeUnit.SECONDS), (person, tick) -> person) .observeOn(AndroidSchedulers.mainThread()) .subscribe(person -> { TextView personView = new TextView(AnimationActivity.this); personView.setText(person.getName()); container.addView(personView); }); }
Source:
public ActualProperties build() { List<LocalProperty<Symbol>> localProperties = unordered ? filteredCopy(this.localProperties, property -> !property.isOrderSensitive()) : this.localProperties; return new ActualProperties(global, localProperties, constants); }

Target:
public ActualProperties build() { List<LocalProperty<Symbol>> localProperties = this.localProperties; if (unordered) { localProperties = filteredCopy(this.localProperties, property -> !property.isOrderSensitive()); } return new ActualProperties(global, localProperties, constants); }
Source:
public void testOnJobRenamed() throws Exception { FreeStyleProject p1 = jenkins.createFreeStyleProject("build1"); List<DeliveryPipelineView.ComponentSpec> componentSpecs = new ArrayList<DeliveryPipelineView.ComponentSpec>(); componentSpecs.add(new DeliveryPipelineView.ComponentSpec("comp1", "build1", null)); componentSpecs.add(new DeliveryPipelineView.ComponentSpec("comp2", "build2", null)); DeliveryPipelineView view = new DeliveryPipelineView("Test"); view.setComponentSpecs(componentSpecs); jenkins.getInstance().addView(view); p1.renameTo("newbuild"); assertEquals("newbuild", view.getComponentSpecs().get(0).getFirstJob()); }

Target:
public void testOnJobRenamed() throws Exception { FreeStyleProject p1 = jenkins.createFreeStyleProject("build1"); List<DeliveryPipelineView.ComponentSpec> componentSpecs = new ArrayList<DeliveryPipelineView.ComponentSpec>(); componentSpecs.add(new DeliveryPipelineView.ComponentSpec("comp1", "build1", NONE)); componentSpecs.add(new DeliveryPipelineView.ComponentSpec("comp2", "build2", NONE)); DeliveryPipelineView view = new DeliveryPipelineView("Test"); view.setComponentSpecs(componentSpecs); jenkins.getInstance().addView(view); p1.renameTo("newbuild"); assertEquals("newbuild", view.getComponentSpecs().get(0).getFirstJob()); }
Source:
public void shouldRemoveEmptySCMPasswordAndEncryptedPasswordAttributes_XslMigrationFrom109To110() throws Exception { ReflectionUtil.setField(new DESCipherProvider(systemEnvironment), "cachedKey", null); FileUtils.writeStringToFile(systemEnvironment.getDESCipherFile(), "269298bc31c44620", UTF_8); String content = configWithPipeline( "<pipeline name='some_pipeline'>" + " <materials>" + " <svn url='svn1' username='bob' encryptedPassword='' dest='svn1'/>" + " <svn url='svn2' username='bob' password='' dest='svn2'/>" + " <tfs url='tfsurl1' username='user' domain='domain' encryptedPassword='' projectPath='path' dest='tfs1' />" + " <tfs url='tfsurl2' username='user' domain='domain' password='' projectPath='path' dest='tfs2' />" + " <p4 port='host:9999' username='user' encryptedPassword='' dest='perforce1'>" + " <view><![CDATA[view]]></view>" + " </p4>" + " <p4 port='host:9999' username='user' password='' dest='perforce2'>" + " <view><![CDATA[view]]></view>" + " </p4>" + " </materials>" + " <stage name='some_stage'>" + " <jobs>" + " <job name='some_job'>" + " </job>" + " </jobs>" + " </stage>" + "</pipeline>", 109); assertThat(XpathUtils.nodeExists(content, " assertThat(XpathUtils.nodeExists(content, " CruiseConfig config = ConfigMigrator.loadWithMigration(content).config; String xmlPartial = xmlWriter.toXmlPartial(config); assertThat(XpathUtils.nodeExists(xmlPartial, " assertThat(XpathUtils.nodeExists(xmlPartial, " }

Target:
public void shouldRemoveEmptySCMPasswordAndEncryptedPasswordAttributes_XslMigrationFrom109To110() throws Exception { resetCipher.setupDESCipherFile(); String content = configWithPipeline( "<pipeline name='some_pipeline'>" + " <materials>" + " <svn url='svn1' username='bob' encryptedPassword='' dest='svn1'/>" + " <svn url='svn2' username='bob' password='' dest='svn2'/>" + " <tfs url='tfsurl1' username='user' domain='domain' encryptedPassword='' projectPath='path' dest='tfs1' />" + " <tfs url='tfsurl2' username='user' domain='domain' password='' projectPath='path' dest='tfs2' />" + " <p4 port='host:9999' username='user' encryptedPassword='' dest='perforce1'>" + " <view><![CDATA[view]]></view>" + " </p4>" + " <p4 port='host:9999' username='user' password='' dest='perforce2'>" + " <view><![CDATA[view]]></view>" + " </p4>" + " </materials>" + " <stage name='some_stage'>" + " <jobs>" + " <job name='some_job'>" + " </job>" + " </jobs>" + " </stage>" + "</pipeline>", 109); assertThat(XpathUtils.nodeExists(content, " assertThat(XpathUtils.nodeExists(content, " CruiseConfig config = ConfigMigrator.loadWithMigration(content).config; String xmlPartial = xmlWriter.toXmlPartial(config); assertThat(XpathUtils.nodeExists(xmlPartial, " assertThat(XpathUtils.nodeExists(xmlPartial, " }