Class NpmPackageClient

java.lang.Object
ca.cdr.test.app.clients.NpmPackageClient
All Implemented Interfaces:
AutoCloseable

public class NpmPackageClient extends Object implements AutoCloseable
NpmPackageClient is a client for the NPM Package Registry API of the CDR. It currently supports anonymous and http-basic authentication. This client provides access to package installation operations through Smile CDR's package registry endpoint, typically running on port 8002.
  • Method Details

    • open

      @Nonnull public static NpmPackageClient open(@Nonnull String theBaseUrl, @Nonnull String theUsername, @Nonnull String thePassword)
      Opens a client authenticating as the given user, over a connection pool of its own.

      The caller owns the pool: open this in a try-with-resources block, or close it from an @AfterAll when it is a field. Use issuingOn(SmileTestHttpClient, String, String, String) instead where a client to issue on already exists.

      Parameters:
      theBaseUrl - the base URL of the package registry
      theUsername - the user to authenticate as
      thePassword - that user's password
    • openAnonymous

      @Nonnull public static NpmPackageClient openAnonymous(@Nonnull String theBaseUrl)
      Opens a client sending no credentials, over a connection pool of its own.

      The caller owns the pool ? see open(String, String, String).

      Parameters:
      theBaseUrl - the base URL of the package registry
    • issuingOn

      @Nonnull public static NpmPackageClient issuingOn(@Nonnull SmileTestHttpClient theHttpClient, @Nonnull String theBaseUrl, @Nonnull String theUsername, @Nonnull String thePassword)
      Builds a client that issues its requests on theHttpClient, sharing that client's connection pool and cookie store with everything else built over it.

      The pool stays the caller's: close() leaves it open, so there is nothing here for the caller to release. Use open(String, String, String) to build a pool of your own.

      Parameters:
      theHttpClient - the client to issue on, which the caller keeps ownership of
      theBaseUrl - the base URL of the package registry
      theUsername - the user to authenticate as
      thePassword - that user's password
      See Also:
    • build

      @Deprecated(since="2026.11.R01", forRemoval=true) @Nonnull public static NpmPackageClient build(@Nonnull String theBaseUrl, @Nonnull String theUsername, @Nonnull String thePassword)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use open(String, String, String), whose name says that the client owns the connection pool it returns and that the caller has to close it.
    • buildAnonymous

      @Deprecated(since="2026.11.R01", forRemoval=true) @Nonnull public static NpmPackageClient buildAnonymous(@Nonnull String theBaseUrl)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use openAnonymous(String), whose name says that the client owns the connection pool it returns and that the caller has to close it.
    • installPackageBySpec

      @Nonnull public ca.uhn.fhir.jpa.packages.PackageInstallOutcomeJson installPackageBySpec(ca.uhn.fhir.jpa.packages.PackageInstallationSpec theSpec)
      Install a package using the provided specification
      Parameters:
      theSpec - The package installation specification
      Returns:
      The installation outcome
    • installPackageBySpec

      @Nonnull public ca.uhn.fhir.jpa.packages.PackageInstallOutcomeJson installPackageBySpec(String theSpecJson)
      Install a package using the provided specification as a JSON string
      Parameters:
      theSpecJson - The package installation specification as JSON string
      Returns:
      The installation outcome
    • installPackageBySpecAsync

      @Nonnull public String installPackageBySpecAsync(@Nonnull ca.uhn.fhir.jpa.packages.PackageInstallationSpec theSpec)
    • getInstallationStatus

      @Nonnull public ca.uhn.fhir.jpa.packages.PackageInstallationStatusJson getInstallationStatus(String theJobId)
    • installPackageByParam

      @Nonnull public ca.uhn.fhir.jpa.packages.PackageInstallOutcomeJson installPackageByParam(String theName, String theVersion, boolean theFetchDependencies, @Nonnull ca.uhn.fhir.jpa.packages.PackageInstallationSpec.InstallModeEnum theInstallMode, @Nonnull ca.uhn.fhir.jpa.packages.PackageInstallationSpec.VersionPolicyEnum theVersionPolicy)
    • deletePackage

      @Nonnull public ca.uhn.fhir.jpa.packages.PackageDeleteOutcomeJson deletePackage(String theName, String theVersion)
    • searchPackages

      @Nonnull public ca.uhn.fhir.jpa.packages.NpmPackageSearchResultJson searchPackages(@Nonnull org.springframework.util.MultiValueMap<String,String> theQueryParams)
    • getPackageMetadata

      @Nonnull public ca.uhn.fhir.jpa.packages.NpmPackageMetadataJson getPackageMetadata(String theName)
    • findPackageAssetInfoByUrl

      @Nonnull public ca.uhn.fhir.jpa.packages.NpmPackageAssetInfoListJson findPackageAssetInfoByUrl(String theFhirVersion, String theCanonicalUrl)
    • close

      public void close()
      Releases the connection pool this client built for itself. A no-op when the client was built over one supplied by a caller, which owns its own pool.
      Specified by:
      close in interface AutoCloseable