Search in sources :

Example 1 with CachingPackageClient

use of org.hl7.fhir.utilities.npm.CachingPackageClient in project org.hl7.fhir.core by hapifhir.

the class CachingPackageClientTests method testRegistry.

@Test
public void testRegistry() throws IOException {
    CachingPackageClient client = new CachingPackageClient("http://packages.fhir.org/packages");
    List<PackageInfo> matches1 = client.listFromRegistry(null, null, null);
    List<PackageInfo> matches2 = client.listFromRegistry(null, null, "4.0.1");
    Assertions.assertTrue(matches1.size() > matches2.size());
}
Also used : PackageInfo(org.hl7.fhir.utilities.npm.PackageInfo) CachingPackageClient(org.hl7.fhir.utilities.npm.CachingPackageClient) Test(org.junit.jupiter.api.Test)

Example 2 with CachingPackageClient

use of org.hl7.fhir.utilities.npm.CachingPackageClient in project org.hl7.fhir.core by hapifhir.

the class CachingPackageClientTests method testVersions.

@Test
public void testVersions() throws IOException {
    CachingPackageClient client = new CachingPackageClient(CachingPackageClientTests.SERVER1);
    List<PackageInfo> matches = client.getVersions("Simplifier.Core.STU3");
    for (PackageInfo pi : matches) {
        System.out.println(pi.toString());
    }
    Assertions.assertTrue(matches.size() > 0);
}
Also used : PackageInfo(org.hl7.fhir.utilities.npm.PackageInfo) CachingPackageClient(org.hl7.fhir.utilities.npm.CachingPackageClient) Test(org.junit.jupiter.api.Test)

Example 3 with CachingPackageClient

use of org.hl7.fhir.utilities.npm.CachingPackageClient in project org.hl7.fhir.core by hapifhir.

the class CachingPackageClientTests method testExists.

// private static final String SERVER2 = "http://local.fhir.org:8080/packages";
@Test
public void testExists() throws IOException {
    CachingPackageClient client = new CachingPackageClient(CachingPackageClientTests.SERVER1);
    Assertions.assertTrue(client.exists("hl7.fhir.r4.core", "4.0.1"));
    Assertions.assertTrue(!client.exists("hl7.fhir.r4.core", "1.0.2"));
    Assertions.assertTrue(client.exists("HL7.fhir.r4.core", "4.0.1"));
    Assertions.assertTrue(!client.exists("hl7.fhir.nothing", "1.0.1"));
}
Also used : CachingPackageClient(org.hl7.fhir.utilities.npm.CachingPackageClient) Test(org.junit.jupiter.api.Test)

Example 4 with CachingPackageClient

use of org.hl7.fhir.utilities.npm.CachingPackageClient in project org.hl7.fhir.core by hapifhir.

the class CachingPackageClientTests method testSearchNoMatches2.

@Test
public void testSearchNoMatches2() throws IOException {
    CachingPackageClient client = new CachingPackageClient(CachingPackageClientTests.SERVER2);
    List<PackageInfo> matches = client.search("corezxxx", null, null, false);
    Assertions.assertTrue(matches.size() == 0);
}
Also used : PackageInfo(org.hl7.fhir.utilities.npm.PackageInfo) CachingPackageClient(org.hl7.fhir.utilities.npm.CachingPackageClient) Test(org.junit.jupiter.api.Test)

Example 5 with CachingPackageClient

use of org.hl7.fhir.utilities.npm.CachingPackageClient in project org.hl7.fhir.core by hapifhir.

the class CachingPackageClientTests method testExists2.

@Test
public void testExists2() throws IOException {
    CachingPackageClient client = new CachingPackageClient(CachingPackageClientTests.SERVER2);
    Assertions.assertTrue(client.exists("hl7.fhir.r4.core", "4.0.1"));
    Assertions.assertTrue(!client.exists("hl7.fhir.r4.core", "1.0.2"));
    Assertions.assertTrue(!client.exists("hl7.fhir.nothing", "1.0.1"));
    Assertions.assertTrue(client.exists(CommonPackages.ID_PUBPACK, CommonPackages.VER_PUBPACK));
}
Also used : CachingPackageClient(org.hl7.fhir.utilities.npm.CachingPackageClient) Test(org.junit.jupiter.api.Test)

Aggregations

CachingPackageClient (org.hl7.fhir.utilities.npm.CachingPackageClient)14 Test (org.junit.jupiter.api.Test)13 PackageInfo (org.hl7.fhir.utilities.npm.PackageInfo)11 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 FHIRException (org.hl7.fhir.exceptions.FHIRException)1 FilesystemPackageCacheManager (org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager)1 NpmPackage (org.hl7.fhir.utilities.npm.NpmPackage)1