auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@Test public void testMySqlCastToVarcharWithLessThanMaxPrecision() { final String query = "select cast(\"product_id\" as varchar(50)), \"product_id\" " + "from \"product\" "; final String expected = "SELECT CAST(`product_id` AS CHAR(50)), `product_id`\n" + "FROM `foodmart`.`product`"; <START> sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); <END> }</code><technical_language>dialect(mySqlDialect(NullCollation.HIGH)), is withMysql() sufficient</technical_language>

Target:
@Test public void testMySqlCastToVarcharWithLessThanMaxPrecision() { final String query = "select cast(\"product_id\" as varchar(50)), \"product_id\" " + "from \"product\" "; final String expected = "SELECT CAST(`product_id` AS CHAR(50)), `product_id`\n" + "FROM `foodmart`.`product`"; sql(query).withMysql().ok(expected); }
Source:
<code>protected void openIntentChooser() throws ActivityNotFoundException { Intent chooser; IntentSender intentSender = null; <START> if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP_MR1) { <END> intentSender = TargetChosenReceiver.getSharingSenderIntent(this.reactContext); chooser = Intent.createChooser(this.getIntent(), this.chooserTitle, intentSender); } else { chooser = Intent.createChooser(this.getIntent(), this.chooserTitle); } chooser.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); if (ShareIntent.hasValidKey("showAppsToView", options) && ShareIntent.hasValidKey("url", options)) { Intent viewIntent = new Intent(Intent.ACTION_VIEW); viewIntent.setType(this.fileShare.getType()); Intent[] viewIntents = this.getIntentsToViewFile(viewIntent, this.fileShare.getURI()); chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, viewIntents); } this.reactContext.getCurrentActivity().startActivityForResult(chooser, RNShareModule.SHARE_REQUEST_CODE); if (intentSender == null) { TargetChosenReceiver.sendCallback(true, true, "OK"); } }</code><technical_language>static isSupported() method . TargetChosenReceiver avoid propagating build versions</technical_language>

Target:
protected void openIntentChooser() throws ActivityNotFoundException { Activity activity = this.reactContext.getCurrentActivity(); if (activity == null) { TargetChosenReceiver.sendCallback(false, "Something went wrong"); return; } Intent chooser; IntentSender intentSender = null; if (TargetChosenReceiver.isSupported()) { intentSender = TargetChosenReceiver.getSharingSenderIntent(this.reactContext); chooser = Intent.createChooser(this.getIntent(), this.chooserTitle, intentSender); } else { chooser = Intent.createChooser(this.getIntent(), this.chooserTitle); } chooser.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); if (ShareIntent.hasValidKey("showAppsToView", options) && ShareIntent.hasValidKey("url", options)) { Intent viewIntent = new Intent(Intent.ACTION_VIEW); viewIntent.setType(this.fileShare.getType()); Intent[] viewIntents = this.getIntentsToViewFile(viewIntent, this.fileShare.getURI()); chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, viewIntents); } activity.startActivityForResult(chooser, RNShareModule.SHARE_REQUEST_CODE); if (intentSender == null) { TargetChosenReceiver.sendCallback(true, true, "OK"); } }
Source:
<code>private Map<Guid, GlusterAsyncTask> updateTasksInCluster(final VDSGroup cluster) { if (!supportsGlusterAsyncTasksFeature(cluster)) { return null; } Map<Guid, GlusterAsyncTask> runningTasks = getProvider().getTaskListForCluster(cluster.getId()); if (runningTasks == null) { return null; } for (Entry<Guid, GlusterAsyncTask> entry : runningTasks.entrySet()) { Guid taskId = entry.getKey(); final GlusterAsyncTask task = entry.getValue(); List<Step> steps = getStepDao().getStepsByExternalId(taskId); GlusterVolumeEntity volume = getVolumeDao().getVolumeByGlusterTask(taskId); if (steps.isEmpty()) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { try { createJobToMonitor(cluster, task); } catch (VdcBLLException e) { log.error("Error creating job for task from CLI", e); } return null; } }); } for (Step step: steps) { if (step.getEndTime() != null) { continue; } JobExecutionStatus oldStatus = step.getStatus(); step.setDescription(getTaskMessage(cluster, step.getStepType(), task)); step.setStatus(task.getStatus()); <START> if(JobExecutionStatus.FINISHED == task.getStatus()) { <END> if(oldStatus != task.getStatus()) { logMessage(volume.getClusterId(), volume, taskTypeStrMap.get(task.getType()), task.getStatus().name().toLowerCase(), taskTypeAuditMsg.get(task.getType())); } } if (hasTaskCompleted(task)) { step.markStepEnded(task.getStatus()); endStepJob(step); releaseVolumeLock(task.getTaskId()); } else { getJobRepository().updateStep(step); } } } return runningTasks; }</code><technical_language>if task is completed return status other finished? move logging hasTaskCompleted block</technical_language>

Target:
private Map<Guid, GlusterAsyncTask> updateTasksInCluster(final VDSGroup cluster) { if (!supportsGlusterAsyncTasksFeature(cluster)) { return null; } Map<Guid, GlusterAsyncTask> runningTasks = getProvider().getTaskListForCluster(cluster.getId()); if (runningTasks == null) { return null; } for (Entry<Guid, GlusterAsyncTask> entry : runningTasks.entrySet()) { Guid taskId = entry.getKey(); final GlusterAsyncTask task = entry.getValue(); List<Step> steps = getStepDao().getStepsByExternalId(taskId); if (steps.isEmpty()) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { try { createJobToMonitor(cluster, task); } catch (VdcBLLException e) { log.error("Error creating job for task from CLI", e); } return null; } }); } for (Step step: steps) { if (step.getEndTime() != null) { continue; } JobExecutionStatus oldStatus = step.getStatus(); step.setDescription(getTaskMessage(cluster, step.getStepType(), task)); step.setStatus(task.getStatus()); eventMessageLogger(task, oldStatus, cluster); if (hasTaskCompleted(task)) { step.markStepEnded(task.getStatus()); endStepJob(step); releaseVolumeLock(task.getTaskId()); } else { getJobRepository().updateStep(step); } } } return runningTasks; }
Source:
<code><START> synchronized void setPresenceStatus(String statusMsg) <END> { if (statusMsg.equals(jvbParticipantStatus)) { return; } if (mucRoom != null) { OperationSetJitsiMeetTools jitsiMeetTools = xmppProvider.getOperationSet( OperationSetJitsiMeetTools.class); jitsiMeetTools.setPresenceStatus(mucRoom, statusMsg); jvbParticipantStatus = statusMsg; } }</code><technical_language>wondering if synchronized cover if condition state modification. I suppose jitsiMeetTools.setPresenceStatus( send changes in order proper synchronization. This is in context of knowing sending XMPP update block for a while NO-OP threads(statusMsg.equals(jvbParticipantStatus)) wait for finish. This is I mean: synchronized(this) { if (statusMsg.equals(jvbParticipantStatus)) { return; } jvbParticipantStatus = statusMsg; } if (mucRoom != null) { // Send presence status update OperationSetJitsiMeetTools jitsiMeetTools = xmppProvider.getOperationSet( OperationSetJitsiMeetTools.class); jitsiMeetTools.setPresenceStatus(mucRoom, statusMsg); }</technical_language>

Target:
void setPresenceStatus(String statusMsg) { synchronized(statusSync) { if (statusMsg.equals(jvbParticipantStatus)) { return; } jvbParticipantStatus = statusMsg; } if (mucRoom != null) { OperationSetJitsiMeetTools jitsiMeetTools = xmppProvider.getOperationSet( OperationSetJitsiMeetTools.class); jitsiMeetTools.setPresenceStatus(mucRoom, statusMsg); } }
Source:
<code>public void onMessageReceived(String from, Bundle extras) { Log.d(LOG_TAG, "onMessage - from: " + from); if (extras != null) { Context applicationContext = getApplicationContext(); SharedPreferences prefs = applicationContext.getSharedPreferences(PushPlugin.COM_ADOBE_PHONEGAP_PUSH, Context.MODE_PRIVATE); boolean forceShow = prefs.getBoolean(FORCE_SHOW, false); boolean clearBadge = prefs.getBoolean(CLEAR_BADGE, false); <START> String messageKey = prefs.getString(MESSAGE_KEY, ""); <END> String titleKey = prefs.getString(TITLE_KEY, ""); extras = normalizeExtras(applicationContext, extras, messageKey, titleKey); if (clearBadge) { PushPlugin.setApplicationIconBadgeNumber(getApplicationContext(), 0); } if (!forceShow && PushPlugin.isInForeground()) { Log.d(LOG_TAG, "foreground"); extras.putBoolean(FOREGROUND, true); extras.putBoolean(COLDSTART, false); PushPlugin.sendExtras(extras); } else if (forceShow && PushPlugin.isInForeground()) { Log.d(LOG_TAG, "foreground force"); extras.putBoolean(FOREGROUND, true); extras.putBoolean(COLDSTART, false); showNotificationIfPossible(applicationContext, extras); } else { Log.d(LOG_TAG, "background"); extras.putBoolean(FOREGROUND, false); extras.putBoolean(COLDSTART, PushPlugin.isActive()); showNotificationIfPossible(applicationContext, extras); } } }</code><technical_language>default MESSAGE String messageKey = prefs.getString(MESSAGE_KEY, MESSAGE);</technical_language>

Target:
public void onMessageReceived(String from, Bundle extras) { Log.d(LOG_TAG, "onMessage - from: " + from); if (extras != null) { Context applicationContext = getApplicationContext(); SharedPreferences prefs = applicationContext.getSharedPreferences(PushPlugin.COM_ADOBE_PHONEGAP_PUSH, Context.MODE_PRIVATE); boolean forceShow = prefs.getBoolean(FORCE_SHOW, false); boolean clearBadge = prefs.getBoolean(CLEAR_BADGE, false); String messageKey = prefs.getString(MESSAGE_KEY, MESSAGE); String titleKey = prefs.getString(TITLE_KEY, TITLE); extras = normalizeExtras(applicationContext, extras, messageKey, titleKey); if (clearBadge) { PushPlugin.setApplicationIconBadgeNumber(getApplicationContext(), 0); } if (!forceShow && PushPlugin.isInForeground()) { Log.d(LOG_TAG, "foreground"); extras.putBoolean(FOREGROUND, true); extras.putBoolean(COLDSTART, false); PushPlugin.sendExtras(extras); } else if (forceShow && PushPlugin.isInForeground()) { Log.d(LOG_TAG, "foreground force"); extras.putBoolean(FOREGROUND, true); extras.putBoolean(COLDSTART, false); showNotificationIfPossible(applicationContext, extras); } else { Log.d(LOG_TAG, "background"); extras.putBoolean(FOREGROUND, false); extras.putBoolean(COLDSTART, PushPlugin.isActive()); showNotificationIfPossible(applicationContext, extras); } } }
Source:
<code>public synchronized void unbuffer() { closeCurrentBlockReaders(); if (curStripeBuf != null) { <START> curStripeBuf.clear(); <END> BUFFER_POOL.putBuffer(curStripeBuf); curStripeBuf = null; } if (parityBuf != null) { parityBuf.clear(); BUFFER_POOL.putBuffer(parityBuf); parityBuf = null; } }</code><technical_language>a minor issue. this curStripeBuf.clear() step in unbuffer method? time is in Line #127-129</technical_language>

Target:
public synchronized void unbuffer() { super.unbuffer(); if (curStripeBuf != null) { BUFFER_POOL.putBuffer(curStripeBuf); curStripeBuf = null; } if (parityBuf != null) { BUFFER_POOL.putBuffer(parityBuf); parityBuf = null; } }
Source:
<code>public Tuple transformPayload(Map<Object, Object> map) { List<String> newNames = new ArrayList<String>(); List<Object> newValues = new ArrayList<Object>(); <START> for (Object name : map.keySet()) { <END> newNames.add(name.toString()); } for (Object value : map.values()) { newValues.add(value); } return TupleBuilder.tuple().ofNamesAndValues(newNames, newValues); }</code><technical_language>2 for loops replaced a single entryset iteration</technical_language>

Target:
public Tuple transformPayload(Map<Object, Object> map) { List<String> newNames = new ArrayList<String>(); List<Object> newValues = new ArrayList<Object>(); for (Map.Entry<Object, Object> entry: map.entrySet()) { newNames.add(entry.getKey().toString()); newValues.add(entry.getValue()); } return TupleBuilder.tuple().ofNamesAndValues(newNames, newValues); }
Source:
<code>public void setSeverity(String severity) { <START> if(severity == null || (!severity.equals("fatal") && !severity.equals("error") && !severity.equals("warning") && !severity.equals("info"))) { <END> this.severity = "error"; } else { this.severity = severity; } }</code><technical_language>java ALLOWED_SEVERITIES = new String[] {"fatal", "error", "warning", "info"}; if(severity == null || !Arrays.asList(ALLOWED_SEVERITIES).contains(severity)) { // ... }</technical_language>

Target:
private void setSeverity(String severity) { if(severity == null || !ALLOWED_SEVERITIES.contains(severity)) { this.severity = "error"; } else { this.severity = severity; } }
Source:
<code>private void plugDiskToVmIfNeeded() { if (Boolean.TRUE.equals(getParameters().getPlugDiskToVm()) && getVm() != null && <START> (getVm().getStatus() == VMStatus.Paused || getVm().getStatus() == VMStatus.Up)) { <END> VmDiskOperationParameterBase params = new VmDiskOperationParameterBase(new DiskVmElement(getParameters().getDiskInfo().getId(), getVmId())); params.setShouldBeLogged(false); ActionReturnValue returnValue = runInternalAction(ActionType.HotPlugDiskToVm, params); if (!returnValue.getSucceeded()) { auditLogDirector.log(this, AuditLogType.USER_FAILED_HOTPLUG_DISK); } } }</code><technical_language>Consider use: getVm().getStatus().isUpOrPaused() Please add a log</technical_language>

Target:
private void plugDiskToVmIfNeeded() { if (Boolean.TRUE.equals(getParameters().getPlugDiskToVm()) && getVm() != null && isVmUpOrPaused()) { VmDiskOperationParameterBase params = new VmDiskOperationParameterBase(new DiskVmElement(getParameters().getDiskInfo().getId(), getVmId())); params.setShouldBeLogged(false); ActionReturnValue returnValue = runInternalAction(ActionType.HotPlugDiskToVm, params); if (!returnValue.getSucceeded()) { auditLogDirector.log(this, AuditLogType.USER_FAILED_HOTPLUG_DISK); } } if (!isVmUpOrPaused()) { log.warn("Disk id- '{}' wasn't plug to VM- '{}' because the VM status is- '{}'", getParameters().getDiskInfo().getId(), getVmId(), getVm().getStatus()); } }
Source:
<code>public static List<String> allKeyNames(Propagation<String> propagation) { if (propagation == null) throw new NullPointerException("propagation == null"); TraceContextOrSamplingFlags emptyExtraction = propagation.extractor((c, k) -> null).extract(Boolean.TRUE); List<String> baggageKeyNames = ExtraBaggageContext.getAllKeyNames(emptyExtraction); if (baggageKeyNames.isEmpty()) return propagation.keys(); <START> List<String> result = new ArrayList<>(propagation.keys()); <END> result.addAll(baggageKeyNames); return Collections.unmodifiableList(result); }</code><technical_language>a tiny bit more performant presize instead of precopy java List<String> result = new ArrayList<>(propagation.keys().size()+ baggageKeyNames.size()); result.addAll(propataion.keys(); result.addAll(baggageKeyNames); return unmodifiable(result);</technical_language>

Target:
public static List<String> allKeyNames(Propagation<String> propagation) { if (propagation == null) throw new NullPointerException("propagation == null"); TraceContextOrSamplingFlags emptyExtraction = propagation.extractor((c, k) -> null).extract(Boolean.TRUE); List<String> baggageKeyNames = ExtraBaggageContext.getAllKeyNames(emptyExtraction); if (baggageKeyNames.isEmpty()) return propagation.keys(); List<String> result = new ArrayList<>(propagation.keys().size() + baggageKeyNames.size()); result.addAll(propagation.keys()); result.addAll(baggageKeyNames); return Collections.unmodifiableList(result); }
Source:
<code>public void deploy(DeploymentPhaseContext context) throws DeploymentUnitProcessingException { DeploymentUnit unit = context.getDeploymentUnit(); if (unit.getParent() == null) { SingletonPolicy policy = context.getAttachment(POLICY_KEY); if (policy != null) { CapabilityServiceSupport support = unit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); if (unit.putAttachment(Attachments.DEPLOYMENT_UNIT_PHASE_BUILDER, new SingletonDeploymentUnitPhaseBuilder(support, policy)) == null) { SingletonLogger.ROOT_LOGGER.singletonDeploymentDetected(policy); ServiceController<?> controller = context.getServiceRegistry().getRequiredService(unit.getServiceName()); <START> controller.addListener(new LifecycleListener() { <END> @Override public void handleEvent(ServiceController<?> controller, LifecycleEvent event) { if(event.equals(LifecycleEvent.DOWN)) { controller.setMode(Mode.ACTIVE); controller.removeListener(this); } } }); controller.setMode(Mode.NEVER); } } } }</code><technical_language>extra careful metaspace usage, please modify this SingletonDeploymentProcessor implements LifecycleListener, registration becomes: controller.addListener(this);</technical_language>

Target:
public void deploy(DeploymentPhaseContext context) throws DeploymentUnitProcessingException { DeploymentUnit unit = context.getDeploymentUnit(); if (unit.getParent() == null) { SingletonPolicy policy = context.getAttachment(POLICY_KEY); if (policy != null) { CapabilityServiceSupport support = unit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); if (unit.putAttachment(Attachments.DEPLOYMENT_UNIT_PHASE_BUILDER, new SingletonDeploymentUnitPhaseBuilder(support, policy)) == null) { SingletonLogger.ROOT_LOGGER.singletonDeploymentDetected(policy); ServiceController<?> controller = context.getServiceRegistry().getRequiredService(unit.getServiceName()); controller.addListener(this); controller.setMode(Mode.NEVER); } } } }
Source:
<code>protected void updateActionBarTitleAndHomeButton(OCFile chosenFile) { if (chosenFile == null) { chosenFile = getFile(); } super.updateActionBarTitleAndHomeButton(chosenFile); <START> if(chosenFile.getRemotePath().equals("/") && mOnlyAvailableOffline) { <END> updateActionBarTitleAndHomeButtonByString( getResources().getString(R.string.drawer_item_only_available_offline)); } }</code><technical_language>ROOT_PATH instead of "/" OCFile.java</technical_language>

Target:
protected void updateActionBarTitleAndHomeButton(OCFile chosenFile) { if (chosenFile == null) { chosenFile = getFile(); } super.updateActionBarTitleAndHomeButton(chosenFile); if(chosenFile.getRemotePath().equals(OCFile.ROOT_PATH) && mOnlyAvailableOffline) { updateActionBarTitleAndHomeButtonByString( getResources().getString(R.string.drawer_item_only_available_offline)); } }
Source:
<code>public void <START> test285130_bulkThreadCreation() <END> throws Exception { AtomicInteger threadCount = new AtomicInteger(); IDebugEventSetListener debugListener = events -> { for (DebugEvent event : events) { if (event.getKind() == DebugEvent.CREATE && event.getSource() instanceof JDIThread) { JDIThread thread = (JDIThread) event.getSource(); try { if (thread.getName().startsWith("bulk-")) { threadCount.incrementAndGet(); } } catch (DebugException e) { } } } }; Map<AbstractDispatchJob, Object> jobs = Collections.synchronizedMap(new IdentityHashMap<AbstractDispatchJob, Object>()); JobChangeAdapter jobListener = new JobChangeAdapter() { @Override public void aboutToRun(IJobChangeEvent event) { Job job = event.getJob(); if (job instanceof AbstractDispatchJob) { jobs.put((AbstractDispatchJob) job, Boolean.TRUE); } } }; DebugPlugin.getDefault().addDebugEventListener(debugListener); Job.getJobManager().addJobChangeListener(jobListener); try { createLineBreakpoint(24, "BulkThreadCreationTest"); launchToBreakpoint("BulkThreadCreationTest"); } finally { removeAllBreakpoints(); DebugPlugin.getDefault().removeDebugEventListener(debugListener); Job.getJobManager().removeJobChangeListener(jobListener); } assertEquals(1000, threadCount.get()); assertEquals(1, jobs.size()); }</code><technical_language>test for a single job dispatching, a dedicated test conditional evaluation in dfferent jobs</technical_language>

Target:
public void test285130_bulkThreadCreation() throws Exception { AtomicInteger threadCount = new AtomicInteger(); IDebugEventSetListener debugListener = events -> { for (DebugEvent event : events) { if (event.getKind() == DebugEvent.CREATE && event.getSource() instanceof JDIThread) { JDIThread thread = (JDIThread) event.getSource(); try { if (thread.getName().startsWith("bulk-")) { threadCount.incrementAndGet(); } } catch (DebugException e) { } } } }; try { createLineBreakpoint(24, "BulkThreadCreationTest"); launchToBreakpoint("BulkThreadCreationTest"); } finally { removeAllBreakpoints(); DebugPlugin.getDefault().removeDebugEventListener(debugListener); } assertEquals(1000, threadCount.get()); assertEquals(1, jobs.size()); }
Source:
<code>protected void doInit() { BeanFactory beanFactory = getBeanFactory(); if (this.gatherChannel == null) { this.gatherChannel = new FixedSubscriberChannel(this.gatherer); } else { if (this.gatherChannel instanceof SubscribableChannel) { this.gatherEndpoint = new EventDrivenConsumer((SubscribableChannel) this.gatherChannel, this.gatherer); } else if (this.gatherChannel instanceof PollableChannel) { this.gatherEndpoint = new PollingConsumer((PollableChannel) this.gatherChannel, this.gatherer); ((PollingConsumer) this.gatherEndpoint).setReceiveTimeout(this.gatherTimeout); } else if (this.gatherChannel instanceof ReactiveStreamsSubscribableChannel) { this.gatherEndpoint = new ReactiveStreamsConsumer(this.gatherChannel, this.gatherer); } else { throw new BeanInitializationException("Unsupported 'replyChannel' type '" + this.gatherChannel.getClass() + "'. " + "'SubscribableChannel', 'PollableChannel' or 'ReactiveStreamsSubscribableChannel' " + "types are supported."); } this.gatherEndpoint.setBeanFactory(beanFactory); this.gatherEndpoint.afterPropertiesSet(); } ((MessageProducer) this.gatherer) .setOutputChannel(new FixedSubscriberChannel(message -> { MessageHeaders headers = message.getHeaders(); MessageChannel gatherResultChannel = headers.get(GATHER_RESULT_CHANNEL, MessageChannel.class); if (gatherResultChannel != null) { this.messagingTemplate.send(gatherResultChannel, message); } else { throw new MessageDeliveryException(message, <START> "The 'gatherResultChannel' header is required to delivery gather result."); <END> } })); }</code><technical_language>s/delivery/deliver the/</technical_language>

Target:
protected void doInit() { BeanFactory beanFactory = getBeanFactory(); if (this.gatherChannel == null) { this.gatherChannel = new FixedSubscriberChannel(this.gatherer); } else { if (this.gatherChannel instanceof SubscribableChannel) { this.gatherEndpoint = new EventDrivenConsumer((SubscribableChannel) this.gatherChannel, this.gatherer); } else if (this.gatherChannel instanceof PollableChannel) { this.gatherEndpoint = new PollingConsumer((PollableChannel) this.gatherChannel, this.gatherer); ((PollingConsumer) this.gatherEndpoint).setReceiveTimeout(this.gatherTimeout); } else if (this.gatherChannel instanceof ReactiveStreamsSubscribableChannel) { this.gatherEndpoint = new ReactiveStreamsConsumer(this.gatherChannel, this.gatherer); } else { throw new BeanInitializationException("Unsupported 'replyChannel' type '" + this.gatherChannel.getClass() + "'. " + "'SubscribableChannel', 'PollableChannel' or 'ReactiveStreamsSubscribableChannel' " + "types are supported."); } this.gatherEndpoint.setBeanFactory(beanFactory); this.gatherEndpoint.afterPropertiesSet(); } ((MessageProducer) this.gatherer) .setOutputChannel(new FixedSubscriberChannel(message -> { MessageHeaders headers = message.getHeaders(); MessageChannel gatherResultChannel = headers.get(GATHER_RESULT_CHANNEL, MessageChannel.class); if (gatherResultChannel != null) { this.messagingTemplate.send(gatherResultChannel, message); } else { throw new MessageDeliveryException(message, "The 'gatherResultChannel' header is required to deliver the gather result."); } })); }
Source:
<code>private Feed getExistingFeed(String provenanceName, String feedName) { if (!provenanceFeeds.containsKey(provenanceName)) { <START> provenanceFeeds.put(provenanceName, new ArrayList<>(alertService.getFeedsByProvenanceName(provenanceName))); <END> } return selectUnique(provenanceFeeds.get(provenanceName), having(on(Feed.class).getName(), equalTo(feedName))); }</code><technical_language>Messes a bit, good if feed name case-insensitive, rest of CsvLookupData</technical_language>

Target:
private Feed getExistingFeed(String provenanceName, String feedName) { if (!provenanceFeedsMap.containsKey(provenanceName)) { provenanceFeedsMap.put(provenanceName, new ArrayList<>(alertService.getFeedsByProvenanceName(provenanceName))); } return selectUnique(provenanceFeedsMap.get(provenanceName), having(on(Feed.class).getName(), equalToIgnoringCase(feedName))); }
Source:
<code>public boolean addConstituent( final StoreKey repository ) { if ( repository == null ) { return false; } if ( constituents == null ) { constituents = new LinkedList<>(); } synchronized ( monitor ) { if ( constituents.contains( repository ) ) { return false; } if ( repository.getType() == StoreType.hosted ) { <START> ( (LinkedList<StoreKey>) constituents ).push( repository ); <END> return true; } else { return constituents.add( repository ); } } }</code><technical_language>Is LinkedList.push(..) ArrayList.add(0,..)? LinkedList performance implications for iterating items in list</technical_language>

Target:
public boolean addConstituent( final StoreKey repository ) { if ( repository == null ) { return false; } synchronized ( constituents ) { if ( constituents.contains( repository ) ) { return false; } if ( isPrependConstituent() ) { constituents.add( 0, repository ); return true; } else { return constituents.add( repository ); } } }
Source:
<code>public SinkRuntimeProvider getSinkRuntimeProvider(Context context) { DataStructureConverter converter = context.createDataStructureConverter(schema.toPhysicalRowDataType()); if (isInsertOnly) { if (runtimeSink.equals("SinkFunction")) { return SinkFunctionProvider.of( new AppendingSinkFunction( tableName, converter)); } else if (runtimeSink.equals("OutputFormat")) { return OutputFormatProvider.of( new AppendingOutputFormat( tableName, converter)); } else { throw new IllegalArgumentException("Unsupported runtime sink class: " + runtimeSink); } } else { assert runtimeSink.equals("SinkFunction"); SinkFunction<RowData> sinkFunction; if (schema.getPrimaryKey().isPresent()) { List<String> fieldNames = Arrays.asList(schema.getFieldNames()); int[] keyIndices = schema.getPrimaryKey().get().getColumns().stream() .mapToInt(fieldNames::indexOf) <START> .toArray(); <END> sinkFunction = new KeyedUpsertingSinkFunction( tableName, converter, keyIndices); } else { sinkFunction = new RetractingSinkFunction( tableName, converter); } return SinkFunctionProvider.of(sinkFunction); } }</code><technical_language>extract keyIndices logic table schema, i upsert sink re-use that</technical_language>

Target:
public SinkRuntimeProvider getSinkRuntimeProvider(Context context) { DataStructureConverter converter = context.createDataStructureConverter(schema.toPhysicalRowDataType()); if (isInsertOnly) { if (runtimeSink.equals("SinkFunction")) { return SinkFunctionProvider.of( new AppendingSinkFunction( tableName, converter)); } else if (runtimeSink.equals("OutputFormat")) { return OutputFormatProvider.of( new AppendingOutputFormat( tableName, converter)); } else { throw new IllegalArgumentException("Unsupported runtime sink class: " + runtimeSink); } } else { assert runtimeSink.equals("SinkFunction"); SinkFunction<RowData> sinkFunction; if (schema.getPrimaryKey().isPresent()) { int[] keyIndices = TableSchemaUtils.getPrimaryKeyIndices(schema); sinkFunction = new KeyedUpsertingSinkFunction( tableName, converter, keyIndices); } else { sinkFunction = new RetractingSinkFunction( tableName, converter); } return SinkFunctionProvider.of(sinkFunction); } }
Source:
<code>public static boolean bindProperties(CamelContext camelContext, Object target, Map<String, Object> properties, String optionPrefix, boolean nesting, boolean deepNesting, boolean fluentBuilder, boolean reference, boolean placeholder) { org.apache.camel.util.ObjectHelper.notNull(camelContext, "camelContext"); org.apache.camel.util.ObjectHelper.notNull(target, "target"); org.apache.camel.util.ObjectHelper.notNull(properties, "properties"); boolean rc = false; setReferenceProperties(camelContext, target, properties); for (Iterator<Map.Entry<String, Object>> iter = properties.entrySet().iterator(); iter.hasNext();) { Map.Entry<String, Object> entry = iter.next(); String key = entry.getKey(); Object value = entry.getValue(); if (isNotEmpty(optionPrefix)) { if (!key.startsWith(optionPrefix)) { <START> return false; <END> } key = key.substring(optionPrefix.length()); } if (entry != null) { if (bindProperty(camelContext, target, key, value, nesting, deepNesting, fluentBuilder, reference, placeholder)) { iter.remove(); rc = true; } } } return rc; }</code><technical_language>I this is wrong, skip keys prefix, return</technical_language>

Target:
public static boolean bindProperties(CamelContext camelContext, Object target, Map<String, Object> properties, String optionPrefix, boolean nesting, boolean deepNesting, boolean fluentBuilder, boolean reference, boolean placeholder) { org.apache.camel.util.ObjectHelper.notNull(camelContext, "camelContext"); org.apache.camel.util.ObjectHelper.notNull(target, "target"); org.apache.camel.util.ObjectHelper.notNull(properties, "properties"); boolean rc = false; setReferenceProperties(camelContext, target, properties); for (Iterator<Map.Entry<String, Object>> iter = properties.entrySet().iterator(); iter.hasNext();) { Map.Entry<String, Object> entry = iter.next(); String key = entry.getKey(); Object value = entry.getValue(); if (isNotEmpty(optionPrefix)) { if (!key.startsWith(optionPrefix)) { continue; } key = key.substring(optionPrefix.length()); } if (entry != null) { if (bindProperty(camelContext, target, key, value, nesting, deepNesting, fluentBuilder, reference, placeholder)) { iter.remove(); rc = true; } } } return rc; }
Source:
<code>private PasswordAuthentication createPasswordAuthentication() { <START> if (! (Strings.isNullOrEmpty(getProxyUserSystemProperty()) <END> || Strings.isNullOrEmpty(getProxyPasswordSystemProperty()))) { return new PasswordAuthentication(getProxyUserSystemProperty(), getProxyPasswordSystemProperty().toCharArray()); } else { return null; } }</code><technical_language>Please static import of isNullOrEmpty</technical_language>

Target:
private PasswordAuthentication createPasswordAuthentication() { if (! (isNullOrEmpty(getProxyUserSystemProperty()) || isNullOrEmpty(getProxyPasswordSystemProperty()))) { return new PasswordAuthentication(getProxyUserSystemProperty(), getProxyPasswordSystemProperty().toCharArray()); } else { return null; } }
Source:
<code>public ObjectName createName(String type, String domain, String name) { try { MetaData metaData; <START> metaData = metaDataMap.get(name); <END> Map<String, String> tags = metaData.getTags(); Hashtable<String, String> table = new Hashtable<>(); table.putAll(tags); ObjectName objectName = new ObjectName(domain, table); return objectName; } catch (MalformedObjectNameException e) { try { return new ObjectName(domain, "name", ObjectName.quote(name)); } catch (MalformedObjectNameException e1) { LOGGER.warn("Unable to register {}", type, name, e1); throw new RuntimeException(e1); } } }</code><technical_language>Combine lines.. next for metaData itself. even.. java Map<String, String> tags = metaDataMap .get(name) .getTags(); do this putAll of this is (I JIT do escape analysis these, still)</technical_language>

Target:
public ObjectName createName(String type, String domain, String name) { try { Hashtable<String, String> table = new Hashtable<>(); table.putAll(metaDataMap.get(name).getTags()); table.replaceAll((k,v) -> needsQuote(v) ? ObjectName.quote(v): v ); return new ObjectName(domain, table); } catch (MalformedObjectNameException e) { LOGGER.warn("Unable to register {" + type + "} {" + name + "}", e); throw new RuntimeException(e); } }
Source:
<code>protected OperationTracker getOperationTracker(PartitionId partitionId) { OperationTracker operationTracker; String trackerType = routerConfig.routerGetOperationTrackerType; if (trackerType.equals(SimpleOperationTracker.class.getCanonicalName())) { operationTracker = new SimpleOperationTracker(routerConfig.routerDatacenterName, partitionId, routerConfig.routerGetCrossDcEnabled, routerConfig.routerGetSuccessTarget, routerConfig.routerGetRequestParallelism); <START> } else if (trackerType.equals(AdaptiveOperationTracker.class.getCanonicalName())) { <END> operationTracker = new AdaptiveOperationTracker(routerConfig.routerDatacenterName, partitionId, routerConfig.routerGetCrossDcEnabled, routerConfig.routerGetSuccessTarget, routerConfig.routerGetRequestParallelism, time, localColoTracker, crossColoTracker, pastDueCounter, routerConfig.routerLatencyToleranceQuantile); } else { throw new IllegalArgumentException("Unrecognized tracker type: " + trackerType); } return operationTracker; }</code><technical_language>class names if is factories? more sense a configuration point of view name "adaptive" "simple"</technical_language>

Target:
protected OperationTracker getOperationTracker(PartitionId partitionId) { OperationTracker operationTracker; String trackerType = routerConfig.routerGetOperationTrackerType; if (trackerType.equals(SimpleOperationTracker.class.getSimpleName())) { operationTracker = new SimpleOperationTracker(routerConfig.routerDatacenterName, partitionId, routerConfig.routerGetCrossDcEnabled, routerConfig.routerGetSuccessTarget, routerConfig.routerGetRequestParallelism); } else if (trackerType.equals(AdaptiveOperationTracker.class.getSimpleName())) { operationTracker = new AdaptiveOperationTracker(routerConfig.routerDatacenterName, partitionId, routerConfig.routerGetCrossDcEnabled, routerConfig.routerGetSuccessTarget, routerConfig.routerGetRequestParallelism, time, localColoTracker, crossColoTracker, pastDueCounter, routerConfig.routerLatencyToleranceQuantile); } else { throw new IllegalArgumentException("Unrecognized tracker type: " + trackerType); } return operationTracker; }
Source:
<code>public void getAllSimilarAttributeNames() throws Exception { System.out.println(CLASS_NAME + "getAllSimilarAttributeNames"); String name = "urn:perun:user:attribute-def:def:login-namespace"; List<String> similarAttrNames = perun.getAttributesManagerBl().getAllSimilarAttributeNames(sess, name); <START> assertTrue("returned less than 0 names",similarAttrNames.size() > 0); <END> }</code><technical_language>suggestion assertTrue("returned names",!similarAttrNames.isEmpty());</technical_language>

Target:
public void getAllSimilarAttributeNames() throws Exception { System.out.println(CLASS_NAME + "getAllSimilarAttributeNames"); String name = "urn:perun:user:attribute-def:def:login-namespace"; List<String> similarAttrNames = perun.getAttributesManagerBl().getAllSimilarAttributeNames(sess, name); assertFalse("returned no names", similarAttrNames.isEmpty()); }
Source:
<code>public void testModeShapeInMemory() throws Exception { Map<String, URL> parameters = new HashMap<String, URL>(); parameters.put(JcrRepositoryFactory.URL, getClass().getClassLoader().getResource("configRepository.json")); RunnerConfiguration runnerConfig = new RunnerConfiguration().addTestsToExclude( <START> TwoWayJoinTestSuite.class.getSimpleName(), <END> ThreeWayJoinTestSuite.class.getSimpleName(), BigFileReadTestSuite.class.getSimpleName(), SmallFileReadTestSuite.class.getSimpleName()); new PerformanceTestSuiteRunner(runnerConfig).runPerformanceTests(parameters, null); }</code><technical_language>Queries supported, join tests fail. binary problem is 2.x</technical_language>

Target:
public void testModeShapeInMemory() throws Exception { Map<String, URL> parameters = new HashMap<String, URL>(); parameters.put(JcrRepositoryFactory.URL, getClass().getClassLoader().getResource("configRepository.json")); performanceTestSuiteRunner.runPerformanceTests(parameters, null); }
Source:
<code>public void onResume() { super.onResume(); <START> launchPull( <END> Session.getCredentials() == null || Session.getCredentials().isDemoCredentials()); }</code><technical_language>null credentials demo credentials is case</technical_language>

Target:
public void onResume() { super.onResume(); if (Session.getCredentials() != null) { launchPull(Session.getCredentials().isDemoCredentials()); } }
Source:
<code>public Object readSqlResultRecord(ResultSet result) { CitationCollectionOrder citationCollectionOrder = null; String collectionId = null; String citationId = null; int location = 0; CitationCollectionOrder.SectionType sectionType = null; String value = null; try { collectionId = result.getString(1); citationId = result.getString(2); location = result.getInt(3); sectionType = CitationCollectionOrder.SectionType.valueOf(result.getString(4)); value = result.getString(5); citationCollectionOrder = new CitationCollectionOrder(collectionId, citationId, location, sectionType, value); } catch (SQLException e) { <START> M_log.debug("TripleReader: problem reading CitationCollectionOrder from result: collectionId(" + collectionId + ") location(" + location <END> + ") sectionType(" + sectionType + ") value(" + value + ")"); return null; } return citationCollectionOrder; }</code><technical_language>log this a warning want production expect happen</technical_language>

Target:
public Object readSqlResultRecord(ResultSet result) { CitationCollectionOrder citationCollectionOrder = null; String collectionId = null; String citationId = null; int location = 0; CitationCollectionOrder.SectionType sectionType = null; String value = null; try { collectionId = result.getString(1); citationId = result.getString(2); location = result.getInt(3); sectionType = CitationCollectionOrder.SectionType.valueOf(result.getString(4)); value = result.getString(5); citationCollectionOrder = new CitationCollectionOrder(collectionId, citationId, location, sectionType, value); } catch (SQLException e) { M_log.warn("TripleReader: problem reading CitationCollectionOrder from result: collectionId(" + collectionId + ") location(" + location + ") sectionType(" + sectionType + ") value(" + value + ")"); return null; } return citationCollectionOrder; }
Source:
<code>private static TextAttributesKey getColor(GoNamedSignatureOwner o) { <START> if (GoPsiImplUtil.isBuiltinFile(o.getContainingFile())) return BUILTIN_FUNCTION; <END> return o.isPublic() ? EXPORTED_FUNCTION : LOCAL_FUNCTION; }</code><technical_language>GoPsiImplUtil#builtin</technical_language>

Target:
private static TextAttributesKey getColor(GoNamedSignatureOwner o) { if (GoPsiImplUtil.builtin(o)) return BUILTIN_FUNCTION; return o.isPublic() ? EXPORTED_FUNCTION : LOCAL_FUNCTION; }
Source:
<code>public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); <START> if (isVisibleToUser) { <END> if (getActivity() != null && getActivity() instanceof SnackbarStatusListener) { if (!NetworkUtil.isConnected(getActivity())) { ((SnackbarStatusListener) getActivity()).resetSnackbarVisibility(authWebView.isShowingError()); } } } }</code><technical_language>if conditions merged 1 if condition</technical_language>

Target:
public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); CourseTabsUtils.setUserVisibleHint(getActivity(), isVisibleToUser, authWebView != null && authWebView.isShowingError()); }
Source:
<code>public void testExactExpirationOnRead() throws Exception { initTest(StateTtlConfig.UpdateType.OnReadAndWrite, StateTtlConfig.StateVisibility.NeverReturnExpired); timeProvider.time = 0; ctx().update(ctx().updateEmpty); takeAndRestoreSnapshot(); timeProvider.time = 50; assertEquals(UNEXPIRED_AVAIL, ctx().getUpdateEmpty, ctx().get()); takeAndRestoreSnapshot(); timeProvider.time = 120; assertEquals("Unexpired state should be available after read", ctx().getUpdateEmpty, ctx().get()); takeAndRestoreSnapshot(); timeProvider.time = 250; assertEquals(EXPIRED_UNAVAIL, ctx().emptyValue, ctx().get()); <START> assertTrue(ctx().isOriginalEmptyValue()); <END> }</code><technical_language>suggestion assertTrue("Original state cleared access", ctx().isOriginalEmptyValue());</technical_language>

Target:
public void testExactExpirationOnRead() throws Exception { initTest(StateTtlConfig.UpdateType.OnReadAndWrite, StateTtlConfig.StateVisibility.NeverReturnExpired); timeProvider.time = 0; ctx().update(ctx().updateEmpty); takeAndRestoreSnapshot(); timeProvider.time = 50; assertEquals(UNEXPIRED_AVAIL, ctx().getUpdateEmpty, ctx().get()); takeAndRestoreSnapshot(); timeProvider.time = 120; assertEquals("Unexpired state should be available after read", ctx().getUpdateEmpty, ctx().get()); takeAndRestoreSnapshot(); timeProvider.time = 250; assertEquals(EXPIRED_UNAVAIL, ctx().emptyValue, ctx().get()); assertTrue("Original state should be cleared on access", ctx().isOriginalEmptyValue()); }
Source:
<code>public void testCreateBaseEntitlementWithInvalidAddOn() throws AccountApiException, EntitlementApiException { final LocalDate initialDate = new LocalDate(2013, 8, 7); clock.setDay(initialDate); final Account account = accountApi.createAccount(getAccountData(7), callContext); final PlanPhaseSpecifier baseSpec = new PlanPhaseSpecifier("Pistol", ProductCategory.BASE, BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, null); final PlanPhaseSpecifier addOnSpec = new PlanPhaseSpecifier("Invalid", ProductCategory.ADD_ON, BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, null); EntitlementSpecifier baseEntitlementSpecifier = new DefaultEntitlementSpecifier("baseExternalKey", baseSpec, null); EntitlementSpecifier addOnEntitlementSpecifier = new DefaultEntitlementSpecifier("addOnExternalKey", addOnSpec, null); final List<EntitlementSpecifier> specifierList = new ArrayList<EntitlementSpecifier>(); specifierList.add(baseEntitlementSpecifier); specifierList.add(addOnEntitlementSpecifier); <START> testListener.pushExpectedEvents(); <END> try { entitlementApi.createBaseEntitlementWithAddOns(account.getId(), specifierList, initialDate, ImmutableList.<PluginProperty>of(), callContext); fail(); } catch (EntitlementApiException e) { assertEquals(e.getMessage(), "Could not find any product named 'Invalid'"); } assertListenerStatus(); final List<Entitlement> allEntitlementsForAccount = entitlementApi.getAllEntitlementsForAccountId(account.getId(), callContext); assertTrue(allEntitlementsForAccount.size() == 0); }</code><technical_language>Unnecessary, event is expected</technical_language>

Target:
public void testCreateBaseEntitlementWithInvalidAddOn() throws AccountApiException, EntitlementApiException { final LocalDate initialDate = new LocalDate(2013, 8, 7); clock.setDay(initialDate); final Account account = accountApi.createAccount(getAccountData(7), callContext); final PlanPhaseSpecifier baseSpec = new PlanPhaseSpecifier("Pistol", ProductCategory.BASE, BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, null); final PlanPhaseSpecifier addOnSpec = new PlanPhaseSpecifier("Invalid", ProductCategory.ADD_ON, BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, null); final String externalKey = "baseExternalKey"; EntitlementSpecifier baseEntitlementSpecifier = new DefaultEntitlementSpecifier(baseSpec, null); EntitlementSpecifier addOnEntitlementSpecifier = new DefaultEntitlementSpecifier(addOnSpec, null); final List<EntitlementSpecifier> specifierList = new ArrayList<EntitlementSpecifier>(); specifierList.add(baseEntitlementSpecifier); specifierList.add(addOnEntitlementSpecifier); try { entitlementApi.createBaseEntitlementWithAddOns(account.getId(), externalKey, specifierList, initialDate, ImmutableList.<PluginProperty>of(), callContext); fail(); } catch (EntitlementApiException e) { assertEquals(e.getMessage(), "Could not find any product named 'Invalid'"); } final List<Entitlement> allEntitlementsForAccount = entitlementApi.getAllEntitlementsForAccountId(account.getId(), callContext); assertTrue(allEntitlementsForAccount.size() == 0); }
Source:
<code>public SearchRefundsResponseFromConnector searchRefunds(Account account, Map<String, String> queryParams) { Response connectorResponse = client .target(connectorUriGenerator.refundsURIWithParams(account, queryParams)) .request() .accept(MediaType.APPLICATION_JSON) .get(); if (connectorResponse.getStatus() == SC_OK) { <START> return connectorResponse.readEntity(SearchRefundsResponseFromConnector.class); <END> } throw new SearchRefundsException(connectorResponse); }</code><technical_language>removed try/catch for ProcessingException here</technical_language>

Target:
public SearchRefundsResponseFromConnector searchRefunds(Account account, Map<String, String> queryParams) { Response connectorResponse = client .target(connectorUriGenerator.refundsURIWithParams(account, queryParams)) .request() .accept(MediaType.APPLICATION_JSON) .get(); if (connectorResponse.getStatus() == SC_OK) { try { return connectorResponse.readEntity(SearchRefundsResponseFromConnector.class); } catch (ProcessingException exception) { throw new SearchRefundsException(exception); } } throw new SearchRefundsException(connectorResponse); }
Source:
<code>public URL getQueueUrl() { try { return new URL(String.format("%s/%s", client.getUrl(), queueName)); } catch (MalformedURLException ex) { logger.error("Queue URL is malformed"); <START> throw logger.logExceptionAsError(new RuntimeException("Queue URL is malformed")); <END> } }</code><technical_language>java logger.error("Queue URL is malformed"); throw logger.logExceptionAsError(new RuntimeException("Queue URL is malformed")); this log twice</technical_language>

Target:
public URL getQueueUrl() { try { return new URL(String.format("%s/%s", client.getUrl(), queueName)); } catch (MalformedURLException ex) { throw logger.logExceptionAsError(new RuntimeException("Queue URL is malformed")); } }
Source:
<code>protected void expand() { int newcapacity = (this.buffer.capacity() + 1) << 1; if (newcapacity < 0) { final int vmBytes = Long.SIZE >> 3; final int javaBytes = 8; @SuppressWarnings("unused") final int headRoom = (vmBytes >= javaBytes) ? vmBytes : javaBytes; newcapacity = Integer.MAX_VALUE - headRoom; <START> if (newcapacity == this.buffer.capacity()) { <END> throw new MessageConstraintException("Maximum buffer size (" + newcapacity + ") exceeded"); } } expandCapacity(newcapacity); }</code><technical_language>@imoldovan-intacct newcapacity >= this.buffer.capacity()</technical_language>

Target:
protected void expand() throws BufferOverflowException { int newcapacity = (this.buffer.capacity() + 1) << 1; if (newcapacity < 0) { final int vmBytes = Long.SIZE >> 3; final int javaBytes = 8; @SuppressWarnings("unused") final int headRoom = (vmBytes >= javaBytes) ? vmBytes : javaBytes; newcapacity = Integer.MAX_VALUE - headRoom; if (newcapacity <= this.buffer.capacity()) { throw new BufferOverflowException(); } } expandCapacity(newcapacity); }
Source:
<code>public void type() { Expression left = mock(Expression.class); <START> when(left.type()).thenReturn(INT); <END> Expression right = mock(Expression.class); when(right.type()).thenReturn(STR); Token and = mock(Token.class); when(and.value()).thenReturn("and"); assertThat(new BinaryExpressionImpl(left, and, right).type()).isEqualTo(or(INT, STR)); Token or = mock(Token.class); when(or.value()).thenReturn("or"); assertThat(new BinaryExpressionImpl(left, or, right).type()).isEqualTo(or(INT, STR)); Token plus = mock(Token.class); when(plus.value()).thenReturn("+"); assertThat(new BinaryExpressionImpl(left, plus, right).type()).isEqualTo(InferredTypes.anyType()); }</code><technical_language>For this kind of test, mocking is parsing python code</technical_language>

Target:
public void type() { assertThat(lastExpression("42 + 43").type()).isEqualTo(INT); assertThat(lastExpression("'foo' + 'bar'").type()).isEqualTo(STR); assertThat(lastExpression("True + False").type()).isEqualTo(InferredTypes.anyType()); assertThat(lastExpression("42 + ''").type()).isEqualTo(InferredTypes.anyType()); assertThat(lastExpression("'' + 42").type()).isEqualTo(InferredTypes.anyType()); assertThat(lastExpression("'' }
Source:
<code>protected boolean runSyncLunsInfoForBlockStorageDomain(Guid storageDomainId, List<LUNs> storageDomainLuns) { return runInternalAction(VdcActionType.SyncLunsInfoForBlockStorageDomain, new SyncLunsInfoForBlockStorageDomainParameters( storageDomainId, <START> VdsCommandsHelper.getHostForExecution(getParameters().getStoragePoolId()), <END> storageDomainLuns)) .getSucceeded(); }</code><technical_language>running VDS DC</technical_language>

Target:
protected boolean runSyncLunsInfoForBlockStorageDomain(Guid storageDomainId, List<LUNs> storageDomainLuns) { return runInternalAction(ActionType.SyncLunsInfoForBlockStorageDomain, new SyncLunsInfoForBlockStorageDomainParameters( storageDomainId, VdsCommandsHelper.getHostForExecution(getParameters().getStoragePoolId()), storageDomainLuns)) .getSucceeded(); }