use of org.hl7.fhir.utilities.npm.CachingPackageClient in project org.hl7.fhir.core by hapifhir.
the class CachingPackageClientTests method testSearchNoMatches.
@Test
public void testSearchNoMatches() throws IOException {
CachingPackageClient client = new CachingPackageClient(CachingPackageClientTests.SERVER1);
List<PackageInfo> matches = client.search("corezxxx", null, null, false);
Assertions.assertTrue(matches.size() == 0);
}
use of org.hl7.fhir.utilities.npm.CachingPackageClient in project org.hl7.fhir.core by hapifhir.
the class CachingPackageClientTests method testSearch2.
@Test
public void testSearch2() throws IOException {
CachingPackageClient client = new CachingPackageClient(CachingPackageClientTests.SERVER2);
List<PackageInfo> matches = client.search("core", null, null, false);
for (PackageInfo pi : matches) {
System.out.println(pi.toString());
}
Assertions.assertTrue(matches.size() > 0);
}
use of org.hl7.fhir.utilities.npm.CachingPackageClient in project org.hl7.fhir.core by hapifhir.
the class CachingPackageClientTests method testVersionsNone2.
@Test
public void testVersionsNone2() throws IOException {
CachingPackageClient client = new CachingPackageClient(CachingPackageClientTests.SERVER2);
List<PackageInfo> matches = client.getVersions("Simplifier.Core.STU3X");
Assertions.assertTrue(matches.size() == 0);
}
use of org.hl7.fhir.utilities.npm.CachingPackageClient in project org.hl7.fhir.core by hapifhir.
the class PackageValidator method execute.
private void execute() throws IOException {
FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
CachingPackageClient pc = new CachingPackageClient(PackageClient.PRIMARY_SERVER);
for (PackageInfo t : pc.search(null, null, null, false)) {
System.out.println("Check Package " + t.getId());
List<PackageInfo> vl = pc.getVersions(t.getId());
PackageInfo v = vl.get(vl.size() - 1);
System.out.println(" v" + v.getVersion());
try {
NpmPackage pi = pcm.loadPackage(v.getId(), v.getVersion());
if (VersionUtilities.isR4Ver(pi.fhirVersion()) || VersionUtilities.isR3Ver(pi.fhirVersion()) || VersionUtilities.isR2Ver(pi.fhirVersion())) {
for (String n : pi.list("package")) {
if (n.endsWith(".json") && !n.equals("ig-r4.json")) {
InputStream s = pi.load("package", n);
try {
parseResource(s, pi.fhirVersion());
} catch (Exception e) {
System.out.println(" error parsing " + n + " for " + pi.fhirVersion() + ": " + e.getMessage());
}
}
}
} else {
System.out.println(" Unsupported FHIR version " + pi.fhirVersion());
}
} catch (Exception e) {
System.out.println(" Error - no FHIR version");
}
}
}
use of org.hl7.fhir.utilities.npm.CachingPackageClient in project org.hl7.fhir.core by hapifhir.
the class CachingPackageClientTests method testVersionsNone.
@Test
public void testVersionsNone() throws IOException {
CachingPackageClient client = new CachingPackageClient(CachingPackageClientTests.SERVER1);
List<PackageInfo> matches = client.getVersions("Simplifier.Core.STU3X");
Assertions.assertTrue(matches.size() == 0);
}
Aggregations