use of org.hl7.fhir.r4.model.Endpoint in project cqf-ruler by DBCG.
the class CacheValueSetsProviderIT method uploadLocalServerEndpoint.
private Endpoint uploadLocalServerEndpoint() throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(CacheValueSetsProvider.class.getResourceAsStream("endpoint/LocalServerEndpoint.json")));
String resourceString = reader.lines().collect(Collectors.joining(System.lineSeparator()));
reader.close();
// Don't want to update during loading because need to setAddress first
Endpoint endpoint = (Endpoint) loadResource("json", resourceString);
endpoint.setAddress("http://localhost:" + getPort() + "/fhir/");
update(endpoint);
return endpoint;
}
use of org.hl7.fhir.r4.model.Endpoint in project cqf-ruler by DBCG.
the class CacheValueSetsProviderIT method testCacheValueSetsAuthenticationErrorPassword.
@Test
public void testCacheValueSetsAuthenticationErrorPassword() throws Exception {
Endpoint endpoint = uploadLocalServerEndpoint();
StringAndListParam stringAndListParam = getStringAndListParamFromValueSet("valueset/AcuteInpatient.json");
RequestDetails details = Mockito.mock(RequestDetails.class);
Resource outcomeResource = cacheValueSetsProvider.cacheValuesets(details, endpoint.getIdElement(), stringAndListParam, null, "password");
String detailMessage = "Password was provided, but not a user name.";
validateOutcome(outcomeResource, detailMessage);
}
use of org.hl7.fhir.r4.model.Endpoint in project cqf-ruler by DBCG.
the class CacheValueSetsProviderIT method testCacheValueSetsNoCompose.
@Test
public void testCacheValueSetsNoCompose() throws Exception {
Endpoint endpoint = uploadLocalServerEndpoint();
RequestDetails details = Mockito.mock(RequestDetails.class);
ValueSet vs = uploadValueSet("valueset/valueset-benzodiazepine-medications.json");
assertTrue(vs.getCompose().getInclude().isEmpty());
StringAndListParam stringAndListParam = getStringAndListParamFromValueSet(vs);
Resource outcomeResource = cacheValueSetsProvider.cacheValuesets(details, endpoint.getIdElement(), stringAndListParam, null, null);
assertTrue(outcomeResource instanceof Bundle);
Bundle resultBundle = (Bundle) outcomeResource;
assertEquals(1, resultBundle.getEntry().size());
BundleEntryComponent entry = resultBundle.getEntry().get(0);
assertTrue(entry.getResponse().getLocation().startsWith("ValueSet/" + vs.getIdElement().getIdPart()));
assertEquals("200 OK", entry.getResponse().getStatus());
// ValueSet resultingValueSet = createClient(ourCtx, endpoint).read().resource(ValueSet.class).withId(vs.getIdElement()).execute();
// resultingValueSet not returning with a version
// assertTrue(resultingValueSet.getVersion().endsWith("-cached"));
}
use of org.hl7.fhir.r4.model.Endpoint in project cqf-ruler by DBCG.
the class CacheValueSetsProviderIT method testCacheValueSetsValueSetDNE.
@Test
public void testCacheValueSetsValueSetDNE() throws Exception {
Endpoint endpoint = uploadLocalServerEndpoint();
StringAndListParam stringAndListParam = new StringAndListParam();
stringAndListParam.setValuesAsQueryTokens(getFhirContext(), "valueset", Arrays.asList(QualifiedParamList.singleton("dne")));
RequestDetails details = Mockito.mock(RequestDetails.class);
Resource outcomeResource = cacheValueSetsProvider.cacheValuesets(details, endpoint.getIdElement(), stringAndListParam, null, null);
validateOutcome(outcomeResource, "HTTP 404 : Resource ValueSet/" + "dne" + " is not known");
}
use of org.hl7.fhir.r4.model.Endpoint in project cqf-ruler by DBCG.
the class ProcessMessageProvider method constructMessageHeaderResource.
private MessageHeader constructMessageHeaderResource() {
String message = "{\"resourceType\": \"MessageHeader\",\"id\": \"messageheader-example-reportheader\",\"meta\": {\"versionId\": \"1\",\"lastUpdated\": \"2020-11-29T02:03:28.045+00:00\",\"profile\": [\"http://hl7.org/fhir/us/medmorph/StructureDefinition/us-ph-messageheader\"]},\"extension\": [{\"url\": \"http://hl7.org/fhir/us/medmorph/StructureDefinition/ext-dataEncrypted\",\"valueBoolean\": false},{\"url\":\"http://hl7.org/fhir/us/medmorph/StructureDefinition/ext-messageProcessingCategory\",\"valueCode\": \"consequence\"}],\"eventCoding\": {\"system\": \"http://hl7.org/fhir/us/medmorph/CodeSystem/us-ph-messageheader-message-types\",\"code\": \"cancer-report-message\"},\"destination\": [{\"name\": \"PHA endpoint\",\"endpoint\": \"http://example.pha.org/fhir\"}],\"source\": {\"name\": \"Healthcare Organization\",\"software\": \"Backend Service App\",\"version\": \"3.1.45.AABB\",\"contact\": {\"system\": \"phone\",\"value\": \"+1 (917) 123 4567\"},\"endpoint\": \"http://example.healthcare.org/fhir\"},\"reason\": {\"coding\": [{\"system\": \"http://hl7.org/fhir/us/medmorph/CodeSystem/us-ph-triggerdefinition-namedevents\",\"code\": \"encounter-close\"}]}}";
MessageHeader messageHeader = (MessageHeader) this.getFhirContext().newJsonParser().parseResource(message);
messageHeader.setId(getUUID());
return messageHeader;
}
Aggregations