Added a couple more Unit Tests for EXM125 and EXM130 since these are important to IntraHealth.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package ca.uhn.fhir.jpa.starter;
|
package ca.uhn.fhir.jpa.starter;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
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.model.primitive.IdDt;
|
||||||
import ca.uhn.fhir.rest.api.CacheControlDirective;
|
import ca.uhn.fhir.rest.api.CacheControlDirective;
|
||||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
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.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
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.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.web.server.LocalServerPort;
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
@@ -55,6 +57,9 @@ public class ExampleServerR4IT implements IServerSupport {
|
|||||||
private FhirContext ourCtx;
|
private FhirContext ourCtx;
|
||||||
private String ourServerBaseURL;
|
private String ourServerBaseURL;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DaoRegistry myDaoRegistry;
|
||||||
|
|
||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
private int port;
|
private int port;
|
||||||
|
|
||||||
@@ -148,6 +153,77 @@ public class ExampleServerR4IT implements IServerSupport {
|
|||||||
return result;
|
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
|
@Test
|
||||||
public void testWebsocketSubscription() throws Exception {
|
public void testWebsocketSubscription() throws Exception {
|
||||||
/*
|
/*
|
||||||
|
|||||||
4122
src/test/resources/r4/EXM125/EXM125_FHIR4-7.2.000-bundle.json
Normal file
4122
src/test/resources/r4/EXM125/EXM125_FHIR4-7.2.000-bundle.json
Normal file
File diff suppressed because one or more lines are too long
126
src/test/resources/r4/EXM125/library-EXM125_FHIR4-7.2.000.json
Normal file
126
src/test/resources/r4/EXM125/library-EXM125_FHIR4-7.2.000.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
310
src/test/resources/r4/EXM125/measure-EXM125_FHIR4-7.2.000.json
Normal file
310
src/test/resources/r4/EXM125/measure-EXM125_FHIR4-7.2.000.json
Normal file
File diff suppressed because one or more lines are too long
4079
src/test/resources/r4/EXM130/EXM130_FHIR4-7.2.000-bundle.json
Normal file
4079
src/test/resources/r4/EXM130/EXM130_FHIR4-7.2.000-bundle.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user