Package ca.cdr.test.app.harness.impl
Class LocalhostSmileHarness
java.lang.Object
ca.cdr.test.app.harness.impl.LocalhostSmileHarness
- All Implemented Interfaces:
SmileHarness
The
DockerSmileHarness
class is responsible for managing interaction
with a Smile CDR environment running on the localhost. It provides utility methods to
identify and interact with Smile modules, such as FHIR endpoints and HL7v2 endpoints,
through exposed ports and administrative interfaces.
This class implements the SmileHarness
interface to provide concrete
implementations of the methods required to handle FHIR and administrative operations.
This class was generated partly with the help of Claude Sonnet 3.7
-
Constructor Summary
ConstructorsConstructorDescriptionLocalhostSmileHarness
(HarnessContext theContext) LocalhostSmileHarness
(HarnessContext theContext, Map<Integer, Integer> theExposedPortMappings) -
Method Summary
Modifier and TypeMethodDescriptionGets an administrative JSON client for interacting with the CDR's admin API.getAdminJsonClient
(int theAdminPort) Gets anAdminJsonRestClient
for interacting with the CDR's admin API on a specific port.Gets a standard FHIR client.getFhirClient
(int thePort) Gets a standard FHIR client on a specific port.getFhirClient
(String theModuleId) Gets a standard FHIR client for a specific module.Gets the only persistence module's FhirContext.getFhirContext
(String moduleId) Get the FHIR context for a specific persistence module.Gets an HL7V2 REST client for interacting with the CDR's HL7V2 endpoint.getHL7V2RestClient
(int thePort) Gets an HL7V2 REST client for interacting with the CDR's HL7V2 endpoint on a specific port.getHL7V2RestClient
(String theModuleId) Gets an HL7V2 REST client for a specific module.Gets an outbound SMART client for OAuth 2.0 authorization flows.getOutboundSmartClient
(int thePort) Gets an outbound SMART client for OAuth 2.0 authorization flows on a specific port.getOutboundSmartClient
(String theModuleId) Gets an outbound SMART client for OAuth 2.0 authorization flows for a specific module.Gets a FHIR client with superuser privileges.getSuperuserFhirClient
(int thePort) Gets a FHIR client with superuser privileges on a specific port.getSuperuserFhirClient
(String theModuleId) Gets a FHIR client with superuser privileges for a specific module.
-
Constructor Details
-
LocalhostSmileHarness
-
LocalhostSmileHarness
public LocalhostSmileHarness(HarnessContext theContext, Map<Integer, Integer> theExposedPortMappings)
-
-
Method Details
-
getSuperuserFhirClient
Description copied from interface:SmileHarness
Gets a FHIR client with superuser privileges. This will create anIGenericClient
with the first available FHIR_ENDPOINT module- Specified by:
getSuperuserFhirClient
in interfaceSmileHarness
- Returns:
- The FHIR client with superuser authentication
-
getSuperuserFhirClient
Description copied from interface:SmileHarness
Gets a FHIR client with superuser privileges on a specific port.- Specified by:
getSuperuserFhirClient
in interfaceSmileHarness
- Parameters:
thePort
- The port to connect to- Returns:
- The FHIR client with superuser authentication on the specified port
-
getAdminJsonClient
Description copied from interface:SmileHarness
Gets an administrative JSON client for interacting with the CDR's admin API. This will create anAdminJsonRestClient
with the first available ADMIN_JSON module u- Specified by:
getAdminJsonClient
in interfaceSmileHarness
- Returns:
- An autodiscovered AdminJsonRestClient.
-
getAdminJsonClient
Description copied from interface:SmileHarness
Gets anAdminJsonRestClient
for interacting with the CDR's admin API on a specific port.- Specified by:
getAdminJsonClient
in interfaceSmileHarness
- Parameters:
theAdminPort
- The port to connect to- Returns:
- The admin JSON client configured with the specified port
-
getSuperuserFhirClient
Description copied from interface:SmileHarness
Gets a FHIR client with superuser privileges for a specific module.- Specified by:
getSuperuserFhirClient
in interfaceSmileHarness
- Parameters:
theModuleId
- The ID of the module to connect to- Returns:
- The FHIR client with superuser authentication for the specified module
-
getFhirClient
Description copied from interface:SmileHarness
Gets a standard FHIR client.- Specified by:
getFhirClient
in interfaceSmileHarness
- Returns:
- The FHIR client with default authentication
-
getFhirClient
Description copied from interface:SmileHarness
Gets a standard FHIR client on a specific port.- Specified by:
getFhirClient
in interfaceSmileHarness
- Parameters:
thePort
- The port to connect to- Returns:
- The FHIR client with default authentication on the specified port
-
getFhirClient
Description copied from interface:SmileHarness
Gets a standard FHIR client for a specific module.- Specified by:
getFhirClient
in interfaceSmileHarness
- Parameters:
theModuleId
- The ID of the module to connect to- Returns:
- The FHIR client with default authentication for the specified module
-
getFhirContext
Gets the only persistence module's FhirContext. If More or less than 1 persistence modules are present, throwsIllegalStateException
.}See
getFhirContext(String)
if you have multiple persistence modules.- Specified by:
getFhirContext
in interfaceSmileHarness
- Returns:
- the
FhirContext
of the only persistence module.}
-
getFhirContext
Get the FHIR context for a specific persistence module.- Specified by:
getFhirContext
in interfaceSmileHarness
- Parameters:
moduleId
- The ID of the persistence module to get the FHIR context for- Returns:
- The FHIR context for the specified module
- Throws:
IllegalStateException
- if the module is not found or has an unsupported type
-
getHL7V2RestClient
Description copied from interface:SmileHarness
Gets an HL7V2 REST client for interacting with the CDR's HL7V2 endpoint.- Specified by:
getHL7V2RestClient
in interfaceSmileHarness
- Returns:
- The HL7V2 REST client configured with default port
-
getHL7V2RestClient
Description copied from interface:SmileHarness
Gets an HL7V2 REST client for interacting with the CDR's HL7V2 endpoint on a specific port.- Specified by:
getHL7V2RestClient
in interfaceSmileHarness
- Parameters:
thePort
- The port to connect to- Returns:
- The HL7V2 REST client configured with the specified port
-
getHL7V2RestClient
Description copied from interface:SmileHarness
Gets an HL7V2 REST client for a specific module.- Specified by:
getHL7V2RestClient
in interfaceSmileHarness
- Parameters:
theModuleId
- The ID of the module to connect to- Returns:
- The HL7V2 REST client for the specified module
-
getOutboundSmartClient
Description copied from interface:SmileHarness
Gets an outbound SMART client for OAuth 2.0 authorization flows. This will create an OutboundSmartClient targeting the first available SMART endpoint module.- Specified by:
getOutboundSmartClient
in interfaceSmileHarness
- Returns:
- The outbound SMART client configured with default endpoint
-
getOutboundSmartClient
Description copied from interface:SmileHarness
Gets an outbound SMART client for OAuth 2.0 authorization flows on a specific port.- Specified by:
getOutboundSmartClient
in interfaceSmileHarness
- Parameters:
thePort
- The port to connect to- Returns:
- The outbound SMART client configured with the specified port
-
getOutboundSmartClient
Description copied from interface:SmileHarness
Gets an outbound SMART client for OAuth 2.0 authorization flows for a specific module.- Specified by:
getOutboundSmartClient
in interfaceSmileHarness
- Parameters:
theModuleId
- The ID of the module to connect to- Returns:
- The outbound SMART client for the specified module
-