diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 6ec99de10b..496122abd6 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -23,26 +23,39 @@ jobs:
distribution: adopt
cache: maven
- - name: Run the tests in Maven
+ - name: Install maven (ubuntu-slim)
+ if: matrix.os == 'ubuntu-slim'
+ run: sudo apt-get update && sudo apt-get install -y maven
+
+ - name: Run the engine tests in Maven
timeout-minutes: 15
- # We need a timeout here
- env:
- MAVEN_OPTS: -Xmx12g
- run: mvn --batch-mode --no-transfer-progress --update-snapshots verify
-
- - uses: actions/upload-artifact@v4
- if: failure()
- with:
- name: testresults
- path: |
- ./matchbox-server/target/surefire-reports
- ./matchbox-engine/target/surefire-reports
- retention-days: 2
-
- - name: Test Summary
- uses: test-summary/action@v2
- with:
- paths: |
- matchbox-engine/target/surefire-reports/TEST-*.xml
- matchbox-server/target/surefire-reports/TEST-*.xml
- if: always()
+ run: mvn --batch-mode --no-transfer-progress --update-snapshots -pl matchbox-engine test
+
+ - name: Run the GazelleApiR4Test tests in Maven
+ timeout-minutes: 15
+ run: mvn --batch-mode --no-transfer-progress --update-snapshots -pl matchbox-server -Dtest=GazelleApiR4Test test
+
+
+ - name: Run the TransformTest tests in Maven
+ timeout-minutes: 15
+ run: mvn --batch-mode --no-transfer-progress --update-snapshots -pl matchbox-server -Dtest=TransformTest test
+
+
+ - name: Run the MatchboxApiR4Test tests in Maven
+ timeout-minutes: 15
+ run: mvn --batch-mode --no-transfer-progress --update-snapshots -pl matchbox-server -Dscheduling_disabled=true -Dtest=MatchboxApiR4Test test
+
+
+ - name: Run the MatchboxApiR4BTest tests in Maven
+ timeout-minutes: 15
+ run: mvn --batch-mode --no-transfer-progress --update-snapshots -pl matchbox-server -Dtest=MatchboxApiR4BTest test
+
+
+ - name: Run the MatchboxApiR5Test tests in Maven
+ timeout-minutes: 15
+ run: mvn --batch-mode --no-transfer-progress --update-snapshots -pl matchbox-server -Dtest=MatchboxApiR5Test test
+
+
+ - name: Run the MatchboxApiR5onR4Test tests in Maven
+ timeout-minutes: 15
+ run: mvn --batch-mode --no-transfer-progress --update-snapshots -pl matchbox-server -Dtest=MatchboxApiR5onR4Test test
diff --git a/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/CdaToFhirTransformTests.java b/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/CdaToFhirTransformTests.java
index 94a7781817..4c45652884 100644
--- a/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/CdaToFhirTransformTests.java
+++ b/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/CdaToFhirTransformTests.java
@@ -23,148 +23,127 @@
import ch.ahdis.matchbox.engine.CdaMappingEngine;
import org.apache.commons.io.IOUtils;
import org.hl7.fhir.exceptions.FHIRException;
-import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Composition;
import org.hl7.fhir.r4.model.Condition;
import org.hl7.fhir.r4.model.Observation;
-import org.hl7.fhir.r4.model.OperationOutcome;
-import org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity;
-import org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent;
import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.StructureMap;
-import org.hl7.fhir.r5.utils.EOperationOutcome;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.*;
import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import java.io.InputStream;
-import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.util.Calendar;
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class CdaToFhirTransformTests {
- static private CdaMappingEngine engine;
- static String cdaLabItaly;
+ private final CdaMappingEngine engine;
+ private final String cdaLabItaly;
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(CdaToFhirTransformTests.class);
- @BeforeAll
- static void setUpBeforeClass() throws Exception {
+ public CdaToFhirTransformTests() throws Exception {
InputStream in = getResourceAsStream("cda-it.xml");
cdaLabItaly = IOUtils.toString(in, StandardCharsets.UTF_8);
+ engine = this.getEngine();
}
-
+
@AfterAll
- static void teardownClass() throws Exception {
- engine = null;
+ void teardownClass() {
CompareUtil.logMemory();
}
-
- private CdaMappingEngine getEngine() {
- if (engine == null) {
- try {
- engine = new CdaMappingEngine.CdaMappingEngineBuilder().getCdaEngineR4();
- StructureMap sm = engine.parseMap(getFileAsStringFromResources("datatypes.map"));
- assertTrue(sm != null);
- engine.addCanonicalResource(sm);
- sm = engine.parseMap(getFileAsStringFromResources("FullHeader.map"));
- assertTrue(sm != null);
- engine.addCanonicalResource(sm);
- sm = engine.parseMap(getFileAsStringFromResources("LabBody.map"));
- assertTrue(sm != null);
- engine.addCanonicalResource(sm);
- sm = getEngine().parseMap(getFileAsStringFromResources("cda-it-observation.map"));
- assertTrue(sm != null);
- engine.addCanonicalResource(sm);
- sm = getEngine().parseMap(getFileAsStringFromResources("cda-it-observation-st-r2b.map"));
- assertTrue(sm != null);
- engine.addCanonicalResource(sm);
- sm = getEngine().parseMap(getFileAsStringFromResources("cda-it-observation-condition.map"));
- assertTrue(sm != null);
- engine.addCanonicalResource(sm);
- sm = getEngine().parseMap(getFileAsStringFromResources("fhir-to-cda.map"));
- assertTrue(sm != null);
- engine.addCanonicalResource(sm);
- } catch (FHIRException | IOException | URISyntaxException e) {
- e.printStackTrace();
- }
- return engine;
- }
+ private CdaMappingEngine getEngine() throws Exception {
+ final var engine = new CdaMappingEngine.CdaMappingEngineBuilder().getCdaEngineR4();
+ StructureMap sm = engine.parseMap(getFileAsStringFromResources("datatypes.map"));
+ assertTrue(sm != null);
+ engine.addCanonicalResource(sm);
+ sm = engine.parseMap(getFileAsStringFromResources("FullHeader.map"));
+ assertTrue(sm != null);
+ engine.addCanonicalResource(sm);
+ sm = engine.parseMap(getFileAsStringFromResources("LabBody.map"));
+ assertTrue(sm != null);
+ engine.addCanonicalResource(sm);
+ sm = engine.parseMap(getFileAsStringFromResources("cda-it-observation.map"));
+ assertTrue(sm != null);
+ engine.addCanonicalResource(sm);
+ sm = engine.parseMap(getFileAsStringFromResources("cda-it-observation-st-r2b.map"));
+ assertTrue(sm != null);
+ engine.addCanonicalResource(sm);
+ sm = engine.parseMap(getFileAsStringFromResources("cda-it-observation-condition.map"));
+ assertTrue(sm != null);
+ engine.addCanonicalResource(sm);
+ sm = engine.parseMap(getFileAsStringFromResources("fhir-to-cda.map"));
+ assertTrue(sm != null);
+ engine.addCanonicalResource(sm);
return engine;
}
- @BeforeEach
- void setUp() throws Exception {
- }
-
@Test
void TestFhirPath() throws FHIRException, IOException {
-
- String str = getEngine().convert(cdaLabItaly, false);
+
+ String str = this.engine.convert(cdaLabItaly, false);
log.debug(str);
- assertEquals("11502-2", getEngine().evaluateFhirPath(cdaLabItaly, false, "code.code"));
+ assertEquals("11502-2", this.engine.evaluateFhirPath(cdaLabItaly, false, "code.code"));
String attributeWithCdaWhiteSpace = cdaLabItaly.replaceAll("11502-2", " 11502-2");
assertTrue(attributeWithCdaWhiteSpace.indexOf(" 11502-2") > 0);
assertEquals("11502-2",
- getEngine().evaluateFhirPath(attributeWithCdaWhiteSpace, false, "code.code"));
+ this.engine.evaluateFhirPath(attributeWithCdaWhiteSpace, false, "code.code"));
assertEquals("REFERTO DI LABORATORIO",
- getEngine().evaluateFhirPath(cdaLabItaly, false, "title.xmlText"));
- assertEquals("IT", getEngine().evaluateFhirPath(cdaLabItaly, false, "realmCode.code"));
+ this.engine.evaluateFhirPath(cdaLabItaly, false, "title.xmlText"));
+ assertEquals("IT", this.engine.evaluateFhirPath(cdaLabItaly, false, "realmCode.code"));
assertEquals("2.16.840.1.113883.1.3",
- getEngine().evaluateFhirPath(cdaLabItaly, false, "typeId.root"));
+ this.engine.evaluateFhirPath(cdaLabItaly, false, "typeId.root"));
// assertEquals("POCD_MT000040UV02",
-// getEngine().evaluateFhirPath(cdaLabItaly, false, "typeId.extension"));
+// this.engine.evaluateFhirPath(cdaLabItaly, false, "typeId.extension"));
assertEquals("POCD_HD000040",
- getEngine().evaluateFhirPath(cdaLabItaly, false, "typeId.extension"));
+ this.engine.evaluateFhirPath(cdaLabItaly, false, "typeId.extension"));
// stdc
-// assertEquals("active", getEngine().evaluateFhirPath(cdaLabItaly, false, "statusCode.code"));
+// assertEquals("active", this.engine.evaluateFhirPath(cdaLabItaly, false, "statusCode.code"));
// changed with core 7.3.0
- assertEquals("active", getEngine().evaluateFhirPath(cdaLabItaly, false, "sdtcStatusCode.code"));
+ assertEquals("active", this.engine.evaluateFhirPath(cdaLabItaly, false, "sdtcStatusCode.code"));
//
assertEquals("2022-03-30T11:24:26+01:00",
- getEngine().evaluateFhirPath(cdaLabItaly, false, "effectiveTime.value"));
+ this.engine.evaluateFhirPath(cdaLabItaly, false, "effectiveTime.value"));
assertEquals("1993-06-19",
- getEngine().evaluateFhirPath(cdaLabItaly,
+ this.engine.evaluateFhirPath(cdaLabItaly,
false,
"recordTarget.patientRole.patient.birthTime.value"));
-
-
+
+
// https://hl7.org/cda/stds/core/2.0.0-sd-snapshot1/StructureDefinition-PN.html
assertEquals("Verdi",
- getEngine().evaluateFhirPath(cdaLabItaly,
+ this.engine.evaluateFhirPath(cdaLabItaly,
false,
"recordTarget.patientRole.patient.name.item.family.xmlText"));
assertEquals("Giuseppe",
- getEngine().evaluateFhirPath(cdaLabItaly,
+ this.engine.evaluateFhirPath(cdaLabItaly,
false,
"recordTarget.patientRole.patient.name.item.given.xmlText"));
// hl7 austria
- assertEquals("2021-06-01", getEngine().evaluateFhirPath(cdaLabItaly, false, "terminologyDate.value"));
- assertEquals("code", getEngine().evaluateFhirPath(cdaLabItaly, false, "formatCode.code"));
- assertEquals("F028", getEngine().evaluateFhirPath(cdaLabItaly, false, "practiceSettingCode.code"));
+ assertEquals("2021-06-01", this.engine.evaluateFhirPath(cdaLabItaly, false, "terminologyDate.value"));
+ assertEquals("code", this.engine.evaluateFhirPath(cdaLabItaly, false, "formatCode.code"));
+ assertEquals("F028", this.engine.evaluateFhirPath(cdaLabItaly, false, "practiceSettingCode.code"));
}
@Test
void TestInitial() throws FHIRException, IOException {
- String result = getEngine().transform(cdaLabItaly,
+ String result = this.engine.transform(cdaLabItaly,
false,
"http://salute.gov.it/ig/cda-fhir-maps/StructureMap/RefertodilaboratorioFULLBODY",
true);
assertNotNull(result);
- Bundle resource = (Bundle) getEngine().transformToFhir(cdaLabItaly, false,"http://salute.gov.it/ig/cda-fhir-maps/StructureMap/RefertodilaboratorioFULLBODY");
+ Bundle resource = (Bundle) this.engine.transformToFhir(cdaLabItaly, false,"http://salute.gov.it/ig/cda-fhir-maps/StructureMap/RefertodilaboratorioFULLBODY");
assertNotNull(resource);
Composition composition = (Composition) resource.getEntryFirstRep().getResource();
assertNotNull(composition);
@@ -181,12 +160,12 @@ void TestInitial() throws FHIRException, IOException {
void TestObservation() throws FHIRException, IOException {
InputStream in = getResourceAsStream("cda-it-observation.xml");
- StructureMap sm = getEngine().parseMap(getFileAsStringFromResources("cda-it-observation.map"));
+ StructureMap sm = this.engine.parseMap(getFileAsStringFromResources("cda-it-observation.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
String cdaObservation = IOUtils.toString(in, StandardCharsets.UTF_8);
- Resource resource = getEngine().transformToFhir(cdaObservation,
+ Resource resource = this.engine.transformToFhir(cdaObservation,
false,
"http://salute.gov.it/ig/cda-fhir-maps/StructureMap/TestObservation");
@@ -204,7 +183,7 @@ void TestObservationSt() throws FHIRException, IOException {
InputStream in = getResourceAsStream("cda-it-observation-st.xml");
String cdaObservation = IOUtils.toString(in, StandardCharsets.UTF_8);
- Resource resource = getEngine().transformToFhir(cdaObservation,
+ Resource resource = this.engine.transformToFhir(cdaObservation,
false,
"http://salute.gov.it/ig/cda-fhir-maps/StructureMap/TestObservation");
Observation obs = (Observation) resource;
@@ -219,7 +198,7 @@ void TestObservationStR2b() throws FHIRException, IOException {
InputStream in = getResourceAsStream("cda-it-observation-st-r2b.xml");
String cdaObservation = IOUtils.toString(in, StandardCharsets.UTF_8);
- Resource resource = getEngine().transformToFhir(cdaObservation,
+ Resource resource = this.engine.transformToFhir(cdaObservation,
false,
"http://salute.gov.it/ig/cda-fhir-maps/StructureMap/TestObservationStR2b");
Observation obs = (Observation) resource;
@@ -234,7 +213,7 @@ void TestObservationCs() throws FHIRException, IOException {
InputStream in = getResourceAsStream("cda-it-observation-cs.xml");
String cdaObservation = IOUtils.toString(in, StandardCharsets.UTF_8);
- Resource resource = getEngine().transformToFhir(cdaObservation,
+ Resource resource = this.engine.transformToFhir(cdaObservation,
false,
"http://salute.gov.it/ig/cda-fhir-maps/StructureMap/TestObservation");
Observation obs = (Observation) resource;
@@ -249,7 +228,7 @@ void TestObservationCd() throws FHIRException, IOException {
InputStream in = getResourceAsStream("cda-it-observation-cd.xml");
String cdaObservation = IOUtils.toString(in, StandardCharsets.UTF_8);
- Resource resource = getEngine().transformToFhir(cdaObservation,
+ Resource resource = this.engine.transformToFhir(cdaObservation,
false,
"http://salute.gov.it/ig/cda-fhir-maps/StructureMap/TestObservation");
Observation obs = (Observation) resource;
@@ -264,7 +243,7 @@ void TestObservationCondition() throws FHIRException, IOException {
InputStream in = getResourceAsStream("cda-it-observation-condition.xml");
String cdaObservation = IOUtils.toString(in, StandardCharsets.UTF_8);
- Resource resource = getEngine().transformToFhir(cdaObservation,
+ Resource resource = this.engine.transformToFhir(cdaObservation,
false,
"http://salute.gov.it/ig/cda-fhir-maps/StructureMap/TestObservationConditionCoding");
Condition condition = (Condition) resource;
@@ -275,7 +254,7 @@ void TestObservationCondition() throws FHIRException, IOException {
@Test
void TestSecond() throws FHIRException, IOException {
- String result = getEngine().transform(cdaLabItaly,
+ String result = this.engine.transform(cdaLabItaly,
false,
"http://salute.gov.it/ig/cda-fhir-maps/StructureMap/RefertodilaboratorioFULLBODY",
true);
@@ -315,16 +294,16 @@ void TestFhirToCda() throws FHIRException, IOException {
" " + //
" " + //
" " + //
-
+
"";
- String result = getEngine().transform(bundleString,
+ String result = this.engine.transform(bundleString,
false,
"http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCda",
false);
assertEquals("2.16.840.1.113883.1.3",
- getEngine().evaluateFhirPath(result, false, "typeId.root"));
+ this.engine.evaluateFhirPath(result, false, "typeId.root"));
// assertEquals("POCD_MT000040UV02",
-// getEngine().evaluateFhirPath(result, false, "typeId.extension"));
+// this.engine.evaluateFhirPath(result, false, "typeId.extension"));
assertNotNull(result);
assertTrue(result.indexOf("20120204140500+0100")>0);
assertTrue(result.indexOf("6B6ED376-A7DA-44CB-92D1-E75CE1AE73B0")>0);
@@ -332,12 +311,12 @@ void TestFhirToCda() throws FHIRException, IOException {
assertTrue(result.indexOf("caption")>0);
assertTrue(result.indexOf("Kommentar")>0);
assertEquals("2012-02-04T14:05:00+01:00",
- getEngine().evaluateFhirPath(result, false, "effectiveTime.value"));
+ this.engine.evaluateFhirPath(result, false, "effectiveTime.value"));
}
@Test
void TestThird() throws FHIRException, IOException {
- String result = getEngine().transform(cdaLabItaly,
+ String result = this.engine.transform(cdaLabItaly,
false,
"http://salute.gov.it/ig/cda-fhir-maps/StructureMap/RefertodilaboratorioFULLBODY",
true);
@@ -345,15 +324,14 @@ void TestThird() throws FHIRException, IOException {
}
@Test
- void TestValidateCdaIt() throws FHIRException, IOException, EOperationOutcome, URISyntaxException {
- ch.ahdis.matchbox.engine.CdaMappingEngine engine = new CdaMappingEngine.CdaMappingEngineBuilder().getCdaEngineR4();
- String fhirBundle = getEngine().transform(cdaLabItaly,
+ void TestValidateCdaIt() throws FHIRException, IOException {
+ String fhirBundle = this.engine.transform(cdaLabItaly,
false,
"http://salute.gov.it/ig/cda-fhir-maps/StructureMap/RefertodilaboratorioFULLBODY",
false);
assertNotNull(fhirBundle);
log.debug(fhirBundle);
- String cda = getEngine().transform(fhirBundle,
+ String cda = this.engine.transform(fhirBundle,
false,
"http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCda",
false);
@@ -364,76 +342,6 @@ void TestValidateCdaIt() throws FHIRException, IOException, EOperationOutcome, U
CompareUtil.logMemory();
}
- private int errors(OperationOutcome op) {
- int i = 0;
- for (OperationOutcomeIssueComponent vm : op.getIssue()) {
- if (vm.getSeverity() == IssueSeverity.ERROR || vm.getSeverity() == IssueSeverity.FATAL) {
- // eg ('tel: 390 666 0581')
- if (vm.getDetails().getText().startsWith("URI values cannot have whitespace")) {
- continue;
- }
- // https://terminology.hl7.org/5.0.0/ValueSet-v3-RoleClassAssignedEntity.json.html
- // has a filter with an is-a concept to ASSIGEND and this cannot be evaluated by
- // org.hl7.fhir.r5.terminologies.ValueSetCheckerSimple
- if (vm.getDetails().getText().startsWith(
- "The System URI could not be determined for the code 'it-IT'")) {
- continue;
- }
- if (vm.getDetails().getText().startsWith(
- "The value provided ('it-IT') was not found in the value set 'All Languages'")) {
- continue;
- }
- if (vm.getDetails().getText().startsWith(
- "The value provided ('ASSIGNED') was not found in the value set 'RoleClassAssignedEntity'")) {
- continue;
- }
-
- if (vm.getDetails().getText().startsWith(
- "IntendedRecipient.classCode: minimum required = 1,")) {
- continue;
- }
-
- if (vm.getDetails().getText().startsWith(
- "ServiceEvent.classCode: minimum required = 1, ")) {
- continue;
- }
-
- if (vm.getDetails().getText().startsWith(
- "HealthCareFacility.classCode: minimum required = 1, ")) {
- continue;
- }
-
- if (vm.getDetails().getText().startsWith(
- "PlayingEntity.classCode: minimum required = 1, ")) {
- continue;
- }
- if (vm.getDetails().getText().startsWith(
- "ObservationRange.classCode: minimum required = 1, ")) {
- continue;
- }
- if (vm.getDetails().getText().startsWith(
- "LabCriterion.classCode: minimum required = 1, ")) {
- continue;
- }
- if (vm.getDetails().getText().startsWith(
- "LabCriterion.moodCode: minimum required = 1, ")) {
- continue;
- }
-
- // id value 'ESAMI_URINE' is not valid
- // id value 'ALBUMINA_URINE' is not valid
- if (vm.getDetails().getText().startsWith(
- "id value ")) {
- continue;
- }
-
- log.error(vm.getDetails().getText());
- ++i;
- }
- }
- return i;
- }
-
private static InputStream getResourceAsStream(final String filename) {
return CdaToFhirTransformTests.class.getResourceAsStream("/cda/" + filename);
}
diff --git a/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/FhirMappingLanguageTests.java b/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/FhirMappingLanguageTests.java
index acadfe7ebb..7f37596201 100644
--- a/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/FhirMappingLanguageTests.java
+++ b/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/FhirMappingLanguageTests.java
@@ -43,32 +43,32 @@
import org.hl7.fhir.r5.formats.JsonParser;
import org.hl7.fhir.r5.model.Composition;
import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import ch.ahdis.matchbox.engine.MatchboxEngine;
import ch.ahdis.matchbox.engine.MatchboxEngine.MatchboxEngineBuilder;
+import org.junit.jupiter.api.TestInstance;
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class FhirMappingLanguageTests {
+ private final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(FhirMappingLanguageTests.class);
- static private MatchboxEngine engine;
+ private final MatchboxEngine engine;
- private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(FhirMappingLanguageTests.class);
-
- @BeforeAll
- static void setUpBeforeClass() throws Exception {
+ public FhirMappingLanguageTests() {
engine = new MatchboxEngineBuilder().getEngineR4();
}
@AfterAll
- static void teardownClass() throws Exception {
- engine = null;
+ static void teardownClass() {
CompareUtil.logMemory();
}
@BeforeEach
- void setUp() throws Exception {
+ void clean() {
+ this.engine.getContext().dropResource("StructureDefinition", "TLeft");
+ this.engine.getContext().dropResource("StructureDefinition", "TRight");
}
public String getFileAsStringFromResources(String file) throws IOException {
@@ -82,7 +82,6 @@ public InputStream getFileAsInputStream(String file) throws IOException {
@Test
void testQr2Patient() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/qr2patgender.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -96,7 +95,6 @@ void testQr2Patient() throws FHIRException, IOException {
@Test
void testMemberOf() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/memberof.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -110,7 +108,6 @@ void testMemberOf() throws FHIRException, IOException {
@Test
void testNarrative() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/narrative.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -124,7 +121,6 @@ void testNarrative() throws FHIRException, IOException {
@Test
void testConformsTo() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/conformsto.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -138,7 +134,6 @@ void testConformsTo() throws FHIRException, IOException {
@Test
void testMatchboxEngine() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/conformstoneg.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -159,7 +154,6 @@ void testMatchboxEngine() throws FHIRException, IOException {
@Test
void testConformsToNeg() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/conformstoneg.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -173,7 +167,6 @@ void testConformsToNeg() throws FHIRException, IOException {
@Test
void testQty() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/quantity.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -195,7 +188,6 @@ void testQty() throws FHIRException, IOException {
@Test
void testStringToCoding() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/stringtocoding.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -210,7 +202,6 @@ void testStringToCoding() throws FHIRException, IOException {
@Test
void testStringToCodingWithCC() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/stringtocodingwithcc.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -226,7 +217,6 @@ void testStringToCodingWithCC() throws FHIRException, IOException {
@Test
void testTranslateCoding() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/translatecoding.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -247,7 +237,6 @@ void testTranslateCoding() throws FHIRException, IOException {
@Test
void testCast() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/cast.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -259,7 +248,6 @@ void testCast() throws FHIRException, IOException {
@Test
void testBundleTimestamp() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/bundlets.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -273,7 +261,6 @@ void testBundleTimestamp() throws FHIRException, IOException {
@Test
void testWhereClause() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/whereclause.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -286,7 +273,6 @@ void testWhereClause() throws FHIRException, IOException {
@Test
void testDateManipulation() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/qr2patfordates.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -307,7 +293,6 @@ private org.hl7.fhir.r5.model.CanonicalResource getCanonicalResourceFromJson(Str
@Test
void testTutorialStep1Xml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step1/map/step1.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -324,7 +309,6 @@ void testTutorialStep1Xml() throws FHIRException, IOException {
@Test
void testTutorialStep1Json() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step1/map/step1.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -346,7 +330,6 @@ void testTutorialStep1bJson() throws FHIRException, IOException {
// from rule 'rule_a_short'
// 1b org.hl7.fhir.exceptions.FHIRException: No matches found for rule for
// 'string to string' from http://hl7.org/fhir/StructureMap/tutorial-step1b,
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step1/map/step1b.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -365,7 +348,6 @@ void testTutorialStep1bJson() throws FHIRException, IOException {
@Test
void testTutorialStep2Xml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step2/map/step2.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -382,7 +364,6 @@ void testTutorialStep2Xml() throws FHIRException, IOException {
@Test
void testTutorialStep2Json() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step2/map/step2.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -401,7 +382,6 @@ void testTutorialStep2Json() throws FHIRException, IOException {
@Test
void testTutorialStep3aXml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step3/map/step3a.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -423,7 +403,6 @@ void testTutorialStep3aXml() throws FHIRException, IOException {
@Test
void testTutorialStep3aJson() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step3/map/step3a.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -447,7 +426,6 @@ void testTutorialStep3aJson() throws FHIRException, IOException {
@Test
void testTutorialStep3bXml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step3/map/step3b.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -469,7 +447,6 @@ void testTutorialStep3bXml() throws FHIRException, IOException {
@Test
void testTutorialStep3bJson() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step3/map/step3b.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -494,7 +471,6 @@ void testTutorialStep3bJson() throws FHIRException, IOException {
@Test
void testTutorialStep3cXml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step3/map/step3c.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -521,7 +497,6 @@ void testTutorialStep3cXml() throws FHIRException, IOException {
@Test
void testTutorialStep3cJson() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step3/map/step3c.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -550,7 +525,6 @@ void testTutorialStep3cJson() throws FHIRException, IOException {
@Test
void testTutorialStep4aXml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step4/map/step4a.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -574,7 +548,6 @@ void testTutorialStep4aXml() throws FHIRException, IOException {
@Test
void testTutorialStep4aJson() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step4/map/step4a.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -601,7 +574,6 @@ void testTutorialStep4aJson() throws FHIRException, IOException {
@Test
void testTutorialStep4b2Xml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step4/map/step4b2.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -623,7 +595,6 @@ void testTutorialStep4b2Xml() throws FHIRException, IOException {
@Test
void testTutorialStep4b2Json() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step4/map/step4b2.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -647,7 +618,6 @@ void testTutorialStep4b2Json() throws FHIRException, IOException {
@Test
void testTutorialStep4b3Xml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step4/map/step4b3.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -669,7 +639,6 @@ void testTutorialStep4b3Xml() throws FHIRException, IOException {
@Test
void testTutorialStep4b3Json() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step4/map/step4b3.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -693,7 +662,6 @@ void testTutorialStep4b3Json() throws FHIRException, IOException {
@Test
void testTutorialStep4cXml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step4/map/step4c.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -715,7 +683,6 @@ void testTutorialStep4cXml() throws FHIRException, IOException {
@Test
void testTutorialStep4cJson() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step4/map/step4c.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -739,7 +706,6 @@ void testTutorialStep4cJson() throws FHIRException, IOException {
@Test
void testTutorialStep5Xml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step5/map/step5.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -761,7 +727,6 @@ void testTutorialStep5Xml() throws FHIRException, IOException {
@Test
void testTutorialStep5Json() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step5/map/step5.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -785,7 +750,6 @@ void testTutorialStep5Json() throws FHIRException, IOException {
@Test
void testTutorialStep6aXml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step6/map/step6a.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -807,7 +771,6 @@ void testTutorialStep6aXml() throws FHIRException, IOException {
@Test
void testTutorialStep6aJson() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step6/map/step6a.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -831,7 +794,6 @@ void testTutorialStep6aJson() throws FHIRException, IOException {
@Test
void testTutorialStep6bXml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step6/map/step6b.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -851,12 +813,11 @@ void testTutorialStep6bXml() throws FHIRException, IOException {
assertTrue(false, "API-0389: Failed to call access method: org.hl7.fhir.exceptions.FHIRException: Rule "rule_a23b": Check condition failed: the collection has more than one item");
}
catch (FHIRException e) {
- }
+ }
}
@Test
void testTutorialStep6bJson() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step6/map/step6b.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -878,12 +839,11 @@ void testTutorialStep6bJson() throws FHIRException, IOException {
assertTrue(false, "API-0389: Failed to call access method: org.hl7.fhir.exceptions.FHIRException: Rule "rule_a23b": Check condition failed: the collection has more than one item");
}
catch (FHIRException e) {
- }
+ }
}
@Test
void testTutorialStep6cXml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step6/map/step6c.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -905,7 +865,6 @@ void testTutorialStep6cXml() throws FHIRException, IOException {
@Test
void testTutorialStep6cJson() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step6/map/step6c.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -929,7 +888,6 @@ void testTutorialStep6cJson() throws FHIRException, IOException {
@Test
void testTutorialStep6dXml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step6/map/step6d.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -951,7 +909,6 @@ void testTutorialStep6dXml() throws FHIRException, IOException {
@Test
void testTutorialStep6dJson() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step6/map/step6d.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -975,7 +932,6 @@ void testTutorialStep6dJson() throws FHIRException, IOException {
@Test
void testTutorialStep7Xml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step7/map/step7.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1002,7 +958,6 @@ void testTutorialStep7Xml() throws FHIRException, IOException {
@Test
void testTutorialStep7Json() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step7/map/step7.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1029,7 +984,6 @@ void testTutorialStep7Json() throws FHIRException, IOException {
@Test
void testTutorialStep8Xml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step8/map/step8.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1046,7 +1000,6 @@ void testTutorialStep8Xml() throws FHIRException, IOException {
@Test
void testTutorialStep8Json() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step8/map/step8.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1065,7 +1018,6 @@ void testTutorialStep8Json() throws FHIRException, IOException {
@Test
void testTutorialStep9Xml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step9/map/step9.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1087,7 +1039,6 @@ void testTutorialStep9Xml() throws FHIRException, IOException {
@Test
void testTutorialStep9Json() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step9/map/step9.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1111,7 +1062,6 @@ void testTutorialStep9Json() throws FHIRException, IOException {
@Test
void testTutorialStep10Xml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step10/map/step10.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1132,7 +1082,6 @@ void testTutorialStep10Xml() throws FHIRException, IOException {
@Test
void testTutorialStep10Json() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step10/map/step10.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1157,7 +1106,6 @@ void testTutorialStep10Json() throws FHIRException, IOException {
@Test
void testTutorialStep11Xml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step11/map/step11.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1174,7 +1122,6 @@ void testTutorialStep11Xml() throws FHIRException, IOException {
@Test
void testTutorialStep11Json() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step11/map/step11.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1193,7 +1140,6 @@ void testTutorialStep11Json() throws FHIRException, IOException {
@Test
void testTutorialStep12Xml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step12/map/step12.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1210,7 +1156,6 @@ void testTutorialStep12Xml() throws FHIRException, IOException {
@Test
void testTutorialStep12Json() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step12/map/step12.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1229,7 +1174,6 @@ void testTutorialStep12Json() throws FHIRException, IOException {
@Test
void testTutorialStep13Xml() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step13/map/step13.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1246,7 +1190,6 @@ void testTutorialStep13Xml() throws FHIRException, IOException {
@Test
void testTutorialStep13Json() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/tutorial/step13/map/step13.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1275,22 +1218,22 @@ void testBundleJson() throws FHIRException, IOException {
if (i>0) {
bundleBuilder.append(",");
}
- bundleBuilder.append(" {\n" +
- " \"resource\": {\n" +
- " \"resourceType\": \"Observation\",\n" +
- " \"id\": \""+i+"\"\n" +
- " \"component\": [\n" +
- " {\n" +
- " \"code\": {\n" +
- " \"coding\": [\n" +
- " {\n" +
- " \"system\": \"http://loinc.org\",\n" +
- " \"code\": \"8480-6\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"valueQuantity\": {\n" +
- " \"value\": " +i +"\n" +
+ bundleBuilder.append(" {\n" +
+ " \"resource\": {\n" +
+ " \"resourceType\": \"Observation\",\n" +
+ " \"id\": \""+i+"\"\n" +
+ " \"component\": [\n" +
+ " {\n" +
+ " \"code\": {\n" +
+ " \"coding\": [\n" +
+ " {\n" +
+ " \"system\": \"http://loinc.org\",\n" +
+ " \"code\": \"8480-6\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " \"valueQuantity\": {\n" +
+ " \"value\": " +i +"\n" +
" }\n" + //
" },\n" + //
" {\n" + //
@@ -1311,7 +1254,7 @@ void testBundleJson() throws FHIRException, IOException {
" }");
}
bundleBuilder.append("]\n}");
- String bundle = bundleBuilder.toString();
+ String bundle = bundleBuilder.toString();
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/bundleobs.map"));
assertTrue(sm != null);
@@ -1323,10 +1266,9 @@ void testBundleJson() throws FHIRException, IOException {
CompareUtil.logMemory();
}
-
+
@Test
void testBundleResolveJson() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/bundle-resolve.map"));
assertTrue(sm != null);
engine.addCanonicalResource(sm);
@@ -1340,7 +1282,6 @@ void testBundleResolveJson() throws FHIRException, IOException {
@Test
void testParseFailWithError() throws FHIRException, IOException {
- MatchboxEngine engine = new MatchboxEngine(FhirMappingLanguageTests.engine);
try {
StructureMap sm = engine.parseMap(getFileAsStringFromResources("/map-with-error.map"));
assertTrue(sm == null);
diff --git a/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/FhirXVersTests.java b/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/FhirXVersTests.java
index afa2ad1748..3ddcdcd3b8 100644
--- a/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/FhirXVersTests.java
+++ b/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/FhirXVersTests.java
@@ -29,15 +29,13 @@
import org.apache.commons.io.IOUtils;
import org.hl7.fhir.exceptions.FHIRException;
-import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.r5.context.SimpleWorkerContext;
import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import ch.ahdis.matchbox.engine.MatchboxEngine;
import ch.ahdis.matchbox.engine.MatchboxEngine.MatchboxEngineBuilder;
+import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
/**
@@ -45,15 +43,14 @@
* Uses more then 4GB on the ci-build
*/
@DisabledIfEnvironmentVariable(named = "GITHUB_ACTIONS", matches = "true")
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class FhirXVersTests {
+ private final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(FhirXVersTests.class);
-// static private MatchboxEngine engineR4B;
- static private MatchboxEngine engineR4, engineR5;
+ private final MatchboxEngine engineR4, engineR5;
- private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(FhirMappingLanguageTests.class);
- @BeforeAll
- static void setUpBeforeClass() throws Exception {
+ public FhirXVersTests() throws Exception {
log.info("Setup");
CompareUtil.logMemory();
engineR4 = new MatchboxEngineBuilder().withXVersion(true).getEngineR4();
@@ -75,34 +72,20 @@ static void setUpBeforeClass() throws Exception {
@AfterAll
static void teardownClass() throws Exception {
- engineR4 = null;
- engineR5 = null;
-// engineR4B = null;
- log.info("Teardown");
CompareUtil.logMemory();
}
- @BeforeEach
- void setUp() throws Exception {
- }
-
public String getFileAsStringFromResources(String file) throws IOException {
InputStream in = FhirXVersTests.class.getResourceAsStream("/xvers" + file);
return IOUtils.toString(in, StandardCharsets.UTF_8);
}
- public StructureDefinition getStructureDefinitionFromFile(String file) throws IOException {
- return (StructureDefinition) new org.hl7.fhir.r4.formats.XmlParser()
- .parse(FhirMappingLanguageTests.class.getResourceAsStream(file));
- }
-
@Test
void testMedication5to4inR4() throws FHIRException, IOException {
log.info("testMedication5to4inR4");
- MatchboxEngine engine = FhirXVersTests.engineR4;
- assertEquals("4.0.1", engine.getVersion());
- assertEquals("4.0.1", engine.getContext().getVersion());
- SimpleWorkerContext context = engine.getContext();
+ assertEquals("4.0.1", engineR4.getVersion());
+ assertEquals("4.0.1", engineR4.getContext().getVersion());
+ SimpleWorkerContext context = engineR4.getContext();
assertNotNull(context.fetchResource(org.hl7.fhir.r5.model.Resource.class,
"http://hl7.org/fhir/StructureDefinition/Patient"));
assertNotNull(context.fetchResource(org.hl7.fhir.r5.model.Resource.class,
@@ -110,7 +93,7 @@ void testMedication5to4inR4() throws FHIRException, IOException {
assertNotNull(context.fetchResource(org.hl7.fhir.r5.model.Resource.class,
"http://hl7.org/fhir/uv/xver/StructureMap/Medication4to5"));
- String result = engine.transform(getFileAsStringFromResources("/medication-r5-med0301.json"), true,
+ String result = engineR4.transform(getFileAsStringFromResources("/medication-r5-med0301.json"), true,
"http://hl7.org/fhir/uv/xver/StructureMap/Medication5to4", true);
log.info(result);
CompareUtil.compare(getFileAsStringFromResources("/medication-r4-med0301.json"), result, false);
@@ -145,16 +128,15 @@ void testMedication5to4inR4() throws FHIRException, IOException {
@Test
void testMedication5to4inR5() throws FHIRException, IOException {
log.info("testMedication5to4inR5");
- MatchboxEngine engine = FhirXVersTests.engineR5;
- SimpleWorkerContext context = engine.getContext();
+ SimpleWorkerContext context = engineR5.getContext();
log.info("finished TestEngineR5");
- assertEquals("5.0.0", engine.getVersion());
- assertEquals("5.0.0", engine.getContext().getVersion());
+ assertEquals("5.0.0", engineR5.getVersion());
+ assertEquals("5.0.0", engineR5.getContext().getVersion());
assertNotNull(context.fetchResource(org.hl7.fhir.r5.model.Resource.class,
"http://hl7.org/fhir/StructureDefinition/Patient"));
assertNotNull(context.fetchResource(org.hl7.fhir.r5.model.Resource.class,
"http://hl7.org/fhir/uv/xver/StructureMap/Medication5to4"));
- String result = engine.transform(getFileAsStringFromResources("/medication-r5-med0301.json"), true,
+ String result = engineR5.transform(getFileAsStringFromResources("/medication-r5-med0301.json"), true,
"http://hl7.org/fhir/uv/xver/StructureMap/Medication5to4", true);
log.info(result);
CompareUtil.compare(getFileAsStringFromResources("/medication-r4-med0301.json"), result, false);
@@ -175,8 +157,7 @@ void testMedication5to4inR5() throws FHIRException, IOException {
@Test
void testMedication4to5inR4() throws FHIRException, IOException {
log.info("testMedication4to5inR4");
- MatchboxEngine engine = FhirXVersTests.engineR4;
- String result = engine.transform(getFileAsStringFromResources("/medication-r4-med0301.json"), true,
+ String result = engineR4.transform(getFileAsStringFromResources("/medication-r4-med0301.json"), true,
"http://hl7.org/fhir/uv/xver/StructureMap/Medication4to5", true);
log.info(result);
CompareUtil.compare(getFileAsStringFromResources("/medication-r5-med0301.json"), result, false);
@@ -206,8 +187,7 @@ void testMedication4to5inR4() throws FHIRException, IOException {
@Test
void testMedication4to5inR5() throws FHIRException, IOException {
log.info("testMedication4to5inR5");
- MatchboxEngine engine = FhirXVersTests.engineR5;
- String result = engine.transform(getFileAsStringFromResources("/medication-r4-med0301.json"), true,
+ String result = engineR5.transform(getFileAsStringFromResources("/medication-r4-med0301.json"), true,
"http://hl7.org/fhir/uv/xver/StructureMap/Medication4to5", true);
log.info(result);
CompareUtil.compare(getFileAsStringFromResources("/medication-r5-med0301.json"), result, false);
diff --git a/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/R4ValidationTests.java b/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/R4ValidationTests.java
index ee69048800..acb85db5da 100644
--- a/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/R4ValidationTests.java
+++ b/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/R4ValidationTests.java
@@ -29,7 +29,7 @@
**/
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class R4ValidationTests {
- private static final Logger log = LoggerFactory.getLogger(R4ValidationTests.class);
+ private final Logger log = LoggerFactory.getLogger(R4ValidationTests.class);
private final MatchboxEngine engine;
private final String careplanRaw;
private final String measureRaw;
diff --git a/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/R5ValidationTests.java b/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/R5ValidationTests.java
index 3675dd630c..420de60d3e 100644
--- a/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/R5ValidationTests.java
+++ b/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/R5ValidationTests.java
@@ -12,7 +12,6 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.stream.Collectors;
@@ -26,12 +25,12 @@
**/
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class R5ValidationTests {
- private static final Logger log = LoggerFactory.getLogger(R5ValidationTests.class);
+ private final Logger log = LoggerFactory.getLogger(R5ValidationTests.class);
private final MatchboxEngine engine;
private final String careplanRaw;
private final String measureRaw;
- public R5ValidationTests() throws IOException, URISyntaxException {
+ public R5ValidationTests() throws IOException {
this.engine = this.getEngine();
//this.engine.setTerminologyServer("http://tx.fhir.org", null, FhirPublication.R4);
this.careplanRaw = this.loadSample("careplan.xml");
@@ -72,7 +71,7 @@ void testValueSetWithAllFromCodeSystem() throws Exception {
assertEquals(2, errors.size());
assertTrue(errors.get(0).getDetails().getText().startsWith("The value provided ('non-existent-code') was not found in the value set 'PublicationStatus'") || errors.get(1).getDetails().getText().startsWith("The value provided ('non-existent-code') was not found in the value set 'PublicationStatus'"));
}
-
+
/**
* Test the validation of a code from a value set that expands urn:ietf:bcp:13.
*
diff --git a/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/SuppressedWarnInfoTests.java b/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/SuppressedWarnInfoTests.java
index 7dc5b2f4b3..51c079742d 100644
--- a/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/SuppressedWarnInfoTests.java
+++ b/matchbox-engine/src/test/java/ch/ahdis/matchbox/engine/tests/SuppressedWarnInfoTests.java
@@ -22,8 +22,8 @@ class SuppressedWarnInfoTests {
private final MatchboxEngine engine;
private final byte[] resource;
- private final static String WARN1 = "A measure should contain at least one group";
- private final static String WARN_DOM6 = "Constraint failed: dom-6: 'A resource should have narrative for robust " +
+ private static final String WARN1 = "A measure should contain at least one group";
+ private static final String WARN_DOM6 = "Constraint failed: dom-6: 'A resource should have narrative for robust " +
"management' (defined in http://hl7.org/fhir/StructureDefinition/DomainResource) (Best Practice Recommendation)";
public SuppressedWarnInfoTests() throws IOException {
@@ -98,7 +98,6 @@ private MatchboxEngine getEngine() {
return new MatchboxEngine.MatchboxEngineBuilder().getEngineR4();
}
-
private String loadSample(final String filename) throws IOException {
return new String(
R4ValidationTests.class.getResourceAsStream("/r4-samples/" + filename).readAllBytes()
diff --git a/matchbox-server/src/test/java/ch/ahdis/matchbox/TestTags.java b/matchbox-server/src/test/java/ch/ahdis/matchbox/TestTags.java
new file mode 100644
index 0000000000..8ccd7c4b67
--- /dev/null
+++ b/matchbox-server/src/test/java/ch/ahdis/matchbox/TestTags.java
@@ -0,0 +1,11 @@
+package ch.ahdis.matchbox;
+
+/**
+ * Some tags to split our tests into logical and moderately sized groups.
+ **/
+public class TestTags {
+ public static final String CORE = "core";
+ public static final String VALIDATION = "validation";
+ public static final String GAZELLE = "gazelle";
+ public static final String MAPPING = "mapping";
+}
diff --git a/matchbox-server/src/test/java/ch/ahdis/matchbox/gazelle/GazelleApiR4Test.java b/matchbox-server/src/test/java/ch/ahdis/matchbox/gazelle/GazelleApiR4Test.java
index 7b68dcc6a6..091c05fbb6 100644
--- a/matchbox-server/src/test/java/ch/ahdis/matchbox/gazelle/GazelleApiR4Test.java
+++ b/matchbox-server/src/test/java/ch/ahdis/matchbox/gazelle/GazelleApiR4Test.java
@@ -1,11 +1,13 @@
package ch.ahdis.matchbox.gazelle;
import ca.uhn.fhir.jpa.starter.Application;
+import ch.ahdis.matchbox.TestTags;
import ch.ahdis.matchbox.validation.gazelle.models.validation.SeverityLevel;
import ch.ahdis.matchbox.validation.gazelle.models.validation.ValidationReport;
import ch.ahdis.matchbox.validation.gazelle.models.validation.ValidationTestResult;
import ch.ahdis.matchbox.test.CompareUtil;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.springframework.boot.test.context.SpringBootTest;
@@ -23,9 +25,10 @@
**/
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@ContextConfiguration(classes = { Application.class })
-@ActiveProfiles("test-r4")
+@ActiveProfiles({"test-r4", "disable-metrics"})
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
+@Tag(TestTags.GAZELLE)
public class GazelleApiR4Test extends AbstractGazelleTest {
private final GazelleClient client = new GazelleClient("http://localhost:8081/matchboxv3/gazelle/");
diff --git a/matchbox-server/src/test/java/ch/ahdis/matchbox/mapping/TransformTest.java b/matchbox-server/src/test/java/ch/ahdis/matchbox/mapping/TransformTest.java
index 26daec481d..71e2342a0c 100644
--- a/matchbox-server/src/test/java/ch/ahdis/matchbox/mapping/TransformTest.java
+++ b/matchbox-server/src/test/java/ch/ahdis/matchbox/mapping/TransformTest.java
@@ -1,12 +1,13 @@
package ch.ahdis.matchbox.mapping;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.jpa.starter.Application;
+import ch.ahdis.matchbox.TestTags;
import ch.ahdis.matchbox.test.CompareUtil;
import ch.ahdis.matchbox.test.ValidationClient;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.springframework.boot.test.context.SpringBootTest;
@@ -34,9 +35,10 @@
**/
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@ContextConfiguration(classes = {Application.class})
-@ActiveProfiles("test-transform")
+@ActiveProfiles({"test-transform", "disable-metrics"})
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
+@Tag(TestTags.MAPPING)
public class TransformTest {
private static final String TARGET_SERVER = "http://localhost:8086/matchboxv3";
private static final FhirContext FHIR_CONTEXT = FhirContext.forR4Cached();
@@ -94,7 +96,7 @@ void testTransformUtf8() throws Exception {
assertTrue(docRef.contains(""));
assertTrue(docRef.contains(""));
}
-
+
@Test
void testTransformEncounterR4() throws Exception {
// Test the regular $transform operation with an R4 resource
diff --git a/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR4BTest.java b/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR4BTest.java
index 35635f2517..50cd2d1331 100644
--- a/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR4BTest.java
+++ b/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR4BTest.java
@@ -2,16 +2,17 @@
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.jpa.starter.Application;
+import ch.ahdis.matchbox.TestTags;
import org.apache.commons.io.FileUtils;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.r4b.model.OperationOutcome;
import org.hl7.fhir.r4b.model.OperationOutcome.IssueSeverity;
import org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.springframework.boot.test.context.SpringBootTest;
@@ -35,12 +36,12 @@
"hapi.fhir.implementationguides.fhir_terminology.name=",
"hapi.fhir.implementationguides.fhir_extensions.name="}) // Unset R4 IGs
@ContextConfiguration(classes = {Application.class})
-@ActiveProfiles("test-r4b")
+@ActiveProfiles({"test-r4b", "disable-metrics"})
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public class MatchboxApiR4BTest {
- static public int getValidationFailures(OperationOutcome outcome) {
+ static int getValidationFailures(OperationOutcome outcome) {
int fails = 0;
if (outcome != null && outcome.getIssue() != null) {
for (OperationOutcomeIssueComponent issue : outcome.getIssue()) {
@@ -60,7 +61,7 @@ static public int getValidationFailures(OperationOutcome outcome) {
private String targetServer = "http://localhost:8083/matchboxv3/fhir";
private final FhirContext context = FhirContext.forR4BCached();
-
+
@BeforeAll
void waitUntilStartup() throws Exception {
Thread.sleep(10000); // give the server some time to start up
@@ -129,7 +130,8 @@ public String getTxServer(FhirContext ctx, IBaseOperationOutcome outcome) {
}
@Test
- public void validatePatientRawR4B() {
+ @Tag(TestTags.VALIDATION)
+ void validatePatientRawR4B() {
ValidationClient validationClient = new ValidationClient(this.context, this.targetServer);
String patient = "\n" + " \n"
@@ -152,7 +154,8 @@ public void validatePatientRawR4B() {
}
@Test
- public void verifyCachingImplementationGuides() {
+ @Tag(TestTags.CORE)
+ void verifyCachingImplementationGuides() {
ValidationClient validationClient = new ValidationClient(this.context, this.targetServer);
String resource = "\n" + //
@@ -178,8 +181,9 @@ public void verifyCachingImplementationGuides() {
}
@Test
+ @Tag(TestTags.VALIDATION)
// https://gazelle.ihe.net/jira/browse/EHS-431
- public void validateEhs431() throws IOException {
+ void validateEhs431() throws IOException {
//
ValidationClient validationClient = new ValidationClient(this.context, this.targetServer);
@@ -195,8 +199,9 @@ public void validateEhs431() throws IOException {
}
@Test
+ @Tag(TestTags.VALIDATION)
// https://gazelle.ihe.net/jira/browse/EHS-419
- public void validateEhs419() throws IOException {
+ void validateEhs419() throws IOException {
//
ValidationClient validationClient = new ValidationClient(this.context, this.targetServer);
diff --git a/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR4Test.java b/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR4Test.java
index 82378a0b37..e170902434 100644
--- a/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR4Test.java
+++ b/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR4Test.java
@@ -4,6 +4,7 @@
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.jpa.starter.Application;
+import ch.ahdis.matchbox.TestTags;
import ch.ahdis.matchbox.validation.gazelle.models.validation.ValidationItem;
import ch.ahdis.matchbox.validation.gazelle.models.validation.ValidationReport;
import ch.ahdis.matchbox.validation.gazelle.models.validation.ValidationRequest;
@@ -14,10 +15,7 @@
import org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity;
import org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent;
import org.hl7.fhir.r4.model.Parameters;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.*;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.core.io.ClassPathResource;
@@ -40,10 +38,10 @@
@SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
@ContextConfiguration(classes = {Application.class})
-@ActiveProfiles("test-r4")
+@ActiveProfiles({"test-r4", "disable-metrics"})
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
-class MatchboxApiR4Test {
+public class MatchboxApiR4Test {
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(MatchboxApiR4Test.class);
private static final String TARGET_SERVER = "http://localhost:8081/matchboxv3";
private static final FhirContext FHIR_CONTEXT = FhirContext.forR4Cached();
@@ -60,6 +58,7 @@ void waitUntilStartup() throws Exception {
}
@Test
+ @Tag(TestTags.VALIDATION)
void validatePatientRawR4() {
String patient = """
@@ -85,6 +84,7 @@ void validatePatientRawR4() {
}
@Test
+ @Tag(TestTags.CORE)
void verifyCachingImplementationGuides() {
String resource = """
@@ -143,6 +143,7 @@ void verifyCachingImplementationGuides() {
}
@Test
+ @Tag(TestTags.CORE)
void verifyIgVersioning() {
String resource = """
@@ -192,6 +193,7 @@ void verifyIgVersioning() {
}
@Test
+ @Tag(TestTags.GAZELLE)
void verifyIgVersioningGazelle() throws Exception {
String resource = """
@@ -233,6 +235,7 @@ void verifyIgVersioningGazelle() throws Exception {
@Test
+ @Tag(TestTags.VALIDATION)
// https://gazelle.ihe.net/jira/browse/EHS-431
void validateEhs431() throws IOException {
// IBaseOperationOutcome operationOutcome =
@@ -245,6 +248,7 @@ void validateEhs431() throws IOException {
}
@Test
+ @Tag(TestTags.GAZELLE)
void validateEhs431Gazelle() throws Exception {
ValidationReport report = this.validateWithGazelle(getContent("ehs-431.json"),
profileCore("Bundle"));
@@ -252,6 +256,7 @@ void validateEhs431Gazelle() throws Exception {
}
@Test
+ @Tag(TestTags.VALIDATION)
// https://gazelle.ihe.net/jira/browse/EHS-419
void validateEhs419() throws IOException {
IBaseOperationOutcome operationOutcome = validationClient.validate(getContent("ehs-419.json"),
@@ -261,6 +266,7 @@ void validateEhs419() throws IOException {
}
@Test
+ @Tag(TestTags.VALIDATION)
void validateIgnoreError() {
String patient = "\r\n" + //
@@ -287,6 +293,7 @@ void validateIgnoreError() {
}
@Test
+ @Tag(TestTags.VALIDATION)
void validateIgnoreErrorMatchboxTest() throws Exception {
String practitioner = "\n" + //
" \n" + //
@@ -303,7 +310,7 @@ void validateIgnoreErrorMatchboxTest() throws Exception {
" \n" + //
" \n" + //
"";
-
+
IBaseOperationOutcome operationOutcome = this.validationClient.validate(practitioner,"http://matchbox.health/ig/test/r4/StructureDefinition/practitioner-identifier-required");
assertEquals(0, getValidationFailures((OperationOutcome) operationOutcome));
@@ -312,6 +319,7 @@ void validateIgnoreErrorMatchboxTest() throws Exception {
}
@Test
+ @Tag(TestTags.GAZELLE)
void validateEhs419Gazelle() throws Exception {
ValidationReport report = this.validateWithGazelle(getContent("ehs-419.json"),
"http://hl7.org/fhir/StructureDefinition/Patient");
@@ -319,6 +327,7 @@ void validateEhs419Gazelle() throws Exception {
}
@Test
+ @Tag(TestTags.VALIDATION)
void validateXVersionSlicingExtensions() throws Exception {
String encounter = "\n" + //
@@ -345,13 +354,14 @@ void validateXVersionSlicingExtensions() throws Exception {
" \n" + //
" \n" + //
"";
-
+
IBaseOperationOutcome operationOutcome = this.validationClient.validate(encounter,
"http://matchbox.health/ig/test/r4/StructureDefinition/encounter-ext-r5");
assertEquals(0, getValidationFailures((OperationOutcome) operationOutcome));
}
@Test
+ @Tag(TestTags.VALIDATION)
@Disabled("For some reason, the validation engine does not fail on unknown extensions with the default configuration, needs further investigation")
void validateUnknownExtensionIsRejectedByDefault() throws Exception {
final var patient = getContent("patient-dicom.json");
@@ -360,6 +370,7 @@ void validateUnknownExtensionIsRejectedByDefault() throws Exception {
}
@Test
+ @Tag(TestTags.VALIDATION)
void validateUnknownExtensionIsAcceptedWithAny() throws Exception {
final var patient = getContent("patient-dicom.json");
final var parameters = new Parameters();
@@ -370,6 +381,7 @@ void validateUnknownExtensionIsAcceptedWithAny() throws Exception {
}
@Test
+ @Tag(TestTags.VALIDATION)
void validateUnknownExtensionIsAcceptedWithValidDomain() throws Exception {
final var patient = getContent("patient-dicom.json");
final var parameters = new Parameters();
@@ -380,6 +392,7 @@ void validateUnknownExtensionIsAcceptedWithValidDomain() throws Exception {
}
@Test
+ @Tag(TestTags.VALIDATION)
@Disabled("For some reason, the validation engine does not fail on unknown extensions with the default configuration, needs further investigation")
void validateUnknownExtensionIsRejectedWithWrongDomain() throws Exception {
final var patient = getContent("patient-dicom.json");
diff --git a/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR5Test.java b/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR5Test.java
index b240e6709b..1c5e99884a 100644
--- a/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR5Test.java
+++ b/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR5Test.java
@@ -2,16 +2,17 @@
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.jpa.starter.Application;
+import ch.ahdis.matchbox.TestTags;
import org.apache.commons.io.FileUtils;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.r5.model.OperationOutcome;
import org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity;
import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.springframework.boot.test.context.SpringBootTest;
@@ -25,11 +26,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.List;
-import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -39,12 +36,12 @@
"hapi.fhir.implementationguides.fhir_terminology.name=",
"hapi.fhir.implementationguides.fhir_extensions.name="}) // Unset R4 IGs
@ContextConfiguration(classes = {Application.class})
-@ActiveProfiles("test-r5")
+@ActiveProfiles({"test-r5", "disable-metrics"})
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public class MatchboxApiR5Test {
- static public int getValidationFailures(OperationOutcome outcome) {
+ static int getValidationFailures(OperationOutcome outcome) {
int fails = 0;
if (outcome != null && outcome.getIssue() != null) {
for (OperationOutcomeIssueComponent issue : outcome.getIssue()) {
@@ -133,7 +130,8 @@ public String getTxServer(FhirContext ctx, IBaseOperationOutcome outcome) {
}
@Test
- public void validatePatientRawR5() {
+ @Tag(TestTags.VALIDATION)
+ void validatePatientRawR5() {
ValidationClient validationClient = new ValidationClient(this.context, this.targetServer);
String patient = "\n" + " \n"
@@ -156,7 +154,8 @@ public void validatePatientRawR5() {
}
@Test
- public void verifyCachingImplementationGuides() {
+ @Tag(TestTags.CORE)
+ void verifyCachingImplementationGuides() {
ValidationClient validationClient = new ValidationClient(this.context, this.targetServer);
String resource = "\n" + //
@@ -182,8 +181,9 @@ public void verifyCachingImplementationGuides() {
}
@Test
+ @Tag(TestTags.VALIDATION)
// https://gazelle.ihe.net/jira/browse/EHS-431
- public void validateEhs431() throws IOException {
+ void validateEhs431() throws IOException {
//
ValidationClient validationClient = new ValidationClient(this.context, this.targetServer);
@@ -199,8 +199,9 @@ public void validateEhs431() throws IOException {
}
@Test
+ @Tag(TestTags.VALIDATION)
// https://gazelle.ihe.net/jira/browse/EHS-419
- public void validateEhs419() throws IOException {
+ void validateEhs419() throws IOException {
//
ValidationClient validationClient = new ValidationClient(this.context, this.targetServer);
diff --git a/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR5onR4Test.java b/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR5onR4Test.java
index 8a2990c6d9..4cf4f5747d 100644
--- a/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR5onR4Test.java
+++ b/matchbox-server/src/test/java/ch/ahdis/matchbox/test/MatchboxApiR5onR4Test.java
@@ -5,12 +5,14 @@
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.jpa.starter.Application;
+import ch.ahdis.matchbox.TestTags;
import org.apache.commons.io.FileUtils;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.r4.model.OperationOutcome;
import org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity;
import org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.springframework.boot.test.context.SpringBootTest;
@@ -30,12 +32,12 @@
@SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
@ContextConfiguration(classes = { Application.class })
-@ActiveProfiles("test-r5onr4")
+@ActiveProfiles({"test-r5onr4", "disable-metrics"})
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public class MatchboxApiR5onR4Test {
- static public int getValidationFailures(OperationOutcome outcome) {
+ static int getValidationFailures(OperationOutcome outcome) {
int fails = 0;
if (outcome != null && outcome.getIssue() != null) {
for (OperationOutcomeIssueComponent issue : outcome.getIssue()) {
@@ -124,7 +126,8 @@ public String getTxServer(FhirContext ctx, IBaseOperationOutcome outcome) {
}
@Test
- public void validatePatientRawR5() {
+ @Tag(TestTags.VALIDATION)
+ void validatePatientRawR5() {
ValidationClient validationClient = new ValidationClient(this.context, this.targetServer);
String patient = "\n" + " \n"
@@ -147,7 +150,8 @@ public void validatePatientRawR5() {
}
@Test
- public void verifyCachingImplementationGuides() {
+ @Tag(TestTags.CORE)
+ void verifyCachingImplementationGuides() {
ValidationClient validationClient = new ValidationClient(this.context, this.targetServer);
String resource = "\n" + //
@@ -173,8 +177,9 @@ public void verifyCachingImplementationGuides() {
}
@Test
+ @Tag(TestTags.VALIDATION)
// https://gazelle.ihe.net/jira/browse/EHS-431
- public void validateEhs431() throws IOException {
+ void validateEhs431() throws IOException {
//
ValidationClient validationClient = new ValidationClient(this.context, this.targetServer);
@@ -190,8 +195,9 @@ public void validateEhs431() throws IOException {
}
@Test
+ @Tag(TestTags.VALIDATION)
// https://gazelle.ihe.net/jira/browse/EHS-419
- public void validateEhs419() throws IOException {
+ void validateEhs419() throws IOException {
//
ValidationClient validationClient = new ValidationClient(this.context, this.targetServer);
diff --git a/matchbox-server/src/test/resources/application-disable-metrics.yaml b/matchbox-server/src/test/resources/application-disable-metrics.yaml
new file mode 100644
index 0000000000..83accb208e
--- /dev/null
+++ b/matchbox-server/src/test/resources/application-disable-metrics.yaml
@@ -0,0 +1,40 @@
+# Common configuration of all test Spring profiles.
+
+## Disable all metrics and the metrics endpoint
+management:
+ metrics:
+ enable:
+ all: false
+ endpoint:
+ metrics:
+ enabled: false
+ prometheus:
+ enabled: false
+ endpoints:
+ web:
+ exposure:
+ exclude: "*"
+ jmx:
+ exposure:
+ exclude: "*"
+ prometheus:
+ metrics:
+ export:
+ enabled: false
+hapi:
+ fhir:
+ openapi_enabled: false
+ lastn_enabled: false
+ subscription:
+ resthook_enabled: false
+ search-coord-core-pool-size: 1
+ search-coord-max-pool-size: 1
+ search-coord-queue-capacity: 1
+ advanced_lucene_indexing: false
+ search_index_full_text_enabled: false
+
+spring:
+ ai:
+ mcp:
+ server:
+ enabled: false