auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testCreateNewTaskFromLockedTask() { Datastream stream = DatastreamTestUtils.createDatastream("dummy", "dummy", "dummy"); stream.getMetadata().put(DatastreamMetadataConstants.TASK_PREFIX, DatastreamTaskImpl.getTaskPrefix(stream)); DatastreamTaskImpl task = new DatastreamTaskImpl(Collections.singletonList(stream)); ZkAdapter mockZkAdapter = mock(ZkAdapter.class); task.setZkAdapter(mockZkAdapter); DatastreamTaskImpl task0 = new DatastreamTaskImpl(Collections.singletonList(stream)); ZkAdapter mockZkAdapter2 = mock(ZkAdapter.class); task0.setZkAdapter(mockZkAdapter2); when(mockZkAdapter2.checkIsTaskLocked(anyString(), anyString(), anyString())).thenReturn(true); task.addDependency(task0); when(mockZkAdapter.checkIsTaskLocked(anyString(), anyString(), anyString())).thenReturn(true); DatastreamTaskImpl task2 = new DatastreamTaskImpl(task, new ArrayList<>()); Assert.assertEquals(new HashSet<>(task2.getDependencies()), ImmutableSet.of(task.getDatastreamTaskName())); }

Target:
public void testCreateNewTaskFromLockedTask() { Datastream stream = DatastreamTestUtils.createDatastream("dummy", "dummy", "dummy"); stream.getMetadata().put(DatastreamMetadataConstants.TASK_PREFIX, DatastreamTaskImpl.getTaskPrefix(stream)); DatastreamTaskImpl task = new DatastreamTaskImpl(Collections.singletonList(stream)); ZkAdapter mockZkAdapter = mock(ZkAdapter.class); task.setZkAdapter(mockZkAdapter); task.addDependency(createDependencyTask(stream, true)); when(mockZkAdapter.checkIsTaskLocked(anyString(), anyString(), anyString())).thenReturn(true); DatastreamTaskImpl task2 = new DatastreamTaskImpl(task, new ArrayList<>()); Assert.assertEquals(new HashSet<>(task2.getDependencies()), ImmutableSet.of(task.getDatastreamTaskName())); }
Source:
protected void executeCommand() { if (FeatureSupported.liveMerge(getVm().getVdsGroupCompatibilityVersion())) { if (!getVm().isQualifiedForSnapshotMerge()) { log.error("Cannot remove VM snapshot. Vm is not Down, Up or Paused"); throw new VdcBLLException(VdcBllErrors.VM_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE); } } else if (!getVm().isDown()) { log.error("Cannot remove VM snapshot. Vm is not Down and cluster version does not support Live Merge"); throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } final Snapshot snapshot = getSnapshotDao().get(getParameters().getSnapshotId()); boolean snapshotHasImages = hasImages(); boolean removeSnapshotMemory = isMemoryVolumeRemoveable(snapshot.getMemoryVolume()); if (!snapshotHasImages && !removeSnapshotMemory) { getSnapshotDao().remove(getParameters().getSnapshotId()); setSucceeded(true); return; } lockSnapshot(snapshot); freeLock(); getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); if (snapshotHasImages) { removeImages(); if (getSnapshotActionType() == VdcActionType.RemoveSnapshotSingleDiskLive) { setCommandStatus(CommandStatus.ACTIVE_ASYNC); persistCommandWithoutContext(getParameters().getParentCommand(), true); } } if (removeSnapshotMemory) { removeMemory(snapshot); } setSucceeded(true); if (snapshotHasImages) { if (getSnapshotActionType() == VdcActionType.RemoveSnapshotSingleDiskLive) { setCommandStatus(CommandStatus.ACTIVE_ASYNC_EXECUTED); } } }

Target:
protected void executeCommand() { if (FeatureSupported.liveMerge(getVm().getVdsGroupCompatibilityVersion())) { if (!getVm().isQualifiedForSnapshotMerge()) { log.error("Cannot remove VM snapshot. Vm is not Down, Up or Paused"); throw new VdcBLLException(VdcBllErrors.VM_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE); } } else if (!getVm().isDown()) { log.error("Cannot remove VM snapshot. Vm is not Down and cluster version does not support Live Merge"); throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } final Snapshot snapshot = getSnapshotDao().get(getParameters().getSnapshotId()); boolean snapshotHasImages = hasImages(); boolean removeSnapshotMemory = isMemoryVolumeRemoveable(snapshot.getMemoryVolume()); if (!snapshotHasImages && !removeSnapshotMemory) { getSnapshotDao().remove(getParameters().getSnapshotId()); setSucceeded(true); return; } lockSnapshot(snapshot); freeLock(); getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); if (snapshotHasImages) { removeImages(); if (getSnapshotActionType() == VdcActionType.RemoveSnapshotSingleDiskLive) { setCommandStatus(CommandStatus.ACTIVE_ASYNC); persistCommandWithoutContext(getParameters().getParentCommand(), true); } } if (removeSnapshotMemory) { removeMemory(snapshot); } setSucceeded(true); }
Source:
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) throws CertificateException { InputStream inStream = null; try { inStream = new FileInputStream(mHttpsCertPath); CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509Certificate ca = (X509Certificate) cf.generateCertificate(inStream); for (X509Certificate cert : certs) { cert.verify(ca.getPublicKey()); } } catch (FileNotFoundException |NoSuchAlgorithmException|InvalidKeyException |NoSuchProviderException |SignatureException e) { throw new CertificateException("Untrusted Certificate!"); } finally { try { if (inStream != null) inStream.close(); } catch (IOException e) { Log.w(TAG, e); } } }

Target:
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) throws CertificateException { InputStream inStream = null; try { inStream = new FileInputStream(mHttpsCertPath); CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509Certificate ca = (X509Certificate) cf.generateCertificate(inStream); for (X509Certificate cert : certs) { cert.verify(ca.getPublicKey()); } } catch (FileNotFoundException |NoSuchAlgorithmException|InvalidKeyException| NoSuchProviderException |SignatureException e) { throw new CertificateException("Untrusted Certificate!", e); } finally { try { if (inStream != null) inStream.close(); } catch (IOException e) { Log.w(TAG, e); } } }
Source:
@Override public WebViewMapFragment build() { if (options == null) { options = new MapboxWebMapType(mapboxAccessToken, mapboxMapId); } if (options instanceof MapboxWebMapType) { return MapboxWebViewMapFragment.newInstance(options); } if (options instanceof GoogleWebMapType) { return GoogleWebViewMapFragment.newInstance(options); } if (options instanceof GoogleChinaMapType) { return GoogleChinaWebViewMapFragment.newInstance(options); } return null; }

Target:
@Override public WebViewMapFragment build() { if (options == null) { options = new GoogleWebMapType(); } if (options instanceof GoogleWebMapType) { return GoogleWebViewMapFragment.newInstance(options); } if (options instanceof GoogleChinaMapType) { return GoogleChinaWebViewMapFragment.newInstance(options); } return null; }
Source:
private void visitMember(FieldOrMethod member, String signatureFormatString) { JavaClass definingClass = (JavaClass) mDescendingVisitor.predecessor(); mStatus.debug("Visit member %s : %s", member.getName(), member.getSignature()); for (AnnotationEntry a : member.getAnnotationEntries()) { if (mAnnotationType.equals(a.getAnnotationType())) { mStatus.debug("Member has annotation %s", mAnnotationType); boolean bridge = (member instanceof Method) && (member.getAccessFlags() & Const.ACC_BRIDGE) != 0; if (bridge) { mStatus.debug("Member is a bridge", mAnnotationType); } String signature = String.format(Locale.US, signatureFormatString, getClassDescriptor(definingClass), member.getName(), member.getSignature()); Member m = new Member(signature, bridge); for (ElementValuePair property : a.getElementValuePairs()) { switch (property.getNameString()) { case EXPECTED_SIGNATURE: String expected = property.getValue().stringifyValue(); if (!bridge && !signature.equals(expected)) { error(definingClass, member, "Expected signature does not match generated:\n" + "Expected: %s\n" + "Generated: %s", expected, signature); } break; } } if (mGreylistFilter.test(m)) { mStatus.greylistEntry(m.signature); } } } }

Target:
private void visitMember(FieldOrMethod member, String signatureFormatString) { JavaClass definingClass = (JavaClass) mDescendingVisitor.predecessor(); mStatus.debug("Visit member %s : %s", member.getName(), member.getSignature()); for (AnnotationEntry a : member.getAnnotationEntries()) { if (mAnnotationType.equals(a.getAnnotationType())) { mStatus.debug("Member has annotation %s", mAnnotationType); boolean bridge = (member.getAccessFlags() & Const.ACC_BRIDGE) != 0; if (bridge) { mStatus.debug("Member is a bridge", mAnnotationType); } String signature = String.format(Locale.US, signatureFormatString, getClassDescriptor(definingClass), member.getName(), member.getSignature()); for (ElementValuePair property : a.getElementValuePairs()) { switch (property.getNameString()) { case EXPECTED_SIGNATURE: String expected = property.getValue().stringifyValue(); if (!bridge && !signature.equals(expected)) { error(definingClass, member, "Expected signature does not match generated:\n" + "Expected: %s\n" + "Generated: %s", expected, signature); } break; } } if (mMemberFilter.test(new Member(signature, bridge))) { mStatus.greylistEntry(signature); } } } }
Source:
public RowBatch nextBatch(RowBatch previous) throws IOException { MessageType requestedSchema = readContext.getRequestedSchema(); List<ColumnDescriptor> columns = requestedSchema.getColumns(); int nColumns = columns.size(); ColumnVector[] columnVectors; RowBatch rowBatch = previous; if (rowBatch == null) { rowBatch = new RowBatch(new ColumnVector[nColumns]); } columnVectors = rowBatch.getColumns(); MessageType[] columnSchemas = new MessageType[nColumns]; for (int i = 0; i < nColumns; i++) { ColumnVector columnVector = columnVectors[i]; columnSchemas[i] = new MessageType(requestedSchema.getFieldName(i), requestedSchema.getType(i)); if (columnVector == null) { columnVector = ColumnVector.from(columns.get(i)); } rowBatch.getColumns()[i] = columnVector; } boolean hasMoreRecords = readVectors(rowBatch.getColumns(), columnSchemas); return hasMoreRecords ? rowBatch : null; }

Target:
public RowBatch nextBatch(RowBatch previous) throws IOException { MessageType requestedSchema = readContext.getRequestedSchema(); List<ColumnDescriptor> columns = requestedSchema.getColumns(); int nColumns = columns.size(); ColumnVector[] columnVectors; RowBatch rowBatch = previous; if (rowBatch == null) { rowBatch = new RowBatch(new ColumnVector[nColumns]); } columnVectors = rowBatch.getColumns(); checkArgument(columns.size() == columnVectors.length, "Number of columns in the requested schema and the previous row batch don't match."); MessageType[] columnSchemas = new MessageType[nColumns]; for (int i = 0; i < nColumns; i++) { ColumnVector columnVector = columnVectors[i]; columnSchemas[i] = new MessageType(requestedSchema.getFieldName(i), requestedSchema.getType(i)); if (columnVector == null) { columnVector = ColumnVector.from(columns.get(i)); } rowBatch.getColumns()[i] = columnVector; } boolean hasMoreRecords = readVectors(rowBatch.getColumns(), columnSchemas); return hasMoreRecords ? rowBatch : null; }
Source:
public Cluster apply(Cluster original) { requireNonNull(original); Cluster upgraded = original.clone(); List<Stripe> stripes = upgraded.getStripes(); for (int i = 0; i < stripes.size(); i++) { if (stripes.get(i).getName() == null) { stripes.get(i).setName("stripe[" + i + "]"); } } String clusterName = upgraded.getName(); Random random = new Random(clusterName.hashCode()); if (upgraded.getUID() == null) { upgraded.setUID(upgraded.newUID(random)); } upgraded.getStripes().forEach(stripe -> { if (stripe.getUID() == null) { stripe.setUID(upgraded.newUID(random)); } stripe.getNodes().forEach(node -> { if (node.getUID() == null) { node.setUID(upgraded.newUID(random)); } }); }); NameGenerator.assignFriendlyNames(upgraded); new ClusterValidator(upgraded).validate(); return upgraded; }

Target:
public Cluster apply(Cluster original) { requireNonNull(original); Cluster upgraded = original.clone(); if(from == Version.V1) { String clusterName = upgraded.getName(); requireNonNull(clusterName); Random random = new Random(clusterName.hashCode()); upgraded.setUID(upgraded.newUID(random)); upgraded.getStripes().forEach(stripe -> { stripe.setUID(upgraded.newUID(random)); stripe.getNodes().forEach(node -> { node.setUID(upgraded.newUID(random)); }); }); NameGenerator.assignFriendlyStripeNames(upgraded, new Random(clusterName.hashCode())); } new ClusterValidator(upgraded).validate(); return upgraded; }
Source:
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(hotPlugSupported || vmStatus.equals(VMStatus.Down)); initCommands(); }

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(allowHotPlug()); initCommands(); }
Source:
private static IMarker[] getMarkersOfView(String viewId, IMarker[] markers) throws CoreException { if (null == viewId) return markers; ArrayList<IMarker> markersOfView = new ArrayList<>(); for (IMarker marker : markers) { if (viewId.equals(getViewId(marker))) markersOfView.add(marker); } return markersOfView.toArray(new IMarker[markersOfView.size()]); }

Target:
private static IMarker[] getMarkersOfView(String viewId, IMarker[] markers) throws CoreException { if (null == viewId) return markers; ArrayList<IMarker> markersOfView = new ArrayList<>(); for (IMarker marker : markers) { if (null != marker && viewId.equals(getViewId(marker))) markersOfView.add(marker); } return markersOfView.toArray(new IMarker[markersOfView.size()]); }
Source:
@Override public void setListener(@Nullable DiscoverySpiListener lsnr) { super.setListener(lsnr == null || discoHooks.isEmpty() ? lsnr : wrap(lsnr, discoHooks.toArray(new DiscoveryHook[0]))); }

Target:
@Override public void setListener(@Nullable DiscoverySpiListener lsnr) { super.setListener(lsnr == null || discoHook == null ? lsnr : wrap(lsnr, discoHook)); }
Source:
private int countEntries(Iterable<Entry<Key,Value>> scanner) { int count = 0; for (Entry<Key,Value> keyValueEntry : scanner) { count++; } return count; }

Target:
private int countEntries(Iterable<Entry<Key,Value>> scanner) { return Iterables.size(scanner); }
Source:
public DeleteQuery build() { Checks.checkNotNull(uri, "Please specify uri"); return new DeleteQuery( uri, where, whereArgs ); }

Target:
public DeleteQuery build() { checkNotNull(uri, "Please specify uri"); return new DeleteQuery( uri, where, whereArgs ); }
Source:
public void onSaveInstanceState(Bundle state) { super.onSaveInstanceState(state); state.putSerializable(COMMENTS_KEY, mComments); }

Target:
public void onSaveInstanceState(Bundle state) { super.onSaveInstanceState(state); state.putSerializable(COMMENTS_KEY, mComments); state.putInt(CONTEXTID, mCommentContextId); state.putString(CONTEXT, mCommentContext); state.putString(TITLE_KEY, mTitle); state.putInt(GUIDEID_KEY, mGuideid); }
Source:
public void onClose(int code, String reason) { if (log.isDebugEnabled()) { log.debug("websocket connection closed - code: " + code + " reason: " + reason); } if (code != 1000) { this.error = new SignalFlowException(code, reason); log.info("Lost WebSocket connection with ({}).", connection, code); SignalFlowExceptionStreamMessage errorMessage = new SignalFlowExceptionStreamMessage( this.error); for (TransportChannel channel : this.channels.values()) { channel.offer(errorMessage); } } this.channels.clear(); this.connection = null; }

Target:
public void onClose(int code, String reason) { log.debug("websocket connection closed ({} {})", code, reason); if (code != 1000) { this.error = new SignalFlowException(code, reason); log.info("Lost WebSocket connection with ({}).", connection, code); SignalFlowExceptionStreamMessage errorMessage = new SignalFlowExceptionStreamMessage( this.error); for (TransportChannel channel : this.channels.values()) { channel.offer(errorMessage); } } this.channels.clear(); this.connection = null; }
Source:
public String selectFirstSuggestedCategory() { WebElement suggestion = categorySelectModule.findElement(autoCompleteSuggestion); String categoryName = suggestion.getText().trim(); suggestion.click(); PageObjectLogging.log("selectCategorySuggestions", "category selected from suggestions", true); return categoryName; }

Target:
public String selectFirstSuggestedCategory() { WebElement suggestion = categorySelectModule.findElement(autoCompleteSuggestion); String categoryName = suggestion.getText().trim(); webDriverWait.until(ExpectedConditions.elementToBeClickable(suggestion)); suggestion.click(); PageObjectLogging.log("selectCategorySuggestions", "category selected from suggestions", true); return categoryName; }
Source:
private void fetchAndDisplayCaption(Contribution contribution) { if ((contribution.getState() != Contribution.STATE_COMPLETED)) { titleView.setText(contribution.getDisplayTitle()); } else { Timber.d("Fetching caption for %s", contribution.getFilename()); String wikibaseMediaId = "M"+contribution.getPageId(); compositeDisposable.add(mediaClient.getCaptionByWikibaseIdentifier(wikibaseMediaId) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .timeout(TIMEOUT_SECONDS, TimeUnit.SECONDS) .subscribe(subscriber -> { if (!subscriber.trim().equals(NO_CAPTION)) { titleView.setText(subscriber); } else titleView.setText(contribution.getDisplayTitle()); })); } }

Target:
private void fetchAndDisplayCaption(Contribution contribution) { if ((contribution.getState() != Contribution.STATE_COMPLETED)) { titleView.setText(contribution.getDisplayTitle()); } else { final String pageId = contribution.getPageId(); if (pageId != null) { Timber.d("Fetching caption for %s", contribution.getFilename()); String wikibaseMediaId = PAGE_ID_PREFIX + pageId; compositeDisposable.add(mediaClient.getCaptionByWikibaseIdentifier(wikibaseMediaId) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .timeout(TIMEOUT_SECONDS, TimeUnit.SECONDS) .subscribe(subscriber -> { if (!subscriber.trim().equals(MediaClient.NO_CAPTION)) { titleView.setText(subscriber); } else { titleView.setText(contribution.getDisplayTitle()); } })); } else { titleView.setText(contribution.getDisplayTitle()); } } }
Source:
public void init(@NonNull Map<UUID, Node> nodes, @NonNull DistanceReporter distanceReporter) { this.distanceReporter = distanceReporter; localDc = newLocalDcHelper().discoverLocalDc().orElse(null); filter = newNodeFilterHelper().createNodeFilter(localDc); for (Node node : nodes.values()) { if (filter.test(node)) { distanceReporter.setDistance(node, NodeDistance.LOCAL); if (node.getState() != NodeState.DOWN) { liveNodes.add(node); } } else { distanceReporter.setDistance(node, NodeDistance.IGNORED); } } }

Target:
public void init(@NonNull Map<UUID, Node> nodes, @NonNull DistanceReporter distanceReporter) { this.distanceReporter = distanceReporter; localDc = discoverLocalDc(nodes).orElse(null); filter = createNodeFilter(localDc, nodes); for (Node node : nodes.values()) { if (filter.test(node)) { distanceReporter.setDistance(node, NodeDistance.LOCAL); if (node.getState() != NodeState.DOWN) { liveNodes.add(node); } } else { distanceReporter.setDistance(node, NodeDistance.IGNORED); } } }
Source:
public IOValue getDIOValue(IOLine ioLine) throws InvalidOperatingModeException, XBeeException { if (!connectionInterface.isOpen()) throw new XBeeException(XBeeException.CONNECTION_NOT_OPEN); if (ioLine == null) throw new NullPointerException("IO line cannot be null."); ATCommandResponse response = sendATCommand(new ATCommand("IS")); if (response == null || response.getResponseStatus() != ATCommandStatus.OK) throw new XBeeException(XBeeException.INVALID_OPERATION); IOSample ioSample = new IOSample(response.getResponse()); if (!ioSample.hasDigitalValues() || !ioSample.getDigitalValues().containsKey(ioLine)) throw new XBeeException(XBeeException.INVALID_OPERATION); return ioSample.getDigitalValues().get(ioLine); }

Target:
public IOValue getDIOValue(IOLine ioLine) throws InvalidOperatingModeException, XBeeException { if (!connectionInterface.isOpen()) throw new XBeeException(XBeeException.CONNECTION_NOT_OPEN); if (ioLine == null) throw new NullPointerException("IO line cannot be null."); ATCommandResponse response = sendATCommand(new ATCommand(ioLine.getReadIOATCommand())); if (response == null || response.getResponseStatus() != ATCommandStatus.OK || response == null || response.getResponse().length == 0) throw new XBeeException(XBeeException.INVALID_OPERATION); IOSample ioSample = new IOSample(response.getResponse()); if (!ioSample.hasDigitalValues() || !ioSample.getDigitalValues().containsKey(ioLine)) throw new XBeeException(XBeeException.INVALID_OPERATION); return ioSample.getDigitalValues().get(ioLine); }
Source:
public void run() { try { digest = MD5FileUtils.computeMd5ForFile(file); } catch (Throwable t) { if (t instanceof IOException) { ioe = (IOException) t; } else { ioe = new IOException(t); } } }

Target:
public void run() { try { digest = MD5FileUtils.computeMd5ForFile(file); } catch (IOException e) { ioe = e; } catch (Throwable t) { ioe = new IOException(t); } }
Source:
private JPanel getScrollPanel() { if (scrollPanel == null) { scrollPanel = new JPanel(); scrollPanel.setLayout(new VerticalLayout()); scrollPanel.add(getMainProxyPanel()); scrollPanel.add(getSecurityProtocolsPanel()); scrollPanel.add(getProxiesOptionsPanel()); } return scrollPanel; }

Target:
private JPanel getScrollPanel() { if (scrollPanel == null) { scrollPanel = new JPanel(new VerticalLayout()); scrollPanel.add(getMainProxyPanel()); scrollPanel.add(getSecurityProtocolsPanel()); scrollPanel.add(getProxiesOptionsPanel()); } return scrollPanel; }
Source:
private static String getUrl(IRepositoryElement element) { if (element instanceof ITask) { ITask task = (ITask) element; AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(task.getConnectorKind()); TaskRepository repository = TasksUiInternal.getRepository(task); if (connector.getBrowseableUrl(repository, element) != null) { return connector.getBrowseableUrl(repository, element).toString(); } else { return TasksUi.getRepositoryConnector(task.getConnectorKind()).getTaskUrl(task.getRepositoryUrl(), task.getTaskId()); } } else if (element.getUrl() != null) { return element.getUrl(); } return null; }

Target:
private static String getUrl(IRepositoryElement element) { if (element instanceof ITask) { ITask task = (ITask) element; AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(task.getConnectorKind()); TaskRepository repository = TasksUiInternal.getRepository(task); URL location = connector.getBrowseableUrl(repository, element); if (location != null) { return location.toString(); } else if (task.getUrl() != null) { return task.getUrl(); } else { return TasksUi.getRepositoryConnector(task.getConnectorKind()).getTaskUrl(task.getRepositoryUrl(), task.getTaskId()); } } else if (element.getUrl() != null) { return element.getUrl(); } return null; }
Source:
public void send(String recipient, String messageSubject, String messageBody) throws MessagingException { try { Message msg = new MimeMessage(session); msg.setFrom(from); InternetAddress address = new InternetAddress(recipient); msg.setRecipient(Message.RecipientType.TO, address); if (replyTo != null) { msg.setReplyTo(new Address[] { replyTo }); } msg.setSubject(messageSubject); if (isBodyHtml){ msg.setContent(String.format("<html><head><title>%s</title></head><body><p>%s</body></html>", messageSubject, messageBody), "text/html"); } else { msg.setText(messageBody); } msg.setSentDate(new Date()); if (isSSL) { Transport transport = session.getTransport("smtps"); transport.connect(); transport.sendMessage(msg, new Address[] { address }); } else { Transport.send(msg); } } catch (MessagingException mex) { StringBuilder errorMsg = new StringBuilder("Failed to send message "); if (from != null) { errorMsg.append(" from " + from.toString()); } if (StringUtils.isNotBlank(recipient)) { errorMsg.append(" to " + recipient); } if (StringUtils.isNotBlank(messageSubject)) { errorMsg.append(" with subject " + messageSubject); } boolean firstProperty = true; for (String key : session.getProperties().stringPropertyNames()) { errorMsg.append(firstProperty ? " (connection properties: " : ", "); firstProperty = false; errorMsg.append(key).append("=").append(session.getProperties().getProperty(key)); } if (auth != null) { if (!firstProperty) { errorMsg.append(", "); firstProperty = false; } errorMsg.append(auth); } if (!firstProperty) { errorMsg.append(")"); } errorMsg.append(" due to to error: " + mex.getMessage()); log.error(errorMsg.toString(), mex); throw mex; } }

Target:
public void send(String recipient, String messageSubject, String messageBody) throws MessagingException { try { Message msg = new MimeMessage(session); msg.setFrom(from); InternetAddress address = new InternetAddress(recipient); msg.setRecipient(Message.RecipientType.TO, address); if (replyTo != null) { msg.setReplyTo(new Address[] { replyTo }); } msg.setSubject(messageSubject); if (isBodyHtml){ msg.setContent(String.format("<html><head><title>%s</title></head><body><p>%s</body></html>", messageSubject, messageBody), "text/html"); } else { msg.setText(messageBody); } msg.setSentDate(new Date()); if (isSSL) { Transport transport = session.getTransport("smtps"); transport.connect(); transport.sendMessage(msg, new Address[] { address }); } else { Transport.send(msg); } } catch (MessagingException mex) { StringBuilder errorMsg = new StringBuilder("Failed to send message "); if (from != null) { errorMsg.append(" from " + from.toString()); } if (StringUtils.isNotBlank(recipient)) { errorMsg.append(" to " + recipient); } if (StringUtils.isNotBlank(messageSubject)) { errorMsg.append(" with subject " + messageSubject); } boolean firstProperty = true; firstProperty = parseSessionProperties(errorMsg, firstProperty); if (auth != null) { if (!firstProperty) { errorMsg.append(", "); firstProperty = false; } errorMsg.append(auth); } if (!firstProperty) { errorMsg.append(")"); } errorMsg.append(" due to to error: " + mex.getMessage()); throw mex; } }
Source:
public String toString() { return String .format("DlmsDeviceMessageMetadata[correlationUid=%s, domain=%s, domainVersion=%s, messageType=%s, organisation=%s, device=%s, ipAddress=%s, retryCount=%d, messagePriority=%d, scheduleTimes=%s]", this.correlationUid, this.domain, this.domainVersion, this.messageType, this.organisationIdentification, this.deviceIdentification, this.ipAddress, this.retryCount, this.messagePriority, this.scheduleTime); }

Target:
public String toString() { return String .format("DlmsDeviceMessageMetadata[correlationUid=%s, domain=%s, domainVersion=%s, messageType=%s, organisation=%s, device=%s, ipAddress=%s, retryCount=%d, messagePriority=%d]", this.correlationUid, this.domain, this.domainVersion, this.messageType, this.organisationIdentification, this.deviceIdentification, this.ipAddress, this.retryCount, this.messagePriority); }
Source:
protected void createMockedRepositoriesFolder() { String repositoriesPath = repositoriesFolder.toPath().toString() + "/"; when(configuration.getGitoliteBaseUrl()).thenReturn(repositoriesPath); log.info("Initialized bare repository folder in {}", repositoriesPath); }

Target:
protected void createMockedRepositoriesFolder() { String repositoriesPath = repositoriesFolder.toPath().toString() + "/"; when(configuration.getGitoliteBaseUrl()).thenReturn(repositoriesPath); when(configuration.getRepositoriesDirectory()).thenReturn(repositoriesFolder); log.info("Initialized bare repository folder in {}", repositoriesPath); }
Source:
public KijiRowData next(int pageSize) { KijiDataRequestBuilder builder = KijiDataRequest.builder(); builder.withTimeRange(mColumnDataRequest.getMinTimestamp(), mColumnDataRequest.getMaxTimestamp()).addColumns() .withFilter(new KijiPaginationFilter(pageSize, mOffset, mColumnDataRequest.getColumn(mColumnName.getFamily(), mColumnName.getQualifier()).getFilter())) .withMaxVersions(mMaxVersions).add(mColumnName); KijiDataRequest nextPageDataRequest = builder.build(); LOG.debug("DataRequest in pager is: [{}]", nextPageDataRequest.toString()); HBaseDataRequestAdapter adapter = new HBaseDataRequestAdapter(nextPageDataRequest); try { Get hbaseGet = adapter.toGet(mEntityId, mLayout); incrementOffset(pageSize); Result nextResultPage = mTable.getHTable().get(hbaseGet); if (nextResultPage.size() < pageSize) { mHasNext = false; } return new HBaseKijiRowData(mEntityId, nextPageDataRequest, mTable, nextResultPage); } catch (IOException ioe) { LOG.error("Unable to get next page of results: {}", ioe); return null; } }

Target:
public KijiRowData next(int pageSize) { KijiDataRequestBuilder builder = KijiDataRequest.builder(); builder.withTimeRange(mColumnDataRequest.getMinTimestamp(), mColumnDataRequest.getMaxTimestamp()).addColumns() .withFilter(new KijiPaginationFilter(pageSize, mOffset, mColumnDataRequest.getColumn(mColumnName.getFamily(), mColumnName.getQualifier()).getFilter())) .withMaxVersions(mMaxVersions).add(mColumnName); KijiDataRequest nextPageDataRequest = builder.build(); LOG.debug("DataRequest in pager is: [{}]", nextPageDataRequest.toString()); HBaseDataRequestAdapter adapter = new HBaseDataRequestAdapter(nextPageDataRequest); try { Get hbaseGet = adapter.toGet(mEntityId, mLayout); incrementOffset(pageSize); Result nextResultPage = mTable.getHTable().get(hbaseGet); if (nextResultPage.size() < pageSize) { mHasNext = false; } return new HBaseKijiRowData(mEntityId, nextPageDataRequest, mTable, nextResultPage); } catch (IOException ioe) { LOG.error("Unable to get next page of results: {}", ioe); return new HBaseKijiRowData(mEntityId, nextPageDataRequest, mTable, new Result()); } }
Source:
private void doRemoveRepository(final OrganizationalUnit orgUnit, final String alias, final Optional<org.guvnor.structure.organizationalunit.config.RepositoryInfo> thisRepositoryConfig, final Consumer<Repository> notification, final boolean lock) { SpaceConfigStorage configStorage = this.spaceConfigStorage.get(orgUnit.getName()); try { if (lock) { configStorage.startBatch(); } Repository repo = this.configuredRepositories.getRepositoryByRepositoryAlias(orgUnit.getSpace(), alias); if (repo != null) { notification.accept(repo); } for (Repository repository : orgUnit.getRepositories()) { if (repository.getAlias().equals(alias)) { organizationalUnitService.removeRepository(orgUnit, repository); metadataStore.delete(alias); } } } finally { if (lock) { configStorage.endBatch(); } } }

Target:
private void doRemoveRepository(final OrganizationalUnit orgUnit, final String alias, final Optional<org.guvnor.structure.organizationalunit.config.RepositoryInfo> thisRepositoryConfig, final Consumer<Repository> notification, final boolean lock) { SpaceConfigStorage configStorage = this.spaceConfigStorage.get(orgUnit.getName()); try { if (lock) { configStorage.startBatch(); } Repository repo = this.configuredRepositories.getRepositoryByRepositoryAlias(orgUnit.getSpace(), alias); if (repo != null) { this.close(repo.getDefaultBranch()); notification.accept(repo); } for (Repository repository : orgUnit.getRepositories()) { if (repository.getAlias().equals(alias)) { organizationalUnitService.removeRepository(orgUnit, repository); metadataStore.delete(alias); } } } finally { if (lock) { configStorage.endBatch(); } } }
Source:
protected void executeQueryCommand() { VDS vds = vdsDao.get(lldpVDSCommandParameters.getVdsId()); if (vds != null && FeatureSupported.isLlldpInformationSupported(vds.getClusterCompatibilityVersion())) { VDSReturnValue command = runVdsCommand(VDSCommandType.GetLldp, lldpVDSCommandParameters); getQueryReturnValue().setReturnValue(command.getReturnValue()); } else { getQueryReturnValue().setReturnValue(null); } }

Target:
protected void executeQueryCommand() { VDS vds = getVds(lldpVDSCommandParameters.getVdsId()); if (FeatureSupported.isLlldpInformationSupported(vds.getClusterCompatibilityVersion())) { VDSReturnValue command = runVdsCommand(VDSCommandType.GetLldp, lldpVDSCommandParameters); getQueryReturnValue().setReturnValue(command.getReturnValue()); } else { getQueryReturnValue().setReturnValue(null); } }
Source:
private boolean isActionInsertFactFragment(final List<? extends MetaData> metaData) { if (!metaData.stream().allMatch((c) -> (c instanceof MoveColumnToMetaData))) { return false; } if (!metaData.stream().map(c -> (MoveColumnToMetaData) c).allMatch(c -> c.getColumn() instanceof ActionInsertFactCol52)) { return false; } final BaseColumn firstColumnInFragment = ((MoveColumnToMetaData) metaData.get(0)).getColumn(); final BaseColumn lastColumnInFragment = ((MoveColumnToMetaData) metaData.get(metaData.size() - 1)).getColumn(); final int firstColumnIndex = model.getExpandedColumns().indexOf(firstColumnInFragment); final int lastColumnIndex = model.getExpandedColumns().indexOf(lastColumnInFragment); return lastColumnIndex - firstColumnIndex == metaData.size() - 1; }

Target:
private boolean isActionInsertFactFragment(final List<? extends MetaData> metaData) { if (!metaData.stream().allMatch((c) -> (c instanceof MoveColumnToMetaData))) { return false; } if (!metaData.stream().map(c -> (MoveColumnToMetaData) c).allMatch(c -> c.getColumn() instanceof ActionInsertFactCol52)) { return false; } final int lastMetaDataIndex = metaData.size() - 1; final BaseColumn firstColumnInFragment = ((MoveColumnToMetaData) metaData.get(0)).getColumn(); final BaseColumn lastColumnInFragment = ((MoveColumnToMetaData) metaData.get(lastMetaDataIndex)).getColumn(); final int firstColumnIndex = model.getExpandedColumns().indexOf(firstColumnInFragment); final int lastColumnIndex = model.getExpandedColumns().indexOf(lastColumnInFragment); return lastColumnIndex - firstColumnIndex == lastMetaDataIndex; }
Source:
protected void applyValidatorResult(Validator validator) { IStatus status = validator.getStatus(); String message = status.getMessage(); if (message == null || message.length() == 0) { message = null; } switch (status.getSeverity()) { case IStatus.OK: if (status == Status.OK_STATUS) { if (getUserName().length() > 0) { message = Messages.AbstractRepositorySettingsPage_Authentication_credentials_are_valid; } else { message = Messages.AbstractRepositorySettingsPage_Repository_is_valid; } } setMessage(message, IMessageProvider.INFORMATION); saveToValidatedProperties(); break; case IStatus.INFO: setMessage(message, IMessageProvider.INFORMATION); break; case IStatus.WARNING: setMessage(message, IMessageProvider.WARNING); break; default: setMessage(message, IMessageProvider.ERROR); break; } setErrorMessage(null); isValid = status.getSeverity() == IStatus.OK || status.getSeverity() == IStatus.INFO; }

Target:
protected void applyValidatorResult(Validator validator) { IStatus status = validator.getStatus(); String message = status.getMessage(); if (message == null || message.length() == 0) { message = null; } switch (status.getSeverity()) { case IStatus.OK: if (status == Status.OK_STATUS) { if (getUserName().length() > 0) { message = Messages.AbstractRepositorySettingsPage_Authentication_credentials_are_valid; } else { message = Messages.AbstractRepositorySettingsPage_Repository_is_valid; } } setMessage(message, IMessageProvider.INFORMATION); break; case IStatus.INFO: setMessage(message, IMessageProvider.INFORMATION); break; case IStatus.WARNING: setMessage(message, IMessageProvider.WARNING); break; default: setMessage(message, IMessageProvider.ERROR); break; } setErrorMessage(null); isValid = status.getSeverity() == IStatus.OK || status.getSeverity() == IStatus.INFO; }
Source:
private boolean addMacToMap(Map<String, Integer> macMap, String mac) { boolean returnValue = false; if (!macMap.containsKey(mac)) { macMap.put(mac, 1); returnValue = true; } else if (allowDuplicate()) { incrementMacInMap(macMap, mac); returnValue = true; } return returnValue; }

Target:
private boolean addMacToMap(Map<String, Integer> macMap, String mac) { if (!macMap.containsKey(mac)) { macMap.put(mac, 1); return true; } else if (allowDuplicate()) { incrementMacInMap(macMap, mac); return true; } return false; }
Source:
private boolean flush(ByteBuffer buf) throws IOException { int remaining = buf.remaining(); if (remaining > 0) { long start = SystemTime.getInstance().nanoseconds(); int written = socketChannel.write(buf); logger.trace("Flushed bytes in ns", written, SystemTime.getInstance().nanoseconds() - start); return written >= remaining; } return true; }

Target:
private boolean flush(ByteBuffer buf) throws IOException { int remaining = buf.remaining(); if (remaining > 0) { long startNs = SystemTime.getInstance().nanoseconds(); int written = socketChannel.write(buf); logger.trace("Flushed bytes in ns", written, SystemTime.getInstance().nanoseconds() - startNs); return written >= remaining; } return true; }
Source:
public RGBValues createRGBValuesFromString(EDataType eDataType, String initialValue) { Iterator<String> it = Splitter.on(',').split(initialValue).iterator(); RGBValues result = new RGBValues(); if (it.hasNext()) { result.setRed(toInt(it.next())); } if (it.hasNext()) { result.setGreen(toInt(it.next())); } if (it.hasNext()) { result.setBlue(toInt(it.next())); } return result; }

Target:
public RGBValues createRGBValuesFromString(EDataType eDataType, String initialValue) { RGBValues result = new RGBValues(); if (!StringUtil.isEmpty(initialValue)) { Iterator<String> it = Splitter.on(',').split(initialValue).iterator(); if (it.hasNext()) { result.setRed(toInt(it.next())); } if (it.hasNext()) { result.setGreen(toInt(it.next())); } if (it.hasNext()) { result.setBlue(toInt(it.next())); } } return result; }
Source:
public Long sumMetric(final Task task, final DimFilter filter, final String metric) { TimeseriesQuery query = Druids.newTimeseriesQueryBuilder() .dataSource("test_ds") .filters(filter) .aggregators( ImmutableList.<AggregatorFactory>of( new LongSumAggregatorFactory(metric, metric) ) ).granularity(Granularities.ALL) .intervals("2000/3000") .build(); List<Result<TimeseriesResultValue>> results = task.getQueryRunner(query).run(QueryPlus.wrap(query), ImmutableMap.of()).toList(); if (results.isEmpty()) { return 0L; } else { return results.get(0).getValue().getLongMetric(metric); } }

Target:
public Long sumMetric(final Task task, final DimFilter filter, final String metric) { TimeseriesQuery query = Druids.newTimeseriesQueryBuilder() .dataSource("test_ds") .filters(filter) .aggregators( ImmutableList.of( new LongSumAggregatorFactory(metric, metric) ) ).granularity(Granularities.ALL) .intervals("2000/3000") .build(); List<Result<TimeseriesResultValue>> results = task.getQueryRunner(query).run(QueryPlus.wrap(query), ImmutableMap.of()).toList(); if (results.isEmpty()) { return 0L; } else { return results.get(0).getValue().getLongMetric(metric); } }
Source:
public void openContextMenuByPathSelectedItem(String path) { final String itemXpath = getItemXpathByPath(path); for (int i = 1; ; i++) { waitAndSelectItem(path); waitItemIsSelected(path); seleniumWebDriverHelper.waitAndContextClick(By.xpath(itemXpath)); waitContextMenu(); try { waitItemIsSelected(path, REDRAW_UI_ELEMENTS_TIMEOUT_SEC); return; } catch (TimeoutException e) { seleniumWebDriverHelper.hideContextMenu(); waitContextMenuPopUpClosed(); if (i >= 2) { final String errorMessage = format( "Selection of the project tree item which located by \"%s\" has been lost, context menu event can't be performed for this element", getItemXpathByPath(path)); throw new RuntimeException(errorMessage); } } } }

Target:
public void openContextMenuByPathSelectedItem(String path) { final String itemXpath = getItemXpathByPath(path); for (int i = 1; ; i++) { waitAndSelectItem(path); waitItemIsSelected(path); seleniumWebDriverHelper.waitAndContextClick(By.xpath(itemXpath)); waitContextMenu(); try { waitItemIsSelected(path, REDRAW_UI_ELEMENTS_TIMEOUT_SEC); return; } catch (TimeoutException e) { seleniumWebDriverHelper.hideContextMenu(); waitContextMenuPopUpClosed(); if (i > 1) { final String errorMessage = format( "Selection of the project tree item which located by \"%s\" has been lost, context menu event can't be performed for this element", getItemXpathByPath(path)); throw new RuntimeException(errorMessage); } } } }
Source:
public static PersistentVolumeClaim newPVC( String name, String accessMode, String quantity, String storageClassName) { SpecNested<PersistentVolumeClaimBuilder> specs = new PersistentVolumeClaimBuilder() .withNewMetadata() .withName(name) .endMetadata() .withNewSpec() .withAccessModes(accessMode); if (storageClassName != null && !storageClassName.equals("")) { specs.withStorageClassName(storageClassName); } return specs .withNewResources() .withRequests(ImmutableMap.of(STORAGE_PARAM, new Quantity(quantity))) .endResources() .endSpec() .build(); }

Target:
public static PersistentVolumeClaim newPVC( String name, String accessMode, String quantity, String storageClassName) { SpecNested<PersistentVolumeClaimBuilder> specs = new PersistentVolumeClaimBuilder() .withNewMetadata() .withName(name) .endMetadata() .withNewSpec() .withAccessModes(accessMode); if (!isNullOrEmpty(storageClassName)) { specs.withStorageClassName(storageClassName); } return specs .withNewResources() .withRequests(ImmutableMap.of(STORAGE_PARAM, new Quantity(quantity))) .endResources() .endSpec() .build(); }
Source:
private void showResetPasswordDialog() { ResetPasswordAlertDialogFragment.newInstance(this, getEmail()).show(getSupportFragmentManager(), null); }

Target:
private void showResetPasswordDialog() { ResetPasswordDialogFragment.newInstance(getEmail()).show(getSupportFragmentManager(), null); }
Source:
private SimplePrincipal(String name) { this.name = name; }

Target:
private SimplePrincipal(String name) { assert(name != null); this.name = name; }
Source:
void expandSubDataTypes(final DataType dataType) { dataType.getSubDataTypes().forEach(subType -> { final Element subDataTypeRow = getRowElement(subType); final Element arrow = getArrowElement(subDataTypeRow); show(subDataTypeRow); if (!isCollapsed(arrow)) { expandSubDataTypes(subType); } }); }

Target:
void expandSubDataTypes(final DataType dataType) { dataType.getSubDataTypes().forEach(view::expandSubType); }
Source:
public void testUpdateFieldVariable_Return400() throws Exception { final FieldResource resource = new FieldResource(); final ContentType contentType = getContentType(); final String jsonField = "{"+ " \"clazz\" : \"com.dotcms.contenttype.model.field.ImmutableRelationshipField\","+ " \"contentTypeId\" : \"CONTENT_TYPE_ID\","+ " \"name\" : \"YouTube Videos\","+ " \"values\" : 1," + " \"variable\": \"youtubeVideos\","+ " \"relationType\": \"Youtube\""+ " }"; Response response = resource.createContentTypeField( contentType.id(), jsonField.replace("CONTENT_TYPE_ID", contentType.id()), getHttpRequest()); assertNotNull(response); assertEquals(200, response.getStatus()); final Map<String, Object> fieldMap = (Map<String, Object>) ((ResponseEntityView) response.getEntity()).getEntity(); final String jsonFieldUpdate = "{"+ " \"clazz\" : \"com.dotcms.contenttype.model.field.ImmutableRelationshipField\","+ " \"contentTypeId\" : \"CONTENT_TYPE_ID\","+ " \"id\" : \"CONTENT_TYPE_FIELD_ID\","+ " \"name\" : \"YouTube Videos\","+ " \"values\" : 1," + " \"variable\": \"youtube-Videos\","+ " \"relationType\": \"Youtube\""+ " }"; response = resource.updateContentTypeFieldById( contentType.id(), (String) fieldMap.get("id"), jsonFieldUpdate.replace("CONTENT_TYPE_ID", contentType.id()).replace("CONTENT_TYPE_FIELD_ID", (String) fieldMap.get("id")), getHttpRequest()); assertNotNull(response); assertEquals(400, response.getStatus()); assertTrue("Error: " + response.getEntity().toString(), response.getEntity().toString().contains("Field variable can not be modified")); }

Target:
public void testUpdateFieldVariable_Return400() throws Exception { final FieldResource resource = new FieldResource(); final ContentType contentType = getContentType(); final String jsonField = "{"+ " \"clazz\" : \"" + ImmutableRelationshipField.class.getCanonicalName() +"\","+ " \"contentTypeId\" : \"CONTENT_TYPE_ID\","+ " \"name\" : \"YouTube Videos\","+ " \"values\" : 1," + " \"variable\": \"youtubeVideos\","+ " \"relationType\": \"Youtube\""+ " }"; Response response = resource.createContentTypeField( contentType.id(), jsonField.replace("CONTENT_TYPE_ID", contentType.id()), getHttpRequest()); assertNotNull(response); assertEquals(200, response.getStatus()); final Map<String, Object> fieldMap = (Map<String, Object>) ((ResponseEntityView) response.getEntity()).getEntity(); final String jsonFieldUpdate = "{"+ " \"clazz\" : \"" + ImmutableRelationshipField.class.getCanonicalName() +"\","+ " \"contentTypeId\" : \"CONTENT_TYPE_ID\","+ " \"id\" : \"CONTENT_TYPE_FIELD_ID\","+ " \"name\" : \"YouTube Videos\","+ " \"values\" : 1," + " \"variable\": \"youtube-Videos\","+ " \"relationType\": \"Youtube\""+ " }"; response = resource.updateContentTypeFieldById( contentType.id(), (String) fieldMap.get("id"), jsonFieldUpdate.replace("CONTENT_TYPE_ID", contentType.id()).replace("CONTENT_TYPE_FIELD_ID", (String) fieldMap.get("id")), getHttpRequest()); assertNotNull(response); assertEquals(400, response.getStatus()); assertTrue("Error: " + response.getEntity().toString(), response.getEntity().toString().contains("Field variable can not be modified")); }
Source:
public void testMultiTenantBatching() throws Exception{ long start = System.currentTimeMillis() - TIME_DIFF; long end = System.currentTimeMillis() + TIME_DIFF; HttpResponse response = httpPost( TID, postMultiPath, JSONMetricsContainerTest.generateMultitenantJSONMetricsData() ); try { assertEquals( 200, response.getStatusLine().getStatusCode() ); verify( context, atLeastOnce() ).update( anyLong(), anyInt() ); final Locator locator = Locator.createLocatorFromPathComponents( "tenantOne", "mzord.duration" ); Points<SimpleNumber> points = AstyanaxReader.getInstance().getDataToRoll( SimpleNumber.class, locator, new Range( start, end ), CassandraModel.getColumnFamily( BasicRollup.class, Granularity.FULL ) ); assertEquals( 1, points.getPoints().size() ); final Locator locatorTwo = Locator.createLocatorFromPathComponents( "tenantTwo", "mzord.duration" ); Points<SimpleNumber> pointsTwo = AstyanaxReader.getInstance().getDataToRoll( SimpleNumber.class, locator, new Range( start, end ), CassandraModel.getColumnFamily( BasicRollup.class, Granularity.FULL ) ); assertEquals( 1, pointsTwo.getPoints().size() ); } finally { EntityUtils.consume( response.getEntity() ); } }

Target:
public void testMultiTenantBatching() throws Exception{ long start = System.currentTimeMillis() - TIME_DIFF_MS; long end = System.currentTimeMillis() + TIME_DIFF_MS; HttpResponse response = httpPost( TID, postMultiPath, generateMultitenantJSONMetricsData() ); try { assertEquals( 200, response.getStatusLine().getStatusCode() ); verify( context, atLeastOnce() ).update( anyLong(), anyInt() ); final Locator locator = Locator.createLocatorFromPathComponents( "tenantOne", "mzord.duration" ); Points<SimpleNumber> points = AstyanaxReader.getInstance().getDataToRoll( SimpleNumber.class, locator, new Range( start, end ), CassandraModel.getColumnFamily( BasicRollup.class, Granularity.FULL ) ); assertEquals( 1, points.getPoints().size() ); final Locator locatorTwo = Locator.createLocatorFromPathComponents( "tenantTwo", "mzord.duration" ); Points<SimpleNumber> pointsTwo = AstyanaxReader.getInstance().getDataToRoll( SimpleNumber.class, locator, new Range( start, end ), CassandraModel.getColumnFamily( BasicRollup.class, Granularity.FULL ) ); assertEquals( 1, pointsTwo.getPoints().size() ); } finally { EntityUtils.consume( response.getEntity() ); } }