auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static Schema generateSchema() { Schema schema = new Schema("Sweep", SweepSchema.class.getPackage().getName() + ".generated", NAMESPACE, OptionalType.JAVA8); schema.addTableDefinition("progress", new TableDefinition() {{ javaTableName("SweepProgress"); tableNameIsSafeLoggable(); namedComponentsSafeByDefault(); rowName(); rowComponent("dummy", ValueType.VAR_LONG); columns(); column("full_table_name", "n", ValueType.STRING); column("minimum_swept_timestamp", "m", ValueType.VAR_SIGNED_LONG); column("start_row", "s", ValueType.BLOB); column("cells_deleted", "d", ValueType.VAR_LONG); column("cells_examined", "e", ValueType.VAR_LONG); conflictHandler(ConflictHandler.IGNORE_ALL); ignoreHotspottingChecks(); }}); schema.addTableDefinition("priority", new TableDefinition() {{ javaTableName("SweepPriority"); tableNameIsSafeLoggable(); namedComponentsSafeByDefault(); rowName(); rowComponent("full_table_name", ValueType.STRING); columns(); column("write_count", "w", ValueType.VAR_LONG); column("last_sweep_time", "t", ValueType.VAR_LONG); column("minimum_swept_timestamp", "m", ValueType.VAR_SIGNED_LONG); column("cells_deleted", "d", ValueType.VAR_LONG); column("cells_examined", "e", ValueType.VAR_LONG); conflictHandler(ConflictHandler.IGNORE_ALL); }}); schema.validate(); return schema; }

Target:
private static Schema generateSchema() { Schema schema = new Schema("Sweep", SweepSchema.class.getPackage().getName() + ".generated", NAMESPACE, OptionalType.JAVA8); schema.addTableDefinition("progress", new TableDefinition() {{ javaTableName("SweepProgress"); allSafeForLoggingByDefault(); rowName(); rowComponent("dummy", ValueType.VAR_LONG); columns(); column("full_table_name", "n", ValueType.STRING); column("minimum_swept_timestamp", "m", ValueType.VAR_SIGNED_LONG); column("start_row", "s", ValueType.BLOB); column("cells_deleted", "d", ValueType.VAR_LONG); column("cells_examined", "e", ValueType.VAR_LONG); conflictHandler(ConflictHandler.IGNORE_ALL); ignoreHotspottingChecks(); }}); schema.addTableDefinition("priority", new TableDefinition() {{ javaTableName("SweepPriority"); allSafeForLoggingByDefault(); rowName(); rowComponent("full_table_name", ValueType.STRING); columns(); column("write_count", "w", ValueType.VAR_LONG); column("last_sweep_time", "t", ValueType.VAR_LONG); column("minimum_swept_timestamp", "m", ValueType.VAR_SIGNED_LONG); column("cells_deleted", "d", ValueType.VAR_LONG); column("cells_examined", "e", ValueType.VAR_LONG); conflictHandler(ConflictHandler.IGNORE_ALL); }}); schema.validate(); return schema; }
Source:
public static AccountObject toAccount(String accountJSONString) { AccountObject account = null; try { JSONObject accountJSON = new JSONObject(accountJSONString); String userName = accountJSON.getString(AccountJSONEnum.USERNAME); String userNickName = accountJSON.getString(AccountJSONEnum.NICK_NAME); String userPassword = accountJSON.getString(AccountJSONEnum.PASSWORD); String userEmail = accountJSON.getString(AccountJSONEnum.EMAIL); long userEnable = accountJSON.getInt(AccountJSONEnum.ENABLE); account = new AccountObject(userName); account.setNickName(userNickName) .setPassword(userPassword) .setEmail(userEmail) .setEnable(userEnable == 1 ? true : false); } catch (JSONException e) { account = null; } return account; }

Target:
public static AccountObject toAccount(String accountJSONString) { AccountObject account = null; try { JSONObject accountJSON = new JSONObject(accountJSONString); String userName = accountJSON.getString(AccountJSONEnum.USERNAME); String userNickName = accountJSON.getString(AccountJSONEnum.NICK_NAME); String userPassword = accountJSON.getString(AccountJSONEnum.PASSWORD); String userEmail = accountJSON.getString(AccountJSONEnum.EMAIL); int userEnable = accountJSON.getInt(AccountJSONEnum.ENABLE); account = new AccountObject(userName); account.setNickName(userNickName) .setPassword(userPassword) .setEmail(userEmail) .setEnable(userEnable == 1 ? true : false); } catch (JSONException e) { account = null; } return account; }
Source:
private long stopTimer() { return System.nanoTime() - startNanos.get(); }

Target:
private long stopTimer() { return System.nanoTime() - startNanos; }
Source:
public void processSoftwareCapabilities(VDS vds) { VDSReturnValue returnValue = ResourceManager.getInstance().runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(vds.getId())); if (!returnValue.getSucceeded()) { vds.setStatus(VDSStatus.NonOperational); vds.setNonOperationalReason(NonOperationalReason.GLUSTER_COMMAND_FAILED); } }

Target:
public void processSoftwareCapabilities(VDS vds) { VDSReturnValue returnValue = ResourceManager.getInstance().runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(vds.getId())); if (!returnValue.getSucceeded()) { vds.setStatus(VDSStatus.NonOperational); vds.setNonOperationalReason(NonOperationalReason.GLUSTER_COMMAND_FAILED); vdsNonOperational(vds, NonOperationalReason.GLUSTER_COMMAND_FAILED); } }
Source:
public void onActivate(ActivateEvent event, EntityRef entity) { BlockItemFactory blockFactory = new BlockItemFactory(entityManager); BlockComponent blockComponent = entity.getComponent(BlockComponent.class); EntityRef flagTaker = event.getInstigator(); if (blockComponent.getBlock().getBlockFamily().getURI().toString().equals("LightAndShadowResources:blackFlag")) { flagTaker.send(new GiveItemAction(flagTaker, blockFactory.newInstance(blockManager.getBlockFamily("LightAndShadowResources:blackFlag")))); } if (blockComponent.getBlock().getBlockFamily().getURI().toString().equals("LightAndShadowResources:redFlag")) { flagTaker.send(new GiveItemAction(flagTaker, blockFactory.newInstance(blockManager.getBlockFamily("LightAndShadowResources:redFlag")))); } worldProvider.setBlock(blockComponent.getPosition(), blockManager.getBlock(BlockManager.AIR_ID)); entity.destroy(); }

Target:
public void onActivate(ActivateEvent event, EntityRef entity) { BlockItemFactory blockFactory = new BlockItemFactory(entityManager); inventoryManager = new InventoryAuthoritySystem(); BlockComponent blockComponent = entity.getComponent(BlockComponent.class); LASTeam teamComponent = entity.getComponent(LASTeam.class); EntityRef flagTaker = event.getInstigator(); if (teamComponent.team.equals("red")) { inventoryManager.giveItem(flagTaker, EntityRef.NULL, blockFactory.newInstance(blockManager.getBlockFamily("LightAndShadowResources:redFlag"))); } if (teamComponent.team.equals("black")) { inventoryManager.giveItem(flagTaker, EntityRef.NULL, blockFactory.newInstance(blockManager.getBlockFamily("LightAndShadowResources:blackFlag"))); } worldProvider.setBlock(blockComponent.getPosition(), blockManager.getBlock(BlockManager.AIR_ID)); entity.destroy(); }
Source:
IdInputPanel(Composite parent, Consumer<Boolean> callback) { super(parent, SWT.NONE); this.setLayout(new RowLayout(SWT.VERTICAL)); Composite fieldContainer = new Composite(this, SWT.NONE); fieldContainer.setLayout(new GridLayout(2, true)); this.textfield = UIUtils.createLinkedFieldInput(this.getIdLabelText(), this.getIdTooltipText(), fieldContainer); textfield.setTextLimit(ID_LENGTH); textfield.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); Button verify = new Button(this, SWT.FLAT); verify.setText(VERIFICATION_BUTTON_TEXT); verify.setEnabled(false); textfield.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { verify.setEnabled(textfield.getText().length() == ID_LENGTH); } }); statusContainer = new Composite(this, SWT.NONE); statusContainer.setLayout(new RowLayout(SWT.VERTICAL)); verify.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { for (Control control : statusContainer.getChildren()) { control.dispose(); } callback.accept(verifyUserIdRegistration()); statusContainer.layout(true, true); parent.layout(true, true); parent.redraw(); parent.update(); } }); }

Target:
IdInputPanel(Composite parent, Consumer<Boolean> callback) { super(parent, SWT.NONE); this.setLayout(RegistrationStep.createRowLayout(SWT.VERTICAL)); Composite fieldContainer = new Composite(this, SWT.NONE); fieldContainer.setLayout(new GridLayout(2, false)); this.textfield = UIUtils.createLinkedFieldInput(this.getIdLabelText(), this.getIdTooltipText(), fieldContainer); textfield.setSize(250, SWT.DEFAULT); textfield.setTextLimit(ID_LENGTH); textfield.setLayoutData(new GridData(350, SWT.DEFAULT)); Button verify = new Button(fieldContainer, SWT.FLAT); verify.setText(VERIFICATION_BUTTON_TEXT); verify.setEnabled(false); verify.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); textfield.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { verify.setEnabled(textfield.getText().length() == ID_LENGTH); } }); statusContainer = new Composite(this, SWT.NONE); statusContainer.setLayout(RegistrationStep.createRowLayout(SWT.VERTICAL)); verify.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { for (Control control : statusContainer.getChildren()) { control.dispose(); } callback.accept(verifyUserIdRegistration()); statusContainer.layout(true, true); parent.layout(true, true); parent.redraw(); parent.update(); } }); }
Source:
@NonNull @Override public String getEditorName() { return AZTEC_EDITOR_NAME; }

Target:
public String getEditorName() { return AZTEC_EDITOR_NAME; }
Source:
public static Address fromBase58(NetworkParameters params, String base58) throws AddressFormatException { NetworkParameters networkParameters = (params != null) ? params : Address.getParametersFromAddress(base58); return Address.fromBase58(networkParameters, base58); }

Target:
public static Address fromBase58(NetworkParameters params, String base58) throws AddressFormatException { NetworkParameters networkParameters = (params != null) ? params : getParametersFromAddress(base58); return Address.fromBase58(networkParameters, base58); }
Source:
public void sendCommand(Command command) throws RecoverablePduException, UnrecoverablePduException, SmppTimeoutException, SmppChannelException, InterruptedException { if (command.getSms()) { Position lastPosition = getLastPosition(command.getDeviceId()); if (lastPosition != null) { Context.getServerManager().getProtocol(lastPosition.getProtocol()) .sendSmsCommand(devicesById.get(command.getDeviceId()).getPhone(), command); } else if (command.getType().equals(Command.TYPE_CUSTOM)) { Context.getSmppManager().sendMessageSync(devicesById.get(command.getDeviceId()).getPhone(), command.getString(Command.KEY_DATA), true); } else { throw new RuntimeException("Command " + command.getType() + " is not supported"); } } else { ActiveDevice activeDevice = Context.getConnectionManager().getActiveDevice(command.getDeviceId()); if (activeDevice != null) { activeDevice.sendCommand(command); } else { throw new RuntimeException("Device is not online"); } } }

Target:
public void sendCommand(Command command) throws Exception { long deviceId = command.getDeviceId(); if (command.getSms()) { Position lastPosition = getLastPosition(deviceId); if (lastPosition != null) { BaseProtocol protocol = Context.getServerManager().getProtocol(lastPosition.getProtocol()); protocol.sendSmsCommand(devicesById.get(deviceId).getPhone(), command); } else if (command.getType().equals(Command.TYPE_CUSTOM)) { Context.getSmppManager().sendMessageSync(devicesById.get(deviceId).getPhone(), command.getString(Command.KEY_DATA), true); } else { throw new RuntimeException("Command " + command.getType() + " is not supported"); } } else { ActiveDevice activeDevice = Context.getConnectionManager().getActiveDevice(deviceId); if (activeDevice != null) { activeDevice.sendCommand(command); } else { if (fallbackToSms) { command.setSms(true); sendCommand(command); } else { throw new RuntimeException("Device is not online"); } } } }
Source:
public @NonNull TmfModelResponse<TmfTreeModel<TimeGraphEntryModel>> fetchTree(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) { List<TimeGraphEntryModel> EntryList = new ArrayList<>(fEntryBuilder.size()); moduleEntryModelList = new ArrayList<>(); Boolean fetchTreeIsComplete = true; synchronized (fEntryBuilder) { fetchTreeIsComplete &= addTrace(monitor, EntryList); if (monitor != null) { if (monitor.isCanceled()) { return new TmfModelResponse<>(null, Status.CANCELLED, CommonStatusMessage.TASK_CANCELLED); } } } Collections.reverse(EntryList); Status status = fetchTreeIsComplete ? Status.COMPLETED : Status.RUNNING; String msg = fetchTreeIsComplete ? CommonStatusMessage.COMPLETED : CommonStatusMessage.RUNNING; return new TmfModelResponse<>(new TmfTreeModel<>(Collections.emptyList(), EntryList), status, msg); }

Target:
public @NonNull TmfModelResponse<TmfTreeModel<TimeGraphEntryModel>> fetchTree(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) { List<TimeGraphEntryModel> entryList = new ArrayList<>(); moduleEntryModelList = new ArrayList<>(); boolean fetchTreeIsComplete; synchronized (fEntryBuilder) { fetchTreeIsComplete = addTrace(monitor); if (monitor != null) { if (monitor.isCanceled()) { return new TmfModelResponse<>(null, Status.CANCELLED, CommonStatusMessage.TASK_CANCELLED); } } } entryList = buildEntryList(monitor); Status status = fetchTreeIsComplete ? Status.COMPLETED : Status.RUNNING; String msg = fetchTreeIsComplete ? CommonStatusMessage.COMPLETED : CommonStatusMessage.RUNNING; return new TmfModelResponse<>(new TmfTreeModel<>(Collections.emptyList(), entryList), status, msg); }
Source:
public ReportPoint apply(@Nullable ReportPoint reportPoint) { if (reportPoint == null) return null; long startNanos = ruleMetrics.ruleStart(); if (!v2Predicate.test(reportPoint)) return reportPoint; reportPoint.getAnnotations().put(tag, PreprocessorUtil.expandPlaceholders(value, reportPoint)); ruleMetrics.incrementRuleAppliedCounter(); ruleMetrics.ruleEnd(startNanos); return reportPoint; }

Target:
public ReportPoint apply(@Nullable ReportPoint reportPoint) { if (reportPoint == null) return null; long startNanos = ruleMetrics.ruleStart(); try { if (!v2Predicate.test(reportPoint)) return reportPoint; reportPoint.getAnnotations().put(tag, PreprocessorUtil.expandPlaceholders(value, reportPoint)); ruleMetrics.incrementRuleAppliedCounter(); return reportPoint; } finally { ruleMetrics.ruleEnd(startNanos); } }
Source:
private MultiValueMap<String, String> filterSubscriptions( MultiValueMap<String, String> allMatches, Message<?> message) { if (!this.selectorHeaderInUse) { return allMatches; } MultiValueMap<String, String> result = new LinkedMultiValueMap<>(allMatches.size()); allMatches.forEach((sessionId, subIds) -> { SessionSubscriptionInfo subscriptions = this.subscriptionRegistry.getSubscriptions(sessionId); if (subscriptions != null) { subIds.stream() .map(subscriptions::getSubscription) .filter(Objects::nonNull) .filter(subscriptionDetail -> evaluateExpression(subscriptionDetail.getSelectorExpression(), message)) .forEach(subscriptionDetail -> result.add(sessionId, subscriptionDetail.getId())); } }); return result; }

Target:
private MultiValueMap<String, String> filterSubscriptions( MultiValueMap<String, String> allMatches, Message<?> message) { if (!this.selectorHeaderInUse) { return allMatches; } MultiValueMap<String, String> result = new LinkedMultiValueMap<>(allMatches.size()); allMatches.forEach((sessionId, subscriptionsIds) -> { SessionSubscriptionInfo subscriptions = this.subscriptionRegistry.getSubscriptions(sessionId); if (subscriptions != null) { for (String subscriptionId : subscriptionsIds) { Subscription subscription = subscriptions.getSubscription(subscriptionId); if (subscription != null && evaluateExpression(subscription.getSelectorExpression(), message)) { result.add(sessionId, subscription.getId()); } } } }); return result; }
Source:
public boolean updateFiles() throws Exception { List<IFileSpec> syncFiles; String path = iclient.getRoot() + "/..."; syncFiles = FileSpecBuilder.makeFileSpecList(path); SyncOptions syncOpts = new SyncOptions(); List<IFileSpec> syncMsg = iclient.sync(syncFiles, syncOpts); for (IFileSpec fileSpec : syncMsg) { if (fileSpec.getOpStatus() != FileSpecOpStatus.VALID) { String msg = fileSpec.getStatusMessage(); if (msg.contains("file(s) up-to-date.")) { return false; } } } return true; }

Target:
public boolean updateFiles() throws Exception { List<IFileSpec> syncFiles; String path = iclient.getRoot() + "/..."; syncFiles = FileSpecBuilder.makeFileSpecList(path); SyncOptions syncOpts = new SyncOptions(); syncOpts.setNoUpdate(true); List<IFileSpec> syncMsg = iclient.sync(syncFiles, syncOpts); for (IFileSpec fileSpec : syncMsg) { if (fileSpec.getOpStatus() != FileSpecOpStatus.VALID) { String msg = fileSpec.getStatusMessage(); if (msg.contains("file(s) up-to-date.")) { return false; } } } return true; }
Source:
protected File getOutputDirectory( Bundle blueprintBundle ) { File managedResourcesFolder = managedResourceProvider.getManagedResourceFolder(); File to = new File( managedResourcesFolder.getAbsolutePath() + "/" + blueprintBundle.getSymbolicName() ); if ( !to.exists() ) { to.mkdirs(); } return to; }

Target:
protected File getOutputDirectory( Bundle blueprintBundle ) { File managedResourcesFolder = managedResourceProvider.getManagedResourceFolder(); File to = Paths.get( managedResourcesFolder.getAbsolutePath(), blueprintBundle.getSymbolicName() ).toFile(); if ( !to.exists() ) { to.mkdirs(); } return to; }
Source:
public void setup() { this.batch = new Batch(); this.batch.setProtocol(Protocol.VERSION_2); Map map1 = new HashMap<String, String>(); map1.put("line", "My super event log"); map1.put("from", "beats"); this.message1 = new Message(1, map1); this.batch.addMessage(this.message1); for(int i = 0; i < numberOfMessage; i++) { Map map2 = new HashMap<String, String>(); map2.put("line", "Another world"); map2.put("from", "Little big Adventure"); this.message2 = new Message(i + 1, map2); this.batch.addMessage(this.message2); } }

Target:
public void setup() { this.batch = new Batch(); this.batch.setProtocol(Protocol.VERSION_2); for(int i = 0; i < numberOfMessage; i++) { Map map = new HashMap<String, String>(); map.put("line", "Another world"); map.put("from", "Little big Adventure"); Message message = new Message(i + 1, map); this.batch.addMessage(message); } }
Source:
private void addDnsConfiguration(ReportedConfigurations result) { if (!this.isManagementNetwork) { return; } List<NameServer> nameServersOfNetworkAttachment = getNameServers(networkAttachment.getDnsResolverConfiguration()); List<NameServer> nameServersOfNetwork = getNameServers(network.getDnsResolverConfiguration()); List<NameServer> nameServersOfHost = getNameServers(vds.getDnsResolverConfiguration()); boolean engineDoesNotContainDnsConfiguration = nameServersOfNetworkAttachment == null && nameServersOfNetwork == null; List<NameServer> expectedNameServers = nameServersOfNetworkAttachment != null ? nameServersOfNetworkAttachment : nameServersOfNetwork; boolean inSync = isDhcpUsed(networkAttachment) || engineDoesNotContainDnsConfiguration || Objects.equals(nameServersOfHost, expectedNameServers); result.add(DNS_CONFIGURATION, addressesAsString(nameServersOfHost), addressesAsString(expectedNameServers), inSync); }

Target:
private void addDnsConfiguration(ReportedConfigurations result) { if (!hasDnsConfigurationData()) { return; } List<NameServer> nameServersOfNetworkAttachment = getNameServers(networkAttachment.getDnsResolverConfiguration()); List<NameServer> nameServersOfNetwork = getNameServers(network.getDnsResolverConfiguration()); List<NameServer> nameServersOfHost = getNameServers(vds.getDnsResolverConfiguration()); boolean engineDoesNotContainDnsConfiguration = nameServersOfNetworkAttachment == null && nameServersOfNetwork == null; List<NameServer> expectedNameServers = nameServersOfNetworkAttachment != null ? nameServersOfNetworkAttachment : nameServersOfNetwork; boolean inSync = isDhcpUsed(networkAttachment) || engineDoesNotContainDnsConfiguration || Objects.equals(nameServersOfHost, expectedNameServers); result.add(DNS_CONFIGURATION, addressesAsString(nameServersOfHost), addressesAsString(expectedNameServers), inSync); }
Source:
public String createPCJ(final String ryaInstanceName, final String sparql, final Set<ExportStrategy> strategies) throws InstanceDoesNotExistException, RyaClientException { requireNonNull(ryaInstanceName); requireNonNull(sparql); if (!instanceExists.exists(ryaInstanceName)) { throw new InstanceDoesNotExistException(String.format("There is no Rya instance named '%s'.", ryaInstanceName)); } final Optional<String> username = connectionDetails.getUsername(); final MongoCredential cred; final MongoClient client; final ServerAddress addr = new ServerAddress(connectionDetails.getHostname(), connectionDetails.getPort()); if(username.isPresent()) { cred = MongoCredential.createCredential(username.get(), ryaInstanceName, connectionDetails.getPassword().get()); client = new MongoClient(addr, Lists.newArrayList(cred)); } else { client = new MongoClient(addr); } @SuppressWarnings("resource") final MongoPcjStorage pcjStore = new MongoPcjStorage(client, ryaInstanceName); try { return pcjStore.createPcj(sparql); } catch (final PCJStorageException e) { throw new RyaClientException("Unable to create PCJ for: " + sparql, e); } finally { client.close(); } }

Target:
public String createPCJ(final String ryaInstanceName, final String sparql, final Set<ExportStrategy> strategies) throws InstanceDoesNotExistException, RyaClientException { requireNonNull(ryaInstanceName); requireNonNull(sparql); if (!instanceExists.exists(ryaInstanceName)) { throw new InstanceDoesNotExistException(String.format("There is no Rya instance named '%s'.", ryaInstanceName)); } try(final MongoPcjStorage pcjStore = new MongoPcjStorage(mongoClient, ryaInstanceName)) { return pcjStore.createPcj(sparql); } catch (final PCJStorageException e) { throw new RyaClientException("Unable to create PCJ for: " + sparql, e); } }
Source:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isExprResult()) { ClassMemberDeclaration declaration = ClassMemberDeclaration.newDeclarationOnThis(n); if (declaration == null || declarationHasBeenAdded(declaration)) { return; } Node fnNode = NodeUtil.getEnclosingFunction(n); String fnName = getEnclosingFunctionName(fnNode); if ("constructor".equals(fnName) && declaration.jsDoc != null && declaration.rhsEqualToField()) { JSTypeExpression declarationType = declaration.jsDoc.getType(); Node params = fnNode.getSecondChild(); @Nullable JSDocInfo constructorJsDoc = NodeUtil.getBestJSDocInfo(fnNode); for (Node param : params.children()) { Node nodeAfterDefault = param.isDefaultValue() ? param.getFirstChild() : param; if (!nodeAfterDefault.isName()) { continue; } String paramName = nodeAfterDefault.getString(); @Nullable JSTypeExpression paramType = constructorJsDoc == null ? null : constructorJsDoc.getParameterType(paramName); if (declaration.memberName.equals(paramName) && (declarationType == null || declarationType.equals(paramType))) { moveAccessModifier(declaration, param); markAsConst(declaration, param); compiler.reportChangeToEnclosingScope(n); n.detach(); return; } } } moveFieldsIntoClasses(declaration); registerDeclaration(declaration); } }

Target:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isExprResult()) { ClassMemberDeclaration declaration = ClassMemberDeclaration.newDeclarationOnThis(n); if (declaration == null || declarationHasBeenAdded(declaration)) { return; } Node fnNode = NodeUtil.getEnclosingFunction(n); String fnName = getEnclosingFunctionName(fnNode); if ("constructor".equals(fnName) && declaration.jsDoc != null && declaration.rhsEqualToField()) { JSTypeExpression declarationType = declaration.jsDoc.getType(); Node params = fnNode.getSecondChild(); @Nullable JSDocInfo constructorJsDoc = NodeUtil.getBestJSDocInfo(fnNode); for (Node param : params.children()) { Node nodeAfterDefault = param.isDefaultValue() ? param.getFirstChild() : param; if (!nodeAfterDefault.isName()) { continue; } String paramName = nodeAfterDefault.getString(); @Nullable JSTypeExpression paramType = constructorJsDoc == null ? null : constructorJsDoc.getParameterType(paramName); if (param.isDefaultValue() && Token.EQUALS.equals(paramType.getRoot().getToken())) { paramType = new JSTypeExpression( paramType.getRoot().getFirstChild(), paramType.getSourceName()); } if (declaration.memberName.equals(paramName) && (declarationType == null || declarationType.equals(paramType))) { moveAccessModifier(declaration, param); markAsConst(declaration, param); compiler.reportChangeToEnclosingScope(n); n.detach(); return; } } } moveFieldsIntoClasses(declaration); registerDeclaration(declaration); } }
Source:
public void prepareRun(BatchSinkContext context) throws Exception { Configuration conf = new Configuration(); String path = conf.get( "mapreduce.task.tmp.dir", conf.get( "mapred.child.tmp", conf.get("hadoop.tmp.dir", "/tmp"))) + "/" + UUID.randomUUID().toString(); context.addOutput(Output.of(config.referenceName, new MongoDBOutputFormatProvider(config, path))); }

Target:
public void prepareRun(BatchSinkContext context) throws Exception { Configuration conf = new Configuration(); String path = conf.get( "mapreduce.task.tmp.dir", conf.get( "mapred.child.tmp", conf.get("hadoop.tmp.dir", System.getProperty("java.io.tmpdir")))) + "/" + UUID.randomUUID().toString(); context.addOutput(Output.of(config.referenceName, new MongoDBOutputFormatProvider(config, path))); }
Source:
public <T extends LwM2mResponse> T send(final Registration destination, DownlinkRequest<T> request, long timeout) throws InterruptedException { if (!presenceService.isClientAwake(destination)) { LOG.info("The destination client is sleeping, request couldn't been sent."); return null; } ResponseCallbackQueueModeSynchronous<T> synchronousResponseCallback = new ResponseCallbackQueueModeSynchronous<T>( presenceService, destination); delegatedSender.send(destination, request, timeout, synchronousResponseCallback, synchronousResponseCallback); return synchronousResponseCallback.waitForResponse(timeout); }

Target:
public <T extends LwM2mResponse> T send(final Registration destination, DownlinkRequest<T> request, long timeout) throws InterruptedException { if (!destination.usesQueueMode()) { return delegatedSender.send(destination, request, timeout); } if (!presenceService.isClientAwake(destination)) { LOG.info("The destination client is sleeping, request couldn't been sent."); return null; } T response = delegatedSender.send(destination, request, timeout); if (response != null) { presenceService.setAwake(destination); } else { presenceService.clientNotResponding(destination); } return response; }
Source:
public void testMDirectMenuItem_Check_Bug547050() { MWindow window = ems.createModelElement(MWindow.class); MMenu mainMenu = ems.createModelElement(MMenu.class); MMenu fileMenu = ems.createModelElement(MMenu.class); fileMenu.setElementId("file"); fileMenu.setLabel("File"); mainMenu.getChildren().add(fileMenu); MMenuItem menuItem = ems.createModelElement(MDirectMenuItem.class); fileMenu.getChildren().add(menuItem); window.setMainMenu(mainMenu); application.getChildren().add(window); contextRule.createAndRunWorkbench(window); MenuManagerRenderer renderer = getRenderer(appContext, mainMenu); MenuManager manager = renderer.getManager(mainMenu); assertNotNull("failed to create menu bar manager", manager); manager.updateAll(true); assertEquals(1, manager.getSize()); MenuManager fileManager = renderer.getManager(fileMenu); MenuManagerRendererFilter.updateElementVisibility(fileMenu, renderer, fileManager, appContext, 2, true); Object widget1 = menuItem.getWidget(); assertNotNull(widget1); assertTrue(widget1 instanceof MenuItem); MenuItem menuItemWidget = (MenuItem) widget1; assertFalse(menuItemWidget.isEnabled()); }

Target:
public void testMDirectMenuItem_Check_Bug547050() { MWindow window = ems.createModelElement(MWindow.class); MMenu mainMenu = ems.createModelElement(MMenu.class); MMenu fileMenu = ems.createModelElement(MMenu.class); fileMenu.setElementId("file"); fileMenu.setLabel("File"); mainMenu.getChildren().add(fileMenu); MMenuItem menuItem = ems.createModelElement(MDirectMenuItem.class); fileMenu.getChildren().add(menuItem); window.setMainMenu(mainMenu); application.getChildren().add(window); contextRule.createAndRunWorkbench(window); MenuManager fileMenuManager = getRenderer(appContext, fileMenu).getManager(fileMenu); Menu fileMenuWidget = fileMenuManager.getMenu(); fileMenuWidget.notifyListeners(SWT.Show, null); Object widget1 = menuItem.getWidget(); assertNotNull(widget1); assertTrue(widget1 instanceof MenuItem); MenuItem menuItemWidget = (MenuItem) widget1; assertFalse(menuItemWidget.isEnabled()); }
Source:
public String[] getMessageParameters() { return new String[] {versionFound.toString(), minimumVersion.toString()}; }

Target:
public String[] getMessageParameters() { return new String[] {versionFound.toString(), minimumVersion.toString(), minimalVersionNickname}; }
Source:
public final void request(long n) { if (n == 0) { return; } boolean mayDrain; long r; long u; do { r = requestedCount.get(); mayDrain = r == 0; if (r == Long.MAX_VALUE) { break; } if (n == Long.MAX_VALUE) { u = n; mayDrain = true; } else { if (r > Long.MAX_VALUE - n) { u = Long.MAX_VALUE; } else { u = r + n; } } } while (!requestedCount.compareAndSet(r, u)); if (mayDrain) { drain(); } }

Target:
public final void request(long n) { if (n == 0) { return; } boolean mayDrain; long r; long u; do { r = get(); mayDrain = r == 0; if (r == Long.MAX_VALUE) { break; } if (n == Long.MAX_VALUE) { u = n; mayDrain = true; } else { if (r > Long.MAX_VALUE - n) { u = Long.MAX_VALUE; } else { u = r + n; } } } while (!compareAndSet(r, u)); if (mayDrain) { drain(); } }
Source:
public CloseableIterator<SAMRecord> queryAlignmentStart(final String sequence, final int start) { long[] filePointers = null; final SAMFileHeader fileHeader = getFileHeader(); final int referenceIndex = fileHeader.getSequenceIndex(sequence); if (referenceIndex != -1) { final BAMIndex fileIndex = getIndex(); final BAMFileSpan fileSpan = fileIndex.getSpanOverlapping( referenceIndex, start, -1); filePointers = fileSpan != null ? fileSpan.toCoordinateArray() : null; } if (filePointers == null || filePointers.length == 0) return emptyIterator; Container c; final SeekableStream s = getSeekableStreamOrFailWithRTE(); for (int i = 0; i < filePointers.length; i += 2) { final long containerOffset = filePointers[i] >>> 16; try { if (s.position() != containerOffset || it.container == null) { s.seek(containerOffset); c = ContainerIO.readContainerHeader(it.getCramHeader().getVersion().major, s); if (c.alignmentStart + c.alignmentSpan > start) { s.seek(containerOffset); it.jumpWithinContainerToPos(fileHeader.getSequenceIndex(sequence), start); return new IntervalIterator(it, new QueryInterval(referenceIndex, start, -1)); } } else { c = it.container; if (c.alignmentStart + c.alignmentSpan > start) { it.jumpWithinContainerToPos(fileHeader.getSequenceIndex(sequence), start); return new IntervalIterator(it, new QueryInterval(referenceIndex, start, -1)); } } } catch (final IOException e) { throw new RuntimeException(e); } } return it; }

Target:
public CloseableIterator<SAMRecord> queryAlignmentStart(final String sequence, final int start) { long[] filePointers = null; final SAMFileHeader fileHeader = getFileHeader(); final int referenceIndex = fileHeader.getSequenceIndex(sequence); if (referenceIndex != -1) { final BAMIndex fileIndex = getIndex(); final BAMFileSpan fileSpan = fileIndex.getSpanOverlapping( referenceIndex, start, -1); filePointers = fileSpan != null ? fileSpan.toCoordinateArray() : null; } if (filePointers == null || filePointers.length == 0) return emptyIterator; Container container; final SeekableStream seekableStream = getSeekableStreamOrFailWithRTE(); for (int i = 0; i < filePointers.length; i += 2) { final long containerOffset = filePointers[i] >>> 16; try { if (seekableStream.position() != containerOffset || iterator.container == null) { seekableStream.seek(containerOffset); container = ContainerIO.readContainerHeader(iterator.getCramHeader().getVersion().major, seekableStream); if (container.alignmentStart + container.alignmentSpan > start) { seekableStream.seek(containerOffset); iterator.jumpWithinContainerToPos(fileHeader.getSequenceIndex(sequence), start); return new IntervalIterator(iterator, new QueryInterval(referenceIndex, start, -1)); } } else { container = iterator.container; if (container.alignmentStart + container.alignmentSpan > start) { iterator.jumpWithinContainerToPos(fileHeader.getSequenceIndex(sequence), start); return new IntervalIterator(iterator, new QueryInterval(referenceIndex, start, -1)); } } } catch (final IOException e) { throw new RuntimeException(e); } } return iterator; }
Source:
public final void commit(DataContainer container) { realCommit(-1, container); }

Target:
public final void commit(DataContainer container) { realCommit(SegmentSpecificCommand.UNKNOWN_SEGMENT, container); }
Source:
public void testConvertListOffsetResponseToSaslHandshakeResponse() { ListOffsetResponse response = new ListOffsetResponse(0, Collections.singletonMap(new TopicPartition("topic", 0), new ListOffsetResponse.PartitionData(Errors.NONE, 0, 0, Optional.empty()))); ByteBuffer buffer = response.serialize(ApiKeys.LIST_OFFSETS, LIST_OFFSETS.latestVersion(), 0); RequestHeader header = new RequestHeader(LIST_OFFSETS, LIST_OFFSETS.latestVersion(), "id", SaslClientAuthenticator.MIN_RESERVED_CORRELATION_ID); try { NetworkClient.parseResponse(buffer.duplicate(), header); fail("parsing non-Sasl response should produce SchemaException"); } catch (SchemaException e) { } header = new RequestHeader(LIST_OFFSETS, LIST_OFFSETS.latestVersion(), "id", 1); try { NetworkClient.parseResponse(buffer.duplicate(), header); fail("the mismatched correlation id of request is NOT reserved so it should throw IllegalStateException"); } catch (IllegalStateException e) { } }

Target:
public void testConvertListOffsetResponseToSaslHandshakeResponse() { ListOffsetResponse response = new ListOffsetResponse(0, Collections.singletonMap(new TopicPartition("topic", 0), new ListOffsetResponse.PartitionData(Errors.NONE, 0, 0, Optional.empty()))); ByteBuffer buffer = response.serialize(ApiKeys.LIST_OFFSETS, LIST_OFFSETS.latestVersion(), 0); final RequestHeader header0 = new RequestHeader(LIST_OFFSETS, LIST_OFFSETS.latestVersion(), "id", SaslClientAuthenticator.MIN_RESERVED_CORRELATION_ID); Assert.assertThrows(SchemaException.class, () -> NetworkClient.parseResponse(buffer.duplicate(), header0)); final RequestHeader header1 = new RequestHeader(LIST_OFFSETS, LIST_OFFSETS.latestVersion(), "id", 1); Assert.assertThrows(IllegalStateException.class, () -> NetworkClient.parseResponse(buffer.duplicate(), header1)); }
Source:
public void testDecodeAllTheLetters() { AffineCipher affineCipher = new AffineCipher(); assertEquals("thequickbrownfoxjumpsoverthelazydog", affineCipher.decode("swxtj npvyk lruol iejdc blaxk swxmh qzglf", 17, 33)); }

Target:
public void testDecodeAllTheLetters() { assertEquals("thequickbrownfoxjumpsoverthelazydog", affineCipher.decode("swxtj npvyk lruol iejdc blaxk swxmh qzglf", 17, 33)); }
Source:
private static void escape(String[] chars) { for (int i = 0; i < chars.length; i++) { if (chars[i].equals("<")) { chars[i] = "&lt;"; } else if (chars[i].equals(">")) { chars[i] = "&gt;"; } else if (chars[i].equals("&")) { chars[i] = "&amp;"; } } }

Target:
private static void escape(String[] chars) { for (int i = 0; i < chars.length; i++) { chars[i] = StringEscapeUtils.escapeHtml(chars[i]); } }
Source:
public void canBeConstructedFromBytes() throws UnsupportedEncodingException { final String test = "Bye 同時に Пока"; final Utf8String str = new Utf8String( test.getBytes(Utf8StringTest.ENCODING) ); MatcherAssert.assertThat(str.asString(), Matchers.equalTo(test)); MatcherAssert.assertThat( str.asBytes(), Matchers.equalTo(test.getBytes(Utf8StringTest.ENCODING)) ); }

Target:
public void canBeConstructedFromBytes() throws UnsupportedEncodingException { final String test = "Bye 同時に Пока"; final Utf8String str = new Utf8String( test.getBytes(Utf8StringTest.ENCODING) ); MatcherAssert.assertThat(str.asString(), new IsEqual<>(test)); MatcherAssert.assertThat( str.asBytes(), new IsEqual<>(test.getBytes(Utf8StringTest.ENCODING)) ); }
Source:
protected CommandStack getCommandStack(IWorkbenchPart part, Object input) { Object helper = getInputType(input); if (null != helper) { return SystemManager.INSTANCE.getCommandStack(((Resource) helper).getAutomationSystem()); } return null; }

Target:
protected CommandStack getCommandStack(IWorkbenchPart part, Object input) { Resource helper = getInputType(input); if (null != helper) { return SystemManager.INSTANCE.getCommandStack(helper.getAutomationSystem()); } return null; }
Source:
private static Properties processProperties(final String propertyFileName) throws IOException { final File propertyFile = new File(propertyFileName); final Properties properties = new Properties(); try (InputStream is = new FileInputStream(propertyFile)) { properties.load(is); } return properties; }

Target:
private static Properties processProperties(final String propertyFileName) throws IOException { final Path propertyFile = Paths.get(propertyFileName); final Properties properties = new Properties(); try (InputStream is = Files.newInputStream(propertyFile)) { properties.load(is); } return properties; }
Source:
public double getStarDistanceToJumpPoint() { if( null == spectralClass || null == subtype ) { return StarUtil.getDistanceToJumpPoint(42); } return StarUtil.getDistanceToJumpPoint(spectralClass, subtype); }

Target:
public double getStarDistanceToJumpPoint() { if( null == spectralClass || null == subtype ) { return StarUtil.getDistanceToJumpPoint(40); } return StarUtil.getDistanceToJumpPoint(spectralClass, subtype); }
Source:
ContributionsListAdapter(final Callback callback, final MediaClient mediaClient) { super(DIFF_CALLBACK); this.callback = callback; this.mediaClient = mediaClient; setHasStableIds(false); }

Target:
ContributionsListAdapter(final Callback callback, final MediaClient mediaClient) { super(DIFF_CALLBACK); this.callback = callback; this.mediaClient = mediaClient; }
Source:
public void getTree(GetTreeRequest request, StreamObserver<GetTreeResponse> responseObserver) { Set<Digest> seenDigests = new HashSet<>(); Deque<Digest> pendingDigests = new ArrayDeque<>(); seenDigests.add(request.getRootDigest()); pendingDigests.push(request.getRootDigest()); boolean skipping = !request.getPageToken().isEmpty(); while (!pendingDigests.isEmpty() && !Context.current().isCancelled()) { Digest digest = pendingDigests.pop(); byte[] directoryBytes; try { directoryBytes = getFromFuture(cache.downloadBlob(digest)); } catch (CacheNotFoundException e) { responseObserver.onError(StatusUtils.notFoundError(digest)); return; } catch (Exception e) { logger.log(WARNING, "Read request failed.", e); responseObserver.onError(StatusUtils.internalError(e)); return; } Directory directory; try { directory = Directory.parseFrom(directoryBytes); } catch (InvalidProtocolBufferException e) { logger.log(WARNING, "Failed to parse directory in tree.", e); responseObserver.onError(StatusUtils.internalError(e)); return; } for (DirectoryNode directoryNode : directory.getDirectoriesList()) { if (!seenDigests.contains(directoryNode.getDigest())) { seenDigests.add(directoryNode.getDigest()); pendingDigests.push(directoryNode.getDigest()); } } GetTreeResponse response = GetTreeResponse.newBuilder() .addDirectories(directory) .setNextPageToken(pendingDigests.isEmpty() ? "" : digest.getHash()) .build(); if (!skipping) { responseObserver.onNext(response); } if (request.getPageToken().equals(digest.getHash())) { skipping = false; } } if (Context.current().isCancelled()) { responseObserver.onError(Status.CANCELLED.asException()); } else { responseObserver.onCompleted(); } }

Target:
public void getTree(GetTreeRequest request, StreamObserver<GetTreeResponse> responseObserver) { Set<Digest> seenDigests = new HashSet<>(); Deque<Digest> pendingDigests = new ArrayDeque<>(); seenDigests.add(request.getRootDigest()); pendingDigests.push(request.getRootDigest()); GetTreeResponse.Builder responseBuilder = GetTreeResponse.newBuilder(); while (!pendingDigests.isEmpty()) { Digest digest = pendingDigests.pop(); byte[] directoryBytes; try { directoryBytes = getFromFuture(cache.downloadBlob(digest)); } catch (CacheNotFoundException e) { responseObserver.onError(StatusUtils.notFoundError(digest)); return; } catch (Exception e) { logger.log(WARNING, "Read request failed.", e); responseObserver.onError(StatusUtils.internalError(e)); return; } Directory directory; try { directory = Directory.parseFrom(directoryBytes); } catch (InvalidProtocolBufferException e) { logger.log(WARNING, "Failed to parse directory in tree.", e); responseObserver.onError(StatusUtils.internalError(e)); return; } responseBuilder.addDirectories(directory); for (DirectoryNode directoryNode : directory.getDirectoriesList()) { if (!seenDigests.contains(directoryNode.getDigest())) { seenDigests.add(directoryNode.getDigest()); pendingDigests.push(directoryNode.getDigest()); } } } responseObserver.onNext(responseBuilder.build()); responseObserver.onCompleted(); }
Source:
public void shouldNotLogPassword() throws Exception { GraphDatabaseFacade database = (GraphDatabaseFacade) databaseBuilder .setConfig( GraphDatabaseSettings.log_queries, Settings.TRUE ) .setConfig( GraphDatabaseSettings.logs_directory, logsDirectory.getPath() ) .setConfig( GraphDatabaseSettings.auth_enabled, Settings.TRUE ) .newGraphDatabase(); EnterpriseAuthManager authManager = database.getDependencyResolver().resolveDependency( EnterpriseAuthManager.class ); EnterpriseSecurityContext neo = authManager.login( AuthToken.newBasicAuthToken( "neo4j", "neo4j" ) ); String query = "CALL dbms.security.changePassword('abc123')"; try ( InternalTransaction tx = database .beginTransaction( KernelTransaction.Type.explicit, neo ) ) { Result res = database.execute( tx, query, Collections.emptyMap() ); res.close(); tx.success(); } finally { database.shutdown(); } List<String> logLines = readAllLines( logFilename ); assertEquals( 1, logLines.size() ); assertThat( logLines.get( 0 ), containsString( "CALL dbms.security.changePassword(******)") ) ; assertThat( logLines.get( 0 ), containsString( neo.subject().username() ) ); }

Target:
public void shouldNotLogPassword() throws Exception { GraphDatabaseFacade database = (GraphDatabaseFacade) databaseBuilder .setConfig( GraphDatabaseSettings.log_queries, Settings.TRUE ) .setConfig( GraphDatabaseSettings.logs_directory, logsDirectory.getPath() ) .setConfig( GraphDatabaseSettings.auth_enabled, Settings.TRUE ) .newGraphDatabase(); EnterpriseAuthManager authManager = database.getDependencyResolver().resolveDependency( EnterpriseAuthManager.class ); EnterpriseSecurityContext neo = authManager.login( AuthToken.newBasicAuthToken( "neo4j", "neo4j" ) ); String query = "CALL dbms.security.changePassword('abc123')"; try ( InternalTransaction tx = database .beginTransaction( KernelTransaction.Type.explicit, neo ) ) { Result res = database.execute( tx, query, Collections.emptyMap() ); res.close(); tx.success(); } finally { database.shutdown(); } List<String> logLines = readAllLines( logFilename ); assertEquals( 1, logLines.size() ); assertThat( logLines.get( 0 ), containsString( "CALL dbms.security.changePassword(******)") ) ; assertThat( logLines.get( 0 ),not( containsString( "abc123" ) ) ); assertThat( logLines.get( 0 ), containsString( neo.subject().username() ) ); }
Source:
void receive(final String requestId, final IEvents events) { List<IEvents> eventsList = getObjectToBeDispatched(requestId); if (eventsList == null) { eventsList = new ArrayList<>(); } eventsList.add(events); getObjectsToBeDispatched().put(requestId, eventsList); flush(); }

Target:
void receive(final String requestId, final IEvents events) { List<IEvents> eventsList = getObjectsToBeDispatched().get(requestId); if (eventsList == null) { eventsList = new ArrayList<>(); } eventsList.add(events); getObjectsToBeDispatched().put(requestId, eventsList); }
Source:
public AnnotationMirror leastUpperBound( final AnnotationMirror a1, final AnnotationMirror a2) { if (AnnotationUtils.areSame(a1, BOTTOM)) { return a2; } else if (AnnotationUtils.areSame(a2, BOTTOM)) { return a1; } if (!AnnotationUtils.hasElementValue(a1, "value")) { return a1; } if (!AnnotationUtils.hasElementValue(a2, "value")) { return a2; } if (isAccumulatorAnnotation(a1) && isAccumulatorAnnotation(a2)) { Set<String> a1Val = new LinkedHashSet<>( ValueCheckerUtils.getValueOfAnnotationWithStringArgument(a1)); Set<String> a2Val = new LinkedHashSet<>( ValueCheckerUtils.getValueOfAnnotationWithStringArgument(a2)); a1Val.retainAll(a2Val); return createAccumulatorAnnotation(a1Val.toArray(new String[0])); } else { return TOP; } }

Target:
public AnnotationMirror leastUpperBound( final AnnotationMirror a1, final AnnotationMirror a2) { if (AnnotationUtils.areSame(a1, bottom)) { return a2; } else if (AnnotationUtils.areSame(a2, bottom)) { return a1; } List<String> a1Val = getAccumulatedValues(a1); List<String> a2Val = getAccumulatedValues(a2); if (a1Val.containsAll(a2Val)) { return a2; } if (a2Val.containsAll(a1Val)) { return a1; } a1Val.retainAll(a2Val); return createAccumulatorAnnotation(a1Val); }
Source:
public void deletePermanentGroupUnprocessableTest() throws Exception { context.turnOffAuthorisationSystem(); GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); final Group group = groupService.findByName(context, Group.ANONYMOUS); context.restoreAuthSystemState(); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform( get("/api/eperson/groups/" + group.getID()) ).andExpect(status().isOk()); getClient(authToken).perform( delete("/api/eperson/groups/" + group.getID()) ).andExpect(status().isUnprocessableEntity()); getClient(authToken).perform( get("/api/eperson/groups/" + group.getID()) ).andExpect(status().isOk()); }

Target:
public void deletePermanentGroupUnprocessableTest() throws Exception { GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); final Group group = groupService.findByName(context, Group.ANONYMOUS); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform( get("/api/eperson/groups/" + group.getID()) ).andExpect(status().isOk()); getClient(authToken).perform( delete("/api/eperson/groups/" + group.getID()) ).andExpect(status().isUnprocessableEntity()); getClient(authToken).perform( get("/api/eperson/groups/" + group.getID()) ).andExpect(status().isOk()); }
Source:
public void testSQLWithAPI() throws ClassNotFoundException, IOException { LogicalPlan dag = new LogicalPlan(); String schema = "{\"separator\":\",\",\"quoteChar\":\"\\\"\",\"fields\":[" + "{\"name\":\"RowTime\",\"type\":\"Date\",\"constraints\":{\"format\":\"dd/MM/yyyy hh:mm:ss Z\"}}," + "{\"name\":\"id\",\"type\":\"Integer\"},{\"name\":\"Product\",\"type\":\"String\"}," + "{\"name\":\"units\",\"type\":\"Integer\"}]}"; Endpoint endpoint = new FileEndpoint("/tmp/test", new CSVMessageFormat(schema)); SQLExecEnvironment.getEnvironment() .registerTable("ORDERS", endpoint) .executeSQL(dag, "SELECT STREAM FLOOR(ROWTIME TO HOUR), SUBSTRING(PRODUCT, 0, 5) FROM ORDERS WHERE id > 3"); dag.validate(); }

Target:
public void testSQLWithAPI() throws ClassNotFoundException, IOException { LogicalPlan dag = new LogicalPlan(); String schema = "{\"separator\":\",\",\"quoteChar\":\"\\\"\",\"fields\":[" + "{\"name\":\"RowTime\",\"type\":\"Date\",\"constraints\":{\"format\":\"dd/MM/yyyy hh:mm:ss Z\"}}," + "{\"name\":\"id\",\"type\":\"Integer\"},{\"name\":\"Product\",\"type\":\"String\"}," + "{\"name\":\"units\",\"type\":\"Integer\"}]}"; Endpoint endpoint = new FileEndpoint("dummyFilePath", new CSVMessageFormat(schema)); SQLExecEnvironment.getEnvironment() .registerTable("ORDERS", endpoint) .executeSQL(dag, "SELECT STREAM FLOOR(ROWTIME TO HOUR), SUBSTRING(PRODUCT, 0, 5) FROM ORDERS WHERE id > 3"); dag.validate(); }