Search in sources :

Example 1 with IBaseOperationOutcome

use of org.hl7.fhir.instance.model.api.IBaseOperationOutcome in project camel-spring-boot by apache.

the class FhirDeleteTest method testDeleteResource.

@Test
public void testDeleteResource() throws Exception {
    assertTrue(patientExists());
    // using org.hl7.fhir.instance.model.api.IBaseResource message body for single parameter "resource"
    IBaseOperationOutcome result = requestBody("direct://RESOURCE", this.patient);
    LOG.debug("resource: " + result);
    assertNotNull(result, "resource result");
    assertFalse(patientExists());
}
Also used : IBaseOperationOutcome(org.hl7.fhir.instance.model.api.IBaseOperationOutcome) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) CamelSpringBootTest(org.apache.camel.test.spring.junit5.CamelSpringBootTest)

Example 2 with IBaseOperationOutcome

use of org.hl7.fhir.instance.model.api.IBaseOperationOutcome in project camel-spring-boot by apache.

the class FhirDeleteTest method testDeleteResourceById.

@Test
public void testDeleteResourceById() throws Exception {
    assertTrue(patientExists());
    // using org.hl7.fhir.instance.model.api.IIdType message body for single parameter "id"
    IBaseOperationOutcome result = requestBody("direct://RESOURCE_BY_ID", this.patient.getIdElement());
    LOG.debug("resourceById: " + result);
    assertNotNull(result, "resourceById result");
    assertFalse(patientExists());
}
Also used : IBaseOperationOutcome(org.hl7.fhir.instance.model.api.IBaseOperationOutcome) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) CamelSpringBootTest(org.apache.camel.test.spring.junit5.CamelSpringBootTest)

Example 3 with IBaseOperationOutcome

use of org.hl7.fhir.instance.model.api.IBaseOperationOutcome in project camel-spring-boot by apache.

the class FhirDeleteTest method testDeleteResourceConditionalByUrl.

@Test
public void testDeleteResourceConditionalByUrl() throws Exception {
    assertTrue(patientExists());
    IBaseOperationOutcome result = requestBody("direct://RESOURCE_CONDITIONAL_BY_URL", "Patient?given=Vincent&family=Freeman");
    LOG.debug("resourceConditionalByUrl: " + result);
    assertNotNull(result, "resourceConditionalByUrl result");
    assertFalse(patientExists());
}
Also used : IBaseOperationOutcome(org.hl7.fhir.instance.model.api.IBaseOperationOutcome) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) CamelSpringBootTest(org.apache.camel.test.spring.junit5.CamelSpringBootTest)

Example 4 with IBaseOperationOutcome

use of org.hl7.fhir.instance.model.api.IBaseOperationOutcome in project openmrs-module-fhir2 by openmrs.

the class BaseFhirR3ResourceProviderWebTest method describeOperationOutcome.

@Override
public void describeOperationOutcome(Description mismatchDescription, IBaseOperationOutcome baseOperationOutcome) {
    if (baseOperationOutcome instanceof OperationOutcome) {
        OperationOutcome operationOutcome = (OperationOutcome) baseOperationOutcome;
        if (operationOutcome.hasIssue() && operationOutcome.getIssue().stream().anyMatch(o -> o.getSeverity().ordinal() <= OperationOutcome.IssueSeverity.WARNING.ordinal())) {
            mismatchDescription.appendText(" with message ");
            mismatchDescription.appendValue(operationOutcome.getIssue().stream().filter(o -> o.getSeverity().ordinal() <= OperationOutcome.IssueSeverity.WARNING.ordinal()).map(OperationOutcome.OperationOutcomeIssueComponent::getDiagnostics).collect(Collectors.joining(". ")));
        }
    }
}
Also used : Description(org.hamcrest.Description) FhirRestServlet(org.openmrs.module.fhir2.web.servlet.FhirRestServlet) Bundle(org.hl7.fhir.dstu3.model.Bundle) IBaseOperationOutcome(org.hl7.fhir.instance.model.api.IBaseOperationOutcome) FhirR3RestServlet(org.openmrs.module.fhir2.web.servlet.FhirR3RestServlet) Collectors(java.util.stream.Collectors) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) BaseFhirResourceProviderWebTest(org.openmrs.module.fhir2.providers.BaseFhirResourceProviderWebTest) FhirContext(ca.uhn.fhir.context.FhirContext) IResourceProvider(ca.uhn.fhir.rest.server.IResourceProvider) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) OperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IBaseOperationOutcome(org.hl7.fhir.instance.model.api.IBaseOperationOutcome) OperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome)

Example 5 with IBaseOperationOutcome

use of org.hl7.fhir.instance.model.api.IBaseOperationOutcome in project openmrs-module-fhir2 by openmrs.

the class BaseFhirR4IntegrationTest method describeOperationOutcome.

@Override
public void describeOperationOutcome(Description mismatchDescription, IBaseOperationOutcome baseOperationOutcome) {
    if (baseOperationOutcome instanceof OperationOutcome) {
        OperationOutcome operationOutcome = (OperationOutcome) baseOperationOutcome;
        if (operationOutcome.hasIssue()) {
            mismatchDescription.appendText(" with message ");
            mismatchDescription.appendValue(operationOutcome.getIssue().stream().map(OperationOutcome.OperationOutcomeIssueComponent::getDiagnostics).collect(Collectors.joining(". ")));
        }
    }
}
Also used : IBaseOperationOutcome(org.hl7.fhir.instance.model.api.IBaseOperationOutcome) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome)

Aggregations

IBaseOperationOutcome (org.hl7.fhir.instance.model.api.IBaseOperationOutcome)11 CamelSpringBootTest (org.apache.camel.test.spring.junit5.CamelSpringBootTest)5 Test (org.junit.jupiter.api.Test)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 Description (org.hamcrest.Description)4 FhirContext (ca.uhn.fhir.context.FhirContext)3 IResourceProvider (ca.uhn.fhir.rest.server.IResourceProvider)3 Collectors (java.util.stream.Collectors)3 FhirRestServlet (org.openmrs.module.fhir2.web.servlet.FhirRestServlet)3 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)3 HashMap (java.util.HashMap)2 Bundle (org.hl7.fhir.dstu3.model.Bundle)2 OperationOutcome (org.hl7.fhir.dstu3.model.OperationOutcome)2 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)2 OperationOutcome (org.hl7.fhir.r4.model.OperationOutcome)2 BaseFhirResourceProviderWebTest (org.openmrs.module.fhir2.providers.BaseFhirResourceProviderWebTest)2 FhirR3RestServlet (org.openmrs.module.fhir2.web.servlet.FhirR3RestServlet)2 DataFormatException (ca.uhn.fhir.parser.DataFormatException)1 CacheControlDirective (ca.uhn.fhir.rest.api.CacheControlDirective)1