Cleaned up some tests - more work to do to get some additional tests working in R4.
This commit is contained in:
@@ -45,7 +45,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
"spring.datasource.url=jdbc:h2:mem:dbr4",
|
||||
"hapi.fhir.fhir_version=R4",
|
||||
"hapi.fhir.cql_enabled=true",
|
||||
"hapi.fhir.empi_enabled=true",
|
||||
"hapi.fhir.empi_enabled=false",
|
||||
"hapi.fhir.subscription.websocket_enabled=true",
|
||||
//Override is currently required when using Empi as the construction of the Empi beans are ambiguous as they are constructed multiple places. This is evident when running in a spring boot environment
|
||||
"spring.main.allow-bean-definition-overriding=true"
|
||||
@@ -79,6 +79,109 @@ public class ExampleServerR4IT implements IServerSupport {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCQLEXM104EvaluateMeasure() throws IOException {
|
||||
String measureId = "measure-EXM104-8.2.000";
|
||||
|
||||
loadBundle("r4/EXM104/EXM104-8.2.000-bundle.json", ourCtx, ourClient);
|
||||
|
||||
// http://localhost:8080/fhir/Measure/measure-EXM104-8.2.000/$evaluate-measure?periodStart=2019-01-01&periodEnd=2019-12-31
|
||||
Parameters inParams = new Parameters();
|
||||
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());
|
||||
}
|
||||
|
||||
private Bundle loadBundle(String theLocation, FhirContext theCtx, IGenericClient theClient) throws IOException {
|
||||
String json = stringFromResource(theLocation);
|
||||
Bundle bundle = (Bundle) theCtx.newJsonParser().parseResource(json);
|
||||
Bundle result = (Bundle) theClient.transaction().withBundle(bundle).execute();
|
||||
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-EXM130-FHIR4-7.2.000/_history/1.
|
||||
//@Test
|
||||
public void testCQLEXM130EvaluateMeasure() 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());
|
||||
}
|
||||
|
||||
// Fails with:
|
||||
// ca.uhn.fhir.rest.server.exceptions.InternalErrorException:
|
||||
// HTTP 500 Server Error: Failed to call access method: org.opencds.cqf.cql.engine.exception.CqlException:
|
||||
// Could not resolve expression reference 'null' in library 'EXM349'.
|
||||
//@Test
|
||||
public void testCQLEXM349EvaluateMeasure() throws IOException {
|
||||
String measureId = "measure-EXM349-2.10.000";
|
||||
|
||||
loadBundle("r4/EXM349/EXM349-2.10.000-bundle.json", ourCtx, ourClient);
|
||||
|
||||
// http://localhost:8080/fhir/Measure/measure-EXM349-2.10.000/$evaluate-measure?periodStart=2019-01-01&periodEnd=2019-12-31
|
||||
Parameters inParams = new Parameters();
|
||||
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
|
||||
void testCreateAndRead() {
|
||||
|
||||
String methodName = "testCreateResourceConditional";
|
||||
@@ -115,116 +218,7 @@ public class ExampleServerR4IT implements IServerSupport {
|
||||
return BundleUtil.toListOfResourcesOfType(ourCtx, bundle, Person.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCQLEvaluateMeasureEXM104() throws IOException {
|
||||
String measureId = "measure-EXM104-8.2.000";
|
||||
|
||||
loadBundle("r4/EXM104/EXM104-8.2.000-bundle.json", ourCtx, ourClient);
|
||||
|
||||
// http://localhost:8080/fhir/Measure/measure-EXM104-8.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());
|
||||
}
|
||||
|
||||
private Bundle loadBundle(String theLocation, FhirContext theCtx, IGenericClient theClient) throws IOException {
|
||||
String json = stringFromResource(theLocation);
|
||||
Bundle bundle = (Bundle) theCtx.newJsonParser().parseResource(json);
|
||||
Bundle result = (Bundle) theClient.transaction().withBundle(bundle).execute();
|
||||
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 {
|
||||
/*
|
||||
* Create subscription
|
||||
|
||||
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
@@ -114,7 +114,7 @@
|
||||
"type": {
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://hl7.org/fhir/codesystem-library-type.html",
|
||||
"system": "http://terminology.hl7.org/CodeSystem/library-type",
|
||||
"code": "logic-library"
|
||||
}
|
||||
]
|
||||
@@ -158,7 +158,7 @@
|
||||
"type": {
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://hl7.org/fhir/codesystem-library-type.html",
|
||||
"system": "http://terminology.hl7.org/CodeSystem/library-type",
|
||||
"code": "logic-library"
|
||||
}
|
||||
]
|
||||
@@ -255,7 +255,7 @@
|
||||
"type": {
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://hl7.org/fhir/codesystem-library-type.html",
|
||||
"system": "http://terminology.hl7.org/CodeSystem/library-type",
|
||||
"code": "logic-library"
|
||||
}
|
||||
]
|
||||
@@ -2263,7 +2263,7 @@
|
||||
"type": {
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://hl7.org/fhir/codesystem-library-type.html",
|
||||
"system": "http://terminology.hl7.org/CodeSystem/library-type",
|
||||
"code": "logic-library"
|
||||
}
|
||||
]
|
||||
@@ -3851,7 +3851,7 @@
|
||||
"type": {
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://hl7.org/fhir/codesystem-library-type.html",
|
||||
"system": "http://terminology.hl7.org/CodeSystem/library-type",
|
||||
"code": "logic-library"
|
||||
}
|
||||
]
|
||||
@@ -3959,7 +3959,7 @@
|
||||
"type": {
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://hl7.org/fhir/codesystem-library-type.html",
|
||||
"system": "http://terminology.hl7.org/CodeSystem/library-type",
|
||||
"code": "logic-library"
|
||||
}
|
||||
]
|
||||
|
||||
3003
src/test/resources/r4/EXM349/EXM349-2.10.000-bundle.json
Normal file
3003
src/test/resources/r4/EXM349/EXM349-2.10.000-bundle.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user