use of org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager in project org.hl7.fhir.core by hapifhir.
the class UTGVersionSorter method loadPackageR2.
private Map<String, CanonicalResource> loadPackageR2(String id) throws IOException {
Map<String, CanonicalResource> res = new HashMap<>();
if (pcm == null) {
pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
}
System.out.println("Load " + id);
NpmPackage npm = pcm.loadPackage(id);
for (PackageResourceInformation p : npm.listIndexedResources("CodeSystem", "ValueSet")) {
CanonicalResource r = (CanonicalResource) VersionConvertorFactory_10_50.convertResource(new org.hl7.fhir.dstu2.formats.JsonParser().parse(npm.load(p)));
res.put(r.getUrl(), r);
}
return res;
}
use of org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager in project org.hl7.fhir.core by hapifhir.
the class OIDBasedValueSetImporter method init.
protected void init() throws FHIRException, IOException {
FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
NpmPackage npm = pcm.loadPackage("hl7.fhir.r5.core", "current");
SimpleWorkerContext context = new SimpleWorkerContext.SimpleWorkerContextBuilder().withAllowLoadingDuplicates(true).fromPackage(npm);
context.loadFromPackage(pcm.loadPackage("hl7.terminology"), null);
this.context = context;
}
use of org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager in project org.hl7.fhir.core by hapifhir.
the class TestingUtilities method context.
public static IWorkerContext context() {
if (fcontext == null) {
FilesystemPackageCacheManager pcm;
try {
pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
fcontext = SimpleWorkerContext.fromPackage(pcm.loadPackage("hl7.fhir.r4.core", "4.0.1"));
fcontext.setUcumService(new UcumEssenceService(TestingUtilities.resourceNameToFile("ucum", "ucum-essence.xml")));
fcontext.setExpansionProfile(new Parameters());
} catch (Exception e) {
throw new Error(e);
}
}
return fcontext;
}
use of org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager in project org.hl7.fhir.core by hapifhir.
the class PackageCacheTests method testLastReleasedVersion.
@Test
public void testLastReleasedVersion() throws IOException {
FilesystemPackageCacheManager cache = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
cache.clear();
Assertions.assertEquals("0.0.8", cache.loadPackage(CommonPackages.ID_PUBPACK, "0.0.8").version());
Assertions.assertEquals(CommonPackages.VER_PUBPACK, cache.loadPackage(CommonPackages.ID_PUBPACK).version());
}
use of org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager in project org.hl7.fhir.core by hapifhir.
the class PackageCacheTests method testNotCaseSensitive.
@Test
public void testNotCaseSensitive() throws IOException {
FilesystemPackageCacheManager cache = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
cache.clear();
Assertions.assertEquals(cache.loadPackage("KBV.Basis", "1.1.3").version(), "1.1.3");
Assertions.assertEquals(cache.loadPackage("kbv.basis", "1.1.3").version(), "1.1.3");
}
Aggregations