auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public RulesetMetadata processElement(ParserContext context, Element element) throws ConfigurationException { List<Element> children = $(element).children().get(); MetadataBuilder metadataBuilder = context.getBuilder().getMetadataBuilder(); for (Element child : children) { Object result = context.processElement(child); switch ($(child).tag()) { case "dependencies": List<AddonId> resultList = (List<AddonId>)result; for(AddonId id : resultList) { metadataBuilder.addRequiredAddon(id); } break; case "sourcePlatform": metadataBuilder.addSourceTechnology((TechnologyReference)result); break; case "sourceFramework": metadataBuilder.addSourceTechnology((TechnologyReference)result); break; case "targetPlatform": metadataBuilder.addTargetTechnology((TechnologyReference)result); break; case "targetFramework": metadataBuilder.addTargetTechnology((TechnologyReference)result); break; case "tags": List<String> tagList = (List<String>)result; for(String tag : tagList) { metadataBuilder.addTag(tag); } break; case "executeAfter": metadataBuilder.addExecuteAfterId((String)result); break; case "executeBefore": metadataBuilder.addExecuteBeforeId((String)result); break; } } return metadataBuilder; }

Target:
public RulesetMetadata processElement(ParserContext context, Element element) throws ConfigurationException { List<Element> children = $(element).children().get(); MetadataBuilder metadataBuilder = context.getBuilder().getMetadataBuilder(); for (Element child : children) { Object result = context.processElement(child); switch ($(child).tag()) { case "dependencies": List<AddonId> resultList = (List<AddonId>)result; for(AddonId id : resultList) { metadataBuilder.addRequiredAddon(id); } break; case "sourceTechnology": metadataBuilder.addSourceTechnology((TechnologyReference)result); break; case "targetTechnology": metadataBuilder.addTargetTechnology((TechnologyReference)result); break; case "tags": List<String> tagList = (List<String>)result; for(String tag : tagList) { metadataBuilder.addTag(tag); } break; case "executeAfter": metadataBuilder.addExecuteAfterId((String)result); break; case "executeBefore": metadataBuilder.addExecuteBeforeId((String)result); break; } } return metadataBuilder; }
Source:
public static String[] getMonthsArray(String key){ System.out.println("Getting months array with key: " + key + ", source: " + arrayDataSource); return arrayDataSource.getArray(key); }

Target:
public static String[] getMonthsArray(String key){ return arrayDataSource.getArray(key); }
Source:
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_API_KEY"))) .endpoint(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_ENDPOINT")) .buildClient(); String document = "My SSN is 555-55-5555"; client.recognizePiiEntities(document).forEach(entity -> System.out.printf( "Recognized personal identifiable information entity: %s, entity category: %s, entity sub-category: %s, score: %f.%n", entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); }

Target:
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); String document = "My SSN is 859-98-0987"; client.recognizePiiEntities(document).forEach(entity -> System.out.printf( "Recognized Personal Identifiable Information entity: %s, entity category: %s, entity sub-category: %s, score: %f.%n", entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); }
Source:
void testInsertEntryWithEmptyFields() throws SQLException { BibEntry expectedEntry = new BibEntry(StandardEntryType.Article); dbmsProcessor.insertEntry(expectedEntry); BibEntry emptyEntry = getBibEntryExample(); emptyEntry.getSharedBibEntryData().setSharedID(1); dbmsProcessor.insertEntry(emptyEntry); Map<String, String> actualFieldMap = new HashMap<>(); try (ResultSet entryResultSet = selectFrom("ENTRY", dbmsConnection, dbmsProcessor)) { assertTrue(entryResultSet.next()); assertEquals(1, entryResultSet.getInt("SHARED_ID")); assertEquals("article", entryResultSet.getString("TYPE")); assertEquals(1, entryResultSet.getInt("VERSION")); assertFalse(entryResultSet.next()); try (ResultSet fieldResultSet = selectFrom("FIELD", dbmsConnection, dbmsProcessor)) { while (fieldResultSet.next()) { actualFieldMap.put(fieldResultSet.getString("NAME"), fieldResultSet.getString("VALUE")); } } } Map<String, String> expectedFieldMap = expectedEntry.getFieldMap().entrySet().stream().collect(Collectors.toMap((entry) -> entry.getKey().getName(), Map.Entry::getValue)); assertEquals(expectedFieldMap, actualFieldMap); }

Target:
void testInsertEntryWithEmptyFields() throws SQLException { BibEntry expectedEntry = new BibEntry(StandardEntryType.Article); dbmsProcessor.insertEntry(expectedEntry); try (ResultSet entryResultSet = selectFrom("ENTRY", dbmsConnection, dbmsProcessor)) { assertTrue(entryResultSet.next()); assertEquals(1, entryResultSet.getInt("SHARED_ID")); assertEquals("article", entryResultSet.getString("TYPE")); assertEquals(1, entryResultSet.getInt("VERSION")); assertFalse(entryResultSet.next()); try (ResultSet fieldResultSet = selectFrom("FIELD", dbmsConnection, dbmsProcessor)) { assertFalse(fieldResultSet.next()); } } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.multiple_apps_limit_view); TextView mulitpleAppLimitTextView = findViewById(R.id.mulitple_app_limit_textview); String text = StringUtils.getStringRobust(this, R.string.multiple_apps_limit_message, String.valueOf(CommCareSetupActivity.MAX_ALLOWED_APPS)); mulitpleAppLimitTextView.setText(text); boolean installAttemptCameFromAppManager = getIntent() .getBooleanExtra(AppManagerActivity.KEY_LAUNCH_FROM_MANAGER, false); setupUI(installAttemptCameFromAppManager); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.multiple_apps_limit_view); boolean installAttemptCameFromAppManager = getIntent() .getBooleanExtra(AppManagerActivity.KEY_LAUNCH_FROM_MANAGER, false); setupUI(installAttemptCameFromAppManager); }
Source:
public static String documentToString(Document doc) { String strMsg = ""; try { DOMImplementation domImpl = doc.getImplementation(); DOMImplementationLS domImplLS = (DOMImplementationLS) domImpl.getFeature("LS", "3.0"); LSSerializer lsSerializer = domImplLS.createLSSerializer(); lsSerializer.getDomConfig().setParameter("format-pretty-print", true); Writer stringWriter = new StringWriter(); LSOutput lsOutput = domImplLS.createLSOutput(); lsOutput.setEncoding("UTF-8"); lsOutput.setCharacterStream(stringWriter); lsSerializer.write(doc, lsOutput); strMsg = stringWriter.toString(); } catch (Exception e) { e.printStackTrace(); } return strMsg; }

Target:
public static String documentToString(Document doc) { String strMsg = ""; try { DOMImplementation domImpl = doc.getImplementation(); DOMImplementationLS domImplLS = (DOMImplementationLS) domImpl.getFeature("LS", "3.0"); LSSerializer lsSerializer = domImplLS.createLSSerializer(); lsSerializer.getDomConfig().setParameter("format-pretty-print", true); Writer stringWriter = new StringWriter(); LSOutput lsOutput = domImplLS.createLSOutput(); lsOutput.setEncoding("UTF-8"); lsOutput.setCharacterStream(stringWriter); lsSerializer.write(doc, lsOutput); strMsg = stringWriter.toString(); } catch (Exception e) { logger.warn("Error occured when converting document to string", e); } return strMsg; }
Source:
private String serialize(Object object) { String json = null; try { objectMapper.writeValueAsString(object); } catch (JsonProcessingException e) { log.severe("Failed to serialize trace", e); } return json; }

Target:
private String serialize(Object object) { String json = null; try { json = objectMapper.writeValueAsString(object); } catch (JsonProcessingException e) { log.severe("Failed to serialize trace", e); } return json; }
Source:
public int partition(String topic, Object key, byte[] keyBytes, Object value, byte[] valueBytes, Cluster cluster) { if (((String)key).length() % 2 == 0) return 0; return 1; }

Target:
public int partition(String topic, Object key, byte[] keyBytes, Object value, byte[] valueBytes, Cluster cluster) { if (((String) key).length() % 2 == 0) { return 0; } return 1; }
Source:
private List<RequestInfo> pollForRequests() { idsToDelete.clear(); putManager.getIdsToDelete(idsToDelete); for (String blobId : idsToDelete) { deleteManager.submitDeleteBlobOperation(blobId, new FutureResult<Void>(), null); } List<RequestInfo> requests = new ArrayList<RequestInfo>(); long lastTime = time.milliseconds(); putManager.poll(requests); routerMetrics.putManagerPollTimeMs.update(time.milliseconds() - lastTime); lastTime = time.milliseconds(); getManager.poll(requests); routerMetrics.getManagerPollTimeMs.update(time.milliseconds() - lastTime); lastTime = time.milliseconds(); deleteManager.poll(requests); routerMetrics.deleteManagerPollTimeMs.update(time.milliseconds() - lastTime); return requests; }

Target:
private List<RequestInfo> pollForRequests() { idsToDelete.clear(); putManager.getIdsToDelete(idsToDelete); for (String blobId : idsToDelete) { deleteManager.submitDeleteBlobOperation(blobId, new FutureResult<Void>(), null); } List<RequestInfo> requests = new ArrayList<RequestInfo>(); putManager.poll(requests); getManager.poll(requests); deleteManager.poll(requests); return requests; }
Source:
public List<GlusterGeoRepSessionDetails> getSessionDetails() { return sessionDetails; }

Target:
public ArrayList<GlusterGeoRepSessionDetails> getSessionDetails() { return sessionDetails; }
Source:
public Transceiver getRawCategories(final ArticleIdentifier articleId) throws IOException { return new Transceiver() { @Override protected Calendar getLastModifiedDate() { ArticleTable article = getArticle(articleId); ArticleVersion articleVersion = getLatestArticleVersion(article); return copyToCalendar(articleVersion.getLastModified()); } @Override protected Object getData() throws IOException { ArticleTable article = getArticle(articleId); ArticleVersion articleVersion = getLatestArticleVersion(article); Document manuscriptXml = getManuscriptXml(articleVersion); List<String> rawTerms = taxonomyService.getRawTerms(manuscriptXml, article, false ); List<String> cleanedTerms = new ArrayList<>(); for (String term : rawTerms) { term = term.replaceAll("<TERM>", "").replaceAll("</TERM>", ""); cleanedTerms.add(term); } return cleanedTerms; } }; }

Target:
public Transceiver getRawCategories(final ArticleIdentifier articleId) throws IOException { return new Transceiver() { @Override protected Calendar getLastModifiedDate() { return null; } @Override protected Object getData() throws IOException { ArticleTable article = getArticle(articleId); ArticleVersion articleVersion = getLatestArticleVersion(article); Document manuscriptXml = getManuscriptXml(articleVersion); List<String> rawTerms = taxonomyService.getRawTerms(manuscriptXml, article, false ); List<String> cleanedTerms = new ArrayList<>(); for (String term : rawTerms) { term = term.replaceAll("<TERM>", "").replaceAll("</TERM>", ""); cleanedTerms.add(term); } return cleanedTerms; } }; }
Source:
private ExecutionErrorHandler getExecutionErrorHandler(RuntimeManager manager) { ExecutionErrorManager errorManager = ((AbstractRuntimeManager) manager).getExecutionErrorManager(); return ((ExecutionErrorManagerImpl) errorManager).createHandler(); }

Target:
private ExecutionErrorHandler getExecutionErrorHandler(RuntimeManager manager) { ExecutionErrorManager errorManager = ((AbstractRuntimeManager) manager).getExecutionErrorManager(); if (errorManager == null) { return new NoOpExecutionErrorHandler(); } return ((ExecutionErrorManagerImpl) errorManager).createHandler(); }
Source:
public IterableStream<ServiceBusReceivedMessage> receive(int maxMessages) { if (maxMessages <= 0) { throw logger.logExceptionAsError(new IllegalArgumentException( "'maxMessages' cannot be less than or equal to 0. maxMessages: " + maxMessages)); } final Flux<ServiceBusReceivedMessage> messages = Flux.create(emitter -> queueWork(maxMessages, DEFAULT_RECEIVE_WAIT_TIME, emitter)); return new IterableStream<>(messages); }

Target:
public IterableStream<ServiceBusReceivedMessage> receive(int maxMessages) { return receive(maxMessages, operationTimeout); }
Source:
public void testChecksumsForSourceFiles() { final ApiClient webClient = getWebClient(USER_2_USERNAME, testingPostgres); WorkflowsApi workflowsApi = new WorkflowsApi(webClient); Workflow workflow = workflowsApi.manualRegister("github", "DockstoreTestUser2/hello-dockstore-workflow", "/Dockstore.wdl", "", "wdl", "/test.json"); workflow = workflowsApi.refresh(workflow.getId()); List<WorkflowVersion> workflowVersions = workflow.getWorkflowVersions(); assertFalse(workflowVersions.isEmpty()); boolean testedWDL = false; for (WorkflowVersion workflowVersion : workflowVersions) { if (workflowVersion.getName().equals("testBoth") || workflowVersion.getName().equals("testWDL")) { testedWDL = true; assertTrue(testedWDL); assertNotNull(workflowVersion.getSourceFiles()); workflowVersion.getSourceFiles().stream().forEach(sourceFile -> assertNotNull("Should have checksums", sourceFile.getChecksums())); } workflowVersion.getSourceFiles(); } WorkflowVersion version = snapshotWorkflowVersion(workflowsApi, "dockstore-testing/hello_world", "/hello_world.cwl", "1.0.1"); assertNotNull(version.getSourceFiles()); version.getSourceFiles().stream().forEach(sourceFile -> assertNotNull("Should have checksums", sourceFile.getChecksums())); }

Target:
public void testChecksumsForSourceFiles() { final ApiClient webClient = getWebClient(USER_2_USERNAME, testingPostgres); WorkflowsApi workflowsApi = new WorkflowsApi(webClient); Workflow workflow = workflowsApi.manualRegister("github", "DockstoreTestUser2/hello-dockstore-workflow", "/Dockstore.wdl", "", "wdl", "/test.json"); workflow = workflowsApi.refresh(workflow.getId()); List<WorkflowVersion> workflowVersions = workflow.getWorkflowVersions(); assertFalse(workflowVersions.isEmpty()); boolean testedWDL = false; for (WorkflowVersion workflowVersion : workflowVersions) { if (workflowVersion.getName().equals("testBoth") || workflowVersion.getName().equals("testWDL")) { testedWDL = true; assertNotNull(workflowVersion.getSourceFiles()); workflowVersion.getSourceFiles().stream().forEach(sourceFile -> assertFalse("Source file should have a checksum", sourceFile.getChecksums().get(0).toString().isEmpty())); } } assertTrue(testedWDL); Workflow workflow2 = manualRegisterAndPublish(workflowsApi, "dockstore-testing/hello_world", "", "cwl", SourceControl.GITHUB, "/hello_world.cwl", true); WorkflowVersion snapshotVersion = workflow2.getWorkflowVersions().stream().filter(v -> v.getName().equals("1.0.1")).findFirst().get(); assertNotNull(snapshotVersion.getSourceFiles()); snapshotVersion.setFrozen(true); workflowsApi.updateWorkflowVersion(workflow2.getId(), Collections.singletonList(snapshotVersion)); snapshotVersion.getSourceFiles().stream().forEach(sourceFile -> assertFalse("Source File should have a checksum", sourceFile.getChecksums().get(0).toString().isEmpty())); workflowsApi.refresh(workflow2.getId()); }
Source:
public boolean onCreateOptionsMenu(Menu menu) { boolean ret = super.onCreateOptionsMenu(menu); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(getResources().getDrawable(R.drawable.ic_done_white_24dp)); actionBar.setTitle(R.string.title_activity_recaptcha); actionBar.setSubtitle(R.string.subtitle_activity_recaptcha); } return ret; }

Target:
public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_recaptcha, menu); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setTitle(R.string.title_activity_recaptcha); actionBar.setSubtitle(R.string.subtitle_activity_recaptcha); } return true; }
Source:
public void shouldParseFormsEventAttributesProperly() { String eventSubject = formsEvent.getSubject(); Map<String, Object> eventParameters = formsEvent.getParameters(); Map<String, Object> parsedParameters = formsEventParser.parseEventParameters(eventSubject, eventParameters); assertTrue(parsedParameters.containsKey("/data/case/@case_id")); assertTrue(parsedParameters.containsKey("/data/case/@user_id")); assertTrue(parsedParameters.containsKey("/data/case/@date_modified")); assertTrue(parsedParameters.containsKey("/data/case/@xmlns")); assertEquals(CASE_ID, parsedParameters.get("/data/case/@case_id")); assertEquals(USER_ID, parsedParameters.get("/data/case/@user_id")); assertEquals(DATE_MODIFIED, parsedParameters.get("/data/case/@date_modified")); assertEquals(XMLNS, parsedParameters.get("/data/case/@xmlns")); }

Target:
public void shouldParseFormsEventAttributesProperly() { String eventSubject = formsEvent.getSubject(); Map<String, Object> eventParameters = formsEvent.getParameters(); Map<String, Object> parsedParameters = formsEventParser.parseEventParameters(eventSubject, eventParameters); assertTrue(parsedParameters.containsKey("/data/case/@case_id")); assertTrue(parsedParameters.containsKey("/data/case/@user_id")); assertTrue(parsedParameters.containsKey("/data/case/@date_modified")); assertTrue(parsedParameters.containsKey("/data/case/@xmlns")); assertTrue(parsedParameters.containsKey("/data/case/update/@date")); assertTrue(parsedParameters.containsKey("/data/case/update/number/@attr")); assertEquals(CASE_ID, parsedParameters.get("/data/case/@case_id")); assertEquals(USER_ID, parsedParameters.get("/data/case/@user_id")); assertEquals(DATE_MODIFIED, parsedParameters.get("/data/case/@date_modified")); assertEquals(XMLNS, parsedParameters.get("/data/case/@xmlns")); assertEquals(DATE, parsedParameters.get("/data/case/update/@date")); assertEquals(ATTR, parsedParameters.get("/data/case/update/number/@attr")); }
Source:
private void discardReadBytesIfNecessary(ByteBuf buffer) { int bufferUsageRatio = clientOptions.getBufferUsageRatio(); if (buffer.writerIndex() * (bufferUsageRatio + 1) >= buffer.capacity() * bufferUsageRatio) { if (buffer.refCnt() != 0) { buffer.discardReadBytes(); } } }

Target:
private void discardReadBytesIfNecessary(ByteBuf buffer) { int bufferUsageRatio = clientOptions.getBufferUsageRatio(); if ((float)buffer.writerIndex() / buffer.capacity() >= (float)bufferUsageRatio / (bufferUsageRatio + 1)) { if (buffer.refCnt() != 0) { buffer.discardReadBytes(); } } }
Source:
public static void createTestBucketOrDirectory(final MantaClient client, final String testPath, final String testType) throws IOException { if ("buckets".equals(testType)) { final String bucketPath = parseBucketPath(testPath); try { client.createBucket(bucketPath); } catch (MantaClientHttpResponseException e) { if (e.getServerCode().equals(MantaErrorCode.BUCKET_EXISTS_ERROR)) { LOG.error("Test Bucket named already exists leading to {}" , integrationTestBucket, e.getStatusMessage()); e.setContextValue("Creating test bucket failed at :", testPath); throw e; } } } else { client.putDirectory(testPath, true); } }

Target:
public static void createTestBucketOrDirectory(final MantaClient client, final String testPath, final String testType) throws IOException { if ("buckets".equals(testType)) { final String bucket_path = parseBucketPath(testPath); try { client.createBucket(bucket_path); } catch (MantaClientHttpResponseException e) { if (!e.getServerCode().equals(MantaErrorCode.BUCKET_EXISTS_ERROR)) { e.setContextValue("Creating test bucket failed at :", testPath); throw e; } } catch (IOException e) { throw new MantaIOException("Unable to create test bucket", e); } } else { client.putDirectory(testPath, true); } }
Source:
private void undistributeParcels(ApiClient apiClient, ParcelResourceApi parcelResourceApi, Stack stack, Map<String, String> parcels) { Set<String> failedDistribution = new HashSet<>(); for (Map.Entry<String, String> distributedComponent : parcels.entrySet()) { try { parcelResourceApi.startRemovalOfDistributionCommand(stack.getName(), distributedComponent.getKey(), distributedComponent.getValue()); } catch (ApiException e) { String product = "[" + distributedComponent.getKey() + ":" + distributedComponent.getValue() + "]"; LOGGER.info(String.format("Unable to undistribute product: %s", product), e); failedDistribution.add(product); } } if (!failedDistribution.isEmpty()) { throw new ClouderaManagerOperationFailedException(String.format("Undistribution failed on the following products: %s", failedDistribution)); } PollingResult pollingResult = clouderaManagerPollingServiceProvider.startPollingCmParcelStatus(stack, apiClient, parcels, ParcelStatus.DOWNLOADED); if (isExited(pollingResult)) { throw new CancellationException("Cluster was terminated while waiting for parcels undistribution"); } else if (isTimeout(pollingResult)) { throw new ClouderaManagerOperationFailedException("Timeout while Cloudera Manager undistribute parcels."); } }

Target:
private void undistributeParcels(ApiClient apiClient, ParcelResourceApi parcelResourceApi, Stack stack, Map<String, String> parcels) { Set<String> failedDistribution = new HashSet<>(); for (Map.Entry<String, String> distributedComponent : parcels.entrySet()) { String product = "[" + distributedComponent.getKey() + ":" + distributedComponent.getValue() + "]"; try { LOGGER.debug("Undistributing product", product); parcelResourceApi.startRemovalOfDistributionCommand(stack.getName(), distributedComponent.getKey(), distributedComponent.getValue()); } catch (ApiException e) { LOGGER.info(String.format("Unable to undistribute product: %s", product), e); failedDistribution.add(product); } } if (!failedDistribution.isEmpty()) { throw new ClouderaManagerOperationFailedException(String.format("Undistribution failed on the following products: %s", failedDistribution)); } PollingResult pollingResult = clouderaManagerPollingServiceProvider.startPollingCmParcelStatus(stack, apiClient, parcels, ParcelStatus.DOWNLOADED); if (isExited(pollingResult)) { throw new CancellationException("Cluster was terminated while waiting for parcels undistribution"); } else if (isTimeout(pollingResult)) { throw new ClouderaManagerOperationFailedException("Timeout while Cloudera Manager undistribute parcels."); } }
Source:
public PsychicPurge(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}"); this.getSpellAbility().addEffect(new DamageTargetEffect(1)); this.getSpellAbility().addTarget(new TargetCreatureOrPlayer()); Ability ability = new PsychicPurgeTriggeredAbility(); this.addAbility(ability); }

Target:
public PsychicPurge(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{U}"); this.getSpellAbility().addEffect(new DamageTargetEffect(1)); this.getSpellAbility().addTarget(new TargetCreatureOrPlayer()); Ability ability = new PsychicPurgeTriggeredAbility(); this.addAbility(ability); }
Source:
public final Void execute(RepositoryContext context) { CodeSystem primaryCodeSystem = createPrimaryCodeSystem(); if (primaryCodeSystem != null) { CodeSystems codeSystems = CodeSystemRequests.prepareSearchCodeSystem() .filterById(primaryCodeSystem.getShortName()) .setLimit(0) .build() .execute(context); if (codeSystems.getTotal() < 1) { CodeSystemRequests.prepareNewCodeSystem() .setName(primaryCodeSystem.getName()) .setOid(primaryCodeSystem.getOid()) .setLanguage(primaryCodeSystem.getPrimaryLanguage()) .setLink(primaryCodeSystem.getOrganizationLink()) .setCitation(primaryCodeSystem.getCitation()) .setIconPath(primaryCodeSystem.getIconPath()) .setTerminologyId(primaryCodeSystem.getTerminologyId()) .setShortName(primaryCodeSystem.getShortName()) .setRepositoryUuid(context.id()) .setBranchPath(Branch.MAIN_PATH) .build(context.id(), Branch.MAIN_PATH, User.SYSTEM.getUsername(), "Create primary code system for repository") .getRequest() .execute(context); } } return null; }

Target:
public final Void execute(RepositoryContext context) { CodeSystem primaryCodeSystem = createPrimaryCodeSystem(); if (primaryCodeSystem != null) { CodeSystems codeSystems = CodeSystemRequests.prepareSearchCodeSystem() .filterById(primaryCodeSystem.getShortName()) .setLimit(0) .build() .execute(context); if (codeSystems.getTotal() < 1) { CodeSystemRequests.prepareNewCodeSystem() .setName(primaryCodeSystem.getName()) .setOid(primaryCodeSystem.getOid()) .setLanguage(primaryCodeSystem.getPrimaryLanguage()) .setLink(primaryCodeSystem.getOrganizationLink()) .setCitation(primaryCodeSystem.getCitation()) .setIconPath(primaryCodeSystem.getIconPath()) .setTerminologyId(primaryCodeSystem.getTerminologyId()) .setShortName(primaryCodeSystem.getShortName()) .setRepositoryId(context.id()) .setBranchPath(Branch.MAIN_PATH) .build(context.id(), Branch.MAIN_PATH, User.SYSTEM.getUsername(), "Create primary code system for repository") .getRequest() .execute(context); } } return null; }
Source:
public void testMultipleLinksToFolder() throws Exception { if (!canCreateSymLinks()) return; IFileStore tempStore = getTempStore(); createFileInFileSystem(tempStore.getChild("foo.txt")); IPath tempFolderPath = URIUtil.toPath(tempStore.toURI()); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject projectA = root.getProject(getUniqueString()); IProject projectB = root.getProject(getUniqueString()); try { create(projectA, true); create(projectB, true); } catch (CoreException e) { fail("1.0", e); } symLinkAndRefresh(projectA, "folderA", tempFolderPath); symLinkAndRefresh(projectB, "folderB", tempFolderPath); }

Target:
public void testMultipleLinksToFolder() { if (!canCreateSymLinks()) return; IFileStore tempStore = getTempStore(); createFileInFileSystem(tempStore.getChild("foo.txt")); IPath tempFolderPath = URIUtil.toPath(tempStore.toURI()); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject projectA = root.getProject(getUniqueString()); IProject projectB = root.getProject(getUniqueString()); try { create(projectA, true); create(projectB, true); } catch (CoreException e) { fail("1.0", e); } symLinkAndRefresh(projectA, "folderA", tempFolderPath); symLinkAndRefresh(projectB, "folderB", tempFolderPath); }
Source:
public void finishJob() { log.info("Shutting down..."); shuttingDown = true; for (final Map.Entry<Long, Sink> entry : sinks.entrySet()) { persistAndMerge(entry.getKey(), entry.getValue()); } while (!sinks.isEmpty()) { try { log.info( "Cannot shut down yet! Sinks remaining: %s", Joiner.on(", ").join( Iterables.transform( sinks.values(), new Function<Sink, String>() { @Override public String apply(Sink input) { return input.getSegment().getIdentifier(); } } ) ) ); synchronized (handoffCondition) { while (!sinks.isEmpty()) { handoffCondition.wait(config.getHandoffConditionTimeout()); } } } catch (InterruptedException e) { throw new ISE("Failed to wait for segment handoff.", e); } } handoffNotifier.stop(); shutdownExecutors(); stopped = true; if (!cleanShutdown) { throw new ISE("Exception occurred during persist and merge."); } }

Target:
public void finishJob() { log.info("Shutting down..."); shuttingDown = true; for (final Map.Entry<Long, Sink> entry : sinks.entrySet()) { persistAndMerge(entry.getKey(), entry.getValue()); } final long forceEndWaitTime = System.currentTimeMillis() + config.getHandoffConditionTimeout(); while (!sinks.isEmpty()) { try { log.info( "Cannot shut down yet! Sinks remaining: %s", Joiner.on(", ").join( Iterables.transform( sinks.values(), new Function<Sink, String>() { @Override public String apply(Sink input) { return input.getSegment().getIdentifier(); } } ) ) ); synchronized (handoffCondition) { while (!sinks.isEmpty()) { if (config.getHandoffConditionTimeout() == 0) { handoffCondition.wait(); } else { long curr = System.currentTimeMillis(); if (forceEndWaitTime - curr > 0) { handoffCondition.wait(forceEndWaitTime - curr); } else { throw new ISE( "Segment handoff wait timeout. [%s] segments might not have completed handoff.", sinks.size() ); } } } } } catch (InterruptedException e) { throw Throwables.propagate(e); } } handoffNotifier.stop(); shutdownExecutors(); stopped = true; if (!cleanShutdown) { throw new ISE("Exception occurred during persist and merge."); } }
Source:
private void advanceLocation() { ParticleEffect.FIREWORKS_SPARK.display(this.location, 2, .001, .001, .001, 0); ParticleEffect.CRIT.display(this.location, 3, Math.random() * 2, Math.random() * 2, Math.random() * 2, 0); playCombustionSound(this.location); this.location = this.location.add(this.direction.clone().multiply(this.speedFactor)); }

Target:
private void advanceLocation() { ParticleEffect.FIREWORKS_SPARK.display(this.location, 2, .001, .001, .001, 0); if(explosionCount % 5 == 0) ParticleEffect.EXPLOSION_LARGE.display(this.location, 1, .001, .001, .001, 0); playCombustionSound(this.location); this.location = this.location.add(this.direction.clone().multiply(this.speedFactor)); this.explosionCount++; }
Source:
public void reuseSession() { if (getSessionId() != null) { RestApiSessionAcquiredEvent.fire(eventBus, getSessionId()); scheduleKeepAliveHeartbeat(); } else { getSessionId(new StorageCallback() { @Override public void onSuccess(String result) { if (result != null) { restApiSessionId = result; RestApiSessionAcquiredEvent.fire(eventBus, result); scheduleKeepAliveHeartbeat(); } else { RestApiSessionManager.logger.severe("Engine REST API session ID is not available"); } } @Override public void onFailure(Throwable caught) { RestApiSessionManager.logger.severe("Engine REST API session ID is not available"); } }); } }

Target:
public void reuseSession() { if (getSessionId() != null) { processSessionId(getSessionId()); } else { getSessionId(new StorageCallback() { @Override public void onSuccess(String result) { if (result != null) { restApiSessionId = result; processSessionId(result); } else { processSessionIdException(); } } @Override public void onFailure(Throwable caught) { processSessionIdException(); } private void processSessionIdException() { RestApiSessionManager.logger.severe("Engine REST API session ID is not available"); } }); } }
Source:
private <T> T proxy(Class<T> clazz) { final T result0 = ProxyFactory.create(clazz, target, clientExecutor); return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class<?>[] { clazz }, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try { Object result1 = method.invoke(result0, args); Class<?> type = String.class; if (result1 instanceof Response) { if(((Response)result1).getStatus()/100 == 2) { String responseClass = method.getAnnotation(ApiOperation.class).responseClass(); type = Class.forName(responseClass); } result1 = BuiltResponsePreservingError.copyResponseAndClose((Response) result1, type); } return result1; } catch (Throwable e) { if (e instanceof InvocationTargetException) { e = ((InvocationTargetException)e).getTargetException(); } throw Exceptions.propagate(e); } } }); }

Target:
private <T> T proxy(Class<T> clazz) { final T result0 = ProxyFactory.create(clazz, target, clientExecutor); return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class<?>[] { clazz }, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try { Object result1 = method.invoke(result0, args); Class<?> type = String.class; if (result1 instanceof Response) { Response resp = (Response)result1; if(isStatusCodeHealthy(resp.getStatus()) && method.isAnnotationPresent(ApiOperation.class)) { type = getClassFromMethodAnnotationOrDefault(method, type); } result1 = BuiltResponsePreservingError.copyResponseAndClose(resp, type); } return result1; } catch (Throwable e) { if (e instanceof InvocationTargetException) { e = ((InvocationTargetException)e).getTargetException(); } throw Exceptions.propagate(e); } } private boolean isStatusCodeHealthy(int code) { return (code>=200 && code<=299); } private Class<?> getClassFromMethodAnnotationOrDefault(Method method, Class<?> def){ Class<?> type; try{ String responseClass = method.getAnnotation(ApiOperation.class).responseClass(); type = Class.forName(responseClass); } catch (Exception e) { type = def; LOG.debug("Unable to get class from annotation: {}. Defaulting to {}", e.getMessage(), def.getName()); Exceptions.propagateIfFatal(e); } return type; } }); }
Source:
public boolean validate(AttributedDocumentEvent event) { KualiDecimal sourceTotalAmount = accountingDocumentForValidation.getSourceTotal(); KualiDecimal targetTotalAmount = accountingDocumentForValidation.getTargetTotal(); boolean ret = true; if(sourceTotalAmount == null || !sourceTotalAmount.isNonZero()){ GlobalVariables.getMessageMap().putError(KFSConstants.AMOUNT_PROPERTY_NAME, CUKFSKeyConstants.ERROR_ZERO_AMOUNT_TOTAL, "From", sourceTotalAmount.toString()); ret = false; } if(targetTotalAmount == null || !targetTotalAmount.isNonZero()){ GlobalVariables.getMessageMap().putError(KFSConstants.AMOUNT_PROPERTY_NAME, CUKFSKeyConstants.ERROR_ZERO_AMOUNT_TOTAL, "To", targetTotalAmount.toString()); ret = false; } return ret; }

Target:
public boolean validate(AttributedDocumentEvent event) { KualiDecimal sourceTotalAmount = accountingDocumentForValidation.getSourceTotal(); KualiDecimal targetTotalAmount = accountingDocumentForValidation.getTargetTotal(); boolean ret = true; if (ObjectUtils.isNull(sourceTotalAmount) || sourceTotalAmount.isZero()) { addGlobalThresholdValidationError("From", sourceTotalAmount); ret = false; } if(ObjectUtils.isNull(targetTotalAmount) || targetTotalAmount.isZero()){ addGlobalThresholdValidationError("To", targetTotalAmount); ret = false; } return ret; }
Source:
public synchronized void takeSnapshot(List<LookupBean> lookups) { try { String lookupsSnapshot = objectMapper.writeValueAsString(lookups); Files.write((StringUtils.toUtf8(lookupsSnapshot)), persistFile); } catch (IOException e) { LOGGER.error(e, "Exception during serialization of lookups"); Throwables.propagate(e); } }

Target:
public synchronized void takeSnapshot(List<LookupBean> lookups) { try { objectMapper.writeValue(persistFile, lookups); } catch (IOException e) { throw new ISE(e, "Exception during serialization of lookups using file [%s]", persistFile.getAbsolutePath()); } }
Source:
@Test public void deleteBuildsManyShouldSuccessEvenTheFirstAndLastBuildDoesNotExist() throws Exception { FreeStyleProject project = j.createFreeStyleProject("aProject"); project.scheduleBuild2(0).get(); project.scheduleBuild2(0).get(); project.scheduleBuild2(0).get(); project.scheduleBuild2(0).get(); project.scheduleBuild2(0).get(); project.getBuildByNumber(1).delete(); project.getBuildByNumber(3).delete(); project.getBuildByNumber(5).delete(); assertThat(((FreeStyleProject) j.jenkins.getItem("aProject")).getBuilds().size(), equalTo(2)); CLICommandInvoker.Result result = command .authorizedTo(Jenkins.READ, Job.READ, Run.DELETE) .invokeWithArgs("aProject", "1,2,3"); assertThat(result, succeeded()); assertThat(result.stdout(), containsString("Deleted 1 builds")); assertThat(((FreeStyleProject) j.jenkins.getItem("aProject")).getBuilds().size(), equalTo(1)); result = command .authorizedTo(Jenkins.READ, Job.READ, Run.DELETE) .invokeWithArgs("aProject", "3-5"); assertThat(result, succeeded()); assertThat(result.stdout(), containsString("Deleted 1 builds")); assertThat(((FreeStyleProject) j.jenkins.getItem("aProject")).getBuilds().size(), equalTo(0)); }

Target:
@Test public void deleteBuildsManyShouldSuccessEvenTheFirstAndLastBuildDoesNotExist() throws Exception { FreeStyleProject project = j.createFreeStyleProject("aProject"); j.buildAndAssertSuccess(project); j.buildAndAssertSuccess(project); j.buildAndAssertSuccess(project); j.buildAndAssertSuccess(project); j.buildAndAssertSuccess(project); project.getBuildByNumber(1).delete(); project.getBuildByNumber(3).delete(); project.getBuildByNumber(5).delete(); assertThat(((FreeStyleProject) j.jenkins.getItem("aProject")).getBuilds(), hasSize(2)); CLICommandInvoker.Result result = command .authorizedTo(Jenkins.READ, Job.READ, Run.DELETE) .invokeWithArgs("aProject", "1,2,3"); assertThat(result, succeeded()); assertThat(result.stdout(), containsString("Deleted 1 builds")); assertThat(((FreeStyleProject) j.jenkins.getItem("aProject")).getBuilds(), hasSize(1)); result = command .authorizedTo(Jenkins.READ, Job.READ, Run.DELETE) .invokeWithArgs("aProject", "3-5"); assertThat(result, succeeded()); assertThat(result.stdout(), containsString("Deleted 1 builds")); assertThat(((FreeStyleProject) j.jenkins.getItem("aProject")).getBuilds(), hasSize(0)); }
Source:
public final ChannelHandlerContext context(String name) { if (name == null) { throw new NullPointerException("name"); } synchronized (handlers) { int idx = findCtxIdx((ctx) -> ctx.name().equals(name)); if (idx == -1) { return null; } return handlers.get(idx); } }

Target:
public final ChannelHandlerContext context(String name) { if (name == null) { throw new NullPointerException("name"); } synchronized (handlers) { return findCtx(ctx -> ctx.name().equals(name)); } }
Source:
public void testGetPreferredNameEmpty() { DoorsTableRowCollector dtc = new DoorsTableRowCollector(extractor); DoorsTableRow dtr = new DoorsTableRow(); dtc.getPreferredName(dtr); Assert.fail(); }

Target:
public void testGetPreferredNameEmpty() { DoorsTableRowCollector dtc = new DoorsTableRowCollector(extractor); DoorsTableRow dtr = new DoorsTableRow(); dtc.getPreferredName(dtr); }
Source:
private void renderHeader(String header) throws IOException { int lf = header.indexOf('\n'); String first; String rest; if (0 <= lf) { first = header.substring(0, lf); rest = header.substring(lf + 1); } else { first = header; rest = ""; } List<Map<String, String>> parts = Lists.newArrayListWithCapacity(4); for (String part : SPACE.split(first)) { if (part.startsWith("a/")) { parts.add(ImmutableMap.of( "text", part, "url", revisionUrl(view.getOldRevision(), part.substring(2)))); } else if (part.startsWith("b/")) { parts.add(ImmutableMap.of( "text", part, "url", revisionUrl(view.getRevision(), part.substring(2)))); } else { parts.add(ImmutableMap.of("text", part)); } } getOutputStream().write(renderer.newRenderer("gitiles.diffHeader") .setData(ImmutableMap.of("firstParts", parts, "rest", rest, "fileIndex", fileIndex)) .render() .getBytes(Charsets.UTF_8)); }

Target:
private void renderHeader(String header) throws IOException { int lf = header.indexOf('\n'); String rest = 0 <= lf ? header.substring(lf + 1) : ""; List<Map<String, String>> parts = Lists.newArrayListWithCapacity(3); parts.add(ImmutableMap.of("text", "diff --git")); if (entry.getChangeType() != ChangeType.ADD) { parts.add(ImmutableMap.of( "text", GIT_PATH.quote(getOldPrefix() + entry.getOldPath()), "url", revisionUrl(view.getOldRevision(), entry.getOldPath()))); } else { parts.add(ImmutableMap.of( "text", GIT_PATH.quote(getOldPrefix() + entry.getNewPath()))); } if (entry.getChangeType() != ChangeType.DELETE) { parts.add(ImmutableMap.of( "text", GIT_PATH.quote(getNewPrefix() + entry.getNewPath()), "url", revisionUrl(view.getRevision(), entry.getNewPath()))); } else { parts.add(ImmutableMap.of( "text", GIT_PATH.quote(getNewPrefix() + entry.getOldPath()))); } getOutputStream().write(renderer.newRenderer("gitiles.diffHeader") .setData(ImmutableMap.of("firstParts", parts, "rest", rest, "fileIndex", fileIndex)) .render() .getBytes(Charsets.UTF_8)); }
Source:
private Object loadFile(String fileName) { byte[] fileByteContent = safelyLoadFileBytes(fileName); Object parsedObject; parsedObject = getBatchInputFileService().parse(getBatchInputFileType(), fileByteContent); return parsedObject; }

Target:
private Object loadFile(String fileName) { byte[] fileByteContent = safelyLoadFileBytes(fileName); Object parsedObject = getBatchInputFileService().parse(getBatchInputFileType(), fileByteContent); return parsedObject; }
Source:
public void testGetInstanceObservationUnitRowsMap() { Map<Integer, List<ObservationUnitRow>> instanceObsUnitRowMap = this.datasetService.getInstanceIdToObservationUnitRowsMap(this.studyId, this.subObsDatasetId, this.instanceIds); List<ObservationUnitRow> observationUnitRows = instanceObsUnitRowMap.get(instanceIds.get(0)); Assert.assertNotNull(observationUnitRows); Assert.assertEquals(40, observationUnitRows.size()); final ObservationUnitRow observationUnitRow = observationUnitRows.get(0); this.verifyObservationUnitRowValues(observationUnitRow); Assert.assertNotNull(observationUnitRow.getVariables().get("STUDY_INSTITUTE")); Assert.assertNotNull(observationUnitRow.getVariables().get("STUDY_BM_CODE")); Assert.assertNotNull(observationUnitRow.getVariables().get("SITE_ALT")); }

Target:
public void testGetInstanceObservationUnitRowsMap() { Map<Integer, List<ObservationUnitRow>> instanceObsUnitRowMap = this.datasetService.getInstanceIdToObservationUnitRowsMap(this.studyId, this.subObsDatasetId, this.instanceIds); List<ObservationUnitRow> observationUnitRows = instanceObsUnitRowMap.get(instanceIds.get(0)); Assert.assertNotNull(observationUnitRows); Assert.assertEquals(40, observationUnitRows.size()); final ObservationUnitRow observationUnitRow = observationUnitRows.get(0); this.verifyObservationUnitRowValues(observationUnitRow); Assert.assertNotNull(observationUnitRow.getVariables().get("STUDY_INSTITUTE")); Assert.assertNotNull(observationUnitRow.getVariables().get("STUDY_BM_CODE")); Assert.assertNotNull(observationUnitRow.getVariables().get("SITE_ALT")); Assert.assertNotNull(observationUnitRow.getVariables().get("SITE_LAT")); Assert.assertNotNull(observationUnitRow.getVariables().get("SITE_LONG")); Assert.assertNotNull(observationUnitRow.getVariables().get("SITE_DATUM")); }
Source:
public static TurboLabel getFirstMatchingTurboLabel(List<TurboLabel> labels, String labelName) { Optional<TurboLabel> firstMatchingLabel = getMatchedLabels(labels, labelName).stream().findFirst(); assert firstMatchingLabel.isPresent(); return firstMatchingLabel.get(); }

Target:
public static final TurboLabel getFirstMatchingTurboLabel(List<TurboLabel> labels, String labelName) { Optional<TurboLabel> firstMatchingLabel = getMatchedLabels(labels, labelName).stream().findFirst(); assert firstMatchingLabel.isPresent(); return firstMatchingLabel.get(); }
Source:
private Collection<ClusterTemplate> createAll(Iterable<ClusterTemplate> clusterTemplates) { User user = userService.getOrCreate(legacyRestRequestThreadLocalService.getCloudbreakUser()); return StreamSupport.stream(clusterTemplates.spliterator(), true) .map(ct -> { try { return measure(() -> create(ct, ct.getWorkspace(), user), LOGGER, "Cluster template created in {}ms"); } catch (DuplicateClusterTemplateException duplicateClusterTemplateException) { LOGGER.info("Template was found, try to get it", duplicateClusterTemplateException); return getByNameForWorkspace(ct.getName(), ct.getWorkspace()); } catch (BadRequestException badRequestException) { LOGGER.info("Template save failed, but try to get it", badRequestException); try { return getByNameForWorkspace(ct.getName(), ct.getWorkspace()); } catch (NotFoundException notFoundException) { LOGGER.info("Template was not found", notFoundException); throw notFoundException; } } }) .collect(Collectors.toList()); }

Target:
private Collection<ClusterTemplate> createAll(Iterable<ClusterTemplate> clusterTemplates) { User user = userService.getOrCreate(legacyRestRequestThreadLocalService.getCloudbreakUser()); return StreamSupport.stream(clusterTemplates.spliterator(), false) .map(ct -> { try { return measure(() -> create(ct, ct.getWorkspace(), user), LOGGER, "Cluster template created in {}ms"); } catch (DuplicateClusterTemplateException duplicateClusterTemplateException) { LOGGER.info("Template was found, try to get it", duplicateClusterTemplateException); return getByNameForWorkspace(ct.getName(), ct.getWorkspace()); } catch (BadRequestException badRequestException) { LOGGER.info("Template save failed, but try to get it", badRequestException); try { return getByNameForWorkspace(ct.getName(), ct.getWorkspace()); } catch (NotFoundException notFoundException) { LOGGER.info("Template was not found", notFoundException); throw notFoundException; } } }) .collect(Collectors.toList()); }
Source:
private static PlanNode planTableScan( TableScanNode node, Expression predicate, Session session, TypeProvider types, PlanNodeIdAllocator idAllocator, Metadata metadata, SqlParser parser, DomainTranslator domainTranslator) { return AddExchanges.pickTableLayout( node, predicate, false, session, types, idAllocator, metadata, parser, domainTranslator) .get(0); }

Target:
private static PlanNode planTableScan( TableScanNode node, Expression predicate, Session session, TypeProvider types, PlanNodeIdAllocator idAllocator, Metadata metadata, SqlParser parser, DomainTranslator domainTranslator) { return listTableLayouts( node, predicate, false, session, types, idAllocator, metadata, parser, domainTranslator) .get(0); }
Source:
public void testJdbcDrivers() throws Exception { String driverName = DEPLOYMENT + ".jar"; ModelNode address = new ModelNode().add(SUBSYSTEM, "datasources"); ModelNode operation = new ModelNode(); operation.get(OP).set("get-installed-driver"); operation.get(OP_ADDR).set(address); operation.get("driver-name").set(driverName); ModelNode result = executeOperation(operation).asList().get(0); System.out.println("\n\n\n Result is: " + result + "\n\n\n"); Assert.assertEquals(driverName, result.get("driver-name").asString()); Assert.assertEquals(driverName, result.get("deployment-name").asString()); Assert.assertEquals(TestDriver.class.getName(), result.get("driver-class-name").asString()); Assert.assertEquals(1, result.get("driver-major-version").asInt()); Assert.assertEquals(0, result.get("driver-minor-version").asInt()); Assert.assertFalse(result.get("jdbc-compliant").asBoolean()); String driver2 = driverName + "_" + TestDriver2.class.getName() + "_1_1"; operation.get("driver-name").set(driver2); result = executeOperation(operation).asList().get(0); Assert.assertEquals(driver2, result.get("driver-name").asString()); Assert.assertEquals(driver2, result.get("deployment-name").asString()); Assert.assertEquals(TestDriver2.class.getName(), result.get("driver-class-name").asString()); Assert.assertEquals(1, result.get("driver-major-version").asInt()); Assert.assertEquals(1, result.get("driver-minor-version").asInt()); Assert.assertTrue(result.get("jdbc-compliant").asBoolean()); }

Target:
public void testJdbcDrivers() throws Exception { String driverName = DEPLOYMENT + ".jar"; ModelNode address = new ModelNode().add(SUBSYSTEM, "datasources"); ModelNode operation = new ModelNode(); operation.get(OP).set("get-installed-driver"); operation.get(OP_ADDR).set(address); operation.get("driver-name").set(driverName); ModelNode result = executeOperation(operation).asList().get(0); Assert.assertEquals(driverName, result.get("driver-name").asString()); Assert.assertEquals(driverName, result.get("deployment-name").asString()); Assert.assertEquals(TestDriver.class.getName(), result.get("driver-class-name").asString()); Assert.assertEquals(1, result.get("driver-major-version").asInt()); Assert.assertEquals(0, result.get("driver-minor-version").asInt()); Assert.assertFalse(result.get("jdbc-compliant").asBoolean()); String driver2 = driverName + "_" + TestDriver2.class.getName() + "_1_1"; operation.get("driver-name").set(driver2); result = executeOperation(operation).asList().get(0); Assert.assertEquals(driver2, result.get("driver-name").asString()); Assert.assertEquals(driver2, result.get("deployment-name").asString()); Assert.assertEquals(TestDriver2.class.getName(), result.get("driver-class-name").asString()); Assert.assertEquals(1, result.get("driver-major-version").asInt()); Assert.assertEquals(1, result.get("driver-minor-version").asInt()); Assert.assertTrue(result.get("jdbc-compliant").asBoolean()); }