From 9d1d64bb59bac5005ccdd45f13adc48c73712962 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 5 Aug 2019 15:48:07 +1000 Subject: [PATCH] more working on test suite --- .../validation/tests/ValidationTestSuite.java | 16 ++++++++++++++ pom.xml | 22 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java index 9aafeb57d..1e4fcb032 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java @@ -30,12 +30,14 @@ import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat; import org.hl7.fhir.r5.elementmodel.ObjectConverter; import org.hl7.fhir.r5.formats.XmlParser; import org.hl7.fhir.r5.model.Base; +import org.hl7.fhir.r5.model.CodeSystem; import org.hl7.fhir.r5.model.Constants; import org.hl7.fhir.r5.model.FhirPublication; import org.hl7.fhir.r5.model.Patient; import org.hl7.fhir.r5.model.Resource; import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.TypeDetails; +import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.test.utils.TestingUtilities; import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext; import org.hl7.fhir.r5.utils.IResourceValidator; @@ -140,6 +142,15 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour if (content.has("questionnaire")) { ve.getContext().cacheResource(loadResource(TestUtilities.resourceNameToFile("validation-examples", content.get("questionnaire").getAsString()), v)); } + if (content.has("codesystems")) { + for (JsonElement je : content.getAsJsonArray("codesystems")) { + String p = je.getAsString(); + System.out.println("CodeSystem: " + p); + String filename = TestUtilities.resourceNameToFile("validation-examples", p); + CodeSystem sd = (CodeSystem) loadResource(filename, v); + val.getContext().cacheResource(sd); + } + } if (content.has("profiles")) { for (JsonElement je : content.getAsJsonArray("profiles")) { String p = je.getAsString(); @@ -303,4 +314,9 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour throw new NotImplementedException("Not done yet (IGPublisherHostServices.conformsToProfile), when item is element"); } + @Override + public ValueSet resolveValueSet(Object appContext, String url) { + return ve.getContext().fetchResource(ValueSet.class, url); + } + } diff --git a/pom.xml b/pom.xml index 5c447f7c2..ab5142c9c 100644 --- a/pom.xml +++ b/pom.xml @@ -151,6 +151,28 @@ true + + + + *