auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void validatesMultipleXmlsInThreads() throws Exception { final int zero = 0; final int hundred = 100; final int ten = 10; final Random rand = new SecureRandom(); final XSD xsd = new XSDDocument( StringUtils.join( "<xs:schema xmlns:xs ='<LINK_0>' >", "<xs:element name='r'><xs:complexType>", "<xs:sequence>", "<xs:element name='x' type='xs:integer'", " minOccurs='0' maxOccurs='unbounded'/>", "</xs:sequence></xs:complexType></xs:element>", "</xs:schema>" ) ); final Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { final int cnt = rand.nextInt(hundred); MatcherAssert.assertThat( xsd.validate( new DOMSource( new XMLDocument( StringUtils.join( "<r>", StringUtils.repeat("<x>hey</x>", cnt), "</r>" ) ).node() ) ), Matchers.hasSize(cnt << 1) ); return null; } }; final ExecutorService executorService = Executors.newFixedThreadPool(5); for (int count = zero; count < ten; count = count + 1) { executorService.submit(callable); } <START> executorService.awaitTermination(ten, TimeUnit.SECONDS); <END> executorService.shutdown(); }</code><technical_language>@tmjee proper shutdown sequence here</technical_language>

Target:
public void validatesMultipleXmlsInThreads() throws Exception { final int random = 100; final int loop = 10; final int timeout = 30; final Random rand = new SecureRandom(); final XSD xsd = new XSDDocument( StringUtils.join( "<xs:schema xmlns:xs ='<LINK_0>' >", "<xs:element name='r'><xs:complexType>", "<xs:sequence>", "<xs:element name='x' type='xs:integer'", " minOccurs='0' maxOccurs='unbounded'/>", "</xs:sequence></xs:complexType></xs:element>", "</xs:schema>" ) ); final Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { final int cnt = rand.nextInt(random); MatcherAssert.assertThat( xsd.validate( new DOMSource( new XMLDocument( StringUtils.join( "<r>", StringUtils.repeat("<x>hey</x>", cnt), "</r>" ) ).node() ) ), Matchers.hasSize(cnt << 1) ); return null; } }; final ExecutorService executorService = Executors.newFixedThreadPool(5); for (int count = 0; count < loop; count = count + 1) { executorService.submit(callable); } executorService.shutdown(); MatcherAssert.assertThat( executorService.awaitTermination(timeout, TimeUnit.SECONDS), Matchers.is(true) ); executorService.shutdownNow(); }
Source:
<code>public void containersChanged(Set<TaskContainerDelta> containers) { for (TaskContainerDelta delta : containers) { ITask review = (ITask) delta.getElement(); AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(review.getConnectorKind()); if (review != null && connector instanceof ReviewsConnector) { TaskData taskData; try { taskData = taskDataManager.getTaskData(review); String reviewUrl = taskData.getRoot().getAttribute(TaskAttribute.TASK_URL).getValue(); String reviewDescription = taskData.getRoot() .getMappedAttribute(TaskAttribute.DESCRIPTION) .getValue(); switch (delta.getKind()) { case DELETED: deleteMappingsTo(reviewUrl); break; case ADDED: case CONTENT: updateMapping(reviewUrl, reviewDescription); break; default: } } catch (CoreException e) { <START> e.printStackTrace(); <END> } } } }</code><technical_language>do here</technical_language>

Target:
public void containersChanged(Set<TaskContainerDelta> containers) { for (TaskContainerDelta delta : containers) { ITask review = (ITask) delta.getElement(); AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(review.getConnectorKind()); if (review != null && connector instanceof ReviewsConnector) { TaskData taskData; try { taskData = taskDataManager.getTaskData(review); String reviewUrl = taskData.getRoot().getAttribute(TaskAttribute.TASK_URL).getValue(); String reviewDescription = taskData.getRoot() .getMappedAttribute(TaskAttribute.DESCRIPTION) .getValue(); switch (delta.getKind()) { case DELETED: deleteMappingsTo(reviewUrl); break; case ADDED: case CONTENT: updateMapping(reviewUrl, reviewDescription); break; default: StatusHandler.log(new Status(IStatus.ERROR, ReviewsCoreConstants.PLUGIN_ID, "Unknown change")); } } catch (CoreException e) { StatusHandler.log( new Status(IStatus.ERROR, ReviewsCoreConstants.PLUGIN_ID, "Error getting taskData.", e)); } } } }
Source:
<code>public RemoteOperationResult(boolean success, HttpMethod httpMethod) throws IOException { this( success, httpMethod.getStatusCode(), httpMethod.getStatusText(), httpMethod.getResponseHeaders() ); if (mHttpCode == HttpStatus.SC_BAD_REQUEST) { String bodyResponse = httpMethod.getResponseBodyAsString(); if (bodyResponse != null && bodyResponse.length() > 0) { InputStream is = new ByteArrayInputStream(bodyResponse.getBytes()); InvalidCharacterExceptionParser xmlParser = new InvalidCharacterExceptionParser(); try { if (xmlParser.parseXMLResponse(is)) { mCode = ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER; } } catch (Exception e) { Log_OC.w(TAG, "Error reading exception from server: " + e.getMessage()); } } } if (mHttpCode == HttpStatus.SC_FORBIDDEN) { String bodyResponse = httpMethod.getResponseBodyAsString(); if (bodyResponse != null && bodyResponse.length() > 0) { InputStream is = new ByteArrayInputStream(bodyResponse.getBytes()); ErrorMessageParser xmlParser = new ErrorMessageParser(); try { String errorMessage = xmlParser.parseXMLResponse(is); <START> if (errorMessage != "" && errorMessage != null) { <END> mCode = ResultCode.SPECIFIC_FORBIDDEN; mHttpPhrase = errorMessage; } } catch (Exception e) { Log_OC.w(TAG, "Error reading exception from server: " + e.getMessage()); } } } }</code><technical_language>isEmpty() method check it, if change it, change order: if(errorMessage != null && !errorMessage.isEmpty())</technical_language>

Target:
public RemoteOperationResult(boolean success, HttpMethod httpMethod) throws IOException { this( success, httpMethod.getStatusCode(), httpMethod.getStatusText(), httpMethod.getResponseHeaders() ); if (mHttpCode == HttpStatus.SC_BAD_REQUEST) { String bodyResponse = httpMethod.getResponseBodyAsString(); if (bodyResponse != null && bodyResponse.length() > 0) { InputStream is = new ByteArrayInputStream(bodyResponse.getBytes()); InvalidCharacterExceptionParser xmlParser = new InvalidCharacterExceptionParser(); try { if (xmlParser.parseXMLResponse(is)) { mCode = ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER; } } catch (Exception e) { Log_OC.w(TAG, "Error reading exception from server: " + e.getMessage()); } } } if (mHttpCode == HttpStatus.SC_FORBIDDEN) { String bodyResponse = httpMethod.getResponseBodyAsString(); if (bodyResponse != null && bodyResponse.length() > 0) { InputStream is = new ByteArrayInputStream(bodyResponse.getBytes()); ErrorMessageParser xmlParser = new ErrorMessageParser(); try { String errorMessage = xmlParser.parseXMLResponse(is); if (errorMessage != null && errorMessage != "") { mCode = ResultCode.SPECIFIC_FORBIDDEN; mHttpPhrase = errorMessage; } } catch (Exception e) { Log_OC.w(TAG, "Error reading exception from server: " + e.getMessage()); } } } }
Source:
<code>private void terminatedPodsInMainThread(List<KubernetesPod> pods) { getMainThreadExecutor().execute(() -> { for (KubernetesPod pod : pods) { if (pod.isTerminated()) { final String podName = pod.getName(); log.info("TaskManager pod is terminated.", podName); final CompletableFuture<KubernetesWorkerNode> requestResourceFuture = requestResourceFutures.remove(podName); if (requestResourceFuture != null) { log.warn("Pod is terminated before receiving the ADDED event.", podName); requestResourceFuture.completeExceptionally(new FlinkException("Pod is terminated.")); } <START> getResourceEventHandler().onWorkerTerminated(new ResourceID(podName)); <END> removePod(podName); } } }); }</code><technical_language>Do need call closeTaskManagerConnection in ActiveResourceManager#onWorkerTerminated</technical_language>

Target:
private void terminatedPodsInMainThread(List<KubernetesPod> pods) { getMainThreadExecutor().execute(() -> { for (KubernetesPod pod : pods) { if (pod.isTerminated()) { final String podName = pod.getName(); log.info("TaskManager pod is terminated.", podName); final CompletableFuture<KubernetesWorkerNode> requestResourceFuture = requestResourceFutures.remove(podName); if (requestResourceFuture != null) { log.warn("Pod is terminated before receiving the ADDED event.", podName); requestResourceFuture.completeExceptionally(new FlinkException("Pod is terminated.")); } getResourceEventHandler().onWorkerTerminated(new ResourceID(podName)); stopPod(podName); } } }); }
Source:
<code>public boolean contains(Object o) { <START> Map.Entry entry = toEntry(o); <END> if (entry != null) { V value = remoteCache.get(entry.getKey()); return value != null && value.equals(entry.getValue()); } return false; }</code><technical_language>do a single if if (!(o instanceof Map.Entry)) return false;</technical_language>

Target:
public boolean contains(Object o) { if (!(o instanceof Map.Entry)) { return false; } Map.Entry<K, V> entry = (Map.Entry<K, V>) o; V value = remoteCache.get(entry.getKey()); return value != null && value.equals(entry.getValue()); }
Source:
<code>public void setup() throws Exception { when(metadata.getDefinitionSetId()).thenReturn(DEF_SET_ID); when(metadata.getProfileId()).thenReturn(DEFAULT_PROFILE.getProfileId()); when(domainProfile.getProfileId()).thenReturn(PROFILE_DOMAIN_ID); Predicate<String> domainProfileFilter = DEF1::equals; when(domainProfile.definitionAllowedFilter()).thenReturn(domainProfileFilter); when(definitionManager.definitionSets()).thenReturn(definitionSets); when(definitionSets.getDefinitionSetById(eq(DEF_SET_ID))).thenReturn(definitionSet); <START> when(definitionManager.adapters()).thenReturn(adapterManager); <END> when(adapterManager.forDefinitionSet()).thenReturn(definitionSetAdapter); when(definitionSetAdapter.getDefinitions(eq(definitionSet))) .thenReturn(Arrays.asList(DEF1, DEF2).stream().collect(Collectors.toSet())); when(profileManager.getProfile(eq(DEF_SET_ID), eq(DEFAULT_PROFILE.getProfileId()))) .thenReturn(DEFAULT_PROFILE); when(profileManager.getProfile(eq(DEF_SET_ID), eq(PROFILE_DOMAIN_ID))) .thenReturn(domainProfile); tested = new DomainProfileManager(definitionManager, profileManager, DEFAULT_PROFILE); }</code><technical_language>simplified to: Stream.of(DEF1, DEF2).collect(Collectors.toSet())</technical_language>

Target:
public void setup() throws Exception { when(metadata.getDefinitionSetId()).thenReturn(DEF_SET_ID); when(metadata.getProfileId()).thenReturn(DEFAULT_PROFILE.getProfileId()); when(domainProfile.getProfileId()).thenReturn(PROFILE_DOMAIN_ID); Predicate<String> domainProfileFilter = DEF1::equals; when(domainProfile.definitionAllowedFilter()).thenReturn(domainProfileFilter); when(definitionManager.definitionSets()).thenReturn(definitionSets); when(definitionSets.getDefinitionSetById(eq(DEF_SET_ID))).thenReturn(definitionSet); when(definitionManager.adapters()).thenReturn(adapterManager); when(adapterManager.forDefinitionSet()).thenReturn(definitionSetAdapter); when(definitionSetAdapter.getDefinitions(eq(definitionSet))) .thenReturn(Stream.of(DEF1, DEF2).collect(Collectors.toSet())); when(profileManager.getProfile(eq(DEF_SET_ID), eq(DEFAULT_PROFILE.getProfileId()))) .thenReturn(DEFAULT_PROFILE); when(profileManager.getProfile(eq(DEF_SET_ID), eq(PROFILE_DOMAIN_ID))) .thenReturn(domainProfile); tested = new DomainProfileManager(definitionManager, profileManager, DEFAULT_PROFILE); }
Source:
<code>private String getDemoCourseIdRoot(String instructorEmail) { final String[] splitedEmail = instructorEmail.split("@"); <START> final String head = splitedEmail[0].replaceAll(FieldValidator.REGEX_COURSE_ID_ILLEGAL, "_"); <END> final String emailAbbreviation = splitedEmail[1].substring(0, 3); return head + "." + emailAbbreviation + "-demo"; }</code><technical_language>I feel safer small snippets abstracted a utility method e.g. StringHelper unit tested</technical_language>

Target:
private String getDemoCourseIdRoot(String instructorEmail) { String[] emailSplit = instructorEmail.split("@"); String username = emailSplit[0]; String host = emailSplit[1]; String head = StringHelper.replaceIllegalChars(username, FieldValidator.REGEX_COURSE_ID, '_'); String hostAbbreviation = host.substring(0, 3); return head + "." + hostAbbreviation + "-demo"; }
Source:
<code>public void emit() { String hrefOrHashName = group(1); if (!hrefOrHashName.contains("#")) { hrefOrHashName = "#" + hrefOrHashName; } else if (hrefOrHashName.charAt(hrefOrHashName.length() - 1) == '#') { hrefOrHashName = hrefOrHashName.substring(0, hrefOrHashName.length() - 1); } StringBuilder sb = new StringBuilder(); if <START> (group(2) != <END> null) { sb.append(group(2).substring(offsetGroup2).trim()); } else { sb.append("["); String text = group(1); int hashPosition = text.indexOf("#"); if (hashPosition > 0) { int extStart = text.substring(0, hashPosition).lastIndexOf("."); if (extStart > 0) { sb.append(text.substring(0, extStart)); } else { sb.append(text.substring(0, hashPosition)); } if (hashPosition != text.length() - 1) { sb.append(text.substring(hashPosition)); } } else { sb.append(text); } sb.append("]"); } builder.link(hrefOrHashName, sb.toString()); }</code><technical_language>consider extracting 2 a constant a name is</technical_language>

Target:
public void emit() { final String linkTarget = group(1); final String linkText = group(2); String hrefOrHashName = linkTarget; if (!hrefOrHashName.contains("#")) { hrefOrHashName = "#" + hrefOrHashName; } else if (hrefOrHashName.charAt(hrefOrHashName.length() - 1) == '#') { hrefOrHashName = hrefOrHashName.substring(0, hrefOrHashName.length() - 1); } StringBuilder sb = new StringBuilder(); if (linkText != null && linkText.length() > linkTextOffset) { sb.append(linkText.substring(linkTextOffset).trim()); } else { sb.append("["); String text = linkTarget; int hashPosition = text.indexOf("#"); if (hashPosition > 0) { int extStart = text.substring(0, hashPosition).lastIndexOf("."); if (extStart > 0) { sb.append(text.substring(0, extStart)); } else { sb.append(text.substring(0, hashPosition)); } if (hashPosition != text.length() - 1) { sb.append(text.substring(hashPosition)); } } else { sb.append(text); } sb.append("]"); } builder.link(hrefOrHashName, sb.toString()); }
Source:
<code>public void testOnlyEnvScriptContainsAPIBinding() throws InvalidScriptException { Script s = scriptWithApiBindingUser(); FlowScript fs = flowScriptWithoutApiBinding(); Script s2 = scriptWithoutApiBinding(); Mockito.when(it.getPreScript()).thenReturn(s2); Mockito.when(it.getPostScript()).thenReturn(s2); Mockito.when(sec.getScript()).thenReturn(s2); Mockito.when(fe.getEnvScript()).thenReturn(s); Mockito.when(it.getFlowScript()).thenReturn(fs); Boolean result = new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd); <START> assertEquals(true, result); <END> }</code><technical_language>assertEquals is relevant</technical_language>

Target:
public void testOnlyEnvScriptContainsAPIBinding() throws InvalidScriptException { Script s = scriptWithApiBindingUser(); FlowScript fs = flowScriptWithoutApiBinding(); Script s2 = scriptWithoutApiBinding(); Mockito.when(it.getPreScript()).thenReturn(s2); Mockito.when(it.getPostScript()).thenReturn(s2); Mockito.when(sec.getScript()).thenReturn(s2); Mockito.when(fe.getEnvScript()).thenReturn(s); Mockito.when(it.getFlowScript()).thenReturn(fs); assertTrue(new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd)); }
Source:
<code>public void onCompleted(Exception e) { synchronized (listeners) { for (RestRequestInfoEventListener listener : listeners) { <START> listener.onCompleted(this, e); <END> } } }</code><technical_language>this need synchronized</technical_language>

Target:
public void onCompleted(Exception e) { synchronized (listeners) { handlingException = e; if (operationComplete.compareAndSet(false, true)) { for (RestRequestInfoEventListener listener : listeners) { listener.onCompleted(this, e); } } } }
Source:
<code>private void postNicInit() { initSelectedType(); getName().setEntity(getNic().getName()); initMAC(); initLinked(); initProfiles(); getPlugged().setEntity(getNic().isPlugged()); <START> if (!hotPlugSupported) { <END> getPlugged().setChangeProhibitionReason(ConstantsManager.getInstance() .getMessages() .hotPlugNotSupported(getClusterCompatibilityVersion().toString())); } getPlugged().setIsChangable(allowHotPlug()); initCommands(); }</code><technical_language>change this allowPlug() well</technical_language>

Target:
private void postNicInit() { initSelectedType(); getName().setEntity(getNic().getName()); initMAC(); initLinked(); initProfiles(); getPlugged().setEntity(getNic().isPlugged()); if (!hotPlugSupported) { getPlugged().setChangeProhibitionReason(ConstantsManager.getInstance() .getMessages() .hotPlugNotSupported(getClusterCompatibilityVersion().toString())); } getPlugged().setIsChangable(allowPlug()); initCommands(); }
Source:
<code>public UserRole[] getAllowedRoles() { <START> return new UserRole[] { UserRole.MANAGER, UserRole.STUDY_PROGRAMME_LEADER, UserRole.ADMINISTRATOR }; <END> }</code><technical_language>limited UserRole.ADMINISTRATOR, in case</technical_language>

Target:
public UserRole[] getAllowedRoles() { return new UserRole[] { UserRole.ADMINISTRATOR }; }
Source:
<code>public void run() { try { SessionState ss = new SessionState(db.getConf()); ss.setIsHiveServerQuery(true); SessionState.start(ss); if (initialized.get()) { for (Table mvTable : db.getAllMaterializedViewObjectsForRewriting()) { RelOptMaterialization existingMV = getRewritingMaterializedView(mvTable.getDbName(), mvTable.getTableName()); if (existingMV != null) { <START> Table existingMVTable = extractTable(existingMV); <END> if (existingMVTable.getCreateTime() < mvTable.getCreateTime() || (existingMVTable.getCreateTime() == mvTable.getCreateTime() && existingMVTable.getCreationMetadata().getMaterializationTime() <= mvTable.getCreationMetadata().getMaterializationTime())) { refreshMaterializedView(db.getConf(), existingMVTable, mvTable); } } else { refreshMaterializedView(db.getConf(), null, mvTable); } } LOG.info("Materialized views registry has been refreshed"); } else { for (Table mvTable : db.getAllMaterializedViewObjectsForRewriting()) { refreshMaterializedView(db.getConf(), null, mvTable); } initialized.set(true); LOG.info("Materialized views registry has been initialized"); } } catch (HiveException e) { if (initialized.get()) { LOG.error("Problem connecting to the metastore when refreshing the view registry", e); } else { LOG.error("Problem connecting to the metastore when initializing the view registry", e); } } }</code><technical_language>I suggest add a info/perf LOG mark beginning of refresh/initialization. LOG is finished give idea long this initialization/refresh spent. This potentially debug issues related performance in future</technical_language>

Target:
public void run() { SessionState ss = new SessionState(db.getConf()); ss.setIsHiveServerQuery(true); SessionState.start(ss); PerfLogger perfLogger = SessionState.getPerfLogger(); perfLogger.PerfLogBegin(CLASS_NAME, PerfLogger.MATERIALIZED_VIEWS_REGISTRY_REFRESH); try { if (initialized.get()) { for (Table mvTable : db.getAllMaterializedViewObjectsForRewriting()) { RelOptMaterialization existingMV = getRewritingMaterializedView(mvTable.getDbName(), mvTable.getTableName()); if (existingMV != null) { Table existingMVTable = extractTable(existingMV); if (existingMVTable.getCreateTime() < mvTable.getCreateTime() || (existingMVTable.getCreateTime() == mvTable.getCreateTime() && existingMVTable.getCreationMetadata().getMaterializationTime() <= mvTable.getCreationMetadata().getMaterializationTime())) { refreshMaterializedView(db.getConf(), existingMVTable, mvTable); } } else { refreshMaterializedView(db.getConf(), null, mvTable); } } LOG.info("Materialized views registry has been refreshed"); } else { for (Table mvTable : db.getAllMaterializedViewObjectsForRewriting()) { refreshMaterializedView(db.getConf(), null, mvTable); } initialized.set(true); LOG.info("Materialized views registry has been initialized"); } } catch (HiveException e) { if (initialized.get()) { LOG.error("Problem connecting to the metastore when refreshing the view registry", e); } else { LOG.error("Problem connecting to the metastore when initializing the view registry", e); } } perfLogger.PerfLogEnd(CLASS_NAME, PerfLogger.MATERIALIZED_VIEWS_REGISTRY_REFRESH); }
Source:
<code>public final Observable<T> doOnCompleted(final Action0 onCompleted) { Action1<T> onNext = Actions.empty(); Action1<Throwable> onError = Actions.empty(); <START> Observer<T> observer = new ActionSubscriber<T>(onNext, onError, onCompleted); <END> return create(new OnSubscribeDoOnEach<T>(this, observer)); }</code><technical_language>ActionObserver</technical_language>

Target:
public final Observable<T> doOnCompleted(final Action0 onCompleted) { Action1<T> onNext = Actions.empty(); Action1<Throwable> onError = Actions.empty(); Observer<T> observer = new ActionObserver<T>(onNext, onError, onCompleted); return create(new OnSubscribeDoOnEach<T>(this, observer)); }
Source:
<code>public void visit(MetricsVisitor visitor) { <START> updateGaugeValues(); <END> visitor.gauge(this); }</code><technical_language>This updates gauges of gauge is visited. override getValue() instead, calculate percentile for gauge currently visited</technical_language>

Target:
public void visit(MetricsVisitor visitor) { updateGaugeValues(percentile); visitor.gauge(this); }
Source:
<code>private void performDiskUpdate(final boolean unlockImage) { final Disk disk = getDiskDao().get(getParameters().getDiskId()); applyUserChanges(disk); TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { @Override public Object runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); updateDeviceProperties(); getBaseDiskDao().update(disk); if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) disk; diskImage.setQuotaId(getQuotaId()); <START> diskImage.setDiskProfileId(((DiskImage) getNewDisk()).getDiskProfileId()); <END> if (unlockImage && diskImage.getImageStatus() == ImageStatus.LOCKED) { diskImage.setImageStatus(ImageStatus.OK); } getImageDao().update(diskImage.getImage()); updateQuota(diskImage); updateDiskProfile(diskImage); } reloadDisks(); updateBootOrder(); setSucceeded(true); return null; } private void updateDeviceProperties() { if (updateReadOnlyRequested()) { vmDeviceForVm.setIsReadOnly(getNewDisk().getReadOnly()); getVmDeviceDao().update(vmDeviceForVm); } if (getOldDisk().getDiskInterface() != getNewDisk().getDiskInterface()) { getVmDeviceDao().clearDeviceAddress(getOldDisk().getId()); } } }); }</code><technical_language>this move applyUserChanges method</technical_language>

Target:
private void performDiskUpdate(final boolean unlockImage) { final Disk disk = getDiskDao().get(getParameters().getDiskId()); applyUserChanges(disk); TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { @Override public Object runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); updateDeviceProperties(); getBaseDiskDao().update(disk); if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) disk; diskImage.setQuotaId(getQuotaId()); if (unlockImage && diskImage.getImageStatus() == ImageStatus.LOCKED) { diskImage.setImageStatus(ImageStatus.OK); } getImageDao().update(diskImage.getImage()); updateQuota(diskImage); updateDiskProfile(diskImage); } reloadDisks(); updateBootOrder(); setSucceeded(true); return null; } private void updateDeviceProperties() { if (updateReadOnlyRequested()) { vmDeviceForVm.setIsReadOnly(getNewDisk().getReadOnly()); getVmDeviceDao().update(vmDeviceForVm); } if (getOldDisk().getDiskInterface() != getNewDisk().getDiskInterface()) { getVmDeviceDao().clearDeviceAddress(getOldDisk().getId()); } } }); }
Source:
<code>private void applyCloseSentTimeout(ChannelHandlerContext ctx) { if (closeSent.isDone() || forceCloseTimeoutMillis < 0) { return; } final ScheduledFuture<?> timeoutTask = ctx.executor().schedule(new Runnable() { @Override public void run() { <START> closeSent.tryFailure(new WebSocketHandshakeException("send close frame timed out")); <END> } }, forceCloseTimeoutMillis, TimeUnit.MILLISECONDS); closeSent.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) { timeoutTask.cancel(false); } }); }</code><technical_language>nit: check if (!closeSend.isDone()... reduce overhead in case is a race</technical_language>

Target:
private void applyCloseSentTimeout(ChannelHandlerContext ctx) { if (closeSent.isDone() || forceCloseTimeoutMillis < 0) { return; } final ScheduledFuture<?> timeoutTask = ctx.executor().schedule(new Runnable() { @Override public void run() { if (!closeSent.isDone()) { closeSent.tryFailure(new WebSocketHandshakeException("send close frame timed out")); } } }, forceCloseTimeoutMillis, TimeUnit.MILLISECONDS); closeSent.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) { timeoutTask.cancel(false); } }); }
Source:
<code>public void updateByUser(final Version version) { reference = version.reference; hidden = version.hidden; <START> if (!isDirtyBit()) { <END> setDirtyBit(false); } }</code><technical_language>discussed, default of false set JPA (and in migration support production) a <LINK_0></technical_language>

Target:
public void updateByUser(final Version version) { reference = version.reference; hidden = version.hidden; }
Source:
<code>protected boolean requiresRuntime(OperationContext context) { <START> return super.requiresRuntime(context) || context.getRunningMode() == RunningMode.ADMIN_ONLY; <END> }</code><technical_language>I return true for: * For a normal server - ok * For admin-only server -not ok * For a HC subsystem in normal mode - ok * For a HC subsystem in admin-only mode - ok * For a <profile>s subsystem in admin-only mode - OK return false for a <profile>s subsystem in normal mode, is ok</technical_language>

Target:
protected boolean requiresRuntime(OperationContext context) { return super.requiresRuntime(context) || context.getProcessType().isServer(); }
Source:
<code>static int findEndPosition(int startPosition, int endPosition, BiFunction<Integer, Integer, Boolean> comparator) { <START> checkArgument(startPosition >= 0, "startPosition must be greater or equal than zero: %d", startPosition); <END> checkArgument(endPosition > 0, "endPosition must be greater than zero: %d", endPosition); checkArgument(startPosition < endPosition, "startPosition must be less than endPosition: %d < %d", startPosition, endPosition); for (int first = startPosition, second = startPosition + 1; second < endPosition; first++, second++) { if (!comparator.apply(first, second)) { return second; } } return endPosition; }</code><technical_language>Preconditions is full string formatting -- allows %s</technical_language>

Target:
static int findEndPosition(int startPosition, int endPosition, BiFunction<Integer, Integer, Boolean> comparator) { checkArgument(startPosition >= 0, "startPosition must be greater or equal than zero: %d", startPosition); checkArgument(endPosition > 0, "endPosition must be greater than zero: %d", endPosition); checkArgument(startPosition < endPosition, "startPosition must be less than endPosition: %d < %d", startPosition, endPosition); int left = startPosition; int right = endPosition - 1; for (int i = 0; i < endPosition - startPosition; i++) { int distance = right - left; if (distance == 0) { return right + 1; } if (distance == 1) { if (comparator.apply(left, right)) { return right + 1; } else { return right; } } int mid = left + distance / 2; if (comparator.apply(left, mid)) { left = mid; } else { right = mid; } } for (int first = startPosition; first < endPosition; first++) { boolean previousPairsWereEqual = true; for (int second = first + 1; second < endPosition; second++) { boolean currentPairIsEqual = comparator.apply(first, second); if (!currentPairIsEqual) { previousPairsWereEqual = false; } if (currentPairIsEqual && !previousPairsWereEqual) { throw new IllegalArgumentException("The input is not sorted"); } } } throw new IllegalArgumentException("failed to find a group ending"); }
Source:
<code>static <T> Stringifier<T> getStringifier(Type typeOfT) { checkNotNull(typeOfT); final Optional<Stringifier<T>> stringifierOptional = getInstance().get(typeOfT); if (stringifierOptional.isPresent()) { final Stringifier<T> stringifier = stringifierOptional.get(); return stringifier; } if (typeOfT instanceof Class) { <START> final Class<?> aClass = (Class)typeOfT; <END> final boolean isMessage = Message.class.isAssignableFrom(aClass); if(isMessage) { return (Stringifier<T>) Stringifiers.defaultStringifier((Class<Message>) typeOfT); } } final String errMsg = format("No stringifier registered for the type: %s", typeOfT); throw new MissingStringifierException(errMsg); }</code><technical_language>isMessage check some utility class. Please check existing utility classes in spine-core</technical_language>

Target:
static <T> Stringifier<T> getStringifier(Type typeOfT) { checkNotNull(typeOfT); final Optional<Stringifier<T>> stringifierOptional = getInstance().get(typeOfT); if (stringifierOptional.isPresent()) { final Stringifier<T> stringifier = stringifierOptional.get(); return stringifier; } if (isMessage(typeOfT)) { return getDefaultStringifier(typeOfT); } final String errMsg = format("No stringifier registered for the type: %s", typeOfT); throw new MissingStringifierException(errMsg); }
Source:
<code>protected List<MethodMatcher> getMethodInvocationMatchers() { return Arrays.asList( MethodMatcher.create().typeDefinition("org.apache.http.message.AbstractHttpMessage").name("setHeader").withAnyParameters(), <START> MethodMatcher.create().typeDefinition("java.net.URLConnection").name("setRequestProperty").withAnyParameters() <END> ); }</code><technical_language>consider 2 methods for check: org.apache.http.message.AbstractHttpMessage#addHeader(String,String) java.net.URLConnection#addRequestProperty(String,String) Eventually, this constructor new org.apache.http.message.BasicHeader("Authorization", "Basic abc")</technical_language>

Target:
protected List<MethodMatcher> getMethodInvocationMatchers() { return Arrays.asList( MethodMatcher.create().typeDefinition("org.apache.http.message.AbstractHttpMessage").name("setHeader").withAnyParameters(), MethodMatcher.create().typeDefinition("org.apache.http.message.AbstractHttpMessage").name("addHeader").addParameter(LANG_STRING).addParameter(LANG_STRING), MethodMatcher.create().typeDefinition("org.apache.http.message.BasicHeader").name("<init>").addParameter(LANG_STRING).addParameter(LANG_STRING), MethodMatcher.create().typeDefinition("java.net.URLConnection").name("setRequestProperty").withAnyParameters(), MethodMatcher.create().typeDefinition("java.net.URLConnection").name("addRequestProperty").withAnyParameters() ); }
Source:
<code><START> @Override public void onPause() { <END> super.onPause(); mShouldRefreshNotifications = true; }</code><technical_language>add a newline here, @Override</technical_language>

Target:
public void onPause() { super.onPause(); mShouldRefreshNotifications = true; }
Source:
<code>public synchronized void modified(Map<String, Object> config) { String primaryAddressConf = (String) config.get(PRIMARY_ADDRESS); if (primaryAddressConf == null || primaryAddressConf.isEmpty() || !isValidIPConfig(primaryAddressConf)) { primaryAddress = getFirstLocalIPv4Address(); } else { primaryAddress = primaryAddressConf; } String broadcastAddressConf = (String) config.get(BROADCAST_ADDRESS); if (broadcastAddressConf == null || broadcastAddressConf.isEmpty() || !isValidIPConfig(broadcastAddressConf)) { configuredBroadcastAddress = getPrimaryBroadcastAddress(); } else { configuredBroadcastAddress = broadcastAddressConf; } <START> scheduleToPollNI(config); <END> }</code><technical_language>a matter of taste, I name method abbreviations: scheduleNetworkInterfacePolling</technical_language>

Target:
public synchronized void modified(Map<String, Object> config) { String primaryAddressConf = (String) config.get(PRIMARY_ADDRESS); if (primaryAddressConf == null || primaryAddressConf.isEmpty() || !isValidIPConfig(primaryAddressConf)) { primaryAddress = getFirstLocalIPv4Address(); } else { primaryAddress = primaryAddressConf; } String broadcastAddressConf = (String) config.get(BROADCAST_ADDRESS); if (broadcastAddressConf == null || broadcastAddressConf.isEmpty() || !isValidIPConfig(broadcastAddressConf)) { configuredBroadcastAddress = getPrimaryBroadcastAddress(); } else { configuredBroadcastAddress = broadcastAddressConf; } Object pollIntervalSecondsObj = null; int pollIntervalSeconds = POLL_INTERVAL_SECONDS; try { pollIntervalSecondsObj = config.get(POLL_INTERVAL); if (pollIntervalSecondsObj != null) { pollIntervalSeconds = Integer.parseInt(pollIntervalSecondsObj.toString()); } } catch (NumberFormatException e) { LOGGER.warn("Cannot parse value from key {}, will use default {}", pollIntervalSecondsObj, POLL_INTERVAL, pollIntervalSeconds); } scheduleToPollNetworkInterface(pollIntervalSeconds); }
Source:
<code>protected float getLayerHardness(BlockPos targetPos, BlockRailBase.EnumRailDirection dir) { float hardness = layerAction(targetPos, dir, 0F, this::getBlockHardness, (s, r) -> s + r); hardness *= HARDNESS_MULTIPLIER; ItemStack boreSlot = getStackInSlot(0); if (boreSlot != null && boreSlot.getItem() instanceof IBoreHead) { IBoreHead head = (IBoreHead) boreSlot.getItem(); float dig = 2f - head.getDigModifier(); hardness *= dig; <START> hardness /= (1 + EnchantmentHelper.getEnchantmentLevel(Enchantments.EFFICIENCY, boreSlot)); <END> } hardness /= RailcraftConfig.boreMiningSpeedMultiplier(); return hardness; }</code><technical_language>I match this algorithm numbers posted. Level 1 cuts time in get diminishing returns there</technical_language>

Target:
protected float getLayerHardness(BlockPos targetPos, BlockRailBase.EnumRailDirection dir) { float hardness = layerAction(targetPos, dir, 0F, this::getBlockHardness, (s, r) -> s + r); hardness *= HARDNESS_MULTIPLIER; ItemStack boreSlot = getStackInSlot(0); if (!InvTools.isEmpty(boreSlot) && boreSlot.getItem() instanceof IBoreHead) { IBoreHead head = (IBoreHead) boreSlot.getItem(); float dig = 2f - head.getDigModifier(); hardness *= dig; int e = EnchantmentHelper.getEnchantmentLevel(Enchantments.EFFICIENCY, boreSlot); hardness /= e * e * 0.2 + 1; } hardness /= RailcraftConfig.boreMiningSpeedMultiplier(); return hardness; }
Source:
<code>public void unregisterAll() { List<AppRegistration> appRegistrations = appRegistryService.findAll(); for (AppRegistration appRegistration : appRegistrations) { String applicationName = appRegistration.getName(); String applicationVersion = appRegistration.getVersion(); ApplicationType applicationType = appRegistration.getType(); if (applicationType != ApplicationType.task) { String streamWithApp = findStreamContainingAppOf(applicationType, applicationName, applicationVersion); <START> if (streamWithApp != null) { <END> throw new UnregisterAppException(String.format("The app [%s:%s:%s] you're trying to unregister is " + "currently used in stream '%s'.", applicationName, applicationType, applicationVersion, streamWithApp)); } } } appRegistryService.deleteAll(); }</code><technical_language>OK exiting exception unregistering other apps used? If so, change exception message unregister done. or, possibly deleteAll(Iterable) method AppRegistrationRepository delete apps used</technical_language>

Target:
public void unregisterAll() { List<AppRegistration> appRegistrations = appRegistryService.findAll(); List<AppRegistration> appRegistrationsToUnregister = new ArrayList<>(); for (AppRegistration appRegistration : appRegistrations) { String applicationName = appRegistration.getName(); String applicationVersion = appRegistration.getVersion(); ApplicationType applicationType = appRegistration.getType(); if (applicationType != ApplicationType.task) { String streamWithApp = findStreamContainingAppOf(applicationType, applicationName, applicationVersion); if (streamWithApp == null) { appRegistrationsToUnregister.add(appRegistration); } } else { appRegistrationsToUnregister.add(appRegistration); } } if (!appRegistrationsToUnregister.isEmpty()) { appRegistryService.deleteAll(appRegistrationsToUnregister); } }
Source:
<code>public void setContext(String context){ <START> typingRule.setContext(BloodTestContext.valueOf(context.replaceAll("\\s","").toUpperCase(Locale.FRENCH))); <END> }</code><technical_language>Is a reason for Locale.FRENCH? Also, is needed remove spaces? do a trim(), removing spaces words</technical_language>

Target:
public void setContext(String context){ typingRule.setContext(BloodTestContext.valueOf(context.replaceAll("\\s","").toUpperCase())); }
Source:
<code>private void testCreatePartitionedBucketedTableAsFewRows(Session session, HiveStorageFormat storageFormat) { String tableName = "test_create_partitioned_bucketed_table_as_few_rows"; @Language("SQL") String createTable = "" + "CREATE TABLE " + tableName + " " + "WITH (" + "format = '" + storageFormat + "', " + "partitioned_by = ARRAY[ 'partition_key' ], " + "bucketed_by = ARRAY[ 'bucket_key' ], " + "bucket_count = 11 " + ") " + "AS " + "SELECT * " + "FROM (" + "VALUES " + " (VARCHAR 'a', VARCHAR 'b', VARCHAR 'c'), " + " ('aa', 'bb', 'cc'), " + " ('aaa', 'bbb', 'ccc')" + ") t(bucket_key, col, partition_key)"; assertUpdate( getParallelWriteSession(), createTable, 3); verifyPartitionedBucketedTableAsFewRows(storageFormat, tableName); try { assertUpdate(session, "INSERT INTO " + tableName + " VALUES ('a0', 'b0', 'c')", 1); fail("expected failure"); <START> } <END> catch (Exception e) { assertEquals( e.getMessage(), getExpectedErrorMessageForInsertExistingBucketedTable( HiveSessionProperties.getInsertExistingPartitionsBehavior(session.toConnectorSession(new ConnectorId(session.getCatalog().get()))), "partition_key=c")); } assertUpdate(session, "DROP TABLE " + tableName); assertFalse(getQueryRunner().tableExists(session, tableName)); }</code><technical_language>While refactoring this, update assertThatThrownBy() <LINK_0></technical_language>

Target:
private void testCreatePartitionedBucketedTableAsFewRows(Session session, HiveStorageFormat storageFormat) { String tableName = "test_create_partitioned_bucketed_table_as_few_rows"; @Language("SQL") String createTable = "" + "CREATE TABLE " + tableName + " " + "WITH (" + "format = '" + storageFormat + "', " + "partitioned_by = ARRAY[ 'partition_key' ], " + "bucketed_by = ARRAY[ 'bucket_key' ], " + "bucket_count = 11 " + ") " + "AS " + "SELECT * " + "FROM (" + "VALUES " + " (VARCHAR 'a', VARCHAR 'b', VARCHAR 'c'), " + " ('aa', 'bb', 'cc'), " + " ('aaa', 'bbb', 'ccc')" + ") t(bucket_key, col, partition_key)"; assertUpdate( getParallelWriteSession(), createTable, 3); verifyPartitionedBucketedTableAsFewRows(storageFormat, tableName); assertThatThrownBy(() -> assertUpdate(session, "INSERT INTO " + tableName + " VALUES ('a0', 'b0', 'c')", 1)) .hasMessage(getExpectedErrorMessageForInsertExistingBucketedTable( getInsertExistingPartitionsBehavior(getConnectorSession(session)), "partition_key=c")); assertUpdate(session, "DROP TABLE " + tableName); assertFalse(getQueryRunner().tableExists(session, tableName)); }
Source:
<code>protected void setBooleanValue(final EObjectObservableValue element, final Object value) { if (value instanceof Collection<?>) { element.setValue(value); } else { if (null == value) { <START> return; <END> } else if (value.equals(0)) { if (element.getValue().toString().equals(booleanProposals[0])) { return; } element.setValue(Boolean.valueOf(booleanProposals[0])); } else if (value.equals(1)) { if (element.getValue().toString().equals(booleanProposals[1])) { return; } element.setValue(Boolean.valueOf(booleanProposals[1])); } else { Activator.log.error("Impossible to set boolean value " + value, null); } } }</code><technical_language>Wht add a return</technical_language>

Target:
protected void setBooleanValue(final EObjectObservableValue element, final Object value) { if (value instanceof Collection<?>) { element.setValue(value); } else { if (null == value) { } else if (value.equals(0)) { if (!element.getValue().toString().equals(this.booleanProposals[0])) { element.setValue(Boolean.valueOf(this.booleanProposals[0])); } } else if (value.equals(1)) { if (!element.getValue().toString().equals(this.booleanProposals[1])) { element.setValue(Boolean.valueOf(this.booleanProposals[1])); } } else { Activator.log.error("Impossible to set boolean value " + value, null); } } }
Source:
<code>protected Image(String id, Date creationTimestamp, URI selfLink, String name, String description, String sourceType, URI preferredKernel, RawDisk rawDisk, Deprecated deprecated) { super(Kind.IMAGE, id, creationTimestamp, selfLink, name, description); this.sourceType = checkNotNull(sourceType, "sourceType of %s", name); this.preferredKernel = fromNullable(preferredKernel); this.rawDisk = checkNotNull(rawDisk, "rawDisk of %s", name); this.deprecated = fromNullable(deprecated); <START> ; <END> }</code><technical_language>Remove</technical_language>

Target:
protected Image(String id, Date creationTimestamp, URI selfLink, String name, String description, String sourceType, URI preferredKernel, RawDisk rawDisk, Deprecated deprecated) { super(Kind.IMAGE, id, creationTimestamp, selfLink, name, description); this.sourceType = checkNotNull(sourceType, "sourceType of %s", name); this.preferredKernel = fromNullable(preferredKernel); this.rawDisk = checkNotNull(rawDisk, "rawDisk of %s", name); this.deprecated = fromNullable(deprecated); }
Source:
<code>public String requestToken() { RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(url, new String[0])); builder.header(HttpHeaders.CONTENT_TYPE, HttpMediaType.APPLICATION_FORM_URLENCODED); builder.header(HttpHeaders.AUTHORIZATION, DEFAULT_AUTHORIZATION); FormBody formBody = new FormBody.Builder() <START> .add("grant_type", "urn:ibm:params:oauth:grant-type:apikey") <END> .add("apikey", apiKey) .add("response_type", "cloud_iam") .build(); builder.body(formBody); tokenData = callIamApi(builder.build()); return tokenData.getAccessToken(); }</code><technical_language>strings constants</technical_language>

Target:
private String requestToken() { RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(url, new String[0])); builder.header(HttpHeaders.CONTENT_TYPE, HttpMediaType.APPLICATION_FORM_URLENCODED); builder.header(HttpHeaders.AUTHORIZATION, DEFAULT_AUTHORIZATION); FormBody formBody = new FormBody.Builder() .add(GRANT_TYPE, REQUEST_GRANT_TYPE) .add(API_KEY, apiKey) .add(RESPONSE_TYPE, CLOUD_IAM) .build(); builder.body(formBody); tokenData = callIamApi(builder.build()); return tokenData.getAccessToken(); }
Source:
<code>private boolean isPartOfGroup(Object object, final Iterable<? extends Diff> differences) { final Predicate<? super EObject> isPartOfTree = new Predicate<EObject>() { public boolean apply(EObject input) { <START> return Iterables.contains(filter(differences, not(or(fViewerFilter.getPredicates()))), input); <END> } }; boolean ret = false; if (object instanceof Match) { ret = Iterables.any(((Match)object).getAllDifferences(), isPartOfTree); } else if (object instanceof Diff) { if (!isPartOfTree.apply((Diff)object)) { if (object instanceof ReferenceChange && ((ReferenceChange)object).getReference().isContainment()) { ret = Iterables.any(((Diff)object).getMatch().getComparison().getMatch( ((ReferenceChange)object).getValue()).getAllDifferences(), isPartOfTree); } } else { ret = true; } } return ret; }</code><technical_language>of this is done, apply filter "differences" iterable passed this method. "differences" filtered arrived here. Change "filteredElements(Iterable, Iterable)" apply filter (as a side note, "or" is useless) : List<? extends Diff> filteredDiffs = new ArrayList(filter(differences, not(fViewerFilter.getPredicates()))); pass this list "isPartOfGroup"</technical_language>

Target:
private boolean isPartOfGroup(Object object, final Iterable<? extends Diff> differences) { final Predicate<? super EObject> isPartOfTree = new Predicate<EObject>() { public boolean apply(EObject input) { return Iterables.contains(differences, input); } }; boolean ret = false; if (object instanceof Match) { ret = Iterables.any(((Match)object).getAllDifferences(), isPartOfTree); } else if (object instanceof Diff) { if (!isPartOfTree.apply((Diff)object)) { if (object instanceof ReferenceChange && ((ReferenceChange)object).getReference().isContainment()) { ret = Iterables.any(((Diff)object).getMatch().getComparison().getMatch( ((ReferenceChange)object).getValue()).getAllDifferences(), isPartOfTree); } } else { ret = true; } } return ret; }
Source:
<code>public boolean applyCSSProperty(Object element, String property, CSSValue value, String pseudo, CSSEngine engine) throws Exception { <START> boolean applied = true; <END> if ("background".equals(property)) { applyCSSPropertyBackground(element, value, pseudo, engine); } else if ("background-attachment".equals(property)) { applyCSSPropertyBackgroundAttachment(element, value, pseudo, engine); }else if ("background-color".equals(property)) { applyCSSPropertyBackgroundColor(element, value, pseudo, engine); }else if ("background-image".equals(property)) { applyCSSPropertyBackgroundImage(element, value, pseudo, engine); }else if ("background-position".equals(property)) { applyCSSPropertyBackgroundPosition(element, value, pseudo, engine); }else if ("background-repeat".equals(property)) { applyCSSPropertyBackgroundRepeat(element, value, pseudo, engine); } else { applied = false; } return applied; }</code><technical_language>a variable is needed</technical_language>

Target:
public boolean applyCSSProperty(Object element, String property, CSSValue value, String pseudo, CSSEngine engine) throws Exception { if (property == null) { return false; } switch (property) { case "background": applyCSSPropertyBackground(element, value, pseudo, engine); break; case "background-attachment": applyCSSPropertyBackgroundAttachment(element, value, pseudo, engine); break; case "background-color": applyCSSPropertyBackgroundColor(element, value, pseudo, engine); break; case "background-image": applyCSSPropertyBackgroundImage(element, value, pseudo, engine); break; case "background-position": applyCSSPropertyBackgroundPosition(element, value, pseudo, engine); break; case "background-repeat": applyCSSPropertyBackgroundRepeat(element, value, pseudo, engine); break; default: return false; } return true; }
Source:
<code><START> public void testLoadYamlFileFromDirectory() { <END> final DirectoryYamlFlowLoader loader = new DirectoryYamlFlowLoader(new Props()); loader.loadProjectFlow(this.project, ExecutionsTestUtil.getFlowDir(YAML_FILE_NAME)); Assert.assertEquals(0, loader.getErrors().size()); Assert.assertEquals(1, this.project.getFlowMap().size()); Assert.assertTrue(this.project.getFlowMap().containsKey(FLOW_NAME)); final Flow flow = this.project.getFlowMap().get(FLOW_NAME); final AzkabanFlow azkabanFlow = flow.getAzkabanFlow(); Assert.assertEquals(FLOW_NAME, azkabanFlow.getName()); }</code><technical_language>is named testLoadYamlFileFromDirectory ? include .flow files in directory</technical_language>

Target:
public void testLoadYamlFileFromDirectory() { final DirectoryYamlFlowLoader loader = new DirectoryYamlFlowLoader(new Props()); loader.loadProjectFlow(this.project, ExecutionsTestUtil.getFlowDir(BASIC_FLOW_YAML_DIR)); Assert.assertEquals(0, loader.getErrors().size()); Assert.assertEquals(1, loader.getFlowMap().size()); Assert.assertTrue(loader.getFlowMap().containsKey(FLOW_NAME_1)); final Flow flow = loader.getFlowMap().get(FLOW_NAME_1); final AzkabanFlow azkabanFlow = flow.getAzkabanFlow(); Assert.assertEquals(FLOW_NAME_1, azkabanFlow.getName()); Assert.assertEquals(4, azkabanFlow.getNodes().size()); }