001/*- 002 * #%L 003 * Smile CDR - CDR 004 * %% 005 * Copyright (C) 2016 - 2025 Smile CDR, Inc. 006 * %% 007 * All rights reserved. 008 * #L% 009 */ 010package ca.cdr.test.app.harness.api; 011 012import ca.cdr.test.app.clients.AdminJsonRestClient; 013import ca.cdr.test.app.clients.HL7V2RestClient; 014import ca.cdr.test.app.clients.NpmPackageClient; 015import ca.cdr.test.app.clients.OutboundSmartClient; 016import ca.uhn.fhir.context.FhirContext; 017import ca.uhn.fhir.rest.client.api.IGenericClient; 018 019/** 020 * Interface for interacting with a Smile CDR instance during testing. 021 * Provides methods to obtain various clients for communicating with the CDR, 022 * including administrative JSON clients and FHIR clients with different 023 * authentication levels. 024 */ 025public interface SmileHarness { 026 /** 027 * Gets an administrative JSON client for interacting with the CDR's admin API. 028 * This will create an {@link AdminJsonRestClient} with the first available ADMIN_JSON module 029 * u 030 * 031 * @return An autodiscovered AdminJsonRestClient. 032 */ 033 AdminJsonRestClient getAdminJsonClient(); 034 035 /** 036 * Gets an {@link AdminJsonRestClient} for interacting with the CDR's admin API on a specific port. 037 * 038 * @param thePort The port to connect to 039 * @return The admin JSON client configured with the specified port 040 */ 041 AdminJsonRestClient getAdminJsonClient(int thePort); 042 043 /** 044 * Gets a FHIR client with superuser privileges. 045 * This will create an {@link IGenericClient} with the first available FHIR_ENDPOINT module 046 * 047 * @return The FHIR client with superuser authentication 048 */ 049 IGenericClient getSuperuserFhirClient(); 050 051 /** 052 * Gets a FHIR client with superuser privileges on a specific port. 053 * 054 * @param thePort The port to connect to 055 * @return The FHIR client with superuser authentication on the specified port 056 */ 057 IGenericClient getSuperuserFhirClient(int thePort); 058 059 /** 060 * Gets a FHIR client with superuser privileges for a specific module. 061 * 062 * @param theModuleId The ID of the module to connect to 063 * @return The FHIR client with superuser authentication for the specified module 064 */ 065 IGenericClient getSuperuserFhirClient(String theModuleId); 066 067 /** 068 * Gets a standard FHIR client. 069 * 070 * @return The FHIR client with default authentication 071 */ 072 IGenericClient getFhirClient(); 073 074 /** 075 * Gets a standard FHIR client on a specific port. 076 * 077 * @param thePort The port to connect to 078 * @return The FHIR client with default authentication on the specified port 079 */ 080 IGenericClient getFhirClient(int thePort); 081 082 /** 083 * Gets a standard FHIR client for a specific module. 084 * 085 * @param theModuleId The ID of the module to connect to 086 * @return The FHIR client with default authentication for the specified module 087 */ 088 IGenericClient getFhirClient(String theModuleId); 089 090 /** 091 * Gets the FHIR context used by this harness. 092 * 093 * @return The FHIR context 094 */ 095 FhirContext getFhirContext(); 096 097 /** 098 * Gets the FHIR context for a specific module. 099 * 100 * @param moduleId The ID of the module 101 * @return The FHIR context for the specified module 102 */ 103 FhirContext getFhirContext(String moduleId); 104 105 /** 106 * Gets an HL7V2 REST client for interacting with the CDR's HL7V2 endpoint. 107 * 108 * @return The HL7V2 REST client configured with default port 109 */ 110 HL7V2RestClient getHL7V2RestClient(); 111 112 /** 113 * Gets an HL7V2 REST client for interacting with the CDR's HL7V2 endpoint on a specific port. 114 * 115 * @param thePort The port to connect to 116 * @return The HL7V2 REST client configured with the specified port 117 */ 118 HL7V2RestClient getHL7V2RestClient(int thePort); 119 120 /** 121 * Gets an HL7V2 REST client for a specific module. 122 * 123 * @param theModuleId The ID of the module to connect to 124 * @return The HL7V2 REST client for the specified module 125 */ 126 HL7V2RestClient getHL7V2RestClient(String theModuleId); 127 128 /** 129 * Gets an outbound SMART client for OAuth 2.0 authorization flows. 130 * This will create an OutboundSmartClient targeting the first available SMART endpoint module. 131 * 132 * @return The outbound SMART client configured with default endpoint 133 */ 134 OutboundSmartClient getOutboundSmartClient(); 135 136 /** 137 * Gets an outbound SMART client for OAuth 2.0 authorization flows on a specific port. 138 * 139 * @param thePort The port to connect to 140 * @return The outbound SMART client configured with the specified port 141 */ 142 OutboundSmartClient getOutboundSmartClient(int thePort); 143 144 /** 145 * Gets an outbound SMART client for OAuth 2.0 authorization flows for a specific module. 146 * 147 * @param theModuleId The ID of the module to connect to 148 * @return The outbound SMART client for the specified module 149 */ 150 OutboundSmartClient getOutboundSmartClient(String theModuleId); 151 152 /** 153 * Gets an NPM Package client for interacting with the CDR's package registry endpoint. 154 * This will create an NpmPackageClient targeting the first available PACKAGE_REGISTRY endpoint module. 155 * 156 * @return The NPM Package client configured with default endpoint 157 */ 158 NpmPackageClient getNpmPackageClient(); 159 160 /** 161 * Gets an NPM Package client for interacting with the CDR's package registry endpoint on a specific port. 162 * 163 * @param thePort The port to connect to 164 * @return The NPM Package client configured with the specified port 165 */ 166 NpmPackageClient getNpmPackageClient(int thePort); 167 168 /** 169 * Gets an NPM Package client for interacting with the CDR's package registry endpoint for a specific module. 170 * 171 * @param theModuleId The ID of the module to connect to 172 * @return The NPM Package client for the specified module 173 */ 174 NpmPackageClient getNpmPackageClient(String theModuleId); 175 176}