auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
ConditionalReplaceOperation(final ByteBuffer buffer, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) { OperationCode opCode = OperationCode.valueOf(buffer.get()); validateOperation(opCode); int keySize = buffer.getInt(); buffer.limit(buffer.position() + keySize); ByteBuffer keyBlob = buffer.slice(); buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); int oldValueSize = buffer.getInt(); buffer.limit(buffer.position() + oldValueSize); ByteBuffer oldValueBlob = buffer.slice(); buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); ByteBuffer valueBlob = buffer.slice(); try { this.key = keySerializer.read(keyBlob); this.value = valueSerializer.read(valueBlob); this.oldValue = valueSerializer.read(oldValueBlob); } catch (ClassNotFoundException e) { throw new CodecException(e); } }

Target:
ConditionalReplaceOperation(final ByteBuffer buffer, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) { OperationCode opCode = OperationCode.valueOf(buffer.get()); if (opCode != getOpCode()) { throw new IllegalArgumentException("Invalid operation: " + opCode); } int keySize = buffer.getInt(); buffer.limit(buffer.position() + keySize); ByteBuffer keyBlob = buffer.slice(); buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); int oldValueSize = buffer.getInt(); buffer.limit(buffer.position() + oldValueSize); ByteBuffer oldValueBlob = buffer.slice(); buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); ByteBuffer valueBlob = buffer.slice(); try { this.key = keySerializer.read(keyBlob); this.oldValue = valueSerializer.read(oldValueBlob); this.newValue = valueSerializer.read(valueBlob); } catch (ClassNotFoundException e) { throw new CodecException(e); } }
Source:
public void shouldGetOnlyNonEmptyCategories() { Set<ApiEntity> mockApis = new HashSet<>(); doReturn(mockApis).when(apiService).findPublishedByUser(any()); existingCategories.stream() .forEach(c -> { switch (c.getId()) { case "1": { doReturn(1L).when(categoryService).getTotalApisByCategory(mockApis, c) ; break; } default: { doReturn(0L).when(categoryService).getTotalApisByCategory(mockApis, c) ; break; } } }); final Response response = target().request().get(); assertEquals(HttpStatusCode.OK_200, response.getStatus()); Mockito.verify(apiService).findPublishedByUser(any()); CategoriesResponse categoriesResponse = response.readEntity(CategoriesResponse.class); assertEquals(1, categoriesResponse.getData().size()); }

Target:
public void shouldGetOnlyNonEmptyCategories() { final Response response = target().request().get(); assertEquals(HttpStatusCode.OK_200, response.getStatus()); Mockito.verify(apiService).findPublishedByUser(any()); CategoriesResponse categoriesResponse = response.readEntity(CategoriesResponse.class); assertEquals(1, categoriesResponse.getData().size()); }
Source:
public static void validateServerId(long serverId) { if ( extendedEphemeralTypesEnabled() ) { if (serverId > EphemeralType.MAX_TTL_SERVER_ID) { throw new RuntimeException("extendedTypesEnabled is true but Server ID is too large. Cannot be larger than " + EphemeralType.MAX_TTL_SERVER_ID); } } }

Target:
public static void validateServerId(long serverId) { if (extendedEphemeralTypesEnabled()) { if (serverId > EphemeralType.MAX_EXTENDED_SERVER_ID) { throw new RuntimeException("extendedTypesEnabled is true but Server ID is too large. Cannot be larger than " + EphemeralType.MAX_EXTENDED_SERVER_ID); } } }
Source:
public Value getValue(Session session) { Value l = left.getValue(session); if (l == ValueNull.INSTANCE) { return l; } int size = valueList.size(); if (size == 1) { Expression e = valueList.get(0); if (e instanceof TableFunction) { return ConditionInParameter.getValue(database, l, e.getValue(session)); } } boolean hasNull = false; for (int i = 0; i < size; i++) { Expression e = valueList.get(i); Value r = e.getValue(session); Value cmp; if (r == ValueNull.INSTANCE || (cmp = Comparison.compareNotNull(database, l, r, Comparison.EQUAL)) == ValueNull.INSTANCE) { hasNull = true; } else if (cmp == ValueBoolean.TRUE) { return cmp; } } if (hasNull) { return ValueNull.INSTANCE; } return ValueBoolean.FALSE; }

Target:
public Value getValue(Session session) { Value l = left.getValue(session); if (l.containsNull()) { return ValueNull.INSTANCE; } int size = valueList.size(); if (size == 1) { Expression e = valueList.get(0); if (e instanceof TableFunction) { return ConditionInParameter.getValue(database, l, e.getValue(session)); } } boolean hasNull = false; for (int i = 0; i < size; i++) { Expression e = valueList.get(i); Value r = e.getValue(session); Value cmp = Comparison.compare(database, l, r, Comparison.EQUAL); if (cmp == ValueNull.INSTANCE) { hasNull = true; } else if (cmp == ValueBoolean.TRUE) { return cmp; } } if (hasNull) { return ValueNull.INSTANCE; } return ValueBoolean.FALSE; }
Source:
public void testSymlinkPutHidden() throws Exception { if (!isAttributeSupported(EFS.ATTRIBUTE_HIDDEN)) return; if (!canCreateSymLinks()) return; makeLinkStructure(); illFile.setAttribute(EFS.ATTRIBUTE_HIDDEN, true); llFile.putInfo(illFile, EFS.SET_ATTRIBUTES, getMonitor()); illFile = llFile.fetchInfo(); assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_HIDDEN)); illDir.setAttribute(EFS.ATTRIBUTE_HIDDEN, true); llDir.putInfo(illDir, EFS.SET_ATTRIBUTES, getMonitor()); illDir = llDir.fetchInfo(); assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_HIDDEN)); illFile = llFile.fetchInfo(); illDir = llDir.fetchInfo(); assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lFile"); assertEquals(illDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lDir"); }

Target:
public void testSymlinkPutHidden() throws Exception { if (!isAttributeSupported(EFS.ATTRIBUTE_HIDDEN)) return; if (!canCreateSymLinks()) return; makeLinkStructure(); illFile.setAttribute(EFS.ATTRIBUTE_HIDDEN, true); llFile.putInfo(illFile, EFS.SET_ATTRIBUTES, getMonitor()); illFile = llFile.fetchInfo(); assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_HIDDEN)); iFile = aFile.fetchInfo(); assertFalse(iFile.getAttribute(EFS.ATTRIBUTE_HIDDEN)); illDir.setAttribute(EFS.ATTRIBUTE_HIDDEN, true); llDir.putInfo(illDir, EFS.SET_ATTRIBUTES, getMonitor()); illDir = llDir.fetchInfo(); assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_HIDDEN)); iDir = aDir.fetchInfo(); assertFalse(iDir.getAttribute(EFS.ATTRIBUTE_HIDDEN)); illFile = llFile.fetchInfo(); illDir = llDir.fetchInfo(); assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lFile"); assertEquals(illDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lDir"); }
Source:
private boolean valueCompare(Object actual, String operator, Object expected) { boolean passed; if (operator.equals("$eq") || operator.equals("$in")) { passed = compareEq(actual, expected); } else if (operator.equals("$lt")) { passed = compareLT(actual, expected); } else if (operator.equals("$lte")) { passed = compareLTE(actual, expected); } else if (operator.equals("$gt")) { passed = compareGT(actual, expected); } else if (operator.equals("$gte")) { passed = compareGTE(actual, expected); } else if (operator.equals("$exists")) { boolean expectedBool = (Boolean) expected; boolean exists = (actual != null); passed = (exists == expectedBool); } else { String msg = String.format("Found unexpected operator in selector: %s", operator); logger.log(Level.WARNING, msg); passed = false; } return passed; }

Target:
private boolean valueCompare(Object actual, String operator, Object expected) { boolean passed; if (operator.equals(EQ)) { passed = compareEq(actual, expected); } else if (operator.equals(LT)) { passed = compareLT(actual, expected); } else if (operator.equals(LTE)) { passed = compareLTE(actual, expected); } else if (operator.equals(GT)) { passed = compareGT(actual, expected); } else if (operator.equals(GTE)) { passed = compareGTE(actual, expected); } else if (operator.equals(EXISTS)) { boolean expectedBool = (Boolean) expected; boolean exists = (actual != null); passed = (exists == expectedBool); } else { String msg = String.format("Found unexpected operator in selector: %s", operator); logger.log(Level.WARNING, msg); passed = false; } return passed; }
Source:
public EnterXMPPAccountComposite(Composite composite, int style) { super(composite, style); super.setLayout(new GridLayout(2, false)); SarosPluginContext.initComponent(this); Label jidLabel = new Label(this, SWT.NONE); jidLabel.setText(Messages.jid_shortform); Combo combo = new Combo(this, SWT.BORDER); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); this.jidCombo = new JIDCombo(combo); Label passwordLabel = new Label(this, SWT.NONE); passwordLabel.setText("Password"); passwordText = new Text(this, SWT.BORDER); passwordText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); passwordText.setEchoChar('*'); new Label(this, SWT.NONE); serverOptionsExpandableComposite = new ExpandableComposite( this, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); serverOptionsExpandableComposite.setText("Advanced Options"); serverOptionsExpandableComposite.addExpansionListener( new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { getParent().layout(); } }); createServerExpandableCompositeContent(); if (CreateXMPPAccountWizard.CREATE_DIALOG_ENABLED) { createAccountButton = new Button(this, SWT.PUSH); createAccountButton.setText(Messages.ConfigurationWizard_button_create_account); } hookListeners(); }

Target:
public EnterXMPPAccountComposite(Composite composite, int style) { super(composite, style); super.setLayout(new GridLayout(2, false)); SarosPluginContext.initComponent(this); Label jidLabel = new Label(this, SWT.NONE); jidLabel.setText(Messages.jid_shortform); Combo combo = new Combo(this, SWT.BORDER); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); this.jidCombo = new JIDCombo(combo); Label passwordLabel = new Label(this, SWT.NONE); passwordLabel.setText("Password"); passwordText = new Text(this, SWT.BORDER); passwordText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); passwordText.setEchoChar('*'); new Label(this, SWT.NONE); serverOptionsExpandableComposite = new ExpandableComposite( this, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); serverOptionsExpandableComposite.setText("Advanced Options"); serverOptionsExpandableComposite.addExpansionListener( new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { getParent().layout(); } }); createServerExpandableCompositeContent(); createAccountButton = new Button(this, SWT.PUSH); createAccountButton.setText(Messages.ConfigurationWizard_button_create_account); createAccountButton.setVisible(CreateXMPPAccountWizard.CREATE_DIALOG_ENABLED); hookListeners(); }
Source:
private boolean hasSnappableDisks() { getDisksBasedOnImage(); return !disksImages.isEmpty(); }

Target:
private boolean hasSnappableDisks() { return !getDisksBasedOnImage().isEmpty(); }
Source:
private Duration determineDelayDuration(HttpResponse response, int tryCount) { int code = response.getStatusCode(); if (code != 429 && code != 503) { return retryStrategy.calculateRetryDelay(tryCount); } return retryStrategy.calculateRetryDelay(response, tryCount); }

Target:
private Duration determineDelayDuration(HttpResponse response, int tryCount) { int code = response.getStatusCode(); if (code != 429 && code != 503) { return retryStrategy.calculateRetryDelay(tryCount); } String retryHeaderValue = null; if (!isNullOrEmpty(this.retryAfterHeader)) { retryHeaderValue = response.getHeaderValue(this.retryAfterHeader); } if (isNullOrEmpty(retryHeaderValue)) { return this.retryStrategy.calculateRetryDelay(tryCount); } return Duration.of(Integer.parseInt(retryHeaderValue), this.retryAfterTimeUnit); }
Source:
private Organization stubOrgObject() { String markdownDescription = "An h1 header ============ Paragraphs are separated by a blank line. 2nd paragraph. *Italic*, **bold**, and `monospace`. Itemized lists look like: * this one * that one * the other one Note that --- not considering the asterisk --- the actual text content starts at 4-columns in. > Block quotes are > written like so. > > They can span multiple paragraphs, > if you like. Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., \"it's all in chapters 12--14\"). Three dots ... will be converted to an ellipsis. Unicode is supported. ☺ "; Organization organization = new Organization(); organization.setName("testname"); organization.setDisplayName("test name"); organization.setLocation("testlocation"); organization.setLink("<LINK_1>"); organization.setEmail("test@email.com"); organization.setDescription(markdownDescription); organization.setTopic("his is a short topic"); organization.setAvatarUrl("<LINK_0>"); return organization; }

Target:
private Organization stubOrgObject() { String markdownDescription = "An h1 header ============ Paragraphs are separated by a blank line. 2nd paragraph. *Italic*, **bold**, and `monospace`. Itemized lists look like: * this one * that one * the other one Note that --- not considering the asterisk --- the actual text content starts at 4-columns in. > Block quotes are > written like so. > > They can span multiple paragraphs, > if you like. Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., \"it's all in chapters 12--14\"). Three dots ... will be converted to an ellipsis. Unicode is supported. ☺ "; Organization organization = new Organization(); organization.setName("testname"); organization.setDisplayName("test name"); organization.setLocation("testlocation"); organization.setLink("<LINK_1>"); organization.setEmail("test@email.com"); organization.setDescription(markdownDescription); organization.setTopic("This is a short topic"); organization.setAvatarUrl("<LINK_0>"); return organization; }
Source:
public boolean hasMultipleValues(final String dimension) { if (isVirtualColumn(dimension)) { return virtualColumns.getVirtualColumn(dimension).capabilities(dimension).hasMultipleValues().isMaybeTrue(); } final ColumnHolder columnHolder = index.getColumnHolder(dimension); return columnHolder != null && columnHolder.getCapabilities().hasMultipleValues().isMaybeTrue(); }

Target:
public ColumnCapabilities.Capable hasMultipleValues(final String dimension) { if (isVirtualColumn(dimension)) { return virtualColumns.getVirtualColumn(dimension).capabilities(dimension).hasMultipleValues(); } final ColumnHolder columnHolder = index.getColumnHolder(dimension); return columnHolder != null ? columnHolder.getCapabilities().hasMultipleValues() : ColumnCapabilities.Capable.FALSE; }
Source:
protected void executeCommand() { VM vm = getVm(); if (vm.getVdsGroupId().equals(getParameters().getClusterId())) { setSucceeded(true); return; } List<Network> networks = getNetworkDao().getAllForCluster(getParameters().getClusterId()); List<VmNic> interfaces = getVmNicDao().getAllForVm(getParameters().getVmId()); for (final VmNic iface : interfaces) { if (iface.getVnicProfileId() != null) { Network network = NetworkHelper.getNetworkByVnicProfileId(iface.getVnicProfileId()); Optional<Network> net = networks.stream() .filter(x -> ObjectUtils.equals(x.getId(), network.getId())) .findFirst(); if (!net.isPresent()) { iface.setVnicProfileId(null); getVmNicDao().update(iface); } } } if (vm.getDedicatedVmForVdsList().size() > 0) { vm.setDedicatedVmForVdsList(Collections.<Guid>emptyList()); dedicatedHostWasCleared = true; } vm.setCpuProfileId(null); vm.setVdsGroupId(getParameters().getClusterId()); DbFacade.getInstance().getVmStaticDao().update(vm.getStaticData()); List<AffinityGroup> allAffinityGroupsByVmId = DbFacade.getInstance().getAffinityGroupDao().getAllAffinityGroupsByVmId(vm.getId()); if (!allAffinityGroupsByVmId.isEmpty()) { StringBuilder sb = new StringBuilder(); for (AffinityGroup affinityGroup : allAffinityGroupsByVmId) { sb.append(affinityGroup.getName() + " "); } log.info("Due to cluster change, removing VM from associated affinity group(s): {}", sb); DbFacade.getInstance().getAffinityGroupDao().removeVmFromAffinityGroups(vm.getId()); } setSucceeded(true); }

Target:
protected void executeCommand() { VM vm = getVm(); if (vm.getVdsGroupId().equals(getParameters().getClusterId())) { setSucceeded(true); return; } List<Network> networks = getNetworkDao().getAllForCluster(getParameters().getClusterId()); List<VmNic> interfaces = getVmNicDao().getAllForVm(getParameters().getVmId()); for (final VmNic iface : interfaces) { if (iface.getVnicProfileId() != null) { Network network = NetworkHelper.getNetworkByVnicProfileId(iface.getVnicProfileId()); boolean networkExistsInCluster = networks.stream() .anyMatch(x -> Objects.equals(x.getId(), network.getId())); if (!networkExistsInCluster) { iface.setVnicProfileId(null); getVmNicDao().update(iface); } } } if (vm.getDedicatedVmForVdsList().size() > 0) { vm.setDedicatedVmForVdsList(Collections.<Guid>emptyList()); dedicatedHostWasCleared = true; } vm.setCpuProfileId(null); vm.setVdsGroupId(getParameters().getClusterId()); DbFacade.getInstance().getVmStaticDao().update(vm.getStaticData()); List<AffinityGroup> allAffinityGroupsByVmId = DbFacade.getInstance().getAffinityGroupDao().getAllAffinityGroupsByVmId(vm.getId()); if (!allAffinityGroupsByVmId.isEmpty()) { StringBuilder sb = new StringBuilder(); for (AffinityGroup affinityGroup : allAffinityGroupsByVmId) { sb.append(affinityGroup.getName() + " "); } log.info("Due to cluster change, removing VM from associated affinity group(s): {}", sb); DbFacade.getInstance().getAffinityGroupDao().removeVmFromAffinityGroups(vm.getId()); } setSucceeded(true); }
Source:
public DocumentModel getEntry(String entryId, EntrySource source, boolean fetchReferences) throws DirectoryException { if (!isCacheEnabled()) { return source.getEntryFromSource(entryId, fetchReferences); } else if (isCacheEnabled() && (getEntryCache() == null || getEntryCacheWithoutReferences() == null)) { if (log.isDebugEnabled()) { if (getEntryCache() == null) { log.debug(String.format( "The cache for entry is undefined for directory '%s', '%s' will be created with the default cache configuration", name, entryCacheName)); } if (getEntryCacheWithoutReferences() == null) { log.debug(String.format( "The cache for entry without references is undefined for directory '%s', '%s' will be created with the default cache configuration", name, entryCacheWithoutReferencesName)); } } return source.getEntryFromSource(entryId, fetchReferences); } Cache cache = fetchReferences ? getEntryCache() : getEntryCacheWithoutReferences(); Serializable entry = cache.get(entryId); if (CACHE_MISS.equals(entry)) { negativeHitsCounter.inc(); return null; } DocumentModel dm = (DocumentModel) entry; if (dm == null) { dm = source.getEntryFromSource(entryId, fetchReferences); if (dm != null) { cache.put(entryId, dm); if (fetchReferences) { sizeCounter.inc(); } } else if (negativeCaching) { cache.put(entryId, CACHE_MISS); } missesCounter.inc(); } else { hitsCounter.inc(); } try { if (dm == null) { return null; } DocumentModel clone = dm.clone(); if (BaseSession.isReadOnlyEntry(dm)) { BaseSession.setReadOnlyEntry(clone); } return clone; } catch (CloneNotSupportedException e) { return dm; } }

Target:
public DocumentModel getEntry(String entryId, EntrySource source, boolean fetchReferences) throws DirectoryException { if (!isCacheEnabled()) { return source.getEntryFromSource(entryId, fetchReferences); } else if (isCacheEnabled() && (getEntryCache() == null || getEntryCacheWithoutReferences() == null)) { if (log.isDebugEnabled()) { if (getEntryCache() == null) { log.debug(String.format( "The cache '%s' is undefined for directory '%s', it will be created with the default cache configuration", entryCacheName, name)); } if (getEntryCacheWithoutReferences() == null) { log.debug(String.format( "The cache '%s' is undefined for directory '%s', it will be created with the default cache configuration", entryCacheWithoutReferencesName, name)); } } return source.getEntryFromSource(entryId, fetchReferences); } Cache cache = fetchReferences ? getEntryCache() : getEntryCacheWithoutReferences(); Serializable entry = cache.get(entryId); if (CACHE_MISS.equals(entry)) { negativeHitsCounter.inc(); return null; } DocumentModel dm = (DocumentModel) entry; if (dm == null) { dm = source.getEntryFromSource(entryId, fetchReferences); if (dm != null) { cache.put(entryId, dm); if (fetchReferences) { sizeCounter.inc(); } } else if (negativeCaching) { cache.put(entryId, CACHE_MISS); } missesCounter.inc(); } else { hitsCounter.inc(); } try { if (dm == null) { return null; } DocumentModel clone = dm.clone(); if (BaseSession.isReadOnlyEntry(dm)) { BaseSession.setReadOnlyEntry(clone); } return clone; } catch (CloneNotSupportedException e) { return dm; } }
Source:
private List<String> dbTablePK(DatabaseMetaData meta, String tableName) throws OrmException, SQLException { ResultSet cols = meta.getPrimaryKeys(null, null, tableName.toUpperCase()); try { Map<Short, String> seqToName = new TreeMap<>(); while (cols.next()) { seqToName.put(cols.getShort("KEY_SEQ"), cols.getString("COLUMN_NAME")); } List<String> pk = new ArrayList<>(seqToName.size()); for (String name : seqToName.values()) { pk.add(name.toUpperCase(Locale.US)); } return pk; } finally { cols.close(); } }

Target:
private List<String> dbTablePK(DatabaseMetaData meta, String tableName) throws SQLException { if (meta.storesUpperCaseIdentifiers()) { tableName = tableName.toUpperCase(); } else if (meta.storesLowerCaseIdentifiers()) { tableName = tableName.toLowerCase(); } ResultSet cols = meta.getPrimaryKeys(null, null, tableName); try { Map<Short, String> seqToName = new TreeMap<>(); while (cols.next()) { seqToName.put(cols.getShort("KEY_SEQ"), cols.getString("COLUMN_NAME")); } List<String> pk = new ArrayList<>(seqToName.size()); for (String name : seqToName.values()) { pk.add(name.toLowerCase(Locale.US)); } return pk; } finally { cols.close(); } }
Source:
public List<Object[]> execute() { List<Object[]> tuples = delegate().execute(); QueryResults.Columns columns = getColumns(); if (tuples.size() > 1) { Iterator<Object[]> iter = tuples.iterator(); int locationCount = columns.getLocationCount(); Set<List<Location>> found = new HashSet<List<Location>>(); while (iter.hasNext()) { Object[] tuple = iter.next(); List<Location> locations = new ArrayList<Location>(locationCount); for (String selectorName : columns.getSelectorNames()) { locations.add((Location)tuple[columns.getLocationIndex(selectorName)]); } if (!found.add(locations)) { iter.remove(); } } } return tuples; }

Target:
public List<Object[]> execute() { List<Object[]> tuples = delegate().execute(); if (!tuples.isEmpty()) { QueryResults.Columns columns = getColumns(); int locationCount = columns.getLocationCount(); int[] locationIndexes = super.getLocationIndexes(columns); Iterator<Object[]> iter = tuples.iterator(); Set<List<Location>> found = new HashSet<List<Location>>(); while (iter.hasNext()) { Object[] tuple = iter.next(); List<Location> locations = new ArrayList<Location>(locationCount); for (int locationIndex : locationIndexes) { locations.add((Location)tuple[locationIndex]); } if (!found.add(locations)) { iter.remove(); } } } return tuples; }
Source:
public CreateContainerOptions headers(Multimap<String, String> headers) { if (!headers.isEmpty()) { this.headers.putAll(headers); } return this; }

Target:
public CreateContainerOptions headers(Multimap<String, String> headers) { this.headers.putAll(headers); return this; }
Source:
protected void executeCommand() { setStoragePoolId(getNetwork().getDataCenterId()); if (Boolean.TRUE.equals(getParameters().getRemoveFromNetworkProvider()) && getNetwork().isExternal()) { removeExternalNetwork(); } removeVnicProfiles(); getNetworkDAO().remove(getNetwork().getId()); setSucceeded(true); }

Target:
protected void executeCommand() { setStoragePoolId(getNetwork().getDataCenterId()); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void> () { @Override public Void runInTransaction() { removeVnicProfiles(); getCompensationContext().snapshotEntity(getNetwork()); getNetworkDAO().remove(getNetwork().getId()); getCompensationContext().stateChanged(); return null; } }); if (getParameters().isRemoveFromNetworkProvider() && getNetwork().isExternal()) { removeExternalNetwork(); } setSucceeded(true); }
Source:
protected void processNewBinding(MethodCallExpr accumulateDSL) { this.accumulateDSL = accumulateDSL; optNewBinding.ifPresent(newBinding -> { final List<Expression> allExpressions = context.getExpressions(); final MethodCallExpr newBindingExpression = newBinding.bindExpression; final SortedSet<String> patterBinding = new TreeSet<>(newBinding.patternBinding); if (patterBinding.size() == 2 && findLastBinding(allExpressions) != null) { Optional<MethodCallExpr> lastBinding = Optional.ofNullable(findLastBinding(allExpressions)); composeTwoBindingIntoExpression(newBindingExpression, lastBinding); } else { replaceBindingWithPatternBinding( newBindingExpression, findLastPattern(allExpressions) ); newBindingResults.add( newBinding ); } }); }

Target:
protected void processNewBinding(MethodCallExpr accumulateDSL) { optNewBinding.ifPresent(newBinding -> { final List<Expression> allExpressions = context.getExpressions(); final MethodCallExpr newBindingExpression = newBinding.bindExpression; final SortedSet<String> patterBinding = new TreeSet<>(newBinding.patternBinding); if (patterBinding.size() == 2 && findLastBinding(allExpressions) != null) { Optional<MethodCallExpr> lastBinding = Optional.ofNullable(findLastBinding(allExpressions)); composeTwoBindingIntoExpression(newBindingExpression, lastBinding, accumulateDSL); } else { replaceBindingWithPatternBinding( newBindingExpression, findLastPattern(allExpressions) ); newBindingResults.add( newBinding ); } }); }
Source:
protected List<Protos.Key> serializeMyselfToProtobuf() { LinkedList<Protos.Key> entries = newLinkedList(); if (seed != null) { Protos.Key.Builder mnemonicEntry = BasicKeyChain.serializeEncryptableItem(seed); mnemonicEntry.setType(Protos.Key.Type.DETERMINISTIC_MNEMONIC); serializeSeedEncryptableItem(seed, mnemonicEntry); mnemonicEntry.setLabel(HDUtils.formatPath(getAccountPath())); entries.add(mnemonicEntry.build()); } Map<ECKey, Protos.Key.Builder> keys = basicKeyChain.serializeToEditableProtobufs(); for (Map.Entry<ECKey, Protos.Key.Builder> entry : keys.entrySet()) { DeterministicKey key = (DeterministicKey) entry.getKey(); Protos.Key.Builder proto = entry.getValue(); proto.setType(Protos.Key.Type.DETERMINISTIC_KEY); final Protos.DeterministicKey.Builder detKey = proto.getDeterministicKeyBuilder(); detKey.setChainCode(ByteString.copyFrom(key.getChainCode())); for (ChildNumber num : key.getPath()) detKey.addPath(num.i()); if (key.equals(externalParentKey)) { detKey.setIssuedSubkeys(issuedExternalKeys); detKey.setLookaheadSize(lookaheadSize); detKey.setSigsRequiredToSpend(getSigsRequiredToSpend()); } else if (key.equals(internalParentKey)) { detKey.setIssuedSubkeys(issuedInternalKeys); detKey.setLookaheadSize(lookaheadSize); detKey.setSigsRequiredToSpend(getSigsRequiredToSpend()); } if (entries.isEmpty() && isFollowing()) { detKey.setIsFollowing(true); } if (key.getParent() != null) { proto.clearCreationTimestamp(); } entries.add(proto.build()); } return entries; }

Target:
protected List<Protos.Key> serializeMyselfToProtobuf() { LinkedList<Protos.Key> entries = newLinkedList(); if (seed != null) { Protos.Key.Builder mnemonicEntry = BasicKeyChain.serializeEncryptableItem(seed); mnemonicEntry.setType(Protos.Key.Type.DETERMINISTIC_MNEMONIC); serializeSeedEncryptableItem(seed, mnemonicEntry); for (ChildNumber childNumber : getAccountPath()) { mnemonicEntry.addAccountPath(childNumber.i()); } entries.add(mnemonicEntry.build()); } Map<ECKey, Protos.Key.Builder> keys = basicKeyChain.serializeToEditableProtobufs(); for (Map.Entry<ECKey, Protos.Key.Builder> entry : keys.entrySet()) { DeterministicKey key = (DeterministicKey) entry.getKey(); Protos.Key.Builder proto = entry.getValue(); proto.setType(Protos.Key.Type.DETERMINISTIC_KEY); final Protos.DeterministicKey.Builder detKey = proto.getDeterministicKeyBuilder(); detKey.setChainCode(ByteString.copyFrom(key.getChainCode())); for (ChildNumber num : key.getPath()) detKey.addPath(num.i()); if (key.equals(externalParentKey)) { detKey.setIssuedSubkeys(issuedExternalKeys); detKey.setLookaheadSize(lookaheadSize); detKey.setSigsRequiredToSpend(getSigsRequiredToSpend()); } else if (key.equals(internalParentKey)) { detKey.setIssuedSubkeys(issuedInternalKeys); detKey.setLookaheadSize(lookaheadSize); detKey.setSigsRequiredToSpend(getSigsRequiredToSpend()); } if (entries.isEmpty() && isFollowing()) { detKey.setIsFollowing(true); } if (key.getParent() != null) { proto.clearCreationTimestamp(); } entries.add(proto.build()); } return entries; }
Source:
public void open() throws IOException { writer = CompressionFactory.getFloatSerializer( ioPeon, StringUtils.safeFormat("%s.float_column", filenameBase), byteOrder, compression ); writer.open(); }

Target:
public void open() throws IOException { writer = CompressionFactory.getFloatSerializer( ioPeon, StringUtils.format("%s.float_column", filenameBase), byteOrder, compression ); writer.open(); }
Source:
private void fetchBatchOfTimestampsBeginningAtStartRow() { byte[] rangeStart = startRowInclusive; ExecutorService executor = PTExecutors.newFixedThreadPool(config.sweepReadThreads()); while (timestamps.isEmpty()) { List<byte[]> rows = getRows(rangeStart); if (rows.isEmpty()) { return; } List<CellWithTimestamp> batch = cqlExecutor.getTimestamps(tableRef, rows, batchHint, executor); timestamps.addAll(batch); rangeStart = RangeRequests.nextLexicographicName(Iterables.getLast(rows)); } executor.shutdown(); }

Target:
private void fetchBatchOfTimestampsBeginningAtStartRow() { byte[] rangeStart = startRowInclusive; Integer executorThreads = config.sweepReadThreads(); ExecutorService executor = PTExecutors.newFixedThreadPool(executorThreads); while (timestamps.isEmpty()) { List<byte[]> rows = getRows(rangeStart); if (rows.isEmpty()) { return; } List<CellWithTimestamp> batch = cqlExecutor.getTimestamps(tableRef, rows, batchHint, executor, executorThreads); timestamps.addAll(batch); rangeStart = RangeRequests.nextLexicographicName(Iterables.getLast(rows)); } executor.shutdown(); }
Source:
public static void main(String[] args) { EnvironmentInformation.logEnvironmentInfo(LOG, YarnSessionClusterEntrypoint.class.getSimpleName(), args); SignalHandler.register(LOG); JvmShutdownSafeguard.installAsShutdownHook(LOG); Map<String, String> env = System.getenv(); final String workingDirectory = env.get(ApplicationConstants.Environment.PWD.key()); Preconditions.checkArgument( workingDirectory != null, "Working directory variable (%s) not set", ApplicationConstants.Environment.PWD.key()); try { YarnEntrypointUtils.logYarnEnvironmentInformation(env, LOG); } catch (IOException e) { LOG.warn("Could not log YARN environment information.", e); } final CommandLineParser<Configuration> commandLineParser = new CommandLineParser<>(new DynamicParametersConfigurationParserFactory()); Configuration dynamicParameters = null; try { dynamicParameters = commandLineParser.parse(args); } catch (FlinkParseException e) { LOG.error("Could not parse command line arguments {}.", args, e); commandLineParser.printHelp(YarnSessionClusterEntrypoint.class.getSimpleName()); System.exit(1); } Configuration configuration = YarnEntrypointUtils.loadConfiguration(workingDirectory, dynamicParameters, env); YarnSessionClusterEntrypoint yarnSessionClusterEntrypoint = new YarnSessionClusterEntrypoint(configuration); ClusterEntrypoint.runClusterEntrypoint(yarnSessionClusterEntrypoint); }

Target:
public static void main(String[] args) { EnvironmentInformation.logEnvironmentInfo(LOG, YarnSessionClusterEntrypoint.class.getSimpleName(), args); SignalHandler.register(LOG); JvmShutdownSafeguard.installAsShutdownHook(LOG); Map<String, String> env = System.getenv(); final String workingDirectory = env.get(ApplicationConstants.Environment.PWD.key()); Preconditions.checkArgument( workingDirectory != null, "Working directory variable (%s) not set", ApplicationConstants.Environment.PWD.key()); try { YarnEntrypointUtils.logYarnEnvironmentInformation(env, LOG); } catch (IOException e) { LOG.warn("Could not log YARN environment information.", e); } final Configuration dynamicParameters = ClusterEntrypointUtils.parseParametersOrExit( args, new DynamicParametersConfigurationParserFactory(), YarnSessionClusterEntrypoint.class); final Configuration configuration = YarnEntrypointUtils.loadConfiguration(workingDirectory, dynamicParameters, env); YarnSessionClusterEntrypoint yarnSessionClusterEntrypoint = new YarnSessionClusterEntrypoint(configuration); ClusterEntrypoint.runClusterEntrypoint(yarnSessionClusterEntrypoint); }
Source:
public PredicateFinalStep visit(FullTextTermExpr fullTextTermExpr) { PropertyValueExpr propertyValueExpr = (PropertyValueExpr) fullTextTermExpr.getChild(); String text = fullTextTermExpr.getTerm(); String absoluteFieldPath = propertyValueExpr.getPropertyPath().asStringPath(); int asteriskPos = text.indexOf(LUCENE_MULTIPLE_CHARACTERS_WILDCARD); int questionPos = text.indexOf(LUCENE_SINGLE_CHARACTER_WILDCARD); if (asteriskPos == -1 && questionPos == -1) { if (isMultiTermText(propertyValueExpr.getPropertyPath(), text)) { PhrasePredicateOptionsStep<?> result = predicateFactory.phrase().field(absoluteFieldPath).matching(text); if (fullTextTermExpr.getFuzzySlop() != null) { result.slop(fullTextTermExpr.getFuzzySlop()); } return result; } else { MatchPredicateOptionsStep<?> result = predicateFactory.match().field(absoluteFieldPath).matching(text); if (fullTextTermExpr.getFuzzySlop() != null) { result.fuzzy(fullTextTermExpr.getFuzzySlop()); } return result; } } else { if (fullTextTermExpr.getFuzzySlop() != null) { throw CONTAINER.getPrefixWildcardOrRegexpQueriesCannotBeFuzzy(fullTextTermExpr.toQueryString()); } if (questionPos == -1 && asteriskPos == text.length() - 1) { return predicateFactory.simpleQueryString() .field(absoluteFieldPath).matching(text); } return predicateFactory.wildcard() .field(absoluteFieldPath).matching(text); } }

Target:
public PredicateFinalStep visit(FullTextTermExpr fullTextTermExpr) { PropertyValueExpr propertyValueExpr = (PropertyValueExpr) fullTextTermExpr.getChild(); String text = fullTextTermExpr.getTerm(); String absoluteFieldPath = propertyValueExpr.getPropertyPath().asStringPath(); int asteriskPos = text.indexOf(LUCENE_MULTIPLE_CHARACTERS_WILDCARD); int questionPos = text.indexOf(LUCENE_SINGLE_CHARACTER_WILDCARD); if (asteriskPos == -1 && questionPos == -1) { if (isMultiTermText(propertyValueExpr.getPropertyPath(), text)) { PhrasePredicateOptionsStep<?> result = predicateFactory.phrase().field(absoluteFieldPath).matching(text); if (fullTextTermExpr.getFuzzySlop() != null) { result.slop(fullTextTermExpr.getFuzzySlop()); } return result; } else { MatchPredicateOptionsStep<?> result = predicateFactory.match().field(absoluteFieldPath).matching(text); if (fullTextTermExpr.getFuzzySlop() != null) { result.fuzzy(fullTextTermExpr.getFuzzySlop()); } return result; } } else { if (fullTextTermExpr.getFuzzySlop() != null) { throw CONTAINER.getPrefixWildcardOrRegexpQueriesCannotBeFuzzy(fullTextTermExpr.toQueryString()); } if (questionPos == -1 && asteriskPos == text.length() - 1) { return predicateFactory.simpleQueryString() .field(absoluteFieldPath).matching(text) .flags(SimpleQueryFlag.PREFIX); } return predicateFactory.wildcard() .field(absoluteFieldPath).matching(text); } }
Source:
public void remove(String noteId, AuthenticationInfo subject) throws IOException { DistributedFileSystemOps dfso = null; try { dfso = getDfs(superuser); Path rootDir = getRootDir(dfso); String hdfsOwner = dfso.getFileStatus(rootDir).getOwner(); Matcher psuMatcher = psuPattern.matcher(hdfsOwner); if (psuMatcher.matches()) { String extractedPSUProjectname = psuMatcher.group(1); Matcher pguMatcher = pguPattern.matcher(subject.getUser()); if (pguMatcher.matches()) { String extractedPGUProjectname = pguMatcher.group(1); if (!extractedPSUProjectname.equals(extractedPGUProjectname)) { throw new IOException("User <" + subject.getUser() + "> does not " + "belong to project"); } } } Path noteDir = new Path(rootDir, noteId); if (!dfso.getFilesystem().exists(noteDir)) { return; } if (!dfso.getFilesystem().isDirectory(noteDir)) { throw new IOException("Can not remove " + noteDir.toString()); } dfso.getFilesystem().delete(noteDir, true); } finally { if (dfso != null) { dfso.close(); } } }

Target:
public void remove(String noteId, AuthenticationInfo subject) throws IOException { DistributedFileSystemOps dfso = null; try { dfso = getDfs(superuser); Path rootDir = getRootDir(dfso); String hdfsOwner = dfso.getFileStatus(rootDir).getOwner(); Matcher psuMatcher = psuPattern.matcher(hdfsOwner); if (psuMatcher.matches()) { String extractedPSUProjectname = psuMatcher.group(1); Matcher pguMatcher = pguPattern.matcher(subject.getUser()); if (pguMatcher.matches()) { String extractedPGUProjectname = pguMatcher.group(1); if (!extractedPSUProjectname.equals(extractedPGUProjectname)) { throw new IOException("User <" + subject.getUser() + "> does not " + "belong to project"); } } } Path noteDir = new Path(rootDir, noteId); if (!dfso.getFilesystem().exists(noteDir)) { return; } if (!dfso.getFilesystem().isDirectory(noteDir)) { throw new IOException("Can not remove " + noteDir.toString()); } dfso.getFilesystem().delete(noteDir, true); } finally { if (dfso != null) { dfsService.closeDfsClient(dfso); } } }
Source:
public NamedCluster fromXmlForEmbed( Node node ) { NamedClusterImpl returnCluster = this.clone(); List<Node> fields = XMLHandler.getNodes( node, "child" ); for ( Node field: fields ) { String fieldName = XMLHandler.getTagValue( field, "id" ); System.out.println( fieldName ); String fieldValue = XMLHandler.getTagValue( field, "value" ); if ( fieldName.toLowerCase().contains( "password" ) ) { fieldValue = passwordEncoder.decode( fieldValue ); } try { BeanUtils.setProperty( returnCluster, fieldName, fieldValue ); } catch ( IllegalAccessException | InvocationTargetException e ) { e.printStackTrace(); return null; } } return returnCluster; }

Target:
public NamedCluster fromXmlForEmbed( Node node ) { NamedClusterImpl returnCluster = this.clone(); List<Node> fields = XMLHandler.getNodes( node, "child" ); for ( Node field: fields ) { String fieldName = XMLHandler.getTagValue( field, "id" ); System.out.println( fieldName ); String fieldValue = XMLHandler.getTagValue( field, "value" ); if ( fieldName.toLowerCase().contains( "password" ) ) { fieldValue = passwordEncoder.decode( fieldValue ); } try { BeanUtils.setProperty( returnCluster, fieldName, fieldValue ); } catch ( IllegalAccessException | InvocationTargetException e ) { LOGGER.error( "Could not serialize NamedCluster to xml: " + e.toString() ); } } return returnCluster; }
Source:
private long getSortPopVal(long popSize) { if (popSize > 400_000) { return GeoCodingConstants.POPULATION_OVER_400K; } else if (popSize > 350_000 && popSize <= 400_000) { return GeoCodingConstants.POPULATION_LT_400K_GT_350K; } else if (popSize > 300_000 && popSize <= 350_000) { return GeoCodingConstants.POPULATION_LT_350K_GT_300K; } else if (popSize > 250_000 && popSize <= 300_000) { return GeoCodingConstants.POPULATION_LT_300K_GT_250K; } else if (popSize > 200_000 && popSize <= 250_000) { return GeoCodingConstants.POPULATION_LT_250K_GT_200K; } else if (popSize > 150_000 && popSize <= 200_000) { return GeoCodingConstants.POPULATION_LT_200K_GT_150K; } else if (popSize > 100_000 && popSize <= 150_000) { return GeoCodingConstants.POPULATION_LT_150K_GT_100K; } else if (popSize > 50_000 && popSize <= 100_000) { return GeoCodingConstants.POPULATION_LT_100K_GT_50K; } else { return GeoCodingConstants.POPULATION_UNDER_50K; } }

Target:
private long getSortPopVal(long popSize) { return Math.min(10, (popSize - 1) / 50_000 + 2); }
Source:
public Builder<ProtocolConfiguration<P>> configure(OperationContext context, ModelNode model) throws OperationFailedException { List<ValueDependency<OutboundSocketBinding>> list = new ArrayList<>(); for (String binding : StringListAttributeDefinition.unwrapValue(context, OUTBOUND_SOCKET_BINDINGS.resolveModelAttribute(context, model))) { InjectedValueDependency<OutboundSocketBinding> outboundSocketBindingInjectedValueDependency = new InjectedValueDependency<>(CommonUnaryRequirement.OUTBOUND_SOCKET_BINDING.getServiceName(context, binding), OutboundSocketBinding.class); list.add(outboundSocketBindingInjectedValueDependency); } this.bindings = list; return super.configure(context, model); }

Target:
public Builder<ProtocolConfiguration<P>> configure(OperationContext context, ModelNode model) throws OperationFailedException { final List<String> value = StringListAttributeDefinition.unwrapValue(context, OUTBOUND_SOCKET_BINDINGS.resolveModelAttribute(context, model)); List<ValueDependency<OutboundSocketBinding>> list = new ArrayList<>(value.size()); for (String binding : value) { list.add(new InjectedValueDependency<>(CommonUnaryRequirement.OUTBOUND_SOCKET_BINDING.getServiceName(context, binding), OutboundSocketBinding.class)); } this.bindings = list; return super.configure(context, model); }
Source:
private Set<Vector> cornerNeighbors(final Vector v) { Vector[] diagnolVectors = new Vector[] { new Vector(v.getBlockX() + 1, v.getBlockY() + 1, v.getBlockZ() + 1), new Vector(v.getBlockX() + 1, v.getBlockY() + 1, v.getBlockZ() - 1), new Vector(v.getBlockX() - 1, v.getBlockY() + 1, v.getBlockZ() + 1), new Vector(v.getBlockX() - 1, v.getBlockY() + 1, v.getBlockZ() - 1), new Vector(v.getBlockX() + 1, v.getBlockY() - 1, v.getBlockZ() + 1), new Vector(v.getBlockX() + 1, v.getBlockY() - 1, v.getBlockZ() - 1), new Vector(v.getBlockX() - 1, v.getBlockY() - 1, v.getBlockZ() + 1), new Vector(v.getBlockX() - 1, v.getBlockY() - 1, v.getBlockZ() - 1) }; return new HashSet<>(Arrays.asList(diagnolVectors)); }

Target:
private Set<Vector> cornerNeighbors(final Vector v) { Vector[] cornerVectors = new Vector[] { new Vector(v.getBlockX() + 1, v.getBlockY() + 1, v.getBlockZ() + 1), new Vector(v.getBlockX() + 1, v.getBlockY() + 1, v.getBlockZ() - 1), new Vector(v.getBlockX() - 1, v.getBlockY() + 1, v.getBlockZ() + 1), new Vector(v.getBlockX() - 1, v.getBlockY() + 1, v.getBlockZ() - 1), new Vector(v.getBlockX() + 1, v.getBlockY() - 1, v.getBlockZ() + 1), new Vector(v.getBlockX() + 1, v.getBlockY() - 1, v.getBlockZ() - 1), new Vector(v.getBlockX() - 1, v.getBlockY() - 1, v.getBlockZ() + 1), new Vector(v.getBlockX() - 1, v.getBlockY() - 1, v.getBlockZ() - 1) }; return new HashSet<>(Arrays.asList(cornerVectors)); }
Source:
public static String sha256Hash(Object data, int len) throws NoSuchAlgorithmException, IOException, InsufficientDataException, InternalException { MessageDigest sha256Digest = MessageDigest.getInstance("SHA-256"); if (data instanceof BufferedInputStream || data instanceof RandomAccessFile) { updateDigests(data, len, sha256Digest, null); } else if (data instanceof byte[]) { sha256Digest.update((byte[]) data, 0, len); } else { throw new InternalException("unknown data to calculate SHA256 hash. This should not happend. " + "Please report this issue at <LINK_0>"); } return BaseEncoding.base16().encode(sha256Digest.digest()).toLowerCase(); }

Target:
public static String sha256Hash(Object data, int len) throws NoSuchAlgorithmException, IOException, InsufficientDataException, InternalException { MessageDigest sha256Digest = MessageDigest.getInstance("SHA-256"); if (data instanceof BufferedInputStream || data instanceof RandomAccessFile) { updateDigests(data, len, sha256Digest, null); } else if (data instanceof byte[]) { sha256Digest.update((byte[]) data, 0, len); } else { throw new InternalException("Unknown data source to calculate sha256 hash. This should not happen, " + "please report this issue at <LINK_0>"); } return BaseEncoding.base16().encode(sha256Digest.digest()).toLowerCase(); }
Source:
Optional<String> getCredentials() { return Optional.ofNullable(basicCredentials); }

Target:
String getCredentials() { return basicCredentials; }
Source:
public static void classSetup() { locatorProperties = new Properties(); serverProperties1 = new Properties(); serverProperties2 = new Properties(); serverProperties3 = new Properties(); locatorProperties.setProperty(MAX_WAIT_TIME_RECONNECT, "15000"); serverProperties1.setProperty(REDIS_PORT, "6371"); serverProperties1.setProperty(REDIS_BIND_ADDRESS, LOCAL_HOST); serverProperties2.setProperty(REDIS_PORT, "6372"); serverProperties2.setProperty(REDIS_BIND_ADDRESS, LOCAL_HOST); serverProperties3.setProperty(REDIS_PORT, "6373"); serverProperties3.setProperty(REDIS_BIND_ADDRESS, LOCAL_HOST); locator = clusterStartUp.startLocatorVM(0, locatorProperties); server1 = clusterStartUp.startServerVM(1, serverProperties1, locator.getPort()); server2 = clusterStartUp.startServerVM(2, serverProperties2, locator.getPort()); server3 = clusterStartUp.startServerVM(3, serverProperties3, locator.getPort()); jedis1 = new Jedis(LOCAL_HOST, 6371); jedis2 = new Jedis(LOCAL_HOST, 6372); jedis3 = new Jedis(LOCAL_HOST, 6373); }

Target:
public static void classSetup() { availablePorts = AvailablePortHelper.getRandomAvailableTCPPorts(3); locatorProperties = new Properties(); serverProperties1 = new Properties(); serverProperties2 = new Properties(); serverProperties3 = new Properties(); locatorProperties.setProperty(MAX_WAIT_TIME_RECONNECT, "15000"); serverProperties1.setProperty(REDIS_PORT, Integer.toString(availablePorts[0])); serverProperties1.setProperty(REDIS_BIND_ADDRESS, LOCAL_HOST); serverProperties2.setProperty(REDIS_PORT, Integer.toString(availablePorts[1])); serverProperties2.setProperty(REDIS_BIND_ADDRESS, LOCAL_HOST); serverProperties3.setProperty(REDIS_PORT, Integer.toString(availablePorts[2])); serverProperties3.setProperty(REDIS_BIND_ADDRESS, LOCAL_HOST); locator = clusterStartUp.startLocatorVM(0, locatorProperties); server1 = clusterStartUp.startServerVM(1, serverProperties1, locator.getPort()); server2 = clusterStartUp.startServerVM(2, serverProperties2, locator.getPort()); server3 = clusterStartUp.startServerVM(3, serverProperties3, locator.getPort()); jedis1 = new Jedis(LOCAL_HOST, availablePorts[0], JEDIS_TIMEOUT); jedis2 = new Jedis(LOCAL_HOST, availablePorts[1], JEDIS_TIMEOUT); jedis3 = new Jedis(LOCAL_HOST, availablePorts[2], JEDIS_TIMEOUT); }
Source:
private void bindServices(DeploymentUnit deploymentUnit, ServiceTarget serviceTarget, ServiceName contextServiceName) { BinderService inAppClientContainerService = new BinderService("InAppClientContainer"); final ServiceName inAppClientServiceName = contextServiceName.append("InAppClientContainer"); inAppClientContainerService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(Values.immediateValue(appclient))); serviceTarget.addService(inAppClientServiceName, inAppClientContainerService) .addDependency(contextServiceName, ServiceBasedNamingStore.class, inAppClientContainerService.getNamingStoreInjector()) .install(); final Map<ServiceName, Set<ServiceName>> jndiComponentDependencies = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPONENT_JNDI_DEPENDENCIES); final Set<ServiceName> jndiDependencies = jndiComponentDependencies.computeIfAbsent(contextServiceName, k-> new HashSet<>()); jndiDependencies.add(inAppClientServiceName); }

Target:
private void bindServices(DeploymentUnit deploymentUnit, ServiceTarget serviceTarget, ServiceName contextServiceName) { BinderService inAppClientContainerService = new BinderService("InAppClientContainer"); final ServiceName inAppClientServiceName = contextServiceName.append("InAppClientContainer"); inAppClientContainerService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(Values.immediateValue(appclient))); serviceTarget.addService(inAppClientServiceName, inAppClientContainerService) .addDependency(contextServiceName, ServiceBasedNamingStore.class, inAppClientContainerService.getNamingStoreInjector()) .install(); final Map<ServiceName, Set<ServiceName>> jndiComponentDependencies = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPONENT_JNDI_DEPENDENCIES); Set<ServiceName> jndiDependencies = jndiComponentDependencies.get(contextServiceName); if (jndiDependencies == null) { jndiComponentDependencies.put(contextServiceName, jndiDependencies = new HashSet<>()); } jndiDependencies.add(inAppClientServiceName); }