Search in sources :

Example 51 with FhirServerConfig

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

the class FhirClientTimeoutTest method testFhirClientContext_handlesDelayWithConfiguration.

@Test
public void testFhirClientContext_handlesDelayWithConfiguration() {
    FhirServerConfig fhirServerConfig = getFhirServerConfig();
    fhirServerConfig.setSocketTimeout(CONFIG_NO_TIMEOUT_MILLIS);
    FHIRClientContext fhirClientContext = new FHIRClientContext.Builder().withDefaultClient(fhirServerConfig).build();
    Patient patient = fhirClientContext.getDataClient().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) 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 52 with FhirServerConfig

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

the class FhirClientTimeoutTest method testFhirClientContext_handlesDelayDefault.

@Test
public void testFhirClientContext_handlesDelayDefault() {
    FhirServerConfig fhirServerConfig = getFhirServerConfig();
    fhirServerConfig.setSocketTimeout(null);
    FHIRClientContext fhirClientContext = new FHIRClientContext.Builder().withDefaultClient(fhirServerConfig).build();
    Patient patient = fhirClientContext.getDataClient().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) 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 53 with FhirServerConfig

use of com.ibm.cohort.fhir.client.config.FhirServerConfig 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 54 with FhirServerConfig

use of com.ibm.cohort.fhir.client.config.FhirServerConfig 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)

Example 55 with FhirServerConfig

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

the class MeasureTestBase method setUp.

@Before
public void setUp() {
    FhirServerConfig config = getFhirServerConfig();
    FhirClientBuilderFactory factory = FhirClientBuilderFactory.newInstance();
    FhirClientBuilder builder = factory.newFhirClientBuilder(fhirContext);
    client = builder.createFhirClient(config);
    expressionsByPopulationType = new HashMap<>();
    expressionsByPopulationType.put(MeasurePopulationType.INITIALPOPULATION, INITIAL_POPULATION);
    expressionsByPopulationType.put(MeasurePopulationType.DENOMINATOR, DENOMINATOR);
    expressionsByPopulationType.put(MeasurePopulationType.DENOMINATOREXCLUSION, DENOMINATOR_EXCLUSION);
    expressionsByPopulationType.put(MeasurePopulationType.DENOMINATOREXCEPTION, DENOMINATOR_EXCEPTION);
    expressionsByPopulationType.put(MeasurePopulationType.NUMERATOR, NUMERATOR);
    expressionsByPopulationType.put(MeasurePopulationType.NUMERATOREXCLUSION, NUMERATOR_EXCLUSION);
    expectationsByPopulationType = new HashMap<>();
    expectationsByPopulationType.put(MeasurePopulationType.INITIALPOPULATION, 1);
    expectationsByPopulationType.put(MeasurePopulationType.DENOMINATOR, 1);
    expectationsByPopulationType.put(MeasurePopulationType.DENOMINATOREXCLUSION, 0);
    expectationsByPopulationType.put(MeasurePopulationType.DENOMINATOREXCEPTION, 0);
    expectationsByPopulationType.put(MeasurePopulationType.NUMERATOR, 0);
    expectationsByPopulationType.put(MeasurePopulationType.NUMERATOREXCLUSION, 0);
}
Also used : FhirClientBuilder(com.ibm.cohort.fhir.client.config.FhirClientBuilder) FhirClientBuilderFactory(com.ibm.cohort.fhir.client.config.FhirClientBuilderFactory) FhirServerConfig(com.ibm.cohort.fhir.client.config.FhirServerConfig) Before(org.junit.Before)

Aggregations

FhirServerConfig (com.ibm.cohort.fhir.client.config.FhirServerConfig)63 Test (org.junit.Test)52 Patient (org.hl7.fhir.r4.model.Patient)39 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)36 ByteArrayOutputStream (java.io.ByteArrayOutputStream)22 HashMap (java.util.HashMap)21 File (java.io.File)18 IAttachment (com.ibm.websphere.jaxrs20.multipart.IAttachment)15 Response (javax.ws.rs.core.Response)15 CqlEvaluator (com.ibm.cohort.cql.evaluation.CqlEvaluator)14 CqlVersionedIdentifier (com.ibm.cohort.cql.library.CqlVersionedIdentifier)14 FileWriter (java.io.FileWriter)14 CqlEvaluationResult (com.ibm.cohort.cql.evaluation.CqlEvaluationResult)13 PrintStream (java.io.PrintStream)13 Writer (java.io.Writer)13 ByteArrayInputStream (java.io.ByteArrayInputStream)11 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)10 IMultipartBody (com.ibm.websphere.jaxrs20.multipart.IMultipartBody)10 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)10 IParser (ca.uhn.fhir.parser.IParser)9