From b5539db6068d1de633a434310056ab8f348b3afd Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Wed, 26 Jun 2024 18:09:46 +1000 Subject: [PATCH] try fixing narrative generation tests --- .../org/hl7/fhir/r5/test/CDARoundTripTests.java | 2 +- .../java/org/hl7/fhir/r5/test/FHIRPathTests.java | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/CDARoundTripTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/CDARoundTripTests.java index 726271ade..555a21bc5 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/CDARoundTripTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/CDARoundTripTests.java @@ -26,7 +26,7 @@ public class CDARoundTripTests { @BeforeAll public static void setUp() throws Exception { FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager.Builder().build(); - context = TestingUtilities.getWorkerContext(pcm.loadPackage("hl7.fhir.r4.core", "4.0.1")); + context = new SimpleWorkerContext(TestingUtilities.getWorkerContext(pcm.loadPackage("hl7.fhir.r4.core", "4.0.1"))); fp = new FHIRPathEngine(context); NpmPackage npm = new FilesystemPackageCacheManager.Builder().build().loadPackage("hl7.cda.uv.core", "current"); diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRPathTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRPathTests.java index 0cdf20a34..0bb10fd9d 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRPathTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRPathTests.java @@ -11,6 +11,7 @@ import org.apache.commons.lang3.NotImplementedException; import org.fhir.ucum.UcumException; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.PathEngineException; +import org.hl7.fhir.r5.context.SimpleWorkerContext; import org.hl7.fhir.r5.elementmodel.Manager; import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat; import org.hl7.fhir.r5.fhirpath.ExpressionNode; @@ -95,7 +96,7 @@ public class FHIRPathTests { @Override public ValueSet resolveValueSet(FHIRPathEngine engine, Object appContext, String url) { - return TestingUtilities.getSharedWorkerContext().fetchResource(ValueSet.class, url); + return context.fetchResource(ValueSet.class, url); } @Override @@ -106,18 +107,20 @@ public class FHIRPathTests { private static FHIRPathEngine fp; private final Map resources = new HashMap(); + private static SimpleWorkerContext context; @BeforeAll public static void setUp() throws FileNotFoundException, FHIRException, IOException { - if (!TestingUtilities.getSharedWorkerContext().hasPackage("hl7.cda.us.ccda", null)) { + context = new SimpleWorkerContext((SimpleWorkerContext) TestingUtilities.getSharedWorkerContext()); + if (!context.hasPackage("hl7.cda.us.ccda", null)) { FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager.Builder().build(); NpmPackage npm = pcm.loadPackage("hl7.cda.uv.core", "2.0.0"); - TestingUtilities.getSharedWorkerContext().loadFromPackage(npm, null); + context.loadFromPackage(npm, null); npm = pcm.loadPackage("hl7.cda.us.ccda", "current"); - TestingUtilities.getSharedWorkerContext().loadFromPackage(npm, null); + context.loadFromPackage(npm, null); } if (fp == null) { - fp = new FHIRPathEngine(TestingUtilities.getSharedWorkerContext()); + fp = new FHIRPathEngine(context); } }