001package ca.cdr.test.app.harness.api;
002
003import ca.cdr.test.app.clients.AdminJsonRestClient;
004import ca.cdr.test.app.clients.HL7V2RestClient;
005import ca.uhn.fhir.context.FhirContext;
006import ca.uhn.fhir.rest.client.api.IGenericClient;
007
008/**
009 * Interface for interacting with a Smile CDR instance during testing.
010 * Provides methods to obtain various clients for communicating with the CDR,
011 * including administrative JSON clients and FHIR clients with different
012 * authentication levels.
013 */
014public interface SmileHarness {
015        /**
016         * Gets an administrative JSON client for interacting with the CDR's admin API.
017         * This will create an @{link JsonRestClient} with the first available ADMIN_JSON moduledmin
018         *
019         * @return An autodiscovered AdminJsonRestClient.
020         */
021        AdminJsonRestClient getAdminJsonClient();
022
023        /**
024         * Gets an administrative JSON client for interacting with the CDR's admin API on a specific port.
025         *
026         * @param thePort The port to connect to
027         * @return The admin JSON client configured with the specified port
028         */
029        AdminJsonRestClient getAdminJsonClient(int thePort);
030
031        /**
032         * Gets a FHIR client with superuser privileges.
033         * This will create an @{link IGenericClient} with the first available FHIR_ENDPOINT module
034         *
035         * @return The FHIR client with superuser authentication
036         */
037        IGenericClient getSuperuserFhirClient();
038
039        /**
040         * Gets a FHIR client with superuser privileges on a specific port.
041         *
042         * @param thePort The port to connect to
043         * @return The FHIR client with superuser authentication on the specified port
044         */
045        IGenericClient getSuperuserFhirClient(int thePort);
046
047        /**
048         * Gets a FHIR client with superuser privileges for a specific module.
049         *
050         * @param theModuleId The ID of the module to connect to
051         * @return The FHIR client with superuser authentication for the specified module
052         */
053        IGenericClient getSuperuserFhirClient(String theModuleId);
054
055        /**
056         * Gets a standard FHIR client.
057         *
058         * @return The FHIR client with default authentication
059         */
060        IGenericClient getFhirClient();
061
062        /**
063         * Gets a standard FHIR client on a specific port.
064         *
065         * @param thePort The port to connect to
066         * @return The FHIR client with default authentication on the specified port
067         */
068        IGenericClient getFhirClient(int thePort);
069
070        /**
071         * Gets a standard FHIR client for a specific module.
072         *
073         * @param theModuleId The ID of the module to connect to
074         * @return The FHIR client with default authentication for the specified module
075         */
076        IGenericClient getFhirClient(String theModuleId);
077
078        /**
079         * Gets the FHIR context used by this harness.
080         *
081         * @return The FHIR context
082         */
083        FhirContext getFhirContext();
084
085        /**
086         * Gets the FHIR context for a specific module.
087         *
088         * @param moduleId The ID of the module
089         * @return The FHIR context for the specified module
090         */
091        FhirContext getFhirContext(String moduleId);
092
093        /**
094         * Gets an HL7V2 REST client for interacting with the CDR's HL7V2 endpoint.
095         *
096         * @return The HL7V2 REST client configured with default port
097         */
098        HL7V2RestClient getHL7V2RestClient();
099
100        /**
101         * Gets an HL7V2 REST client for interacting with the CDR's HL7V2 endpoint on a specific port.
102         *
103         * @param thePort The port to connect to
104         * @return The HL7V2 REST client configured with the specified port
105         */
106        HL7V2RestClient getHL7V2RestClient(int thePort);
107
108        /**
109         * Gets an HL7V2 REST client for a specific module.
110         *
111         * @param theModuleId The ID of the module to connect to
112         * @return The HL7V2 REST client for the specified module
113         */
114        HL7V2RestClient getHL7V2RestClient(String theModuleId);
115
116}