auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void visitFunctionType(VisitableXmlElement<FunctionType> visitable) { JAXBElement<FunctionType> element = visitable.getElement(); LOGGER.debug(element.getName().getLocalPart()); FunctionType functionType = element.getValue(); String functionName = functionType.getName(); if (FORMS_FUNCTION_V1.equals(functionName)) { List<Optional<Serializable>> args = functionType .getExpression() .stream() .map(JAXBElement::getValue) .map(LiteralType.class::cast) .flatMap( t -> (t.getContent() == null || t.getContent().isEmpty()) ? Stream.of(Optional.<Serializable>empty()) : t.getContent().stream().map(Optional::of)) .collect(Collectors.toList()); args.forEach(o -> LOGGER.debug(o.toString())); Function<Serializable, Boolean> boolFunc = s -> Boolean.parseBoolean((String) s); builder.setTemplatedValues( get(args, 0, String.class), get(args, 1, String.class), get(args, 2, boolFunc), get(args, 3, boolFunc)); } else { throw new FilterProcessingException("Could not find a valid function name"); } }

Target:
public void visitFunctionType(VisitableXmlElement<FunctionType> visitable) { JAXBElement<FunctionType> element = visitable.getElement(); traceLocalPart(element.getName().getLocalPart()); FunctionType functionType = element.getValue(); String functionName = functionType.getName(); if (TEMPLATE_SUBSTITUTIONS_V1.equals(functionName)) { List<Optional<Serializable>> args = functionType .getExpression() .stream() .map(JAXBElement::getValue) .map(LiteralType.class::cast) .flatMap( literalType -> (literalType.getContent() == null || literalType.getContent().isEmpty()) ? Stream.of(Optional.<Serializable>empty()) : literalType.getContent().stream().map(Optional::of)) .collect(Collectors.toList()); if (LOGGER.isTraceEnabled()) { args.stream().map(optional -> optional.orElse(null)).forEach(this::traceValue); } builder.setTemplatedValues( get(args, DEFAULT_VALUE_INDEX, String.class), get(args, NODE_ID_INDEX, String.class), get(args, IS_VISIBLE_INDEX, BOOL_FUNC), get(args, IS_READONLY_INDEX, BOOL_FUNC)); } else { throw new FilterProcessingException("Unrecognized function: " + functionName); } }
Source:
public void testUriWithSessionProperties() throws SQLException { String sessionProperties = "sessionProp1:sessionValue1;sessionProp2:sessionValue2"; PrestoDriverUri parameters = createDriverUri("presto://localhost:8080?extraCredentials=" + sessionProperties); Properties properties = parameters.getProperties(); assertEquals(properties.getProperty(EXTRA_CREDENTIALS.getKey()), sessionProperties); }

Target:
public void testUriWithSessionProperties() throws SQLException { String sessionProperties = "sessionProp1:sessionValue1;sessionProp2:sessionValue2"; PrestoDriverUri parameters = createDriverUri("presto://localhost:8080?sessionProperties=" + sessionProperties); Properties properties = parameters.getProperties(); assertEquals(properties.getProperty(SESSION_PROPERTIES.getKey()), sessionProperties); }
Source:
public void execute() { String inviterId = getRequestParamValue(ParamsNames.INVITER_ID); Assumption.assertPostParamNotNull(ParamsNames.INVITER_ID, inviterId); String courseId = getRequestParamValue(ParamsNames.COURSE_ID); Assumption.assertPostParamNotNull(ParamsNames.COURSE_ID, courseId); String instructorEmail = getRequestParamValue(ParamsNames.INSTRUCTOR_EMAIL); Assumption.assertPostParamNotNull(ParamsNames.INSTRUCTOR_EMAIL, instructorEmail); AccountAttributes inviter = logic.getAccount(inviterId); Assumption.assertNotNull(inviter); CourseAttributes course = logic.getCourse(courseId); Assumption.assertNotNull(course); RetryManager rm = new RetryManager(5); InstructorAttributes instructor = null; try { instructor = rm.runUntilNotNull(new RetryableTaskReturns<InstructorAttributes>("getInstructor") { @Override public InstructorAttributes run() { return logic.getInstructorById(courseId, instructorEmail); } }); } catch (MaximumRetriesExceededException e) { Assumption.fail("If the instructor hasn't been retrieved yet there is some problem in adding of instructor" + TeammatesException.toStringWithStackTrace(e)); } Assumption.assertNotNull(instructor); EmailWrapper email = new EmailGenerator() .generateInstructorCourseJoinEmail(inviter, instructor, course); try { emailSender.sendEmail(email); } catch (Exception e) { Assumption.fail("Unexpected error while sending email" + TeammatesException.toStringWithStackTrace(e)); } }

Target:
public void execute() { String inviterId = getRequestParamValue(ParamsNames.INVITER_ID); Assumption.assertPostParamNotNull(ParamsNames.INVITER_ID, inviterId); String courseId = getRequestParamValue(ParamsNames.COURSE_ID); Assumption.assertPostParamNotNull(ParamsNames.COURSE_ID, courseId); String instructorEmail = getRequestParamValue(ParamsNames.INSTRUCTOR_EMAIL); Assumption.assertPostParamNotNull(ParamsNames.INSTRUCTOR_EMAIL, instructorEmail); AccountAttributes inviter = logic.getAccount(inviterId); Assumption.assertNotNull(inviter); CourseAttributes course = logic.getCourse(courseId); Assumption.assertNotNull(course); RetryManager rm = new RetryManager(4); InstructorAttributes instructor = null; try { instructor = rm.runUntilNotNull(new RetryableTaskReturns<InstructorAttributes>("getInstructor") { @Override public InstructorAttributes run() { return logic.getInstructorById(courseId, instructorEmail); } }); } catch (MaximumRetriesExceededException e) { Assumption.fail("If the instructor hasn't been retrieved yet there is some problem in adding of instructor" + TeammatesException.toStringWithStackTrace(e)); } Assumption.assertNotNull(instructor); EmailWrapper email = new EmailGenerator() .generateInstructorCourseJoinEmail(inviter, instructor, course); try { emailSender.sendEmail(email); } catch (Exception e) { Assumption.fail("Unexpected error while sending email" + TeammatesException.toStringWithStackTrace(e)); } }
Source:
protected void verifyMetadataSourceAssigned(Model model, Resource primaryResource, File depositDirectory, String sourceType, String fileSuffix) { Property stagingLoc = CdrDeposit.stagingLocation; Property hasSourceMetadata = Cdr.hasSourceMetadataProfile; Property sourceMD = RDF.type; Property hasDS = CdrDeposit.hasDatastream; assertEquals("Did not have metadata source type", sourceType, primaryResource.getProperty(hasSourceMetadata) .getLiteral().getString()); Resource sourceMDResource = primaryResource.getProperty(sourceMD).getResource(); assertNotNull("Source metdata was not assigned to main resource", sourceMDResource); File sourceMDFile = verifyStagingLocationExists(sourceMDResource, stagingLoc, depositDirectory, "Original metadata"); assertTrue("Original metadata file did not have the correct suffix, most likely the wrong file", sourceMDFile .getName().endsWith(fileSuffix)); String sourceMDDatastream = primaryResource.getProperty(hasDS).getResource().getURI(); assertEquals("Source datastream path did not match the sourceMetadata", sourceMDResource.getURI(), sourceMDDatastream); }

Target:
protected void verifyMetadataSourceAssigned(Model model, Resource primaryResource, File depositDirectory, String sourceType, String fileSuffix) { Property stagingLoc = CdrDeposit.stagingLocation; Property hasMetadataProfile = Cdr.hasSourceMetadataProfile; Property hasDS = CdrDeposit.hasDatastream; Property hasSourceMD = CdrDeposit.hasSourceMetadata; assertEquals("Did not have metadata source type", sourceType, primaryResource.getProperty(hasMetadataProfile) .getLiteral().getString()); Resource sourceMDResource = primaryResource.getProperty(hasSourceMD).getResource(); assertNotNull("Source metdata was not assigned to main resource", sourceMDResource); File sourceMDFile = verifyStagingLocationExists(sourceMDResource, stagingLoc, depositDirectory, "Original metadata"); assertTrue("Original metadata file did not have the correct suffix, most likely the wrong file", sourceMDFile .getName().endsWith(fileSuffix)); String sourceMDDatastream = primaryResource.getProperty(hasDS).getResource().getURI(); assertEquals("Source datastream path did not match the sourceMetadata", sourceMDResource.getURI(), sourceMDDatastream); }
Source:
public void killTask(ExecutorDriver driver, TaskID taskId) { LOGGER.info("Killing task : " + taskId.getValue()); if (task.process != null) { LOGGER.info("Found task to kill: " + taskId.getValue()); int pid = task.pid(); if (pid == -1) { LOGGER.debug("Graceful shutdown failed. Could not read crate.pid."); task.process.destroy(); task.process = null; return; } boolean success = task.gracefulStop(); if (success) { driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_KILLED) .build()); driver.stop(); } else { driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_RUNNING) .build()); } } else { LOGGER.debug("No running task found :("); } }

Target:
public void killTask(ExecutorDriver driver, TaskID taskId) { LOGGER.info("Killing task : " + taskId.getValue()); if (task.process != null) { LOGGER.debug("Found task to kill: " + taskId.getValue()); int pid = task.pid(); if (pid == -1) { LOGGER.error("Graceful shutdown failed. Could not read crate.pid."); task.process.destroy(); task.process = null; return; } boolean success = task.gracefulStop(); if (success) { driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_KILLED) .build()); driver.stop(); } else { driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_RUNNING) .build()); } } else { LOGGER.error("No running task found."); } }
Source:
public GenericRecord getGenericRecord(Object tuple) throws Exception { GenericRecord rec = new GenericData.Record(getSchema()); for (int i = 0; i < columnNames.size(); i++) { try { rec.put(columnNames.get(i).name(), AvroRecordHelper.convertValueStringToAvroKeyType(getSchema(), columnNames.get(i).name(), keyMethodMap.get(i).get(tuple).toString())); } catch (AvroRuntimeException e) { LOG.error("Could not set Field [" + columnNames.get(i).name() + "] in the generic record"); fieldErrorCnt++; } catch (Exception e) { LOG.error("Parse Exception"); fieldErrorCnt++; } } return rec; }

Target:
private GenericRecord getGenericRecord(Object tuple) throws Exception { int writeErrorCount = 0; GenericRecord rec = new GenericData.Record(getSchema()); for (int i = 0; i < columnNames.size(); i++) { try { rec.put(columnNames.get(i).name(), AvroRecordHelper.convertValueStringToAvroKeyType(getSchema(), columnNames.get(i).name(), keyMethodMap.get(i).get(tuple).toString())); } catch (AvroRuntimeException e) { LOG.error("Could not set Field [" + columnNames.get(i).name() + "] in the generic record", e); fieldErrorCount++; } catch (Exception e) { LOG.error("Parse Exception", e); fieldErrorCount++; writeErrorCount++; } } if (columnNames.size() == writeErrorCount) { errorCount++; return null; } else { return rec; } }
Source:
public void connect(MessageContext messageContext) { Object ejbObj; String methodName = (String) getParameter(messageContext, EJBConstants.METHOD_NAME); String returnName = (String) getParameter(messageContext, EJBConstants.RETURN); if (getParameter(messageContext, EJBConstants.RETURN) == null) { returnName = EJBConstants.RESPONSE; } if (messageContext.getProperty(messageContext.getMessageID()) == null) { ejbObj = EJBUtil.getEJBObject(messageContext, EJBConstants.JNDI_NAME); messageContext.setProperty(messageContext.getMessageID(), ejbObj); } else { ejbObj = messageContext.getProperty(messageContext.getMessageID()); } Object[] args = EJBUtil.buildArguments(messageContext, EJBConstants.STATEFUL); Method method = EJBUtil.resolveMethod(ejbObj.getClass(), methodName, args.length); Object obj = EJBUtil.invokeInstanceMethod(ejbObj, method, args); if (!method.getReturnType().toString().equals(EJBConstants.VOID)) { messageContext.setProperty(returnName, obj); } else { messageContext.setProperty(EJBConstants.RESPONSE, EJBConstants.SUCCESS); } }

Target:
public void connect(MessageContext messageContext) { Object ejbObj; String methodName = (String) getParameter(messageContext, EJBConstants.METHOD_NAME); String returnName = (String) getParameter(messageContext, EJBConstants.RETURN); if (getParameter(messageContext, EJBConstants.RETURN) == null) { returnName = EJBConstants.RESPONSE; } if (messageContext.getProperty(EJBConstants.EJB_OBJECT) == null) { ejbObj = EJBUtil.getEJBObject(messageContext, EJBConstants.JNDI_NAME); messageContext.setProperty(EJBConstants.EJB_OBJECT, ejbObj); } else { ejbObj = messageContext.getProperty(EJBConstants.EJB_OBJECT); } Object[] args = EJBUtil.buildArguments(messageContext, EJBConstants.STATEFUL); Method method = EJBUtil.resolveMethod(ejbObj.getClass(), methodName, args.length); Object obj = EJBUtil.invokeInstanceMethod(ejbObj, method, args); if (!method.getReturnType().toString().equals(EJBConstants.VOID)) { messageContext.setProperty(returnName, obj); } else { messageContext.setProperty(EJBConstants.RESPONSE, EJBConstants.SUCCESS); } }
Source:
public ColdMergeVDSCommandParameters(Guid storageJobId, SubchainInfo subchainInfo) { super(); this.storageJobId = storageJobId; this.subchainInfo = subchainInfo; }

Target:
public ColdMergeVDSCommandParameters(Guid storageJobId, SubchainInfo subchainInfo) { this.storageJobId = storageJobId; this.subchainInfo = subchainInfo; }
Source:
private void assertGeneratingDifferentNumbers(RandomFactory factory1, RandomFactory factory2) { Random random = factory1.createRandom(); Random random2 = factory2.createRandom(); for (int i = 0; i < EnvironmentModeTest.NUMBER_OF_RANDOM_NUMBERS_GENERATED; i++) { Assertions.assertThat(random.nextInt()).as("Random factories should not generate exactly the same results " + "in the non-reproducible environment mode. " + "It can happen but the probability is very low. Run test again") .isNotEqualTo(random2.nextInt()); } }

Target:
private void assertGeneratingDifferentNumbers(RandomFactory factory1, RandomFactory factory2) { Random random = factory1.createRandom(); Random random2 = factory2.createRandom(); SoftAssertions.assertSoftly(softly -> IntStream.range(0, NUMBER_OF_RANDOM_NUMBERS_GENERATED) .forEach(i -> softly.assertThat(random.nextInt()) .as("Random factories should not generate exactly the same results " + "in the non-reproducible environment mode. " + "It can happen but the probability is very low. Run test again") .isNotEqualTo(random2.nextInt()))); }
Source:
public int compareTo(CorfuRecordId o) { if ((this.sequence != Address.NON_ADDRESS && o.sequence == Address.NON_ADDRESS) || (this.sequence == Address.NON_ADDRESS && o.sequence != Address.NON_ADDRESS)) { throw new IllegalStateException("CorfuQueue cannot mix transactional and non-transactional types"); } return Comparator.comparing(CorfuRecordId::getEpoch) .thenComparing(CorfuRecordId::getSequence) .thenComparing(CorfuRecordId::getEntryId) .compare(this, o); }

Target:
public int compareTo(CorfuRecordId o) { return Comparator.comparing(CorfuRecordId::getEpoch) .thenComparing(CorfuRecordId::getSequence) .thenComparing(CorfuRecordId::getEntryId) .compare(this, o); }
Source:
public ResponseEntity enableRLS( HttpServletRequest request, @PathVariable(value = TYPE_ID) String typeId) throws URISyntaxException { permissionService.addType(typeId); return ResponseEntity.created(new URI(request.getRequestURI())).build(); }

Target:
public ResponseEntity enableRLS( HttpServletRequest request, @PathVariable(value = TYPE_ID) String typeId) { permissionService.addType(typeId); return ResponseEntity.created(getUriFromRequest(request)).build(); }
Source:
protected void importFile(String parserType, URL url) { Parser<E> parser = parsers.get(parserType); if (parser != null) { InputStream is = null; InputStreamReader inputStreamReader = null; try { is = url.openStream(); BufferedInputStream bis = new BufferedInputStream(is); inputStreamReader = new InputStreamReader(bis); Set<E> providedObjects = parser.parse(inputStreamReader); if (providedObjects != null) { updateProvidedObjectsHolder(url, providedObjects); } } catch (ParsingException e) { logger.debug(e.getMessage(), e); } catch (IOException e) { logger.debug(e.getMessage(), e); } finally { try { if (inputStreamReader != null) { inputStreamReader.close(); } if (is != null) { is.close(); } } catch (IOException e) { } } } else { synchronized (urls) { List<URL> value = urls.get(parserType); if (value == null) { value = new ArrayList<URL>(); urls.put(parserType, value); } value.add(url); } logger.debug("Parser not available", parserType, new Exception()); } }

Target:
protected void importFile(String parserType, URL url) { Parser<E> parser = parsers.get(parserType); if (parser != null) { InputStream is = null; InputStreamReader inputStreamReader = null; try { is = url.openStream(); BufferedInputStream bis = new BufferedInputStream(is); inputStreamReader = new InputStreamReader(bis); Set<E> providedObjects = parser.parse(inputStreamReader); updateProvidedObjectsHolder(url, providedObjects); } catch (ParsingException e) { logger.debug(e.getMessage(), e); } catch (IOException e) { logger.debug(e.getMessage(), e); } finally { if (inputStreamReader != null) { try { inputStreamReader.close(); } catch (IOException e) { } } if (is != null) { try { is.close(); } catch (IOException e) { } } } } else { synchronized (urls) { List<URL> value = urls.get(parserType); if (value == null) { value = new ArrayList<URL>(); urls.put(parserType, value); } value.add(url); } logger.debug("Parser not available", parserType, new Exception()); } }
Source:
public String getContentAccessModeList() { String[] modeList = contentAccessModeList == null ? new String[0] : contentAccessModeList.split(","); String ammend = ""; if (!ArrayUtils.contains(modeList, ContentAccessCertServiceAdapter.DEFAULT_CONTENT_ACCESS_MODE)) { ammend = modeList.length > 0 ? "," : ""; ammend += ContentAccessCertServiceAdapter.DEFAULT_CONTENT_ACCESS_MODE; } return modeList.length > 0 ? this.contentAccessModeList + ammend : ammend; }

Target:
public String getContentAccessModeList() { return this.contentAccessModeList; }
Source:
private MixedSqlNode parseDynamicTags(XNode node) { List<SqlNode> contents = new ArrayList<SqlNode>(); NodeList children = node.getNode().getChildNodes(); for (int i = 0; i < children.getLength(); i++) { XNode child = node.newXNode(children.item(i)); if (child.getNode().getNodeType() == Node.CDATA_SECTION_NODE || child.getNode().getNodeType() == Node.TEXT_NODE) { String data = child.getStringBody(""); TextSqlNode textSqlNode = new TextSqlNode(data); if (textSqlNode.isDynamic()) { contents.add(textSqlNode); isDynamic = true; } else { contents.add(new StaticTextSqlNode(data)); } } else if (child.getNode().getNodeType() == Node.ELEMENT_NODE) { String nodeName = child.getNode().getNodeName(); NodeHandler handler = nodeHandlerMap.get(nodeName); if (handler == null) { throw new BuilderException("Unknown element <" + nodeName + "> in SQL statement."); } handler.handleNode(child, contents); isDynamic = true; } } return new MixedSqlNode(contents); }

Target:
protected MixedSqlNode parseDynamicTags(XNode node) { List<SqlNode> contents = new ArrayList<SqlNode>(); NodeList children = node.getNode().getChildNodes(); for (int i = 0; i < children.getLength(); i++) { XNode child = node.newXNode(children.item(i)); if (child.getNode().getNodeType() == Node.CDATA_SECTION_NODE || child.getNode().getNodeType() == Node.TEXT_NODE) { String data = child.getStringBody(""); TextSqlNode textSqlNode = new TextSqlNode(data); if (textSqlNode.isDynamic()) { contents.add(textSqlNode); isDynamic = true; } else { contents.add(new StaticTextSqlNode(data)); } } else if (child.getNode().getNodeType() == Node.ELEMENT_NODE) { String nodeName = child.getNode().getNodeName(); NodeHandler handler = nodeHandlerMap.get(nodeName); if (handler == null) { throw new BuilderException("Unknown element <" + nodeName + "> in SQL statement."); } handler.handleNode(child, contents); isDynamic = true; } } return new MixedSqlNode(contents); }
Source:
void onPositionObserverUpdate() { if (controller == null || txtvPosition == null || txtvLength == null) { return; } TimeSpeedConverter converter = new TimeSpeedConverter(controller.getCurrentPlaybackSpeedMultiplier()); int currentPosition = converter.convert(controller.getPosition()); int duration = converter.convert(controller.getDuration()); int remainingTime = converter.convert( controller.getDuration() - controller.getPosition()); Log.d(TAG, "currentPosition " + Converter.getDurationStringLong(currentPosition)); if (currentPosition == PlaybackService.INVALID_TIME || duration == PlaybackService.INVALID_TIME) { Log.w(TAG, "Could not react to position observer update because of invalid time"); return; } txtvPosition.setText(Converter.getDurationStringLong(currentPosition)); if (showTimeLeft) { txtvLength.setText("-" + Converter.getDurationStringLong(remainingTime)); } else { txtvLength.setText(Converter.getDurationStringLong(duration)); } updateProgressbarPosition(currentPosition, duration); Playable media = controller.getMedia(); if (media instanceof FeedMedia) { FeedMedia feedMedia = (FeedMedia) media; FeedPreferences preferences = feedMedia.getItem().getFeed().getPreferences(); int skipEnd = preferences.getFeedSkipEnding(); if (skipEnd > 0 && remainingTime < skipEnd * 1000) { Log.d(TAG, "Skipping the remaining " + remainingTime / 1000 + " " + skipEnd ); String skipMesg = MediaplayerActivity.this.getString(de.danoeh.antennapod.core.R.string.pref_feed_skip_ending) + " " + skipEnd + " " + MediaplayerActivity.this.getString(de.danoeh.antennapod.core.R.string.time_seconds); Toast toast = Toast.makeText(MediaplayerActivity.this, skipMesg, Toast.LENGTH_LONG); toast.show(); IntentUtils.sendLocalBroadcast(MediaplayerActivity.this, PlaybackService.ACTION_SKIP_CURRENT_EPISODE); } else { Log.d(TAG, "Not Skipping the remaining " + remainingTime / 1000 + " " + skipEnd ); } } }

Target:
void onPositionObserverUpdate() { if (controller == null || txtvPosition == null || txtvLength == null) { return; } TimeSpeedConverter converter = new TimeSpeedConverter(controller.getCurrentPlaybackSpeedMultiplier()); int currentPosition = converter.convert(controller.getPosition()); int duration = converter.convert(controller.getDuration()); int remainingTime = converter.convert( controller.getDuration() - controller.getPosition()); Log.d(TAG, "currentPosition " + Converter.getDurationStringLong(currentPosition)); if (currentPosition == PlaybackService.INVALID_TIME || duration == PlaybackService.INVALID_TIME) { Log.w(TAG, "Could not react to position observer update because of invalid time"); return; } txtvPosition.setText(Converter.getDurationStringLong(currentPosition)); if (showTimeLeft) { txtvLength.setText("-" + Converter.getDurationStringLong(remainingTime)); } else { txtvLength.setText(Converter.getDurationStringLong(duration)); } updateProgressbarPosition(currentPosition, duration); }
Source:
List<IRemoteTest> createIndividualTests(Set<TestInfo> testInfos, String configPath) { List<IRemoteTest> tests = new ArrayList<>(); if (configPath == null) { return tests; } File configFie = new File(configPath); if (!configFie.exists()) { return tests; } testInfos = dedupTestInfos(testInfos); for (TestInfo testInfo : testInfos) { super.cleanUpSuiteSetup(); super.clearModuleArgs(); super.clearConfigPaths(); super.addConfigPaths(configFie); parseOptions(testInfo); LinkedHashMap<String, IConfiguration> config = super.loadTests(); for (Map.Entry<String, IConfiguration> entry : config.entrySet()) { tests.addAll(entry.getValue().getTests()); } } return tests; }

Target:
List<IRemoteTest> createIndividualTests(Set<TestInfo> testInfos, String configPath) { CLog.i("Creating individual tests for configuration: %s", configPath); List<IRemoteTest> tests = new ArrayList<>(); if (configPath == null) { throw new RuntimeException(String.format("Configuration path is null.")); } File configFie = new File(configPath); if (!configFie.exists()) { throw new RuntimeException( String.format("Configuration path: %s doesn't exits.", configPath)); } testInfos = dedupTestInfos(testInfos); for (TestInfo testInfo : testInfos) { super.cleanUpSuiteSetup(); super.clearModuleArgs(); super.clearConfigPaths(); super.addConfigPaths(configFie); parseOptions(testInfo); LinkedHashMap<String, IConfiguration> config = super.loadTests(); for (Map.Entry<String, IConfiguration> entry : config.entrySet()) { tests.addAll(entry.getValue().getTests()); } } return tests; }
Source:
public static <T> PersistentPortability<T> persistent(final Portability<T> normal) { List<Class<?>> proxyInterfaces = new ArrayList<>(); proxyInterfaces.add(PersistentPortability.class); for (Class<?> klazz = normal.getClass(); klazz != null; klazz = klazz.getSuperclass()) { proxyInterfaces.addAll(asList(klazz.getInterfaces())); } return (PersistentPortability<T>) Proxy.newProxyInstance(normal.getClass().getClassLoader(), proxyInterfaces.toArray(new Class[0]), (o, method, os) -> { if (method.getDeclaringClass().equals(Persistent.class)) { return null; } else { return method.invoke(normal, os); } }); }

Target:
public static <T> PersistentPortability<T> persistent(final Portability<T> normal) { if (normal instanceof PersistentPortability<?>) { return (PersistentPortability<T>) normal; } else { LinkedHashSet<Class<?>> proxyInterfaces = new LinkedHashSet<>(); for (Class<?> klazz = normal.getClass(); klazz != null; klazz = klazz.getSuperclass()) { proxyInterfaces.addAll(asList(klazz.getInterfaces())); } proxyInterfaces.add(PersistentPortability.class); return (PersistentPortability<T>) Proxy.newProxyInstance(normal.getClass().getClassLoader(), proxyInterfaces.toArray(new Class[0]), (o, method, os) -> { if (method.getDeclaringClass().equals(Persistent.class)) { return null; } else { return method.invoke(normal, os); } }); } }
Source:
public void bulkClaim(List<TaskSummary> taskSummaries) { if (taskSummaries == null || taskSummaries.isEmpty()) { return; } taskSummaries.parallelStream().forEach(taskSummary -> { if (getClaimActionCondition().test(taskSummary)) { claimTask(taskSummary); } else { view.displayNotification( constants.ClaimNotAllowedOn(String.valueOf(taskSummary.getId()), taskSummary.getName())); } }); }

Target:
public void bulkClaim(List<TaskSummary> taskSummaries) { if (taskSummaries == null || taskSummaries.isEmpty()) { return; } taskSummaries.forEach(taskSummary -> { if (getClaimActionCondition().test(taskSummary)) { claimTask(taskSummary); } else { view.displayNotification( constants.ClaimNotAllowedOn(String.valueOf(taskSummary.getId()), taskSummary.getName())); } }); }
Source:
public static <T> ArrayList<T> newArrayList(int size) { return new ArrayList<T>( getInitialCapacityFromExpectedSize( size ) ); }

Target:
public static <T> ArrayList<T> newArrayList(int size) { return new ArrayList<T>( size ); }
Source:
private void takeUserRegionLock() throws IOException { try { long waitTime = connectionConfig.getScannerTimeoutPeriod(); if (!userRegionLock.tryLock(waitTime, TimeUnit.MILLISECONDS)) { throw new LockTimeoutException("Failed to get user region lock in" + waitTime + " ms. " + " for accessing meta region server."); } } catch (InterruptedException ie) { LOG.error("Interrupted while waiting for a lock", ie); throw ExceptionUtil.asInterrupt(ie); } }

Target:
void takeUserRegionLock() throws IOException { try { long waitTime = connectionConfig.getMetaOperationTimeout(); if (!userRegionLock.tryLock(waitTime, TimeUnit.MILLISECONDS)) { throw new LockTimeoutException("Failed to get user region lock in" + waitTime + " ms. " + " for accessing meta region server."); } } catch (InterruptedException ie) { LOG.error("Interrupted while waiting for a lock", ie); throw ExceptionUtil.asInterrupt(ie); } }
Source:
public static void handle(Throwable caught, String name) { if (caught instanceof StatusCodeException) { final StatusCodeException statusCodeException = (StatusCodeException) caught; if (statusCodeException.getStatusCode() == 401) { showErrorMessage("The session is expired", null); Window.Location.reload(); return; } } printMessage(caught, name); }

Target:
public static void handle(Throwable caught, String name) { if (caught instanceof StatusCodeException) { final StatusCodeException statusCodeException = (StatusCodeException) caught; if (statusCodeException.getStatusCode() == 401) { showErrorMessage("The session has expired", null); Timer timer = new Timer() { @Override public void run() { Window.Location.reload(); } }; timer.schedule(2000); return; } } printMessage(caught, name); }
Source:
static ClassFilter createDefaultInstance() { List<Pattern> patternOverride = loadPatternOverride(); try { if (patternOverride != null) { LOGGER.log(Level.FINE, "Using user specified overrides for class blacklisting"); return new RegExpClassFilter(patternOverride); } else { LOGGER.log(Level.FINE, "Using default in built class blacklisting"); return new RegExpClassFilter(DEFAULT_PATTERNS); } } catch (Error e) { LOGGER.log(Level.SEVERE, "Failed to initialize the default class filter", e); throw e; } }

Target:
static ClassFilter createDefaultInstance() { try { List<Pattern> patternOverride = loadPatternOverride(); if (patternOverride != null) { LOGGER.log(Level.FINE, "Using user specified overrides for class blacklisting"); return new RegExpClassFilter(patternOverride); } else { LOGGER.log(Level.FINE, "Using default in built class blacklisting"); return new RegExpClassFilter(DEFAULT_PATTERNS); } } catch (Error e) { LOGGER.log(Level.SEVERE, "Failed to initialize the default class filter", e); throw e; } }
Source:
private boolean retryRelease0(int decrement) { for (;;) { int rawCnt = refCntUpdater.get(this), realCnt = toLiveRealCnt(rawCnt, decrement); if (decrement == realCnt) { if (refCntUpdater.compareAndSet(this, rawCnt, 1)) { maxCapacity(-rawMaxCapacity()); deallocate(); return true; } } else if (decrement < realCnt) { if (refCntUpdater.compareAndSet(this, rawCnt, rawCnt - (decrement << 1))) { return false; } } else { throw new IllegalReferenceCountException(realCnt, -decrement); } Thread.yield(); } }

Target:
private boolean retryRelease0(int decrement) { for (;;) { int rawCnt = refCntUpdater.get(this), realCnt = toLiveRealCnt(rawCnt, decrement); if (decrement == realCnt) { if (refCntUpdater.compareAndSet(this, rawCnt, 1)) { maxCapacity(-maxCapacity()); deallocate(); return true; } } else if (decrement < realCnt) { if (refCntUpdater.compareAndSet(this, rawCnt, rawCnt - (decrement << 1))) { return false; } } else { throw new IllegalReferenceCountException(realCnt, -decrement); } Thread.yield(); } }
Source:
public void deallocate(ByteBuffer buffer) { synchronized (lock) { availableMemory += buffer.capacity(); if (availableMemory > capacity) { availableMemory = capacity; } lock.notify(); } }

Target:
public void deallocate(ByteBuffer buffer) { synchronized (lock) { availableMemory += buffer.capacity(); if (availableMemory > capacity) { availableMemory = capacity; logger.warn("The total deallocated memory is more than that had been allocated from the buffer pool."); } lock.notify(); } }
Source:
public Token appendCheckpoint(Token snapshotTimestamp, Long streamTail) { long start = System.currentTimeMillis(); if (!Address.isAddress(streamTail)) { snapshotTimestamp = forceHole(); streamTail = snapshotTimestamp.getSequence(); } try { rt.getAddressSpaceView().read(snapshotTimestamp.getSequence()); } catch (TrimmedException te) { log.info("appendCheckpointOnSnapshot: stream tail at has been trimmed. Checkpoint on same state" + "as previous checkpoint.", snapshotTimestamp); } rt.getObjectsView().TXBuild() .type(TransactionType.SNAPSHOT) .snapshot(snapshotTimestamp) .build() .begin(); try (Timer.Context context = MetricsUtils.getConditionalContext(appendCheckpointTimer)) { log.info("appendCheckpoint: Started checkpoint for at snapshot {}", streamId, snapshotTimestamp); ICorfuSMR<T> corfuObject = (ICorfuSMR<T>) this.map; Set<Map.Entry> entries = this.map.entrySet(); startCheckpoint(snapshotTimestamp, streamTail); appendObjectState(entries); finishCheckpoint(); long cpDuration = System.currentTimeMillis() - start; log.info("appendCheckpoint: completed checkpoint for {}, entries({}), tableSize({}) bytes, " + "cpSize({}) bytes at snapshot in ms", streamId, entries.size(), MetricsUtils.sizeOf.deepSizeOf(entries), numBytes, snapshotTimestamp, cpDuration); } finally { rt.getObjectsView().TXEnd(); } return snapshotTimestamp; }

Target:
public Token appendCheckpoint(Token snapshotTimestamp, Long streamTail) { long start = System.currentTimeMillis(); if (!Address.isAddress(streamTail)) { snapshotTimestamp = forceHole(); streamTail = snapshotTimestamp.getSequence(); } rt.getAddressSpaceView().read(snapshotTimestamp.getSequence()); long currentEpoch = rt.getSequencerView().query().getEpoch(); if (currentEpoch != snapshotTimestamp.getEpoch()) { throw new WrongEpochException(currentEpoch); } rt.getObjectsView().TXBuild() .type(TransactionType.SNAPSHOT) .snapshot(snapshotTimestamp) .build() .begin(); try (Timer.Context context = MetricsUtils.getConditionalContext(appendCheckpointTimer)) { log.info("appendCheckpoint: Started checkpoint for at snapshot {}", streamId, snapshotTimestamp); Set<Map.Entry> entries = this.map.entrySet(); startCheckpoint(snapshotTimestamp, streamTail); appendObjectState(entries); finishCheckpoint(); long cpDuration = System.currentTimeMillis() - start; log.info("appendCheckpoint: completed checkpoint for {}, entries({}), tableSize({}) bytes, " + "cpSize({}) bytes at snapshot in ms", streamId, entries.size(), MetricsUtils.sizeOf.deepSizeOf(entries), numBytes, snapshotTimestamp, cpDuration); } finally { rt.getObjectsView().TXEnd(); } return snapshotTimestamp; }
Source:
public void agentsConfigFile() throws Exception { j.createSlave("node1", "node1", new EnvVars()); AgentsConfigFile comp = new AgentsConfigFile(); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); comp.addContents(new Container() { @Override public void add(@CheckForNull Content content) { try { content.writeTo(baos); } catch (IOException e) { e.printStackTrace(); } } }); String fileContent = baos.toString(); Assert.assertTrue(fileContent.contains("<name>node1</name>")); }

Target:
public void agentsConfigFile() throws Exception { j.createSlave("node1", "node1", new EnvVars()); AgentsConfigFile comp = new AgentsConfigFile(); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); comp.addContents(new Container() { @Override public void add(@CheckForNull Content content) { try { content.writeTo(baos); } catch (IOException e) { Assert.fail(e.getMessage()); } } }); String fileContent = baos.toString(); Assert.assertTrue(fileContent.contains("<name>node1</name>")); }
Source:
protected Object encodeCommand(Command command) { switch (command.getType()) { case Command.TYPE_REBOOT_DEVICE: return formatCommand(command, "SA200CMD;{%s};02;Reboot\r", Command.KEY_UNIQUE_ID); case Command.TYPE_POSITION_SINGLE: return formatCommand(command, "SA200GTR;{%s};02;\r", Command.KEY_UNIQUE_ID); case Command.TYPE_OUTPUT_CONTROL: return formatCommand(command, "SA200CMD;{%s};0{%s};Enable{%s}\r", Command.KEY_UNIQUE_ID, Command.KEY_DATA, Command.KEY_DATA); case Command.TYPE_ENGINE_STOP: return formatCommand(command, "SA200CMD;{%s};02;Enable1\r", Command.KEY_UNIQUE_ID); case Command.TYPE_ENGINE_RESUME: return formatCommand(command, "SA200CMD;{%s};02;Disable1\r", Command.KEY_UNIQUE_ID); default: Log.warning(new UnsupportedOperationException(command.getType())); break; } return null; }

Target:
protected Object encodeCommand(Command command) { switch (command.getType()) { case Command.TYPE_REBOOT_DEVICE: return formatCommand(command, "SA200CMD;{%s};02;Reboot\r", Command.KEY_UNIQUE_ID); case Command.TYPE_POSITION_SINGLE: return formatCommand(command, "SA200GTR;{%s};02;\r", Command.KEY_UNIQUE_ID); case Command.TYPE_OUTPUT_CONTROL: if (command.getAttributes().containsKey(Command.KEY_DATA)) { if (command.getAttributes().get(Command.KEY_DATA).equals("1")) { return formatCommand(command, "SA200CMD;{%s};02;Enable{%s}\r", Command.KEY_UNIQUE_ID, Command.KEY_INDEX); } else return formatCommand(command, "SA200CMD;{%s};02;Disable{%s}\r", Command.KEY_UNIQUE_ID, Command.KEY_INDEX); } case Command.TYPE_ENGINE_STOP: return formatCommand(command, "SA200CMD;{%s};02;Enable1\r", Command.KEY_UNIQUE_ID); case Command.TYPE_ENGINE_RESUME: return formatCommand(command, "SA200CMD;{%s};02;Disable1\r", Command.KEY_UNIQUE_ID); default: Log.warning(new UnsupportedOperationException(command.getType())); break; } return null; }
Source:
public void testQueueFullEmitsError() { final CountDownLatch latch = new CountDownLatch(1); final int capacity = (int)Math.pow(2, new Random().nextInt(10)); Observable<Integer> observable = Observable.create(new OnSubscribe<Integer>() { @Override public void call(Subscriber<? super Integer> o) { for (int i = 0; i < capacity + 10; i++) { o.onNext(i); } latch.countDown(); o.onCompleted(); } }); TestSubscriber<Integer> testSubscriber = new TestSubscriber<Integer>(new Observer<Integer>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { } @Override public void onNext(Integer t) { try { latch.await(500, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { e.printStackTrace(); } } }); System.out.println("Using capacity " + capacity); observable.observeOn(Schedulers.newThread(), capacity).subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); List<Throwable> errors = testSubscriber.getOnErrorEvents(); assertEquals(1, errors.size()); System.out.println("Errors: " + errors); Throwable t = errors.get(0); if (t instanceof MissingBackpressureException) { } else { if (t.getCause() instanceof MissingBackpressureException) { } else { fail("Expecting MissingBackpressureException"); } } }

Target:
public void testQueueFullEmitsError() { final CountDownLatch latch = new CountDownLatch(1); Observable<Integer> observable = Observable.create(new OnSubscribe<Integer>() { @Override public void call(Subscriber<? super Integer> o) { for (int i = 0; i < RxRingBuffer.SIZE + 10; i++) { o.onNext(i); } latch.countDown(); o.onCompleted(); } }); TestSubscriber<Integer> testSubscriber = new TestSubscriber<Integer>(new Observer<Integer>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { } @Override public void onNext(Integer t) { try { latch.await(500, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { e.printStackTrace(); } } }); observable.observeOn(Schedulers.newThread()).subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); List<Throwable> errors = testSubscriber.getOnErrorEvents(); assertEquals(1, errors.size()); System.out.println("Errors: " + errors); Throwable t = errors.get(0); if (t instanceof MissingBackpressureException) { } else { if (t.getCause() instanceof MissingBackpressureException) { } else { fail("Expecting MissingBackpressureException"); } } }
Source:
public synchronized int submitUnprocessedBuildsForImport(AvailableBuildsList availableBuilds) { List<BuildImportSummary> buildsSortedByDateDescending = BuildByDateSorter .sortBuildsByDateDescending(buildImportSummaries.values()); List<BuildIdentifier> importNeededBuilds = new LinkedList<>(); for (BuildImportSummary buildImportSummary : buildsSortedByDateDescending) { if (buildImportSummary != null && buildImportSummary.getStatus().isImportNeeded()) { importNeededBuilds.add(buildImportSummary.getIdentifier()); submitBuildForImport(availableBuilds, buildImportSummary.getIdentifier()); } } asyncBuildImportExecutor.submit(() -> asyncBuildImportExecutor.submit(() -> comparisonExecutor.scheduleComparisonFinishedLog())); return importNeededBuilds.size(); }

Target:
public synchronized int submitUnprocessedBuildsForImport(AvailableBuildsList availableBuilds) { List<BuildImportSummary> buildsSortedByDateDescending = BuildByDateSorter .sortBuildsByDateDescending(buildImportSummaries.values()); List<BuildIdentifier> importNeededBuilds = new LinkedList<>(); for (BuildImportSummary buildImportSummary : buildsSortedByDateDescending) { if (buildImportSummary != null && buildImportSummary.getStatus().isImportNeeded()) { importNeededBuilds.add(buildImportSummary.getIdentifier()); submitBuildForImport(availableBuilds, buildImportSummary.getIdentifier()); } } executeAfterAllPendingImportsAndComparisonsDone(() -> LOGGER.info(ALL_BUILD_IMPORTS_AND_COMPARISONS_FINISHED_LOG_ENTRY_FOR_CI_CHECK)); return importNeededBuilds.size(); }
Source:
private void displayYouWontSeeNearbyMessage() { ViewUtil.showLongToast(getActivity(), "You wont see narby place since you didn't gave permission"); }

Target:
private void displayYouWontSeeNearbyMessage() { ViewUtil.showLongToast(getActivity(), getResources().getString(R.string.unable_to_display_nearest_place)); }
Source:
public void testMigration() throws IOException { copyFileFromAssets("database" + File.separator + dbFilename, DATABASE_PATH); FormsDatabaseHelper databaseHelper = new FormsDatabaseHelper(); ensureMigrationAppliesFully(databaseHelper); SQLiteDatabase db = databaseHelper.getReadableDatabase(); assertThat(db.getVersion(), is(FormsDatabaseHelper.DATABASE_VERSION)); List<String> newColumnNames = FormsDatabaseHelper.getFormsColumnNames(db); assertThat(newColumnNames, contains(FormsDatabaseHelper.CURRENT_VERSION_COLUMN_NAMES)); if (description.startsWith("Upgrading")) { assertThatFormsAreKeptAfterUpgrading(); } }

Target:
public void testMigration() throws IOException { copyFileFromAssets("database" + File.separator + dbFilename, DATABASE_PATH); FormsDatabaseHelper databaseHelper = new FormsDatabaseHelper(); ensureMigrationAppliesFully(databaseHelper); SQLiteDatabase db = databaseHelper.getReadableDatabase(); assertThat(db.getVersion(), is(FormsDatabaseHelper.DATABASE_VERSION)); List<String> newColumnNames = SQLiteUtils.getColumnNames(db, FORMS_TABLE_NAME); assertThat(newColumnNames, contains(FormsDatabaseHelper.CURRENT_VERSION_COLUMN_NAMES)); if (action.equals(UPGRADE)) { assertThatFormsAreKeptAfterUpgrading(); } }
Source:
public static void requireUShort16(int value) { if (value < 0) { throw new IllegalArgumentException("unsigned 16-bit integers can't be negative"); } if (value > ((1 << 16) - 1)) { throw new IllegalArgumentException("unsigned 16-bit integers can't be greater than 2^16 - 1"); } }

Target:
public static int requireUShort16(int value) { if (value < 0) { throw new IllegalArgumentException("unsigned 16-bit integers can't be negative"); } if (value > ((1 << 16) - 1)) { throw new IllegalArgumentException("unsigned 16-bit integers can't be greater than 2^16 - 1"); } return value; }
Source:
public static String extractSignatureFromAssertion(AssertionType assertion) { return assertion != null && !StringUtils.isBlank(assertion.getSignatureAlgorithm()) ? assertion.getSignatureAlgorithm() : getSignatureAlgorithm(); }

Target:
public static String extractSignatureFromAssertion(AssertionType assertion) { return assertion != null && StringUtils.isNotBlank(assertion.getSignatureAlgorithm()) ? assertion.getSignatureAlgorithm() : getSignatureAlgorithm(); }
Source:
public static List<CodeSystemEntry> getAllCodeSystems(ServiceProvider context) { final Repositories repositories = RepositoryRequests.prepareSearch() .all() .build() .execute(context); return repositories.getItems() .stream() .filter( repository -> RepositoryInfo.Health.GREEN == repository.health() ) .flatMap(repository -> { return new RepositoryRequest<>(repository.id(), CodeSystemRequests.prepareSearchCodeSystem() .all() .build()).execute(context).stream(); }) .collect(Collectors.toList()); }

Target:
public static List<CodeSystemEntry> getAllCodeSystems(ServiceProvider context) { final Repositories repositories = RepositoryRequests.prepareSearch() .all() .build() .execute(context); return repositories.getItems() .stream() .flatMap(repository -> { return CodeSystemRequests.prepareSearchCodeSystem() .all() .build(repository.id()) .getRequest() .execute(context) .stream(); }) .collect(Collectors.toList()); }
Source:
public void dispose() { super.dispose(); if (control != null) { control.dispose(); } }

Target:
public void dispose() { if (control != null) { control.dispose(); } super.dispose(); }
Source:
public void run() { TransactionImpl txi = null; try { while (true) { String status = "FAILED"; try { txi = new TransactionImpl(env); Transaction tx = txi; if (TracingTransaction.isTracingEnabled()) tx = new TracingTransaction(tx); loader.load(tx); txi.commit(); status = "COMMITTED"; return; } catch (CommitException e) { } catch (Exception e) { log.error("Failed to execute loader " + loader, e); throw new RuntimeException(e); } finally { if (txi != null) TxLogger.logTx(status, loader.getClass().getName(), txi.getStats()); } } } finally { txi.close(); } }

Target:
public void run() { TransactionImpl txi = null; try { while (true) { String status = "FAILED"; try { txi = new TransactionImpl(env); Transaction tx = txi; if (TracingTransaction.isTracingEnabled()) tx = new TracingTransaction(tx); loader.load(tx); txi.commit(); status = "COMMITTED"; return; } catch (CommitException e) { } catch (Exception e) { log.error("Failed to execute loader " + loader, e); throw new RuntimeException(e); } finally { if (txi != null) TxLogger.logTx(status, loader.getClass().getName(), txi.getStats()); } } } finally { if (txi != null) { txi.close(); } } }
Source:
private void executeDownload(final DownloadBatch downloadBatch) { InternalDownloadBatchStatus downloadBatchStatus = downloadBatch.status(); if (downloadBatchStatus.status() == DOWNLOADED) { return; } updateStatusToQueuedIfNeeded(downloadBatchStatus); downloadService.download(downloadBatch, downloadBatchCallback()); }

Target:
private void executeDownload(final DownloadBatch downloadBatch) { InternalDownloadBatchStatus downloadBatchStatus = downloadBatch.status(); if (downloadBatchStatus.status() != DOWNLOADED) { updateStatusToQueuedIfNeeded(downloadBatchStatus); downloadService.download(downloadBatch, downloadBatchCallback()); } }
Source:
public void testLoopCreation() { thrown.expect(IllegalArgumentException.class); BusinessService service1 = createService("Business Service #1"); BusinessService service2 = createService("Business Service #2"); BusinessService service3 = createService("Business Service #3"); Long serviceId1 = businessServiceDao.save(service1); Long serviceId2 = businessServiceDao.save(service2); Long serviceId3 = businessServiceDao.save(service3); businessServiceManager.assignChildService(serviceId1, serviceId2); businessServiceManager.assignChildService(serviceId2, serviceId3); businessServiceManager.assignChildService(serviceId3, serviceId1); }

Target:
public void testLoopCreation() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Service will form a loop"); BusinessService service1 = createService("Business Service #1"); BusinessService service2 = createService("Business Service #2"); BusinessService service3 = createService("Business Service #3"); Long serviceId1 = businessServiceDao.save(service1); Long serviceId2 = businessServiceDao.save(service2); Long serviceId3 = businessServiceDao.save(service3); businessServiceManager.assignChildService(serviceId1, serviceId2); businessServiceManager.assignChildService(serviceId2, serviceId3); businessServiceManager.assignChildService(serviceId3, serviceId1); }