Search in sources :

Example 11 with DefaultFhirClientBuilder

use of com.ibm.cohort.fhir.client.config.DefaultFhirClientBuilder in project quality-measure-and-cohort-service by Alvearie.

the class FhirClientTimeoutTest method testDefaultFhirClientBuilder_handlesDelayWithConfiguration.

@Test
public void testDefaultFhirClientBuilder_handlesDelayWithConfiguration() {
    FhirServerConfig fhirServerConfig = getFhirServerConfig();
    fhirServerConfig.setSocketTimeout(CONFIG_NO_TIMEOUT_MILLIS);
    DefaultFhirClientBuilder builder = new DefaultFhirClientBuilder(fhirContext);
    IGenericClient client = builder.createFhirClient(fhirServerConfig);
    Patient patient = client.read().resource(Patient.class).withId(PATIENT_ID).execute();
    Enumerations.AdministrativeGender actual = patient.getGender();
    Assert.assertEquals(Enumerations.AdministrativeGender.OTHER, actual);
}
Also used : DefaultFhirClientBuilder(com.ibm.cohort.fhir.client.config.DefaultFhirClientBuilder) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) Patient(org.hl7.fhir.r4.model.Patient) FhirServerConfig(com.ibm.cohort.fhir.client.config.FhirServerConfig) Enumerations(org.hl7.fhir.r4.model.Enumerations) Test(org.junit.Test)

Example 12 with DefaultFhirClientBuilder

use of com.ibm.cohort.fhir.client.config.DefaultFhirClientBuilder in project quality-measure-and-cohort-service by Alvearie.

the class FhirClientTimeoutTest method testDefaultFhirClientBuilder_handlesDelayDefault.

@Test
public void testDefaultFhirClientBuilder_handlesDelayDefault() {
    FhirServerConfig fhirServerConfig = getFhirServerConfig();
    fhirServerConfig.setSocketTimeout(null);
    DefaultFhirClientBuilder builder = new DefaultFhirClientBuilder(fhirContext);
    IGenericClient client = builder.createFhirClient(fhirServerConfig);
    Patient patient = client.read().resource(Patient.class).withId(PATIENT_ID).execute();
    Enumerations.AdministrativeGender actual = patient.getGender();
    Assert.assertEquals(Enumerations.AdministrativeGender.OTHER, actual);
}
Also used : DefaultFhirClientBuilder(com.ibm.cohort.fhir.client.config.DefaultFhirClientBuilder) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) Patient(org.hl7.fhir.r4.model.Patient) FhirServerConfig(com.ibm.cohort.fhir.client.config.FhirServerConfig) Enumerations(org.hl7.fhir.r4.model.Enumerations) Test(org.junit.Test)

Aggregations

DefaultFhirClientBuilder (com.ibm.cohort.fhir.client.config.DefaultFhirClientBuilder)12 Test (org.junit.Test)10 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)7 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)4 FhirServerConfig (com.ibm.cohort.fhir.client.config.FhirServerConfig)3 FhirContext (ca.uhn.fhir.context.FhirContext)2 Enumerations (org.hl7.fhir.r4.model.Enumerations)2 Patient (org.hl7.fhir.r4.model.Patient)2 IBMFhirServerConfig (com.ibm.cohort.fhir.client.config.IBMFhirServerConfig)1 After (org.junit.After)1