auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean isPolicyValid(RespondingGatewayProvideAndRegisterDocumentSetSecuredResponseRequestType request, AssertionType assertion) { boolean isValid = false; if (hasNhinTargetHomeCommunityId(request)) { String senderHCID = getSubjectHelper().determineSendingHomeCommunityId(assertion.getHomeCommunity(), assertion); String receiverHCID = getNhinTargetHomeCommunityId(request); String direction = NhincConstants.POLICYENGINE_OUTBOUND_DIRECTION; isValid = getXDRPolicyChecker().checkXDRResponsePolicy(request.getRegistryResponse(), assertion, senderHCID, receiverHCID, direction); } else { LOG.warn("Check on policy requires a non null target home community ID specified in the request"); } LOG.debug("Check on policy returns: " + isValid); return isValid; }

Target:
private boolean isPolicyValid(RespondingGatewayProvideAndRegisterDocumentSetSecuredResponseRequestType request, AssertionType assertion) { boolean isValid = false; if (hasNhinTargetHomeCommunityId(request)) { isValid = getXDRPolicyChecker().checkXDRResponsePolicy(request.getRegistryResponse(), assertion, getSubjectHelper().determineSendingHomeCommunityId(assertion.getHomeCommunity(), assertion), getNhinTargetHomeCommunityId(request), NhincConstants.POLICYENGINE_OUTBOUND_DIRECTION); } else { LOG.warn("Check on policy requires a non null target home community ID specified in the request"); } LOG.debug("Check on policy returns: " + isValid); return isValid; }
Source:
public void cleanupStaleBuffers() { m_es.execute(new Runnable() { public void run() { long generationIdCreated = m_committedBuffers.getGenerationIdCreated(); try { if (m_committedBuffers.deleteStalePBDSegments(generationIdCreated)) { m_gapTracker = new ExportSequenceNumberTracker(); } } catch (IOException e) { VoltDB.crashLocalVoltDB("Error while trying to delete stale PBD segments older than generation " + generationIdCreated, true, e); } } }); }

Target:
public void cleanupStaleBuffers() { m_es.execute(new Runnable() { public void run() { long generationIdCreated = m_committedBuffers.getGenerationIdCreated(); try { if (m_committedBuffers.deleteStaleBlocks(generationIdCreated)) { m_gapTracker = m_committedBuffers.scanForGap(); } } catch (IOException e) { VoltDB.crashLocalVoltDB("Error while trying to delete stale PBD segments older than generation " + generationIdCreated, true, e); } } }); }
Source:
private static Map<Class<? extends Message>, Method> scan(Class<?> declaringClass, Predicate<Method> filter) { final Map<Class<? extends Message>, Method> tempMap = Maps.newHashMap(); for (Method method : declaringClass.getDeclaredMethods()) { if (filter.apply(method)) { final Class<? extends Message> messageClass = HandlerMethod.getFirstParamType(method); if (tempMap.containsKey(messageClass)) { final Method alreadyPresent = tempMap.get(messageClass); throw new DuplicateHandlerMethodException( declaringClass, messageClass, alreadyPresent.getName(), method.getName()); } tempMap.put(messageClass, method); } } final ImmutableMap.Builder<Class<? extends Message>, Method> builder = ImmutableMap.builder(); builder.putAll(tempMap); return builder.build(); }

Target:
private static Map<Class<? extends Message>, Method> scan(Class<?> declaringClass, Predicate<Method> filter) { final Map<Class<? extends Message>, Method> tempMap = Maps.newHashMap(); for (Method method : declaringClass.getDeclaredMethods()) { if (filter.apply(method)) { final Class<? extends Message> messageClass = HandlerMethod.getFirstParamType(method); if (tempMap.containsKey(messageClass)) { final Method alreadyPresent = tempMap.get(messageClass); throw new DuplicateHandlerMethodException( declaringClass, messageClass, alreadyPresent.getName(), method.getName()); } tempMap.put(messageClass, method); } } final ImmutableMap<Class<? extends Message>, Method> result = ImmutableMap.copyOf(tempMap); return result; }
Source:
public List<DeterministicKey> getKeys(KeyPurpose purpose,int numberOfKeys) { checkArgument(numberOfKeys > 0); lock.lock(); try { DeterministicKey parentKey; int index; switch (purpose) { case RECEIVE_FUNDS: case REFUND: issuedExternalKeys += numberOfKeys; index = issuedExternalKeys; parentKey = externalKey; break; case CHANGE: issuedInternalKeys += numberOfKeys; index = issuedInternalKeys; parentKey = internalKey; break; default: throw new UnsupportedOperationException(); } List<DeterministicKey> lookahead = maybeLookAhead(parentKey, index); basicKeyChain.importKeys(lookahead); List keys = new ArrayList<DeterministicKey>(numberOfKeys); for (int i=1; i<=numberOfKeys; i++) { keys.add(hierarchy.get(HDUtils.append(parentKey.getPath(), new ChildNumber((index-numberOfKeys+i) - 1, false)), false, false)); } return keys; } finally { lock.unlock(); } }

Target:
public List<DeterministicKey> getKeys(KeyPurpose purpose,int numberOfKeys) { checkArgument(numberOfKeys > 0); lock.lock(); try { DeterministicKey parentKey; int index; switch (purpose) { case RECEIVE_FUNDS: case REFUND: issuedExternalKeys += numberOfKeys; index = issuedExternalKeys; parentKey = externalKey; break; case CHANGE: issuedInternalKeys += numberOfKeys; index = issuedInternalKeys; parentKey = internalKey; break; default: throw new UnsupportedOperationException(); } List<DeterministicKey> lookahead = maybeLookAhead(parentKey, index); basicKeyChain.importKeys(lookahead); List<DeterministicKey> keys = new ArrayList<DeterministicKey>(numberOfKeys); for (int i = 1; i <= numberOfKeys; i++) { keys.add(hierarchy.get(HDUtils.append(parentKey.getPath(), new ChildNumber((index-numberOfKeys+i) - 1, false)), false, false)); } return keys; } finally { lock.unlock(); } }
Source:
public void testBlockCompressSequenceFileWriterSync() throws IOException, EventDeliveryException, InterruptedException { String hdfsPath = testPath + "/sequenceFileWriterSync"; String body = "test event-" + System.nanoTime(); Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(conf); fs.setVerifyChecksum(false); fs.setWriteChecksum(false); Path dirPath = new Path(hdfsPath); fs.delete(dirPath, true); fs.mkdirs(dirPath); Context context = new Context(); context.put("hdfs.path", hdfsPath); context.put("hdfs.rollCount", "10"); context.put("hdfs.rollSize", "0"); context.put("hdfs.rollInterval", "0"); context.put("hdfs.batchSize", "1"); context.put("hdfs.fileType", "SequenceFile"); context.put("hdfs.codeC", "BZip2Codec"); context.put("hdfs.writeFormat", "Writable"); Configurables.configure(sink, context); Channel channel = new MemoryChannel(); Configurables.configure(channel, context); sink.setChannel(channel); sink.start(); Transaction txn = channel.getTransaction(); txn.begin(); Event event = new SimpleEvent(); event.setBody(body.getBytes()); channel.put(event); txn.commit(); txn.close(); sink.process(); FileStatus[] dirStat = fs.listStatus(dirPath); Path[] paths = FileUtil.stat2Paths(dirStat); Assert.assertEquals(1, paths.length); SequenceFile.Reader reader = new SequenceFile.Reader(conf, SequenceFile.Reader.stream(fs.open(paths[0]))); LongWritable key = new LongWritable(); BytesWritable value = new BytesWritable(); Assert.assertTrue(reader.next(key, value)); Assert.assertArrayEquals(body.getBytes(), value.copyBytes()); fs.close(); }

Target:
public void testBlockCompressSequenceFileWriterSync() throws IOException, EventDeliveryException { String hdfsPath = testPath + "/sequenceFileWriterSync"; FileSystem fs = FileSystem.get(new Configuration()); fs.setVerifyChecksum(false); fs.setWriteChecksum(false); String codecs = {"BZip2Codec", "DeflateCodec"}; for (String codec : codecs) { sequenceFileWriteAndVerifyEvents(fs, hdfsPath, codec, Collections.singletonList( "single-event" )); sequenceFileWriteAndVerifyEvents(fs, hdfsPath, codec, Arrays.asList( "multiple-events-1", "multiple-events-2", "multiple-events-3", "multiple-events-4", "multiple-events-5" )); } fs.close(); }
Source:
public void putShouldChangeCachedValueImmediately(Boolean initialCacheValue, boolean newCacheValue) { initializeCache(initialCacheValue); remoteRepositoryAlivenessCacheManager.put(remoteRepository, newCacheValue); boolean actualCacheValue = remoteRepositoryAlivenessCacheManager.isAlive(remoteRepository); assertEquals(newCacheValue, actualCacheValue); }

Target:
public void putShouldChangeCachedValueImmediately(Boolean initialCacheValue, boolean newCacheValue) { initializeCache(initialCacheValue); remoteRepositoryAlivenessCacheManager.put(remoteRepository, newCacheValue); boolean alive = remoteRepositoryAlivenessCacheManager.isAlive(remoteRepository); assertThat(alive).isEqualTo(newCacheValue); }
Source:
public Token getRequestToken() { createSession(); PostMethod requestPostMethod = new PostMethod(this.config.getRequestTokenURL()); signRequest(OAuthConstants.EMPTY_TOKEN, requestPostMethod, false); int requestTokenResponse = -1; try { requestTokenResponse = this.httpClient.executeMethod(requestPostMethod); } catch (HttpException e1) { MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Error", "Failed to obtain valid authentication response"); } catch (IOException e1) { MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Error", "Failed to obtain valid authentication response"); } Token requestToken = null; try { System.out.println(requestTokenResponse); System.out.println("Request Token" + requestPostMethod.getResponseBodyAsString()); InputStream responseBodyAsStream = requestPostMethod.getResponseBodyAsStream(); TokenExtractorImpl tokenextractor = new TokenExtractorImpl(); requestToken = tokenextractor.extract(StreamUtils.getStreamContents(responseBodyAsStream)); } catch (IOException e1) { MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Error", "Failed to obtain valid authentication response"); } return requestToken; }

Target:
public Token getRequestToken() { createSession(); PostMethod requestPostMethod = new PostMethod(this.config.getRequestTokenURL()); signRequest(OAuthConstants.EMPTY_TOKEN, requestPostMethod, false); int requestTokenResponse = -1; try { requestTokenResponse = this.httpClient.executeMethod(requestPostMethod); } catch (HttpException e1) { MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Error", "Failed to obtain valid authentication response"); } catch (IOException e1) { MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Error", "Failed to obtain valid authentication response"); } Token requestToken = null; try { OseeLog.log(DWAOAuthService.class, Level.INFO, "requestTokenResponse: " + requestTokenResponse); OseeLog.log(DWAOAuthService.class, Level.INFO, "Request Token" + requestPostMethod.getResponseBodyAsString()); InputStream responseBodyAsStream = requestPostMethod.getResponseBodyAsStream(); TokenExtractorImpl tokenextractor = new TokenExtractorImpl(); requestToken = tokenextractor.extract(StreamUtils.getStreamContents(responseBodyAsStream)); } catch (IOException e1) { MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Error", "Failed to obtain valid authentication response"); } return requestToken; }
Source:
public List<String> getPushOptions() { if (allowPushOptions) { if (enabledCapabilities == null) { throw new RequestNotYetReadException(); } return pushOptions == null ? null : Collections.unmodifiableList(pushOptions); } else { throw new IllegalStateException(); } }

Target:
public List<String> getPushOptions() { if (!allowPushOptions) { throw new IllegalStateException(); } if (enabledCapabilities == null) { throw new RequestNotYetReadException(); } if (pushOptions == null) { return null; } return Collections.unmodifiableList(pushOptions); }
Source:
public void testXXXAclSuccessAudits() throws Exception { String userName = ugi.getUserName(); String adminName = ugi.getUserName(); String volumeName = "volume" + RandomStringUtils.randomNumeric(5); org.apache.hadoop.ozone.client.VolumeArgs createVolumeArgs = org.apache.hadoop.ozone.client.VolumeArgs.newBuilder() .setAdmin(adminName) .setOwner(userName) .build(); store.createVolume(volumeName, createVolumeArgs); verifyLog(OMAction.CREATE_VOLUME.name(), volumeName, AuditEventStatus.SUCCESS.name()); OzoneVolume retVolumeinfo = store.getVolume(volumeName); verifyLog(OMAction.READ_VOLUME.name(), volumeName, AuditEventStatus.SUCCESS.name()); Assert.assertTrue(retVolumeinfo.getName().equalsIgnoreCase(volumeName)); OzoneObj volObj = new OzoneObjInfo.Builder() .setVolumeName(volumeName) .setResType(VOLUME) .setStoreType(OZONE) .build(); List<OzoneAcl> acls = store.getAcl(volObj); verifyLog(OMAction.GET_ACL.name(), volumeName, AuditEventStatus.SUCCESS.name()); Assert.assertTrue(acls.size() > 0); store.addAcl(volObj, USER_ACL); verifyLog(OMAction.ADD_ACL.name(), volumeName, "johndoe", AuditEventStatus.SUCCESS.name()); store.removeAcl(volObj, USER_ACL); verifyLog(OMAction.REMOVE_ACL.name(), volumeName, "johndoe", AuditEventStatus.SUCCESS.name()); store.setAcl(volObj, aclListToAdd); verifyLog(OMAction.SET_ACL.name(), volumeName, "johndoe", "jane", AuditEventStatus.SUCCESS.name()); }

Target:
public void testXXXAclSuccessAudits() throws Exception { String userName = ugi.getUserName(); String adminName = ugi.getUserName(); String volumeName = "volume" + RandomStringUtils.randomNumeric(5); VolumeArgs createVolumeArgs = VolumeArgs.newBuilder() .setAdmin(adminName) .setOwner(userName) .build(); store.createVolume(volumeName, createVolumeArgs); verifyLog(OMAction.CREATE_VOLUME.name(), volumeName, AuditEventStatus.SUCCESS.name()); OzoneVolume retVolumeinfo = store.getVolume(volumeName); verifyLog(OMAction.READ_VOLUME.name(), volumeName, AuditEventStatus.SUCCESS.name()); Assert.assertTrue(retVolumeinfo.getName().equalsIgnoreCase(volumeName)); OzoneObj volObj = new OzoneObjInfo.Builder() .setVolumeName(volumeName) .setResType(VOLUME) .setStoreType(OZONE) .build(); List<OzoneAcl> acls = store.getAcl(volObj); verifyLog(OMAction.GET_ACL.name(), volumeName, AuditEventStatus.SUCCESS.name()); Assert.assertTrue(acls.size() > 0); store.addAcl(volObj, USER_ACL); verifyLog(OMAction.ADD_ACL.name(), volumeName, "johndoe", AuditEventStatus.SUCCESS.name()); store.removeAcl(volObj, USER_ACL); verifyLog(OMAction.REMOVE_ACL.name(), volumeName, "johndoe", AuditEventStatus.SUCCESS.name()); store.setAcl(volObj, aclListToAdd); verifyLog(OMAction.SET_ACL.name(), volumeName, "johndoe", "jane", AuditEventStatus.SUCCESS.name()); }
Source:
public void testSomethingByIterableHandleNullWithNull() { final SomethingByIterableHandleNull s = handle.attach(SomethingByIterableHandleNull.class); final List<Something> out = s.get(null); Assert.assertEquals(4, out.size()); }

Target:
public void testSomethingByIterableHandleNullWithNull() { final SomethingByIterableHandleNull s = handle.attach(SomethingByIterableHandleNull.class); final List<Something> out = s.get(null); Assert.assertEquals(0, out.size()); }
Source:
public String ToUnsupportedOptionsString() { String value = ""; String delimiter = ""; for (Map.Entry<String, String> pair : fencingAgentInstanceOptions.entrySet()) { String displayedKey = GetDisplayedKey(getAgent(), pair.getKey()); if (!IsSupported(displayedKey)) { value = value + delimiter + displayedKey + (pair.getValue().length() > 0 ? EQUAL + pair.getValue() : ""); delimiter = (new Character(COMMA)).toString(); } } return value; }

Target:
public String ToUnsupportedOptionsString() { String delimiter = ""; StringBuilder value = new StringBuilder(); for (Map.Entry<String, String> pair : fencingAgentInstanceOptions.entrySet()) { String displayedKey = GetDisplayedKey(getAgent(), pair.getKey()); if (!IsSupported(displayedKey)) { value.append(delimiter) .append(displayedKey) .append((pair.getValue().length() > 0 ? EQUAL + pair.getValue() : "")); delimiter = COMMA; } } return value.toString(); }
Source:
private void registerNullChannel() { if (this.beanFactory.containsBean(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)) { BeanDefinition nullChannelDefinition = null; BeanFactory beanFactory = this.beanFactory; do { if (beanFactory instanceof ConfigurableListableBeanFactory) { ConfigurableListableBeanFactory listable = (ConfigurableListableBeanFactory) beanFactory; if (listable.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)) { nullChannelDefinition = listable .getBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME); } } if (beanFactory instanceof HierarchicalBeanFactory) { beanFactory = ((HierarchicalBeanFactory) beanFactory).getParentBeanFactory(); } } while (nullChannelDefinition == null && beanFactory != null); if (nullChannelDefinition != null && !NullChannel.class.getName().equals(nullChannelDefinition.getBeanClassName())) { throw new IllegalStateException("The bean name '" + IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME + "' is reserved."); } } else { this.registry.registerBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME, new RootBeanDefinition(NullChannel.class)); } }

Target:
private void registerNullChannel() { if (this.beanFactory.containsBean(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)) { BeanDefinition nullChannelDefinition = null; BeanFactory beanFactory = this.beanFactory; do { if (beanFactory instanceof ConfigurableListableBeanFactory) { ConfigurableListableBeanFactory listable = (ConfigurableListableBeanFactory) beanFactory; if (listable.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)) { nullChannelDefinition = listable .getBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME); } } if (beanFactory instanceof HierarchicalBeanFactory) { beanFactory = ((HierarchicalBeanFactory) beanFactory).getParentBeanFactory(); } } while (nullChannelDefinition == null); if (nullChannelDefinition != null && !NullChannel.class.getName().equals(nullChannelDefinition.getBeanClassName())) { throw new IllegalStateException("The bean name '" + IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME + "' is reserved."); } } else { this.registry.registerBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME, new RootBeanDefinition(NullChannel.class)); } }
Source:
public ImmutableSet<SanitizedSecret> getSanitizedSecretsFor(Group group) { checkNotNull(group); ImmutableSet.Builder<SanitizedSecret> set = ImmutableSet.builder(); return dslContext.transactionResult(configuration -> { SecretContentDAO secretContentDAO = secretContentDAOFactory.using(configuration); List<SecretSeries> serieses = DSL.using(configuration) .select() .from(SECRETS) .join(ACCESSGRANTS) .on(SECRETS.ID.eq(ACCESSGRANTS.SECRETID)) .join(GROUPS) .on(GROUPS.ID.eq(ACCESSGRANTS.GROUPID)) .where(GROUPS.NAME.eq(group.getName())) .fetchInto(SECRETS) .map(secretSeriesMapper); for (SecretSeries series : serieses) { for (SecretContent content : secretContentDAO.getSecretContentsBySecretId(series.getId())) { SecretSeriesAndContent seriesAndContent = SecretSeriesAndContent.of(series, content); set.add(SanitizedSecret.fromSecretSeriesAndContent(seriesAndContent)); } } return set.build(); }); }

Target:
public ImmutableSet<SanitizedSecret> getSanitizedSecretsFor(Group group) { checkNotNull(group); ImmutableSet.Builder<SanitizedSecret> set = ImmutableSet.builder(); return dslContext.transactionResult(configuration -> { SecretContentDAO secretContentDAO = secretContentDAOFactory.using(configuration); for (SecretSeries series : getSecretSeriesFor(configuration, group)) { for (SecretContent content : secretContentDAO.getSecretContentsBySecretId(series.getId())) { SecretSeriesAndContent seriesAndContent = SecretSeriesAndContent.of(series, content); set.add(SanitizedSecret.fromSecretSeriesAndContent(seriesAndContent)); } } return set.build(); }); }
Source:
private static void removeNetworkFromHosts(Network network, CommandContext context, List<VdsNetworkInterface> nics) { final ManagementNetworkUtil managementNetworkUtil = Injector.get(ManagementNetworkUtil.class); InterfaceDao interfaceDao = Injector.get(InterfaceDao.class); VdsStaticDao vdsStaticDao = Injector.get(VdsStaticDao.class); NetworkClusterDao networkClusterDao = Injector.get(NetworkClusterDao.class); NetworkAttachmentDao networkAttachmentDao = Injector.get(NetworkAttachmentDao.class); RemoveNetworkParametersBuilder builder = new RemoveNetworkParametersBuilder(network, context, managementNetworkUtil, interfaceDao, vdsStaticDao, networkClusterDao, networkAttachmentDao); ArrayList<VdcActionParametersBase> parameters = builder.buildParameters(nics); if (!parameters.isEmpty()) { HostSetupNetworksParametersBuilder.updateParametersSequencing(parameters); Backend.getInstance().runInternalMultipleActions(VdcActionType.PersistentHostSetupNetworks, parameters, context); } }

Target:
private static void removeNetworkFromHosts(Network network, CommandContext context, List<VdsNetworkInterface> nics) { RemoveNetworkParametersBuilder builder = Injector.get(RemoveNetworkParametersBuilder.class); ArrayList<VdcActionParametersBase> parameters = builder.buildParameters(network, nics); if (!parameters.isEmpty()) { HostSetupNetworksParametersBuilder.updateParametersSequencing(parameters); Backend.getInstance().runInternalMultipleActions(VdcActionType.PersistentHostSetupNetworks, parameters, context); } }
Source:
private void undeploy(EventProcessingDeployer deployer, Artifact artifact) throws DeploymentException { List<CappFile> files = artifact.getFiles(); String fileName = artifact.getFiles().get(0).getName(); String artifactPath = artifact.getExtractedPath() + File.separator + fileName; try { deployer.processUndeployment(new DeploymentFileData(new File(artifactPath), deployer).getAbsolutePath()); artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED); } catch (Exception e) { artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED); log.error("Undeployment is failed due to " + e.getMessage(), e); throw new DeploymentException(e.getMessage(), e); } }

Target:
private void undeploy(EventProcessingDeployer deployer, Artifact artifact) throws DeploymentException { List<CappFile> files = artifact.getFiles(); String fileName = artifact.getFiles().get(0).getName(); String artifactPath = artifact.getExtractedPath() + File.separator + fileName; try { deployer.processUndeployment(new DeploymentFileData(new File(artifactPath), deployer).getAbsolutePath()); artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_PENDING); } catch (Exception e) { artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED); log.error("Undeployment is failed due to " + e.getMessage(), e); throw new DeploymentException(e.getMessage(), e); } }
Source:
public void testRegisterProcessorAndGetIdShouldFailForDuplicateProcessorRegistration() { final String testHostName = "localhost"; final String testProcessId = "testProcessorId"; ProcessorData processorData1 = new ProcessorData(testHostName, testProcessId); zkUtils.registerProcessorAndGetId(processorData1); ZkUtils zkUtils1 = new ZkUtils(KEY_BUILDER, zkClient, 1000, 500, new NoOpMetricsRegistry()); zkUtils1.connect(); ProcessorData duplicateProcessorData = new ProcessorData(testHostName, testProcessId); expectedException.expect(SamzaException.class); zkUtils1.registerProcessorAndGetId(duplicateProcessorData); }

Target:
public void testRegisterProcessorAndGetIdShouldFailForDuplicateProcessorRegistration() { final String testHostName = "localhost"; final String testProcessId = "testProcessorId"; ProcessorData processorData1 = new ProcessorData(testHostName, testProcessId); zkUtils.registerProcessorAndGetId(processorData1); ZkUtils zkUtils1 = getZkUtils(); zkUtils1.connect(); ProcessorData duplicateProcessorData = new ProcessorData(testHostName, testProcessId); expectedException.expect(SamzaException.class); zkUtils1.registerProcessorAndGetId(duplicateProcessorData); }
Source:
public void testSearchOnChainedToken() { Patient patient = new Patient(); patient.setId("P"); patient.addIdentifier().setSystem("sys").setValue("val"); myPatientDao.update(patient); Observation obs = new Observation(); obs.setId("O"); obs.getSubject().setReference("Patient/P"); myObservationDao.update(obs); SearchParameterMap map = new SearchParameterMap(); map.setLoadSynchronous(true); map.add(Observation.SP_SUBJECT, new ReferenceParam("identifier", "sys|val")); myCaptureQueriesListener.clear(); IBundleProvider outcome = myObservationDao.search(map); assertThat(toUnqualifiedVersionlessIdValues(outcome), containsInAnyOrder("Observation/O")); assertEquals(2, myCaptureQueriesListener.countSelectQueriesForCurrentThread()); assertEquals(0, myCaptureQueriesListener.countInsertQueriesForCurrentThread()); assertEquals(0, myCaptureQueriesListener.countUpdateQueriesForCurrentThread()); assertEquals(0, myCaptureQueriesListener.countDeleteQueriesForCurrentThread()); myCaptureQueriesListener.logSelectQueriesForCurrentThread(); assertEquals(1, StringUtils.countMatches(myCaptureQueriesListener.getSelectQueriesForCurrentThread().get(0).getSql(true, true).toLowerCase(), "join")); }

Target:
public void testSearchOnChainedToken() { Patient patient = new Patient(); patient.setId("P"); patient.addIdentifier().setSystem("sys").setValue("val"); myPatientDao.update(patient); Observation obs = new Observation(); obs.setId("O"); obs.getSubject().setReference("Patient/P"); myObservationDao.update(obs); SearchParameterMap map = SearchParameterMap.newSynchronous(Observation.SP_SUBJECT, new ReferenceParam("identifier", "sys|val")); myCaptureQueriesListener.clear(); IBundleProvider outcome = myObservationDao.search(map); assertThat(toUnqualifiedVersionlessIdValues(outcome), containsInAnyOrder("Observation/O")); assertEquals(2, myCaptureQueriesListener.countSelectQueriesForCurrentThread()); assertEquals(0, myCaptureQueriesListener.countInsertQueriesForCurrentThread()); assertEquals(0, myCaptureQueriesListener.countUpdateQueriesForCurrentThread()); assertEquals(0, myCaptureQueriesListener.countDeleteQueriesForCurrentThread()); myCaptureQueriesListener.logSelectQueriesForCurrentThread(); assertEquals(1, StringUtils.countMatches(myCaptureQueriesListener.getSelectQueriesForCurrentThread().get(0).getSql(true, true).toLowerCase(), "join")); }
Source:
public int getLastChunkIndex() { int originalLineLength = originalLine.length(); int substitutedLineLength = substitutedLine.length(); if (originalLineLength == substitutedLineLength) return lastChunkIndex; else { return lastChunkIndex - (substitutedLineLength - originalLineLength); } }

Target:
public int getLastChunkIndex() { return lastChunkIndex - substitutedLine.length() + originalLine.length(); }
Source:
public ScanQuery( @JsonProperty("dataSource") DataSource dataSource, @JsonProperty("intervals") QuerySegmentSpec querySegmentSpec, @JsonProperty("resultFormat") String resultFormat, @JsonProperty("batchSize") int batchSize, @JsonProperty("limit") int limit, @JsonProperty("filter") DimFilter dimFilter, @JsonProperty("columns") List<String> columns, @JsonProperty("context") Map<String, Object> context ) { super(dataSource, querySegmentSpec, false, context); this.resultFormat = resultFormat; this.batchSize = (batchSize == 0) ? 4096 * 5 : batchSize; this.limit = (limit == 0) ? Integer.MAX_VALUE : limit; this.dimFilter = dimFilter; this.columns = columns; }

Target:
public ScanQuery( @JsonProperty("dataSource") DataSource dataSource, @JsonProperty("intervals") QuerySegmentSpec querySegmentSpec, @JsonProperty("resultFormat") String resultFormat, @JsonProperty("batchSize") int batchSize, @JsonProperty("limit") int limit, @JsonProperty("filter") DimFilter dimFilter, @JsonProperty("columns") List<String> columns, @JsonProperty("context") Map<String, Object> context ) { super(dataSource, querySegmentSpec, false, context); this.resultFormat = resultFormat == null ? RESULT_FORMAT_LIST : resultFormat; this.batchSize = (batchSize == 0) ? 4096 * 5 : batchSize; this.limit = (limit == 0) ? Integer.MAX_VALUE : limit; Preconditions.checkArgument(this.batchSize > 0, "batchSize must be greater than 0"); Preconditions.checkArgument(this.limit > 0, "limit must be greater than 0"); this.dimFilter = dimFilter; this.columns = columns; }
Source:
public boolean isTrue(State state, String[] params) { List<ObjectInstance> ingredients = state.getObjectsOfTrueClass(IngredientFactory.ClassNameComplex); boolean failed; boolean not_fail; for (ObjectInstance ingredient : ingredients) { failed = false; not_fail = false; for (BakingSubgoal sg : this.ing_subgoals) { IngredientRecipe goalIng = sg.getIngredient(); if (Recipe.isFailure(state, goalIng.makeFakeAttributeCopy(ingredient), ingredient)) { failed = true; } else { not_fail = true; } } if (failed && !not_fail) { return true; } } return false; }

Target:
public boolean isTrue(State state, String[] params) { List<ObjectInstance> ingredients = state.getObjectsOfTrueClass(IngredientFactory.ClassNameComplex); boolean failed; boolean notFail; for (ObjectInstance ingredient : ingredients) { failed = false; notFail = false; for (BakingSubgoal sg : this.ingSubgoals) { IngredientRecipe goalIng = sg.getIngredient(); if (Recipe.isFailure(state, goalIng.makeFakeAttributeCopy(ingredient), ingredient)) { failed = true; } else { notFail = true; } } if (failed && !notFail) { return true; } } return false; }
Source:
private JsonParserIterator<SegmentWithOvershadowedStatus> getMetadataSegments( DruidLeaderClient coordinatorClient, ObjectMapper jsonMapper, BytesAccumulatingResponseHandler responseHandler, Set<String> watchedDataSources ) { String query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus"; if (watchedDataSources != null && !watchedDataSources.isEmpty()) { log.debug( "filtering datasources in published segments based on broker's watchedDataSources[%s]", watchedDataSources); final StringBuilder sb = new StringBuilder(); for (String ds : watchedDataSources) { sb.append("datasources=").append(ds).append("&"); } sb.setLength(sb.length() - 1); query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus?" + sb; } Request request; try { request = coordinatorClient.makeRequest( HttpMethod.GET, StringUtils.format(query), false ); } catch (IOException e) { throw new RuntimeException(e); } ListenableFuture<InputStream> future = coordinatorClient.goAsync( request, responseHandler ); final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<SegmentWithOvershadowedStatus>() { }); return new JsonParserIterator<>( typeRef, future, request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper, responseHandler ); }

Target:
private JsonParserIterator<SegmentWithOvershadowedStatus> getMetadataSegments( DruidLeaderClient coordinatorClient, ObjectMapper jsonMapper, BytesAccumulatingResponseHandler responseHandler, Set<String> watchedDataSources ) { String query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus"; if (watchedDataSources != null && !watchedDataSources.isEmpty()) { log.debug( "filtering datasources in published segments based on broker's watchedDataSources[%s]", watchedDataSources); final StringBuilder sb = new StringBuilder(); for (String ds : watchedDataSources) { sb.append("datasources=").append(ds).append("&"); } sb.setLength(sb.length() - 1); query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus&" + sb; } Request request; try { request = coordinatorClient.makeRequest( HttpMethod.GET, StringUtils.format(query), false ); } catch (IOException e) { throw new RuntimeException(e); } ListenableFuture<InputStream> future = coordinatorClient.goAsync( request, responseHandler ); final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<SegmentWithOvershadowedStatus>() { }); return new JsonParserIterator<>( typeRef, future, request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper, responseHandler ); }
Source:
private List<HomeFeedbackSessionRow> createSessionRows(List<FeedbackSessionAttributes> sessions, InstructorAttributes instructor) { List<HomeFeedbackSessionRow> rows = new ArrayList<>(); int statsToDisplayLeft = MAX_CLOSED_SESSION_STATS; for (FeedbackSessionAttributes session : sessions) { boolean isRecent = session.isOpened() || session.isWaitingToOpen(); if (!isRecent && statsToDisplayLeft > 0 && !TimeHelper.isOlderThanAYear(session.getCreatedTime())) { isRecent = true; --statsToDisplayLeft; } InstructorHomeFeedbackSessionRow row = new InstructorHomeFeedbackSessionRow( sanitizeForHtml(session.getFeedbackSessionName()), getInstructorHoverMessageForFeedbackSession(session), getInstructorStatusForFeedbackSession(session), TimeHelper.formatDateTimeForInstructorHomePage(session.getStartTime()), session.getStartTimeString(), TimeHelper.formatDateTimeForInstructorHomePage(session.getEndTime()), session.getEndTimeString(), getInstructorFeedbackStatsLink(session.getCourseId(), session.getFeedbackSessionName()), isRecent, getInstructorFeedbackSessionActions( session, Const.ActionURIs.INSTRUCTOR_HOME_PAGE, instructor)); rows.add(row); } return rows; }

Target:
private List<HomeFeedbackSessionRow> createSessionRows(List<FeedbackSessionAttributes> sessions, InstructorAttributes instructor) { List<HomeFeedbackSessionRow> rows = new ArrayList<>(); int statsToDisplayLeft = MAX_CLOSED_SESSION_STATS; for (FeedbackSessionAttributes session : sessions) { boolean isRecent = session.isOpened() || session.isWaitingToOpen(); if (!isRecent && statsToDisplayLeft > 0 && !TimeHelper.isOlderThanAYear(session.getCreatedTime())) { isRecent = true; --statsToDisplayLeft; } InstructorHomeFeedbackSessionRow row = new InstructorHomeFeedbackSessionRow( sanitizeForHtml(session.getFeedbackSessionName()), getInstructorHoverMessageForFeedbackSession(session), getInstructorStatusForFeedbackSession(session), TimeHelper.formatDateTimeForInstructorHomePage(session.getStartTime()), TimeHelper.formatDateTimeForInstructorHomePage(session.getEndTime()), getInstructorFeedbackStatsLink(session.getCourseId(), session.getFeedbackSessionName()), isRecent, getInstructorFeedbackSessionActions( session, Const.ActionURIs.INSTRUCTOR_HOME_PAGE, instructor)); rows.add(row); } return rows; }
Source:
protected boolean triangleContains(float x, float y, float p1x, float p1y, float p2x, float p2y, float p3x, float p3y) { boolean b1, b2, b3; if (p1x == p2x && p2x == p3x && p1y == p2y && p2y == p3y){ return x == p1x && y == p2y; } b1 = sign(x, y, p1x, p1y, p2x, p2y) < 0.0f; b2 = sign(x, y, p2x, p2y, p3x, p3y) < 0.0f; b3 = sign(x, y, p3x, p3y, p1x, p1y) < 0.0f; return ((b1 == b2) && (b2 == b3)); }

Target:
protected boolean triangleContains(float x, float y, float p1x, float p1y, float p2x, float p2y, float p3x, float p3y) { boolean b1, b2, b3; if (MathUtils.isEqual(p1x, p2x) && MathUtils.isEqual(p2x, p3x) && MathUtils.isEqual(p1y, p2y) && MathUtils.isEqual(p2y, p3y)){ return MathUtils.isEqual(x, p1x) && MathUtils.isEqual(y, p1y); } b1 = sign(x, y, p1x, p1y, p2x, p2y) < 0.0f; b2 = sign(x, y, p2x, p2y, p3x, p3y) < 0.0f; b3 = sign(x, y, p3x, p3y, p1x, p1y) < 0.0f; return ((b1 == b2) && (b2 == b3)); }
Source:
private Expression translateParameter(RexDynamicParam expr, RexImpTable.NullAs nullAs, Type storageType) { if (storageType == null) { storageType = typeFactory.getJavaClass(expr.getType()); } Expression expression = Expressions.call(root, BuiltInMethod.DATA_CONTEXT_GET.method, Expressions.constant("?" + expr.getIndex())); Set<SqlTypeName> toIntegerTypes = Sets.newHashSet( DATE, TIME, TIME_WITH_LOCAL_TIME_ZONE, INTERVAL_YEAR, INTERVAL_YEAR_MONTH, INTERVAL_MONTH); Expression midExpress = expression; if (toIntegerTypes.contains(expr.getType().getSqlTypeName())) { SqlTypeName t = expr.getType().getSqlTypeName(); switch (t) { case DATE: midExpress = Expressions.call( BuiltInMethod.STRING_TO_DATE_ALLOW_NULLABLE.method, convert(expression, String.class)); break; case TIME: midExpress = Expressions.call( BuiltInMethod.STRING_TO_TIME_ALLOW_NULLABLE.method, convert(expression, String.class)); break; default: } } return nullAs.handle(convert(midExpress, storageType)); }

Target:
private Expression translateParameter(RexDynamicParam expr, RexImpTable.NullAs nullAs, Type storageType) { if (storageType == null) { storageType = typeFactory.getJavaClass(expr.getType()); } Expression expression = Expressions.call(root, BuiltInMethod.DATA_CONTEXT_GET.method, Expressions.constant("?" + expr.getIndex())); Expression midExpress = expression; if (NEED_TO_CONVERT_TYPES_FOR_DYNAMIC_PARAM.contains(expr.getType().getSqlTypeName())) { SqlTypeName t = expr.getType().getSqlTypeName(); switch (t) { case DATE: midExpress = Expressions.call( BuiltInMethod.STRING_TO_DATE_ALLOW_NULLABLE.method, convert(expression, String.class)); break; case TIME: midExpress = Expressions.call( BuiltInMethod.STRING_TO_TIME_ALLOW_NULLABLE.method, convert(expression, String.class)); break; case INTEGER: midExpress = Expressions.call(BuiltInMethod.STRING_TO_INTEGER.method, convert(expression, String.class)); break; case TINYINT: midExpress = Expressions.call(BuiltInMethod.STRING_TO_BYTE.method, convert(expression, String.class)); break; case SMALLINT: midExpress = Expressions.call(BuiltInMethod.STRING_TO_SHORT.method, convert(expression, String.class)); break; case BIGINT: midExpress = Expressions.call(BuiltInMethod.STRING_TO_LONG.method, convert(expression, String.class)); break; case FLOAT: midExpress = Expressions.call(BuiltInMethod.STRING_TO_FLOAT.method, convert(expression, String.class)); break; case DOUBLE: midExpress = Expressions.call(BuiltInMethod.STRING_TO_DOUBLE.method, convert(expression, String.class)); break; case BOOLEAN: midExpress = Expressions.call(BuiltInMethod.STRING_TO_BOOLEAN.method, convert(expression, String.class)); break; default: } } return nullAs.handle(convert(midExpress, storageType)); }
Source:
public void setUp() { semanticModel = SETestUtils.getSemanticModel("src/test/files/se/annotations/NullableAnnotationUtils.java"); }

Target:
public static void setUp() { semanticModel = SETestUtils.getSemanticModel("src/test/files/se/annotations/NullableAnnotationUtils.java"); }
Source:
public CharSequence toXML() { XmlStringBuilder xml = new XmlStringBuilder(); xml.openElement("always"); for (Jid jid : alwaysJids) { xml.element("jid", jid.toString()); } xml.closeElement("always"); return xml; }

Target:
public CharSequence toXML() { XmlStringBuilder xml = new XmlStringBuilder(); xml.openElement("always"); for (Jid jid : alwaysJids) { xml.element("jid", jid); } xml.closeElement("always"); return xml; }
Source:
public void testBug503035_1() { IGraph<String> graph = getBug503035_cyclicGraph_1(); Iterator<String> it = graph.breadthFirstIterator(); assertEquals("A", it.next()); assertTrue(it.hasNext()); assertEquals("B", it.next()); assertEquals("C", it.next()); assertFalse(it.hasNext()); }

Target:
public void testBug503035_1() { IGraph<String> graph = new Graph<String>(); graph.addChildren("A", ImmutableSet.of("B", "C")); graph.addChildren("B", ImmutableSet.of("C")); graph.addChildren("C", ImmutableSet.of("B")); Iterator<String> it = graph.breadthFirstIterator(); assertEquals("A", it.next()); assertTrue(it.hasNext()); assertEquals("B", it.next()); assertEquals("C", it.next()); assertFalse(it.hasNext()); }
Source:
private Response cloneVmFromTemplate(VmStatic staticVm, VM vm, Guid templateId) { AddVmFromTemplateParameters params = new AddVmFromTemplateParameters(staticVm, getDisksToClone(vm.getDisks(), templateId), Guid.Empty); params.setVmPayload(getPayload(vm)); if (vm.isSetMemoryPolicy() && vm.getMemoryPolicy().isSetBallooning()) { params.setBalloonEnabled(vm.getMemoryPolicy().isBallooning()); } if (vm.isSetConsoleDeviceEnabled()) { params.setConsoleEnabled(vm.isConsoleDeviceEnabled()); } params.setMakeCreatorExplicitOwner(shouldMakeCreatorExplicitOwner()); return performCreate(VdcActionType.AddVmFromTemplate, params, new QueryIdResolver<Guid>(VdcQueryType.GetVmByVmId, IdQueryParameters.class)); }

Target:
private Response cloneVmFromTemplate(VmStatic staticVm, VM vm, Guid templateId) { AddVmFromTemplateParameters params = new AddVmFromTemplateParameters(staticVm, getDisksToClone(vm.getDisks(), templateId), Guid.Empty); params.setVmPayload(getPayload(vm)); if (vm.isSetMemoryPolicy() && vm.getMemoryPolicy().isSetBallooning()) { params.setBalloonEnabled(vm.getMemoryPolicy().isBallooning()); } params.setConsoleEnabled(vm.isSetConsole() && vm.getConsole().isSetEnabled() ? vm.getConsole().isEnabled() : !getConsoleDevicesForEntity(templateId).isEmpty()); params.setMakeCreatorExplicitOwner(shouldMakeCreatorExplicitOwner()); return performCreate(VdcActionType.AddVmFromTemplate, params, new QueryIdResolver<Guid>(VdcQueryType.GetVmByVmId, IdQueryParameters.class)); }
Source:
public OutputStream call() throws IOException { File f = File.createTempFile(filename, ""); System.err.println("Creating: " + f); return new RemoteOutputStream(new FileOutputStream(f)); }

Target:
public OutputStream call() throws IOException { Path path = Files.createFile(Paths.get(System.getProperty("java.io.tmpdir"), filename)); System.err.println("Creating: " + path); return new RemoteOutputStream(new FileOutputStream(path.toFile())); }
Source:
private double calculateTotalCost (List<Integer> books,double priceSoFar ){ double minPrice = Double.MAX_VALUE; if(books.size() == 0) return priceSoFar; List<Integer> groups = (ArrayList<Integer>) books.stream().distinct().collect(Collectors.toList()); double price = 0; for(int i = 0;i<groups.size();i++){ books.remove(groups.get(i)); } try { price = calculateTotalCost(books,priceSoFar + costPerGroup(groups.size())); } catch (Exception e) { e.printStackTrace(); } minPrice = Math.min(minPrice, price); return minPrice; }

Target:
private double calculateTotalCost (List<Integer> books,double priceSoFar ){ double minPrice = Double.MAX_VALUE; if(books.size() == 0){ return priceSoFar; } List<Integer> groups = (ArrayList<Integer>) books.stream().distinct().collect(Collectors.toList()); double price = 0; for(int i = 0;i<groups.size();i++){ books.remove(groups.get(i)); } try { price = calculateTotalCost(books,priceSoFar + costPerGroup(groups.size())); } catch (Exception e) { e.printStackTrace(); } minPrice = Math.min(minPrice, price); return minPrice; }
Source:
public List<K> getKeys(V value) { final List<K> listOfKey = reverseCache.get(value); if (listOfKey == null) { reverseCache.put(value, Collections.<K>emptyList()); return Collections.emptyList(); } return listOfKey; }

Target:
public List<K> getKeys(V value) { final List<K> listOfKey = reverseCache.get(value); if (listOfKey == null) { return Collections.emptyList(); } return listOfKey; }
Source:
private String computeLabel(StoragePathAdapter adapter) { String computedLabel = ""; if (adapter != null) { String commitId = adapter.getCommitId(); String username = adapter.getUsername(); if (adapter.isLocal()) { computedLabel = "Local: " + adapter.getStoragePath(); } else { computedLabel = adapter.getStoragePath(); } if (commitId != null && !"".equals(commitId)) { if (commitId.length() > 7) { commitId = commitId.substring(0, 7); } computedLabel += " " + commitId; } if (username != null && !"".equals(username)) { computedLabel += " (" + username + ")"; } } return computedLabel; }

Target:
private String computeLabel(StoragePathAdapter adapter) { String computedLabel = ""; if (adapter != null) { String commitId = adapter.getCommitId(); String username = adapter.getUsername(); if (adapter.isLocal()) { computedLabel = "Local: " + adapter.getStoragePath(); } else { computedLabel = adapter.getStoragePath(); } if (commitId != null) { if (commitId.length() > 7) { commitId = commitId.substring(0, 7); } computedLabel = String.format("%s %s", computedLabel, commitId).trim(); } if (username != null && !"".equals(username)) { computedLabel += " (" + username + ")"; } } return computedLabel; }
Source:
public void updatePersonAddress(Config config, String uuid, Person.Address address) { String requestJson = buildGson().toJson(address); postWithEmptyResponseBody(config, requestJson, "/person/{personUuid}/address/{addressUuid}?v=full", uuid, address.getUuid()); }

Target:
public void updatePersonAddress(Config config, String uuid, Person.Address address) { String requestJson = buildGson().toJson(address); postWithEmptyResponseBody(config, requestJson, "/person/{personUuid}/address/{addressUuid}", uuid, address.getUuid()); }
Source:
public void testTimeseriesWithBetweenFilter1() { TimeseriesQuery query = Druids.newTimeseriesQueryBuilder() .dataSource(QueryRunnerTestHelper.dataSource) .granularity(QueryRunnerTestHelper.dayGran) .filters( new AndDimFilter( Arrays.asList( new BetweenDimFilter( QueryRunnerTestHelper.marketDimension, "spa", "spot", true, null, null ), new BetweenDimFilter( QueryRunnerTestHelper.marketDimension, "spot", "spotify", null, true, null ), (DimFilter) new BetweenDimFilter( QueryRunnerTestHelper.marketDimension, "SPOT", "spot", null, null, null ) ) ) ) .intervals(QueryRunnerTestHelper.firstToThird) .aggregators( Arrays.<AggregatorFactory>asList( QueryRunnerTestHelper.rowsCount, QueryRunnerTestHelper.indexLongSum, QueryRunnerTestHelper.qualityUniques ) ) .postAggregators(Arrays.<PostAggregator>asList(QueryRunnerTestHelper.addRowsIndexConstant)) .build(); List<Result<TimeseriesResultValue>> expectedResults = Arrays.asList( new Result<>( new DateTime("2011-04-01"), new TimeseriesResultValue( ImmutableMap.<String, Object>of( "rows", 9L, "index", 1102L, "addRowsIndexConstant", 1112.0, "uniques", QueryRunnerTestHelper.UNIQUES_9 ) ) ), new Result<>( new DateTime("2011-04-02"), new TimeseriesResultValue( ImmutableMap.<String, Object>of( "rows", 9L, "index", 1120L, "addRowsIndexConstant", 1130.0, "uniques", QueryRunnerTestHelper.UNIQUES_9 ) ) ) ); Iterable<Result<TimeseriesResultValue>> results = Sequences.toList( runner.run(query, CONTEXT), Lists.<Result<TimeseriesResultValue>>newArrayList() ); TestHelper.assertExpectedResults(expectedResults, results); }

Target:
public void testTimeseriesWithBetweenFilter1() { TimeseriesQuery query = Druids.newTimeseriesQueryBuilder() .dataSource(QueryRunnerTestHelper.dataSource) .granularity(QueryRunnerTestHelper.dayGran) .filters( new AndDimFilter( Arrays.asList( new BoundDimFilter( QueryRunnerTestHelper.marketDimension, "spa", "spot", true, null, null ), new BoundDimFilter( QueryRunnerTestHelper.marketDimension, "spot", "spotify", null, true, null ), (DimFilter) new BoundDimFilter( QueryRunnerTestHelper.marketDimension, "SPOT", "spot", null, null, null ) ) ) ) .intervals(QueryRunnerTestHelper.firstToThird) .aggregators( Arrays.<AggregatorFactory>asList( QueryRunnerTestHelper.rowsCount, QueryRunnerTestHelper.indexLongSum, QueryRunnerTestHelper.qualityUniques ) ) .postAggregators(Arrays.<PostAggregator>asList(QueryRunnerTestHelper.addRowsIndexConstant)) .build(); List<Result<TimeseriesResultValue>> expectedResults = Arrays.asList( new Result<>( new DateTime("2011-04-01"), new TimeseriesResultValue( ImmutableMap.<String, Object>of( "rows", 9L, "index", 1102L, "addRowsIndexConstant", 1112.0, "uniques", QueryRunnerTestHelper.UNIQUES_9 ) ) ), new Result<>( new DateTime("2011-04-02"), new TimeseriesResultValue( ImmutableMap.<String, Object>of( "rows", 9L, "index", 1120L, "addRowsIndexConstant", 1130.0, "uniques", QueryRunnerTestHelper.UNIQUES_9 ) ) ) ); Iterable<Result<TimeseriesResultValue>> results = Sequences.toList( runner.run(query, CONTEXT), Lists.<Result<TimeseriesResultValue>>newArrayList() ); TestHelper.assertExpectedResults(expectedResults, results); }
Source:
private void checkCollection(Supplier<Collection<Ignite>> s) { Ignite srv = grid(SRV); Ignite clnt = grid(CLNT); clnt.compute(clnt.cluster().forNodeId(srv.cluster().localNode().id())) .broadcast(() -> { Collection<Ignite> nodes = s.get(); for (Ignite node : nodes) { assertTrue(Proxy.isProxyClass(node.getClass())); assertFalse(node instanceof IgniteEx); } }); Collection<Ignite> nodes = s.get(); for (Ignite node : nodes) { assertFalse(Proxy.isProxyClass(node.getClass())); assertTrue(node instanceof IgniteEx); } }

Target:
private void checkCollection(Supplier<Collection<Ignite>> s) { Ignite srv = grid(SRV); Ignite clnt = grid(CLNT); clnt.compute(clnt.cluster().forNodeId(srv.cluster().localNode().id())) .broadcast(() -> { Collection<Ignite> nodes = s.get(); for (Ignite node : nodes) { node.compute().call(() -> true); } }); }