Added a couple more Unit Tests for EXM125 and EXM130 since these are important to IntraHealth.

This commit is contained in:
Kevin Dougan
2020-12-07 13:46:48 -05:00
parent 8da9989984
commit ff09ff1af6
6 changed files with 9113 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
package ca.uhn.fhir.jpa.starter;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.api.CacheControlDirective;
import ca.uhn.fhir.rest.api.EncodingEnum;
@@ -19,6 +20,7 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -55,6 +57,9 @@ public class ExampleServerR4IT implements IServerSupport {
private FhirContext ourCtx;
private String ourServerBaseURL;
@Autowired
DaoRegistry myDaoRegistry;
@LocalServerPort
private int port;
@@ -148,6 +153,77 @@ public class ExampleServerR4IT implements IServerSupport {
return result;
}
// Fails with: ca.uhn.fhir.rest.server.exceptions.InternalErrorException: HTTP 500 :
// Failed to call access method: java.lang.IllegalArgumentException:
// Could not load library source for libraries referenced in Measure/Measure/measure-EXM125-FHIR4-7.2.000/_history/1.
//@Test
public void testCQLEvaluateMeasureEXM125() throws IOException {
String measureId = "measure-EXM125-FHIR4-7.2.000";
loadBundle("r4/EXM125/library-deps-EXM125_FHIR4-7.2.000-bundle.json", ourCtx, ourClient);
loadResource("r4/EXM125/library-EXM125_FHIR4-7.2.000.json", ourCtx, myDaoRegistry);
loadBundle("r4/EXM125/EXM125_FHIR4-7.2.000-bundle.json", ourCtx, ourClient);
loadResource("r4/EXM125/measure-EXM125_FHIR4-7.2.000.json", ourCtx, myDaoRegistry);
// http://localhost:8080/fhir/Measure/measure-EXM125-FHIR4-7.2.000/$evaluate-measure?periodStart=2019-01-01&periodEnd=2019-12-31
Parameters inParams = new Parameters();
// inParams.addParameter().setName("measure").setValue(new StringType("Measure/measure-EXM104-8.2.000"));
// inParams.addParameter().setName("patient").setValue(new StringType("Patient/numer-EXM104-FHIR3"));
inParams.addParameter().setName("periodStart").setValue(new StringType("2019-01-01"));
inParams.addParameter().setName("periodEnd").setValue(new StringType("2019-12-31"));
Parameters outParams = ourClient
.operation()
.onInstance(new IdDt("Measure", measureId))
.named("$evaluate-measure")
.withParameters(inParams)
.cacheControl(new CacheControlDirective().setNoCache(true))
.withAdditionalHeader("Content-Type", "application/json")
.useHttpGet()
.execute();
List<Parameters.ParametersParameterComponent> response = outParams.getParameter();
Assert.assertTrue(!response.isEmpty());
Parameters.ParametersParameterComponent component = response.get(0);
Assert.assertTrue(component.getResource() instanceof MeasureReport);
MeasureReport report = (MeasureReport) component.getResource();
Assert.assertEquals("Measure/"+measureId, report.getMeasure());
}
// Fails with: ca.uhn.fhir.rest.server.exceptions.InternalErrorException: HTTP 500 :
// Failed to call access method: java.lang.IllegalArgumentException:
// Could not load library source for libraries referenced in Measure/Measure/measure-EXM130-FHIR4-7.2.000/_history/1.
//@Test
public void testCQLEvaluateMeasureEXM130() throws IOException {
String measureId = "measure-EXM130-FHIR4-7.2.000";
loadBundle("r4/EXM130/EXM130_FHIR4-7.2.000-bundle.json", ourCtx, ourClient);
// http://localhost:8080/fhir/Measure/measure-EXM130-FHIR4-7.2.000/$evaluate-measure?periodStart=2019-01-01&periodEnd=2019-12-31
Parameters inParams = new Parameters();
// inParams.addParameter().setName("measure").setValue(new StringType("Measure/measure-EXM104-8.2.000"));
// inParams.addParameter().setName("patient").setValue(new StringType("Patient/numer-EXM104-FHIR3"));
inParams.addParameter().setName("periodStart").setValue(new StringType("2019-01-01"));
inParams.addParameter().setName("periodEnd").setValue(new StringType("2019-12-31"));
Parameters outParams = ourClient
.operation()
.onInstance(new IdDt("Measure", measureId))
.named("$evaluate-measure")
.withParameters(inParams)
.cacheControl(new CacheControlDirective().setNoCache(true))
.withAdditionalHeader("Content-Type", "application/json")
.useHttpGet()
.execute();
List<Parameters.ParametersParameterComponent> response = outParams.getParameter();
Assert.assertTrue(!response.isEmpty());
Parameters.ParametersParameterComponent component = response.get(0);
Assert.assertTrue(component.getResource() instanceof MeasureReport);
MeasureReport report = (MeasureReport) component.getResource();
Assert.assertEquals("Measure/"+measureId, report.getMeasure());
}
@Test
public void testWebsocketSubscription() throws Exception {
/*

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long