use of org.hl7.fhir.r5.model.CapabilityStatement in project cqf-ruler by DBCG.
the class OAuthProvider method extend.
@Override
public void extend(CapabilityStatement metadata) {
metadata.getRestFirstRep().getSecurity().setCors(securityProperties.getOAuth().getSecurityCors());
Extension securityExtension = metadata.getRestFirstRep().getSecurity().addExtension();
securityExtension.setUrl(securityProperties.getOAuth().getSecurityUrl());
// security.extension.extension
Extension securityExtExt = securityExtension.addExtension();
securityExtExt.setUrl(securityProperties.getOAuth().getSecurityExtAuthUrl());
securityExtExt.setValue(new UriType(securityProperties.getOAuth().getSecurityExtAuthValueUri()));
Extension securityTokenExt = securityExtension.addExtension();
securityTokenExt.setUrl(securityProperties.getOAuth().getSecurityExtTokenUrl());
securityTokenExt.setValue(new UriType(securityProperties.getOAuth().getSecurityExtTokenValueUri()));
// security.extension.service
Coding coding = new Coding();
coding.setSystem(securityProperties.getOAuth().getServiceSystem());
coding.setCode(securityProperties.getOAuth().getServiceCode());
coding.setDisplay(securityProperties.getOAuth().getServiceDisplay());
CodeableConcept codeConcept = new CodeableConcept();
codeConcept.addCoding(coding);
metadata.getRestFirstRep().getSecurity().getService().add(codeConcept);
// metadata.getRestFirstRep().getSecurity().getService() //how do we handle "text" on the sample not part of getService
}
use of org.hl7.fhir.r5.model.CapabilityStatement in project cqf-ruler by DBCG.
the class OAuthProviderIT method testOAuthConfig.
@Test
public void testOAuthConfig() {
CapabilityStatement cs = getClient().capabilities().ofType(CapabilityStatement.class).execute();
assertNotNull(cs);
assertEquals(true, cs.getRestFirstRep().getSecurity().getCors());
assertEquals("http://hl7.org/fhir/restful-security-service", cs.getRestFirstRep().getSecurity().getService().stream().findAny().get().getCodingFirstRep().getSystem());
}
use of org.hl7.fhir.r5.model.CapabilityStatement in project cqf-ruler by DBCG.
the class OAuthProviderIT method testOAuthConfig.
@Test
public void testOAuthConfig() {
CapabilityStatement cs = getClient().capabilities().ofType(CapabilityStatement.class).execute();
assertNotNull(cs);
assertEquals(true, cs.getRestFirstRep().getSecurity().getCors());
assertEquals("http://hl7.org/fhir/restful-security-service", cs.getRestFirstRep().getSecurity().getService().stream().findAny().get().getCodingFirstRep().getSystem());
}
use of org.hl7.fhir.r5.model.CapabilityStatement in project beneficiary-fhir-data by CMSgov.
the class V1Server method configureServerInfoMetadata.
/**
* Configures various metadata fields that will be included in this server's {@link
* CapabilityStatement}.
*/
private void configureServerInfoMetadata() {
setServerName(CAPABILITIES_SERVER_NAME);
/*
* Read in some of the project metadata from a Maven-filtered properties
* file, which ensures that it's always up to date.
*/
Properties projectProps = new Properties();
try (InputStream projectPropsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("project.properties")) {
projectProps.load(projectPropsStream);
setImplementationDescription(projectProps.getProperty("project.id"));
setServerVersion(projectProps.getProperty("project.version"));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
// Lightly customize the capability provider to set publisher name.
ServerCapabilityStatementProvider capabilityStatementProvider = new ServerCapabilityStatementProvider();
capabilityStatementProvider.setPublisher(CAPABILITIES_PUBLISHER);
setServerConformanceProvider(capabilityStatementProvider);
}
use of org.hl7.fhir.r5.model.CapabilityStatement in project beneficiary-fhir-data by CMSgov.
the class ServerCapabilityStatementIT method getCapabilities.
/**
* Verifies that the server responds as expected to the <code>GET [base]/_metadata</code>
* endpoint.
*/
@Test
public void getCapabilities() {
IGenericClient fhirClient = ServerTestUtils.get().createFhirClient();
CapabilityStatement capabilities = fhirClient.capabilities().ofType(CapabilityStatement.class).execute();
assertNotNull(capabilities);
// Verify that our custom server metadata is correct.
assertEquals(V1Server.CAPABILITIES_PUBLISHER, capabilities.getPublisher());
assertEquals(V1Server.CAPABILITIES_SERVER_NAME, capabilities.getSoftware().getName());
assertEquals("gov.cms.bfd:bfd-server-war", capabilities.getImplementation().getDescription());
assertNotEquals(null, capabilities.getSoftware().getVersion());
assertNotEquals("", capabilities.getSoftware().getVersion());
// The default for this field is HAPI's version but we don't use that.
assertNotEquals(VersionUtil.getVersion(), capabilities.getSoftware().getVersion());
assertEquals(1, capabilities.getRest().size());
CapabilityStatementRestComponent restCapabilities = capabilities.getRestFirstRep();
assertEquals(RestfulCapabilityMode.SERVER, restCapabilities.getMode());
// Verify that Patient resource support looks like expected.
CapabilityStatementRestResourceComponent patientCapabilities = restCapabilities.getResource().stream().filter(r -> r.getType().equals(Patient.class.getSimpleName())).findAny().get();
assertTrue(patientCapabilities.getInteraction().stream().filter(i -> i.getCode() == TypeRestfulInteraction.READ).findAny().isPresent());
assertTrue(patientCapabilities.getInteraction().stream().filter(i -> i.getCode() == TypeRestfulInteraction.SEARCHTYPE).findAny().isPresent());
assertFalse(patientCapabilities.getInteraction().stream().filter(i -> i.getCode() == TypeRestfulInteraction.CREATE).findAny().isPresent());
// Verify that Coverage resource support looks like expected.
CapabilityStatementRestResourceComponent coverageCapabilities = restCapabilities.getResource().stream().filter(r -> r.getType().equals(Coverage.class.getSimpleName())).findAny().get();
assertTrue(coverageCapabilities.getInteraction().stream().filter(i -> i.getCode() == TypeRestfulInteraction.READ).findAny().isPresent());
assertTrue(coverageCapabilities.getInteraction().stream().filter(i -> i.getCode() == TypeRestfulInteraction.SEARCHTYPE).findAny().isPresent());
// Verify that EOB resource support looks like expected.
CapabilityStatementRestResourceComponent eobCapabilities = restCapabilities.getResource().stream().filter(r -> r.getType().equals(ExplanationOfBenefit.class.getSimpleName())).findAny().get();
assertTrue(eobCapabilities.getInteraction().stream().filter(i -> i.getCode() == TypeRestfulInteraction.READ).findAny().isPresent());
assertTrue(eobCapabilities.getInteraction().stream().filter(i -> i.getCode() == TypeRestfulInteraction.SEARCHTYPE).findAny().isPresent());
// Spot check that an arbitrary unsupported resource isn't listed.
assertFalse(restCapabilities.getResource().stream().filter(r -> r.getType().equals(DiagnosticReport.class.getSimpleName())).findAny().isPresent());
}
Aggregations