auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String getLogText() throws IOException { return Files.lines(new File(run.getRootDir(), FILE_NAME).toPath()) .collect(Collectors.joining("\n")); }

Target:
public String getLogText() throws IOException { return FileUtils.readFileToString(new File(run.getRootDir(), FILE_NAME), StandardCharsets.UTF_8); }
Source:
public SystemEvent process(SystemEvent event, Session session) { Payload payload = event.getPayload(); ContentTypePayloadDataWrapper contentTypePayloadDataWrapper = (ContentTypePayloadDataWrapper) payload.getRawData(); Structure structure = contentTypePayloadDataWrapper.getStructure(); ContentTypeView contentTypeView = ContentTypeView.getInstance(structure, contentTypePayloadDataWrapper.getActionUrl()); return new SystemEvent(event.getId(), event.getEventType(), new Payload(contentTypeView, payload.getVisibility(), payload.getVisibilityId()), event.getCreationDate()); }

Target:
public SystemEvent process(SystemEvent event, Session session) { Payload payload = event.getPayload(); ContentTypePayloadDataWrapper contentTypePayloadDataWrapper = (ContentTypePayloadDataWrapper) payload.getRawData(); Structure structure = contentTypePayloadDataWrapper.getStructure(); ContentTypeView contentTypeView = new ContentTypeView(structure, contentTypePayloadDataWrapper.getActionUrl()); return new SystemEvent(event.getId(), event.getEventType(), new Payload(contentTypeView, payload.getVisibility(), payload.getVisibilityId()), event.getCreationDate()); }
Source:
private List<ProductEntity> getAllEntitiesIncludingDeleted() { List<ProductEntity> result = entityManager.createQuery( "from ProductEntity pe " + "LEFT OUTER JOIN FETCH pe.developer " + "LEFT OUTER JOIN FETCH pe.productCertificationStatuses ", ProductEntity.class).getResultList(); logger.debug("SQL call: List<ProductEntity> getAllEntities()"); return result; }

Target:
private List<ProductEntity> getAllEntitiesIncludingDeleted() { List<ProductEntity> result = entityManager.createQuery( "from ProductEntity pe " + "LEFT OUTER JOIN FETCH pe.developer ", ProductEntity.class).getResultList(); logger.debug("SQL call: List<ProductEntity> getAllEntities()"); return result; }
Source:
public void hashcodeTest() { VariantDeclaration a = new VariantDeclaration(); VariantDeclaration b = new VariantDeclaration(); b.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8)); VariantDeclaration c = new VariantDeclaration(); c.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8)); assertEquals(fixture.hashCode(), a.hashCode()); assertEquals(b.hashCode(), c.hashCode()); assertNotEquals(fixture.hashCode(), c.hashCode()); assertNotEquals(a.hashCode(), c.hashCode()); }

Target:
public void hashcodeTest() { VariantDeclaration a = new VariantDeclaration(); VariantDeclaration b = new VariantDeclaration(); b.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8)); VariantDeclaration c = new VariantDeclaration(); c.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8)); assertEquals(fixture.hashCode(), a.hashCode()); assertEquals(b.hashCode(), c.hashCode()); }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); Object object; for (int i = 0, length = valueTable.length; i < length; i++) { if ((object = valueTable[i]) != null) { sb.append(new String(keyTable[i])); sb.append(" -> "); sb.append(object.toString()); sb.append("\n"); } } return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); Object object; for (int i = 0, length = valueTable.length; i < length; i++) { if ((object = valueTable[i]) != null) { sb.append(keyTable[i]); sb.append(" -> "); sb.append(object); sb.append("\n"); } } return sb.toString(); }
Source:
public ClientPartitionServiceImpl(HazelcastClientInstanceImpl client) { this.client = client; this.logger = client.getLoggingService().getLogger(ClientPartitionService.class); clientExecutionService = (ClientExecutionServiceImpl) client.getClientExecutionService(); ClassLoader classLoader = client.getClientConfig().getClassLoader(); final List<ListenerConfig> listenerConfigs = client.getClientConfig().getListenerConfigs(); if (listenerConfigs != null && !listenerConfigs.isEmpty()) { for (ListenerConfig listenerConfig : listenerConfigs) { EventListener implementation = listenerConfig.getImplementation(); if (implementation == null) { try { implementation = ClassLoaderUtil.newInstance(classLoader, listenerConfig.getClassName()); } catch (Exception e) { logger.severe(e); } } if (implementation instanceof PartitionLostListener) { partitionLostListeners.add((PartitionLostListener) implementation); } } } }

Target:
public ClientPartitionServiceImpl(HazelcastClientInstanceImpl client) { this.client = client; this.logger = client.getLoggingService().getLogger(ClientPartitionService.class); clientExecutionService = (ClientExecutionServiceImpl) client.getClientExecutionService(); }
Source:
public static @Nullable Class<? extends Quantity<?>> parseDimension(String dimension) { if (StringUtils.isBlank(dimension)) { return null; } try { @SuppressWarnings("unchecked") Class<? extends Quantity<?>> dimensionClass = (Class<? extends Quantity<?>>) Class .forName(JAVAX_MEASURE_QUANTITY + dimension); return dimensionClass; } catch (ClassNotFoundException e) { logger.error("Error creating a Class instance for name '{}'.", dimension); } return null; }

Target:
public static @Nullable Class<? extends Quantity<?>> parseDimension(String dimension) { if (StringUtils.isBlank(dimension)) { return null; } try { return dimensionClass(FRAMEWORK_DIMENSION_PREFIX, dimension); } catch (ClassNotFoundException e1) { try { return dimensionClass(JAVAX_MEASURE_QUANTITY_PREFIX, dimension); } catch (ClassNotFoundException e2) { throw new IllegalArgumentException( "Error creating a dimension Class instance for name '" + dimension + "'."); } } }
Source:
public Flux<MultiValueMap<String, String>> read(ResolvableType elementType, ReactiveHttpInputMessage inputMessage, Map<String, Object> hints) { return Flux.error(new UnsupportedOperationException()); }

Target:
public Flux<MultiValueMap<String, String>> read(ResolvableType elementType, ReactiveHttpInputMessage inputMessage, Map<String, Object> hints) { return readMono(elementType, inputMessage, hints).flux(); }
Source:
private void deleteEntities(SortedMap<EntityType, List<Entity>> entityMap, HttpServletRequest request) throws IOException, JAXBException { for (Map.Entry<EntityType, List<Entity>> entry : entityMap.entrySet()) { for (final Entity entity : entry.getValue()) { final HttpServletRequest bufferedRequest = getEntityStream(entity, entity.getEntityType(), request); final String entityType = entity.getEntityType().toString(); final String entityName = entity.getName(); new EntityProxy(entityType, entityName) { @Override protected APIResult doExecute(String colo) throws FalconException { return getConfigSyncChannel(colo).invoke("delete", bufferedRequest, entityType, entityName, colo); } }.execute(); if (!embeddedMode) { super.delete(bufferedRequest, entityType, entityName, currentColo); } } } }

Target:
private void deleteEntities(SortedMap<EntityType, List<Entity>> entityMap, HttpServletRequest request) throws IOException, JAXBException { for (Map.Entry<EntityType, List<Entity>> entry : entityMap.entrySet()) { for (final Entity entity : entry.getValue()) { final HttpServletRequest bufferedRequest = getEntityStream(entity, entity.getEntityType(), request); final String entityType = entity.getEntityType().toString(); final String entityName = entity.getName(); entityProxyUtil.proxyDelete(entityType, entityName, bufferedRequest); if (!embeddedMode) { super.delete(bufferedRequest, entityType, entityName, currentColo); } } } }
Source:
public void testBooleanComparator() { boolean[] values = {false, true}; for (int i = 0; i < values.length; ++i) { for (int j = 0; j < values.length; ++j) { boolean vi = values[i]; boolean vj = values[j]; int exp = i - j; assertSignumEquals(vi, vj, exp, BOOLEAN_COMPARATOR.compare(vi, vj)); assertSignumEquals(vi, vj, exp, BOOLEAN_COMPARATOR.compare(Boolean.valueOf(vi), Boolean.valueOf(vj))); } } checkThrowingUnsupportedException(BOOLEAN_COMPARATOR, Boolean.TYPE); }

Target:
public void testBooleanComparator() { Boolean[] valuesInAscendingOrder = { null, false, true }; for (int i = 0; i < valuesInAscendingOrder.length; ++i) { for (int j = 0; j < valuesInAscendingOrder.length; ++j) { Boolean vi = valuesInAscendingOrder[i]; Boolean vj = valuesInAscendingOrder[j]; int exp = i - j; assertSignumEquals(vi, vj, exp, BOOLEAN_COMPARATOR.compare(vi, vj)); if (vi != null && vj != null) { assertSignumEquals(vi, vj, exp, BOOLEAN_COMPARATOR.compare(vi.booleanValue(), vj.booleanValue())); } } } checkThrowingUnsupportedException(BOOLEAN_COMPARATOR, Boolean.TYPE); }
Source:
private void testIsStudentsInSameTeam() { ______TS("non-existent student1"); CourseAttributes course1 = dataBundle.courses.get("typicalCourse1"); StudentAttributes student2InCourse1 = dataBundle.students.get("student2InCourse1"); String nonExistStudentEmail = "nonExist@google.tmt"; assertFalse(studentsLogic.isStudentsInSameTeam(course1.getId(), nonExistStudentEmail, student2InCourse1.email)); ______TS("students of different teams"); StudentAttributes student1InCourse1 = dataBundle.students.get("student1InCourse1"); assertTrue(studentsLogic.isStudentsInSameTeam(course1.getId(), student2InCourse1.email, student1InCourse1.email)); }

Target:
private void testIsStudentsInSameTeam() { ______TS("non-existent student1"); CourseAttributes course1 = dataBundle.courses.get("typicalCourse1"); StudentAttributes student2InCourse1 = dataBundle.students.get("student2InCourse1"); String nonExistStudentEmail = "nonExist@google.tmt"; assertFalse(studentsLogic.isStudentsInSameTeam(course1.getId(), nonExistStudentEmail, student2InCourse1.email)); ______TS("students of different teams"); StudentAttributes student1InCourse1 = dataBundle.students.get("student1InCourse1"); assertTrue(studentsLogic.isStudentsInSameTeam(course1.getId(), student2InCourse1.email, student1InCourse1.email)); StudentAttributes student5InCourse1 = dataBundle.students.get("student5InCourse1"); assertFalse(studentsLogic.isStudentsInSameTeam(course1.getId(), student2InCourse1.email, student5InCourse1.email)); }
Source:
private void expandParent(ParentObject parentObject, int position) { ParentWrapper parentWrapper = (ParentWrapper) mExpandableRecyclerAdapterHelper.getHelperItemAtPosition(position); if (parentWrapper == null) { return; } if (parentWrapper.isExpanded()) { parentWrapper.setExpanded(false); mExpandCollapseListener.onRecyclerViewItemCollapsed(position); mStableIdMap.put(parentWrapper.getStableId(), false); List<Object> childObjectList = ((ParentObject) parentWrapper.getParentObject()).getChildObjectList(); if (childObjectList != null) { for (int i = childObjectList.size() - 1; i >= 0; i--) { mItemList.remove(position + i + 1); mExpandableRecyclerAdapterHelper.getHelperItemList().remove(position + i + 1); notifyItemRemoved(position + i + 1); Log.d(TAG, "Removed " + childObjectList.get(i).toString()); } } } else { parentWrapper.setExpanded(true); mExpandCollapseListener.onRecyclerViewItemExpanded(position); mStableIdMap.put(parentWrapper.getStableId(), true); List<Object> childObjectList = ((ParentObject) parentWrapper.getParentObject()).getChildObjectList(); if (childObjectList != null) { for (int i = 0; i < childObjectList.size(); i++) { mItemList.add(position + i + 1, childObjectList.get(i)); mExpandableRecyclerAdapterHelper.getHelperItemList().add(position + i + 1, childObjectList.get(i)); notifyItemInserted(position + i + 1); } } } }

Target:
private void expandParent(ParentObject parentObject, int position) { ParentWrapper parentWrapper = (ParentWrapper) mExpandableRecyclerAdapterHelper.getHelperItemAtPosition(position); if (parentWrapper == null) { return; } if (parentWrapper.isExpanded()) { parentWrapper.setExpanded(false); if (mExpandCollapseListener != null) { int expandedCountBeforePosition = getExpandedItemCount(position); mExpandCollapseListener.onRecyclerViewItemCollapsed(position - expandedCountBeforePosition); } mStableIdMap.put(parentWrapper.getStableId(), false); List<Object> childObjectList = ((ParentObject) parentWrapper.getParentObject()).getChildObjectList(); if (childObjectList != null) { for (int i = childObjectList.size() - 1; i >= 0; i--) { mItemList.remove(position + i + 1); mExpandableRecyclerAdapterHelper.getHelperItemList().remove(position + i + 1); notifyItemRemoved(position + i + 1); } } } else { parentWrapper.setExpanded(true); if (mExpandCollapseListener != null) { int expandedCountBeforePosition = getExpandedItemCount(position); mExpandCollapseListener.onRecyclerViewItemExpanded(position - expandedCountBeforePosition); } mStableIdMap.put(parentWrapper.getStableId(), true); List<Object> childObjectList = ((ParentObject) parentWrapper.getParentObject()).getChildObjectList(); if (childObjectList != null) { for (int i = 0; i < childObjectList.size(); i++) { mItemList.add(position + i + 1, childObjectList.get(i)); mExpandableRecyclerAdapterHelper.getHelperItemList().add(position + i + 1, childObjectList.get(i)); notifyItemInserted(position + i + 1); } } } }
Source:
public synchronized void send(final EventualMessage msg) { assert msg.getTarget() == this; if (VmSettings.ACTOR_TRACING && VmSettings.MESSAGE_TIMESTAMPS) { mailbox.addMessageSendTime(); } mailbox.append(msg); logMessageAddedToMailbox(msg); if (!isExecuting) { isExecuting = true; executeOnPool(); } }

Target:
public synchronized void send(final EventualMessage msg) { assert msg.getTarget() == this; if (VmSettings.MESSAGE_TIMESTAMPS) { mailbox.addMessageSendTime(); } mailbox.append(msg); logMessageAddedToMailbox(msg); if (!isExecuting) { isExecuting = true; executeOnPool(); } }
Source:
public void tearDown(final ManagementClient managementClient, final String containerId) { try { ServerReload.reloadIfRequired(managementClient.getControllerClient()); } catch (Exception e) { throw new RuntimeException(e); } try { ServerReload.executeReloadAndWaitForCompletion(managementClient.getControllerClient()); } catch (Exception e) { throw new RuntimeException(e); } applyRemoveAllowReload(managementClient.getControllerClient(), domainAddress, false); applyRemoveAllowReload(managementClient.getControllerClient(), realmAddress, false); }

Target:
public void tearDown(final ManagementClient managementClient, final String containerId) { applyRemoveAllowReload(managementClient.getControllerClient(), domainAddress, false); applyRemoveAllowReload(managementClient.getControllerClient(), realmAddress, false); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; LocalRepository that = (LocalRepository) o; return repositoryDirectory != null ? repositoryDirectory.equals(that.repositoryDirectory) : that.repositoryDirectory == null; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } LocalRepository that = (LocalRepository) o; EqualsBuilder builder = new EqualsBuilder(); builder.append(repositoryDirectory, that.repositoryDirectory); return builder.isEquals(); }
Source:
public GenericRowSorter(List<String> sortOrder, Schema schema) { int sortOrderSize = sortOrder.size(); Comparator[] comparators = new Comparator[sortOrderSize]; for (int i = 0; i < sortOrderSize; i++) { String column = sortOrder.get(i); FieldSpec fieldSpec = schema.getFieldSpecFor(column); Preconditions.checkState(fieldSpec.isSingleValueField(), "Cannot use multi value column: %s for sorting", column); comparators[i] = getComparator(fieldSpec.getDataType()); } _genericRowComparator = (o1, o2) -> { for (int i = 0; i < comparators.length; i++) { String column = sortOrder.get(i); int result = comparators[i].compare(o1.getValue(column), o2.getValue(column)); if (result != 0) { return result; } } return 0; }; }

Target:
public GenericRowSorter(List<String> sortOrder, Schema schema) { int sortOrderSize = sortOrder.size(); FieldSpec.DataType[] dataTypes = new FieldSpec.DataType[sortOrderSize]; for (int i = 0; i < sortOrderSize; i++) { String column = sortOrder.get(i); FieldSpec fieldSpec = schema.getFieldSpecFor(column); Preconditions.checkState(fieldSpec != null, "Column in sort order: %s does not exist in schema", column); Preconditions.checkState(fieldSpec.isSingleValueField(), "Cannot use multi value column: %s for sorting", column); dataTypes[i] = fieldSpec.getDataType(); } _genericRowComparator = (o1, o2) -> { for (int i = 0; i < sortOrderSize; i++) { String column = sortOrder.get(i); FieldSpec.DataType dataType = dataTypes[i]; Object value1 = o1.getValue(column); Object value2 = o2.getValue(column); int result; switch (dataType) { case INT: result = Integer.compare((int) value1, (int) value2); break; case LONG: result = Long.compare((long) value1, (long) value2); break; case FLOAT: result = Float.compare((float) value1, (float) value2); break; case DOUBLE: result = Double.compare((double) value1, (double) value2); break; case STRING: result = ((String) value1).compareTo((String) value2); break; case BYTES: result = ByteArray.compare((byte[]) value1, (byte[]) value2); break; default: throw new IllegalStateException("Cannot sort on column with dataType " + dataType); } if (result != 0) { return result; } } return 0; }; }
Source:
public AsyncTaskParameterSource(DbEngineDialect dialect,async_tasks task) { super(dialect); addValue("action_type", task.getaction_type()); addValue("result", task.getresult()); addValue("status", task.getstatus()); addValue("task_id", task.gettask_id()); task.getaction_parameters(); addValue("action_parameters", serializeParameters(task.getaction_parameters())); addValue("action_params_class",task.getaction_parameters().getClass().getName()); }

Target:
public AsyncTaskParameterSource(DbEngineDialect dialect,async_tasks task) { super(dialect); addValue("action_type", task.getaction_type()); addValue("result", task.getresult()); addValue("status", task.getstatus()); addValue("task_id", task.gettask_id()); addValue("action_parameters", serializeParameters(task.getaction_parameters())); addValue("action_params_class",task.getaction_parameters().getClass().getName()); }
Source:
public static <T> boolean put(String key, T value) { if (key == null) { throw new NullPointerException("Key cannot be null"); } if (value == null) { return remove(key); } if (!isHawkInitialised()) { return false; } String encodedText = zip(value); return encodedText != null && hawkBuilder.getStorage().put(key, encodedText); }

Target:
public static <T> boolean put(String key, T value) { if (key == null) { throw new NullPointerException("Key cannot be null"); } Utils.validateBuild(); if (value == null) { return remove(key); } String encodedText = zip(value); return encodedText != null && internal.getStorage().put(key, encodedText); }
Source:
public GHRef createRef(String name, String sha) throws IOException { return root.retrieve() .method("POST") .with("ref", name) .with("sha", sha) .method("POST") .withUrlPath(getApiTailUrl("git/refs")) .to(GHRef.class) .wrap(root); }

Target:
public GHRef createRef(String name, String sha) throws IOException { return root.createRequest() .method("POST") .with("ref", name) .with("sha", sha) .withUrlPath(getApiTailUrl("git/refs")) .fetch(GHRef.class) .wrap(root); }
Source:
public org.eclipse.gef.commands.Command getGraphicalCommand(EditingDomain domain, GraphicalEditPart targetEditPart, PapyrusClipboard<Object> papyrusClipboard) { org.eclipse.gef.commands.CompoundCommand compoundCommand = new org.eclipse.gef.commands.CompoundCommand("Copy all stereotypes"); for(Iterator<EObject> iterator = papyrusClipboard.getTarget().iterator(); iterator.hasNext();) { EObject eObject = iterator.next(); if(eObject instanceof View) { View view = (View)eObject; String type = view.getType(); if ("AppliedStereotypeCompartment".equals(type)){ org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand deleteCommand = new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand((TransactionalEditingDomain)domain,view); GMFtoGEFCommandWrapper gmFtoGEFCommandWrapper = new GMFtoGEFCommandWrapper(deleteCommand); compoundCommand.add(gmFtoGEFCommandWrapper); } } } if (targetEditPart != null){ Object model = targetEditPart.getModel(); if (model instanceof View){ View view = (View)model; EObject targetOwner = view.getElement(); org.eclipse.emf.common.command.Command semanticCommand = this.getSemanticCommand(domain, targetOwner, papyrusClipboard); if (semanticCommand != null){ EMFtoGEFCommandWrapper emFtoGEFCommandWrapper = new EMFtoGEFCommandWrapper(semanticCommand); compoundCommand.add(emFtoGEFCommandWrapper); } } } return compoundCommand; }

Target:
public org.eclipse.gef.commands.Command getGraphicalCommand(EditingDomain domain, GraphicalEditPart targetEditPart, PapyrusClipboard<Object> papyrusClipboard) { org.eclipse.gef.commands.CompoundCommand compoundCommand = new org.eclipse.gef.commands.CompoundCommand("Copy all stereotypes"); if (targetEditPart != null){ Object model = targetEditPart.getModel(); if (model instanceof View){ View view = (View)model; EObject targetOwner = view.getElement(); org.eclipse.emf.common.command.Command semanticCommand = this.getSemanticCommand(domain, targetOwner, papyrusClipboard); if (semanticCommand != null){ compoundCommand.add(EMFtoGEFCommandWrapper.wrap(semanticCommand)); } } } for(Iterator<EObject> iterator = papyrusClipboard.getTarget().iterator(); iterator.hasNext();) { EObject eObject = iterator.next(); if(eObject instanceof BasicCompartment) { BasicCompartment basicCompartment = (BasicCompartment) eObject; RestoreStereotypeCompartmentCommand refreshStereotypeCompartmentCommand = new RestoreStereotypeCompartmentCommand((TransactionalEditingDomain)domain,basicCompartment); Command wrap = EMFtoGEFCommandWrapper.wrap(refreshStereotypeCompartmentCommand); compoundCommand.add(wrap); } } if(compoundCommand.getCommands().isEmpty()) { return null; } return compoundCommand; }
Source:
public List<V> pull(final List<K> keys) { final List<K> nonLocalKeys = new ArrayList<>(); final List<V> valueList = new ArrayList(); for (final K key : keys) { if (!localParameters.containsKey(key)) { nonLocalKeys.add(key); } } if (!nonLocalKeys.isEmpty()) { final List<V> remoteValues = parameterWorker.pull(nonLocalKeys); int i = 0; for (final K key : nonLocalKeys) { localParameters.put(key, remoteValues.get(i++)); } } for (final K key : keys) { valueList.add(localParameters.get(key)); } return valueList; }

Target:
public List<V> pull(final List<K> keys) { final List<K> nonLocalKeys = new ArrayList<>(); final List<V> valueList = new ArrayList<>(); for (final K key : keys) { if (!localParameters.containsKey(key)) { nonLocalKeys.add(key); } } if (!nonLocalKeys.isEmpty()) { final List<V> remoteValues = parameterWorker.pull(nonLocalKeys); int i = 0; for (final K key : nonLocalKeys) { localParameters.put(key, remoteValues.get(i++)); } } for (final K key : keys) { valueList.add(localParameters.get(key)); } return valueList; }
Source:
public void setup() { kvs = new InMemoryKeyValueService(true); TimestampService tsService = new InMemoryTimestampService(); LockClient lockClient = LockClient.of("sweep client"); lockService = LockServiceImpl.create(LockServerOptions.builder().isStandaloneServer(false).build()); TransactionService txService = TransactionServices.createTransactionService(kvs); Supplier<AtlasDbConstraintCheckingMode> constraints = Suppliers.ofInstance( AtlasDbConstraintCheckingMode.NO_CONSTRAINT_CHECKING); ConflictDetectionManager cdm = ConflictDetectionManagers.createWithoutWarmingCache(kvs); SweepStrategyManager ssm = SweepStrategyManagers.createDefault(kvs); Cleaner cleaner = new NoOpCleaner(); SerializableTransactionManager transactionManager = new SerializableTransactionManager( kvs, tsService, lockClient, lockService, txService, constraints, cdm, ssm, cleaner, false, 8, 2); txManager = transactionManager; }

Target:
public void setup() { kvs = new InMemoryKeyValueService(true); TimestampService tsService = new InMemoryTimestampService(); LockClient lockClient = LockClient.of("sweep client"); lockService = LockServiceImpl.create(LockServerOptions.builder().isStandaloneServer(false).build()); TransactionService txService = TransactionServices.createTransactionService(kvs); Supplier<AtlasDbConstraintCheckingMode> constraints = Suppliers.ofInstance( AtlasDbConstraintCheckingMode.NO_CONSTRAINT_CHECKING); ConflictDetectionManager cdm = ConflictDetectionManagers.createWithoutWarmingCache(kvs); SweepStrategyManager ssm = SweepStrategyManagers.createDefault(kvs); Cleaner cleaner = new NoOpCleaner(); SerializableTransactionManager transactionManager = new SerializableTransactionManager( kvs, tsService, lockClient, lockService, txService, constraints, cdm, ssm, cleaner, false, AbstractTransactionTest.GET_RANGES_THREAD_POOL_SIZE, AbstractTransactionTest.DEFAULT_GET_RANGES_CONCURRENCY); txManager = transactionManager; }
Source:
public void testRenderTopItemIndex_afterAllItems() throws IOException { new TreeItem( tree, SWT.NONE ); TreeItem item = new TreeItem( tree, SWT.NONE ); TreeColumn column = new TreeColumn( tree, SWT.NONE ); tree.setTopItem( item ); getLCA( display ).render( display ); TestMessage message = Fixture.getProtocolMessage(); CreateOperation operation1 = message.findCreateOperation( item ); CreateOperation operation2 = message.findCreateOperation( column ); SetOperation operation3 = message.findSetOperation( tree, "topItemIndex" ); assertNotNull( operation1 ); assertNotNull( operation2 ); assertNotNull( operation3 ); List<Operation> operations = message.getOperations(); assertTrue( findIndex( operations, operation1 ) < findIndex( operations, operation3 ) ); assertTrue( findIndex( operations, operation2 ) < findIndex( operations, operation3 ) ); }

Target:
public void testRenderTopItemIndex_afterAllItems() throws IOException { new TreeItem( tree, SWT.NONE ); TreeItem item = new TreeItem( tree, SWT.NONE ); TreeColumn column = new TreeColumn( tree, SWT.NONE ); tree.setTopItem( item ); getLCA( display ).render( display ); TestMessage message = Fixture.getProtocolMessage(); CreateOperation operation1 = message.findCreateOperation( item ); CreateOperation operation2 = message.findCreateOperation( column ); SetOperation operation3 = message.findSetOperation( tree, "topItemIndex" ); assertNotNull( operation1 ); assertNotNull( operation2 ); assertNotNull( operation3 ); List<Operation> operations = message.getOperations(); assertTrue( operations.indexOf( operation1 ) < operations.indexOf( operation3 ) ); assertTrue( operations.indexOf( operation2 ) < operations.indexOf( operation3 ) ); }
Source:
public void addStateTo(StateDumpCollector dump) { ClusterTierDump.dump(dump, managerIdentifier, storeIdentifier, configuration); { Map<ClientDescriptor, ClusterTierClientState> clients = new HashMap<>(connectedClients); dump.addState("clientCount", String.valueOf(clients.size())); List<Map> allClients = new ArrayList<>(); for (Map.Entry<ClientDescriptor, ClusterTierClientState> entry : clients.entrySet()) { Map<String,String> clientMap = new HashMap<>(); clientMap.put("clientDescriptor", entry.getKey().toString()); clientMap.put("clientIdentifier", String.valueOf(entry.getValue().getClientIdentifier())); clientMap.put("storeIdentifier", entry.getValue().getStoreIdentifier()); clientMap.put("attached", String.valueOf(entry.getValue().isAttached())); allClients.add(clientMap); } dump.addState("clients", allClients); } }

Target:
public void addStateTo(StateDumpCollector dump) { ClusterTierDump.dump(dump, managerIdentifier, storeIdentifier, configuration); { Map<ClientDescriptor, ClusterTierClientState> clients = new HashMap<>(connectedClients); List<Map> allClients = new ArrayList<>(clients.size()); for (Map.Entry<ClientDescriptor, ClusterTierClientState> entry : clients.entrySet()) { Map<String,String> clientMap = new HashMap<>(4); clientMap.put("clientDescriptor", entry.getKey().toString()); clientMap.put("clientIdentifier", String.valueOf(entry.getValue().getClientIdentifier())); clientMap.put("storeIdentifier", entry.getValue().getStoreIdentifier()); clientMap.put("attached", String.valueOf(entry.getValue().isAttached())); allClients.add(clientMap); } dump.addState("clientCount", String.valueOf(allClients.size())); dump.addState("clients", allClients); } }
Source:
private static boolean cannotBeCombined(CharSequence name) { return CASE_SENSITIVE_HASHER.equals(SET_COOKIE, name); }

Target:
private static boolean cannotBeCombined(CharSequence name) { return SET_COOKIE.contentEqualsIgnoreCase(name); }
Source:
public boolean process(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException { String pathInfo = req.getPathInfo(); if (pathInfo == null || pathInfo.equals("")) { return false; } pathInfo = !pathInfo.endsWith("/") ? pathInfo + '/' : pathInfo; if (!pathInfo.equals(getExclusionPath())) { return false; } chain.doFilter(req, resp); return true; }

Target:
public boolean process(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException { String pathInfo = req.getPathInfo(); if (isEmpty(pathInfo)) { return false; } pathInfo = pathInfo.endsWith("/") ? pathInfo : pathInfo + '/'; if (!pathInfo.equals(getExclusionPath())) { return false; } chain.doFilter(req, resp); return true; }
Source:
protected boolean checkReadOnly() throws OperationNotSupportedException { if (readOnly) { if("true".equals(System.getProperty("jndiExceptionOnFailedWrite"))) { throw new OperationNotSupportedException(); } return true; } return false; }

Target:
protected boolean checkReadOnly() throws OperationNotSupportedException { if (readOnly) { if("true".equals(SystemInstance.get().getProperty(JNDI_EXCEPTION_ON_FAILED_WRITE,"true"))) { throw new OperationNotSupportedException(); } return true; } return false; }
Source:
protected Future<Boolean> reindexSinceAsync( final JcrWorkspace workspace, final long timestamp ) { ChangeJournal journal = runningState.journal(); assert journal != null; Set<NodeKey> changedNodes = journal.changedNodesSince(timestamp); if (changedNodes.isEmpty()) { return new ImmediateFuture<>(Boolean.FALSE); } return reindexSinceAsync(workspace.getSession().cache().getWorkspace(), getIndexWriter(), changedNodes); }

Target:
protected Future<Boolean> reindexSinceAsync( final JcrWorkspace workspace, final long timestamp ) { ChangeJournal journal = runningState.journal(); assert journal != null; Iterator<NodeKey> changedNodes = journal.changedNodesSince(timestamp); if (!changedNodes.hasNext()) { return new ImmediateFuture<>(Boolean.FALSE); } return reindexSinceAsync(workspace.getSession().cache().getWorkspace(), getIndexWriter(), changedNodes); }
Source:
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) { if(tab == EsteemedInnovation.tab) { for (Types type : Types.values()) { items.add(new ItemStack(this, 1, type.getMeta())); } } }

Target:
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) { if (isInCreativeTab(tab)) { for (Types type : Types.values()) { items.add(new ItemStack(this, 1, type.getMeta())); } } }
Source:
private void initUserSettings(final int userId) { getOnce(userId) .toMaybe() .filter(UserSettings::isNone) .subscribe(userSettings -> { put(new UserSettings(DEFAULT_REPOSITORY_ID)); }); }

Target:
private void initUserSettings(final int userId) { getOnce(userId) .filter(UserSettings::isNone) .subscribe(__ -> put(new UserSettings(DEFAULT_REPOSITORY_ID))); }
Source:
public <T> T getService(long l, ServiceConfiguration<T> serviceConfiguration) { Class<T> serviceType = serviceConfiguration.getServiceType(); return !serviceType.equals(DetailedServerStateImpl.class) ? null : serviceType.cast(detailedServerState); }

Target:
public <T> T getService(long l, ServiceConfiguration<T> serviceConfiguration) { Class<T> serviceType = serviceConfiguration.getServiceType(); return !serviceType.equals(DetailedServerState.class) ? null : serviceType.cast(detailedServerState); }
Source:
private boolean hasMissingVm(PagedList<VirtualMachine> virtualMachines, Collection<String> privateInstanceIds) { Set<String> virtualMachineNames = virtualMachines .stream() .map(VirtualMachine::name) .collect(Collectors.toSet()); boolean hasMissingVm = !virtualMachineNames.containsAll(privateInstanceIds); if (hasMissingVm) { LOGGER.info("Fetched VM id-s ({}) do not contain one of the following id-s: {}", virtualMachineNames, privateInstanceIds); } return !hasMissingVm; }

Target:
private boolean hasMissingVm(PagedList<VirtualMachine> virtualMachines, Collection<String> privateInstanceIds) { Set<String> virtualMachineNames = virtualMachines .stream() .map(VirtualMachine::name) .collect(Collectors.toSet()); boolean hasMissingVm = !virtualMachineNames.containsAll(privateInstanceIds); if (hasMissingVm) { LOGGER.info("Fetched VM id-s ({}) do not contain one of the following id-s: {}", virtualMachineNames, privateInstanceIds); } return hasMissingVm; }
Source:
public Map<String, String> parseParams(String envParams, boolean substitueFromConfig) { if (org.apache.commons.lang3.StringUtils.isEmpty(envParams)) { return Collections.EMPTY_MAP; } Map<String, String> extraEnvParamsMap = new HashMap<>(); Arrays.stream(envParams.split(",")) .forEach( pair1 -> { String[] pair = pair1.split("="); if (pair.length > 1) { String key, value; if (substitueFromConfig) { key = pair[1]; value = getProperty(pair[0], String.class); } else { key = pair[0]; value = pair[1]; } if (!org.apache.commons.lang3.StringUtils.isBlank(key) && !org.apache.commons.lang3.StringUtils.isBlank(value)) { extraEnvParamsMap.put(key, value); } } }); return extraEnvParamsMap; }

Target:
public Map<String, String> parseParams(String envParams, boolean substitueFromConfig) { if (StringUtils.isEmpty(envParams)) { return Collections.EMPTY_MAP; } Map<String, String> extraEnvParamsMap = new HashMap<>(); Arrays.stream(envParams.split(",")) .forEach( pair1 -> { String[] pair = pair1.split("="); if (pair.length > 1) { String key, value; if (substitueFromConfig) { key = pair[1]; value = getProperty(pair[0], String.class); } else { key = pair[0]; value = pair[1]; } if (!StringUtils.isBlank(key) && !StringUtils.isBlank(value)) { extraEnvParamsMap.put(key, value); } } }); return extraEnvParamsMap; }
Source:
public void init(Permission perm) { path = node.getName().replaceAll("%2F", "/"); initData(node); GetHistory.initAction(node, getGroup().getDb()); { NodeBuilder b = node.createChild("unsubscribe"); b.setSerializable(false); b.setDisplayName("Unsubscribe"); b.setAction(new Action(perm, new Handler<ActionResult>() { @Override public void handle(ActionResult event) { unsubscribe(); } })); b.build(); } if (!group.canWriteOnNewData()) { ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); long interval = group.getInterval(); ScheduledFuture<?> scheduledFuture = scheduler.scheduleAtFixedRate(writeValues, 0, interval, TimeUnit.MILLISECONDS); } }

Target:
public void init(Permission perm) { path = node.getName().replaceAll("%2F", "/").replaceAll("%2E", "."); initData(node); GetHistory.initAction(node, getGroup().getDb()); { NodeBuilder b = node.createChild("unsubscribe"); b.setSerializable(false); b.setDisplayName("Unsubscribe"); b.setAction(new Action(perm, new Handler<ActionResult>() { @Override public void handle(ActionResult event) { unsubscribe(); } })); b.build(); } group.addWatch(this); }
Source:
public static String toHex(byte[] bytes) { StringBuilder buffer = new StringBuilder(); for (byte b : bytes) { buffer.append(String.format(Locale.getDefault(), "%02x", b)); } return buffer.toString(); }

Target:
private static String toHex(byte[] bytes) { StringBuilder buffer = new StringBuilder(); for (byte b : bytes) { buffer.append(String.format(Locale.getDefault(), "%02x", b)); } return buffer.toString(); }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { boolean doFilter = false; try { HttpServletRequest req = (HttpServletRequest) request; if (!FiltersHelper.isAuthenticated(req)) { String profileName = (String) request.getAttribute(FiltersHelper.Constants.REQUEST_PROFILE_KEY); ExtMap authRecord = (ExtMap) request.getAttribute(FiltersHelper.Constants.REQUEST_AUTH_RECORD_KEY); if (authRecord != null) { String engineSessionId = UUID.randomUUID().toString(); InitialContext context = new InitialContext(); try { VdcReturnValueBase returnValue = FiltersHelper.getBackend(context).login(new LoginUserParameters( profileName, authRecord, engineSessionId, loginAsAdmin ? VdcActionType.LoginAdminUser : VdcActionType.LoginUser) ); if (returnValue.getSucceeded()) { HttpSession session = req.getSession(true); session.setAttribute( FiltersHelper.Constants.HTTP_SESSION_ENGINE_SESSION_ID_KEY, engineSessionId ); } } finally { context.close(); } } } doFilter = true; } catch (Exception ex) { log.error(String.format("Error in login to engine. Message is: %1$s", ex.getMessage())); ((HttpServletResponse) response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } if (doFilter) { chain.doFilter(request, response); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { boolean doFilter = false; try { HttpServletRequest req = (HttpServletRequest) request; if (!FiltersHelper.isAuthenticated(req)) { String profileName = (String) request.getAttribute(FiltersHelper.Constants.REQUEST_PROFILE_KEY); ExtMap authRecord = (ExtMap) request.getAttribute(FiltersHelper.Constants.REQUEST_AUTH_RECORD_KEY); if (authRecord != null) { InitialContext context = new InitialContext(); try { VdcLoginReturnValueBase returnValue = (VdcLoginReturnValueBase)FiltersHelper.getBackend(context).login(new LoginUserParameters( profileName, authRecord, loginAsAdmin ? VdcActionType.LoginAdminUser : VdcActionType.LoginUser) ); if (returnValue.getSucceeded()) { HttpSession session = req.getSession(true); session.setAttribute( FiltersHelper.Constants.HTTP_SESSION_ENGINE_SESSION_ID_KEY, returnValue.getSessionId() ); } } finally { context.close(); } } } doFilter = true; } catch (Exception ex) { log.error(String.format("Error in login to engine. Message is: %1$s", ex.getMessage())); ((HttpServletResponse) response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } if (doFilter) { chain.doFilter(request, response); } }
Source:
private void updateGetAlignmentCommandAvailability() { getScanAlignmentCommand().setIsExecutionAllowed(false); if (getSelectedItems() == null || getSelectedItems().size() != 1) { return; } ArrayList<Disk> disks = getSelectedItems() != null ? Linq.<Disk> cast(getSelectedItems()) : new ArrayList<Disk>(); for (Disk disk : disks) { if (!isImageDiskOK(disk)) { return; } } final VM vm = getEntity(); AsyncDataProvider.getDataCenterById(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VmDiskListModel model = (VmDiskListModel) target; StoragePool dataCenter = (StoragePool) returnValue; Version minClusterVersion = vm.getVdsGroupCompatibilityVersion(); Version minDcVersion = dataCenter.getcompatibility_version(); AsyncDataProvider.isCommandCompatible(new AsyncQuery(model, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VmDiskListModel model = (VmDiskListModel) target; model.getScanAlignmentCommand().setIsExecutionAllowed((Boolean) returnValue); } }), VdcActionType.GetDiskAlignment, minClusterVersion, minDcVersion); } }), vm.getStoragePoolId().getValue()); }

Target:
private void updateGetAlignmentCommandAvailability() { getScanAlignmentCommand().setIsExecutionAllowed(false); if (getSelectedItems() == null || getSelectedItems().size() != 1) { return; } ArrayList<Disk> disks = getSelectedItems() != null ? Linq.<Disk> cast(getSelectedItems()) : new ArrayList<Disk>(); for (Disk disk : disks) { if (!isImageDiskOK(disk)) { return; } } final VM vm = getEntity(); AsyncDataProvider.getDataCenterById(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VmDiskListModel model = (VmDiskListModel) target; StoragePool dataCenter = (StoragePool) returnValue; Version minClusterVersion = vm.getVdsGroupCompatibilityVersion(); Version minDcVersion = dataCenter.getcompatibility_version(); AsyncDataProvider.isCommandCompatible(new AsyncQuery(model, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VmDiskListModel model = (VmDiskListModel) target; model.getScanAlignmentCommand().setIsExecutionAllowed((Boolean) returnValue); } }), VdcActionType.GetDiskAlignment, minClusterVersion, minDcVersion); } }), vm.getStoragePoolId()); }
Source:
protected ArviointiasteikkoYleissivistava meanGrade(Collection<ArviointiasteikkoYleissivistava> grades) { if (grades.stream().anyMatch(grade -> ArviointiasteikkoYleissivistava.isNumeric(grade))) { int gradeSum = 0; int gradeCount = 0; for (ArviointiasteikkoYleissivistava grade : grades) { if (ArviointiasteikkoYleissivistava.isNumeric(grade)) { gradeSum += Integer.valueOf(grade.toString()); gradeCount++; } } if (gradeCount > 0) { return ArviointiasteikkoYleissivistava.get(String.valueOf(Math.round((double) gradeSum / gradeCount))); } else return null; } else { if (grades.stream().anyMatch(grade -> ArviointiasteikkoYleissivistava.isLiteral(grade))) { if (grades.stream().anyMatch(grade -> ArviointiasteikkoYleissivistava.GRADE_S == grade)) return ArviointiasteikkoYleissivistava.GRADE_S; else return ArviointiasteikkoYleissivistava.GRADE_H; } else return null; } }

Target:
protected ArviointiasteikkoYleissivistava meanGrade(Collection<ArviointiasteikkoYleissivistava> grades) { if (grades.stream().anyMatch(grade -> ArviointiasteikkoYleissivistava.isNumeric(grade))) { int gradeSum = 0; int gradeCount = 0; for (ArviointiasteikkoYleissivistava grade : grades) { if (ArviointiasteikkoYleissivistava.isNumeric(grade)) { gradeSum += Integer.valueOf(grade.toString()); gradeCount++; } } if (gradeCount > 0) { return ArviointiasteikkoYleissivistava.get(String.valueOf(Math.round((double) gradeSum / gradeCount))); } else { return null; } } else { if (grades.stream().anyMatch(grade -> ArviointiasteikkoYleissivistava.isLiteral(grade))) { if (grades.stream().anyMatch(grade -> ArviointiasteikkoYleissivistava.GRADE_S == grade)) { return ArviointiasteikkoYleissivistava.GRADE_S; } else { return ArviointiasteikkoYleissivistava.GRADE_H; } } else { return null; } } }
Source:
public void onSuccess() { if (!flag) { if (!projectNodes.isEmpty()) { try { doFrontEndWork(jTree, model, root, codePaneTinyEditorsInfoList, projectNodes); jTabbedPane.setSelectedIndex(1); } catch (RuntimeException rte) { jTabbedPane.setSelectedIndex(0); showHelpInfo(rte.getMessage()); } } else { showHelpInfo(String.format(QUERY_HELP_MESSAGE, importsInLines.toString().replaceAll(",", "<br/>"))); jTree.updateUI(); notification.expire(); } } else { showHelpInfo(httpErrorMsg); } }

Target:
public void onSuccess() { if (!isFailed) { if (!projectNodes.isEmpty()) { try { doFrontEndWork(jTree, model, root, codePaneTinyEditorsInfoList, projectNodes); jTabbedPane.setSelectedIndex(1); } catch (RuntimeException rte) { rte.printStackTrace(); } } else { showHelpInfo(String.format(QUERY_HELP_MESSAGE, importsInLines.toString().replaceAll(",", "<br/>"))); jTree.updateUI(); notification.expire(); } } else { showHelpInfo(httpErrorMsg); } }
Source:
public void testMultipleClients() throws Exception { Injector injector = new Bootstrap( (Module) binder -> { httpClientBinder(binder).bindHttpClient("foo", FooClient.class); httpClientBinder(binder).bindHttpClient("bar", BarClient.class); }) .quiet() .strictConfig() .initialize(); HttpClient fooClient = injector.getInstance(Key.get(HttpClient.class, FooClient.class)); HttpClient barClient = injector.getInstance(Key.get(HttpClient.class, BarClient.class)); assertNotSame(fooClient, barClient); assertNotNull(injector.getExistingBinding(Key.get(JettyIoPoolManager.class, FooClient.class))); assertNotNull(injector.getExistingBinding(Key.get(JettyIoPoolManager.class, BarClient.class))); assertJettyIoPools(injector, FooClient.class); assertJettyIoPools(injector, BarClient.class); assertPoolsDestroyProperly(injector, FooClient.class, BarClient.class); }

Target:
public void testMultipleClients() throws Exception { Injector injector = new Bootstrap( binder -> { httpClientBinder(binder).bindHttpClient("foo", FooClient.class); httpClientBinder(binder).bindHttpClient("bar", BarClient.class); }) .quiet() .strictConfig() .initialize(); HttpClient fooClient = injector.getInstance(Key.get(HttpClient.class, FooClient.class)); HttpClient barClient = injector.getInstance(Key.get(HttpClient.class, BarClient.class)); assertNotSame(fooClient, barClient); assertNotNull(injector.getExistingBinding(Key.get(JettyIoPoolManager.class, FooClient.class))); assertNotNull(injector.getExistingBinding(Key.get(JettyIoPoolManager.class, BarClient.class))); assertJettyIoPools(injector, FooClient.class); assertJettyIoPools(injector, BarClient.class); assertPoolsDestroyProperly(injector, FooClient.class, BarClient.class); }
Source:
private void updateOptions() { getCompulsoryActions().clear(); getOptionalActions().clear(); startProgress(null); if (getEntity() != null && getEntity().getStoragePoolId() != null) { AsyncDataProvider.getInstance().getDataCenterById(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { ClusterGuideModel model = (ClusterGuideModel) target; model.dataCenter = (StoragePool) returnValue; if (model.dataCenter == null || !model.dataCenter.isLocal()) { model.updateOptionsNonLocalFSData(); } else { model.updateOptionsLocalFSData(); } } }), getEntity().getStoragePoolId()); } else if (getEntity() != null && getEntity().getStoragePoolId() == null) { AsyncDataProvider.getInstance().getDataCenterList(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { ClusterGuideModel model = (ClusterGuideModel) target; @SuppressWarnings("unchecked") List<StoragePool> dataCenters = (ArrayList<StoragePool>) returnValue; final List<StoragePool> localDataCenters = new ArrayList<StoragePool>(); boolean enableButton = false; for (StoragePool dataCenter: dataCenters) { if (model.getEntity().getCompatibilityVersion().compareTo( dataCenter.getCompatibilityVersion()) >= 0 ) { if (dataCenter.isLocal()) { localDataCenters.add(dataCenter); } else { enableButton = true; break; } } } if (enableButton || localDataCenters.isEmpty()) { model.updateOptionsRequiredAddDataCenter(enableButton); } else { model.updateOptionsRequiredAddDataCenter(localDataCenters); } } } )); } }

Target:
private void updateOptions() { getCompulsoryActions().clear(); getOptionalActions().clear(); if (getEntity() == null) { return; } startProgress(null); if (getEntity().getStoragePoolId() != null) { AsyncDataProvider.getInstance().getDataCenterById(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { ClusterGuideModel model = (ClusterGuideModel) target; model.dataCenter = (StoragePool) returnValue; if (model.dataCenter == null || !model.dataCenter.isLocal()) { model.updateOptionsNonLocalFSData(); } else { model.updateOptionsLocalFSData(); } } }), getEntity().getStoragePoolId()); } else if (getEntity().getStoragePoolId() == null) { AsyncDataProvider.getInstance().getDataCenterList(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { ClusterGuideModel model = (ClusterGuideModel) target; @SuppressWarnings("unchecked") List<StoragePool> dataCenters = (ArrayList<StoragePool>) returnValue; final List<StoragePool> localDataCenters = new ArrayList<StoragePool>(); boolean enableButton = false; for (StoragePool dataCenter: dataCenters) { if (model.getEntity().getCompatibilityVersion().compareTo( dataCenter.getCompatibilityVersion()) >= 0 ) { if (dataCenter.isLocal()) { localDataCenters.add(dataCenter); } else { enableButton = true; break; } } } if (enableButton || localDataCenters.isEmpty()) { model.updateOptionsRequiredAddDataCenter(enableButton); } else { model.updateOptionsRequiredAddDataCenter(localDataCenters); } } } )); } }
Source:
public void testCorrectGetQueryForming() { String formedQuery = DUMMY_QUERY_FORMER.formQuery(QueryFormer.SupportedQuery.GET, "test", DUMMY_TABLE_REFERENCE); assertThat(formedQuery).isEqualTo(DUMMY_GET_QUERY); }

Target:
public void testCorrectGetQueryForming() { String formedQuery = DUMMY_QUERY_FORMER.formQuery(SupportedQuery.GET, "test", DUMMY_TABLE_REFERENCE); assertThat(formedQuery).isEqualTo(DUMMY_GET_QUERY); }