diff --git a/docs/src/pages/guides/FHIRServerUsersGuide.md b/docs/src/pages/guides/FHIRServerUsersGuide.md index adbf8a8e3b9..cbe74201e24 100644 --- a/docs/src/pages/guides/FHIRServerUsersGuide.md +++ b/docs/src/pages/guides/FHIRServerUsersGuide.md @@ -897,7 +897,7 @@ The set of search parameters can filtered / refined via `fhirServer/resources/[r ## 4.7 FHIR client API ### 4.7.1 Overview -In addition to the server, we also offer a Java API for invoking the FHIR REST APIs. The IBM FHIR Client API is based on the JAX-RS 2.0 standard and provides a simple properties-driven client that can be easily configured for a given endpoint, mutual authentication, request/response logging, and more. +In addition to the server, we also offer a Java API for invoking FHIR REST APIs. The IBM FHIR Client is built on JAX-RS 2.1 and provides a simple properties-driven client that can be configured for a given endpoint, mutual authentication, request/response logging, and more. ### 4.7.2 Maven coordinates To use the FHIR Client from your application, specify the `fhir-client` artifact as a dependency within your `pom.xml` file, as in the following example: @@ -910,7 +910,28 @@ To use the FHIR Client from your application, specify the `fhir-client` artifact ``` -### 4.7.3 Sample usage +### 4.7.3 Client properties +Applicable client properties are documented in the FHIRClient interface. +Below is a summary of the most pertinent ones: + +| Property | Default | Description | +| -------- | ------- | ----------- | +| fhirclient.rest.base.url* | | The target FHIR Server's [base URL](https://hl7.org/fhir/R4B/http.html#root) | +| fhirclient.default.mimetype | application/fhir+json; fhirVersion=4.3 | The value to use in the HTTP headers (Accept and Content-Type) passed to the FHIR Server. | +| fhirclient.truststore.location | | The client truststore's filename. The client truststore contains the server's public key certificates and is used to verify the server's identity. | +| fhirclient.truststore.password | | The client truststore's password. | +| fhirclient.hostnameVerification.enabled | true | Indicates whether or not to enable hostname verification when connecting over TLS. | +| fhirclient.basicauth.enabled | false | Indicates whether Basic Authentication should be used. If enabled, then the username and password properties are required. | +| fhirclient.basicauth.username | | The username to use with Basic Authentication. | +| fhirclient.basicauth.password | | The password to use with Basic Authentication. | +| fhirclient.clientauth.enabled | false | Indicates whether mutual TLS certificate-based authentication should be used. If enabled, then keystore properties are required. | +| fhirclient.keystore.location | | The client keystore's filename. The client keystore constains the client's public/private key pair. When using client certificate-based authentication, this is now the client supplies its identity to the server| +| fhirclient.keystore.password | | The client keystore's password. | +| fhirclient.keystore.key.password | | The password associated with the client's certificate within the keystore. | +| fhirclient.logging.enabled | false | Whether to enable request/response logging (useful for debug). | +| fhirclient.http.receive.timeout | 130000 (130 seconds) | The time, in seconds, to wait for a server response. | + +### 4.7.4 Sample usage For examples on how to use the IBM FHIR Client, look for tests like `com.ibm.fhir.client.test.mains.FHIRClientSample` from the `fhir-client` project in git. Additionally, the FHIR Client is heavilly used from our integration tests in `fhir-server-test`. ## 4.8 Using local references within request bundles diff --git a/fhir-client/src/main/java/com/ibm/fhir/client/FHIRClient.java b/fhir-client/src/main/java/com/ibm/fhir/client/FHIRClient.java index 56669c23ac1..2c49f061d1c 100644 --- a/fhir-client/src/main/java/com/ibm/fhir/client/FHIRClient.java +++ b/fhir-client/src/main/java/com/ibm/fhir/client/FHIRClient.java @@ -27,14 +27,14 @@ public interface FHIRClient { /** * Specifies the default mimetype to be used by the FHIRClient instance when invoking - * FHIR REST APIs. If not specified a value of "application/fhir+json" will be used. + * FHIR REST APIs. If not specified a value of "application/fhir+json; fhirVersion=4.3" will be used. */ public static final String PROPNAME_DEFAULT_MIMETYPE = "fhirclient.default.mimetype"; /** * Indicates whether OAuth 2.0 should be used when invoking REST API requests. - * Valid values are "true" and "false" (the default). If enabled, then the authorizeURL, tokenURL and grantType properties - * are required as well. + * Valid values are "true" and "false" (the default). If enabled, then fhirclient.oAuth2.accessToken + * is required as well. */ public static final String PROPNAME_OAUTH2_ENABLED = "fhirclient.oAuth2.enabled"; @@ -45,7 +45,7 @@ public interface FHIRClient { /** * Indicates whether Basic Authentication should be used when invoking REST API requests. - * Valid values are "true" and "false" (the default). If enabled, then the username and password properties + * Valid values are "true" and "false" (the default). If enabled, then the username and password properties * are required as well. */ public static final String PROPNAME_BASIC_AUTH_ENABLED = "fhirclient.basicauth.enabled"; @@ -61,9 +61,9 @@ public interface FHIRClient { public static final String PROPNAME_CLIENT_PASSWORD = "fhirclient.basicauth.password"; /** - * Indicates whether Client Certificate-based Authentication should be used when invoking REST API requests. - * Valid values are "true" and "false" (the default). If enabled, then the rest of the "clientauth"-related properties - * are required as well. + * Indicates whether client certificate-based authentication should be used when invoking REST API requests. + * Valid values are "true" and "false" (the default). If enabled, then the keystore properties + * are required. */ public static final String PROPNAME_CLIENT_AUTH_ENABLED = "fhirclient.clientauth.enabled"; diff --git a/fhir-client/src/main/java/com/ibm/fhir/client/impl/FHIRClientImpl.java b/fhir-client/src/main/java/com/ibm/fhir/client/impl/FHIRClientImpl.java index 1b41c6ec086..c1ee3196633 100644 --- a/fhir-client/src/main/java/com/ibm/fhir/client/impl/FHIRClientImpl.java +++ b/fhir-client/src/main/java/com/ibm/fhir/client/impl/FHIRClientImpl.java @@ -45,6 +45,7 @@ import com.ibm.fhir.config.FHIRConfiguration; import com.ibm.fhir.core.FHIRMediaType; import com.ibm.fhir.core.FHIRUtilities; +import com.ibm.fhir.core.FHIRVersionParam; import com.ibm.fhir.core.HTTPReturnPreference; import com.ibm.fhir.model.resource.Bundle; import com.ibm.fhir.model.resource.Parameters; @@ -67,7 +68,7 @@ public class FHIRClientImpl implements FHIRClient { private Client client = null; private Properties clientProperties = null; private String baseEndpointURL = null; - private String defaultMimeType = FHIRMediaType.APPLICATION_FHIR_JSON; + private String defaultMimeType = FHIRMediaType.APPLICATION_FHIR_JSON + "; fhirVersion=" + FHIRVersionParam.VERSION_43.value(); private boolean basicAuthEnabled = false; private String basicAuthUsername = null; diff --git a/fhir-client/src/test/java/com/ibm/fhir/client/sample/FHIRClientSample.java b/fhir-client/src/test/java/com/ibm/fhir/client/sample/FHIRClientSample.java index 1f2c40565f7..a85a58dc6bc 100644 --- a/fhir-client/src/test/java/com/ibm/fhir/client/sample/FHIRClientSample.java +++ b/fhir-client/src/test/java/com/ibm/fhir/client/sample/FHIRClientSample.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2016, 2020 + * (C) Copyright IBM Corp. 2016, 2022 * * SPDX-License-Identifier: Apache-2.0 */ @@ -33,6 +33,9 @@ public static void main(String[] args) throws Exception { // Create properties to be used to configure the client. Properties clientProperties = new Properties(); clientProperties.setProperty(FHIRClient.PROPNAME_BASE_URL, "https://localhost:9443/fhir-server/api/v4"); + clientProperties.setProperty(FHIRClient.PROPNAME_TRUSTSTORE_LOCATION, "src/test/resources/fhirClientTrustStore.p12"); + clientProperties.setProperty(FHIRClient.PROPNAME_TRUSTSTORE_PASSWORD, "change-password"); + clientProperties.setProperty(FHIRClient.PROPNAME_LOGGING_ENABLED, "false"); // Retrieve an instance of the FHIRClient interface. FHIRClient client = FHIRClientFactory.getClient(clientProperties); diff --git a/fhir-client/src/test/resources/test.basic.properties b/fhir-client/src/test/resources/test.basic.properties index 0941a96675b..7bd9461b812 100644 --- a/fhir-client/src/test/resources/test.basic.properties +++ b/fhir-client/src/test/resources/test.basic.properties @@ -3,20 +3,12 @@ fhirclient.rest.base.url = https://jigsaw.w3.org/HTTP/Basic/ fhirclient.default.mimetype = application/fhir+json -fhirclient.basicauth.enabled = true -fhirclient.basicauth.username = guest -fhirclient.basicauth.password = guest - -fhirclient.clientauth.enabled = false -fhirclient.keystore.location = fhirClientKeyStore.p12 -fhirclient.keystore.password = change-password -fhirclient.keystore.key.password = change-password fhirclient.truststore.location = fhirClientTrustStore.p12 fhirclient.truststore.password = change-password -fhirclient.oAuth2.enabled = false - -fhirclient.encryption.enabled = false +fhirclient.basicauth.enabled = true +fhirclient.basicauth.username = guest +fhirclient.basicauth.password = guest fhirclient.logging.enabled = false diff --git a/fhir-client/src/test/resources/test.properties b/fhir-client/src/test/resources/test.properties index 01830673eab..a5f3feaab76 100644 --- a/fhir-client/src/test/resources/test.properties +++ b/fhir-client/src/test/resources/test.properties @@ -1,27 +1,15 @@ # Properties file containing test-related properties fhirclient.rest.base.url = https://localhost:9443/fhir-server/api/v4 -fhirclient.default.mimetype = application/fhir+json +fhirclient.default.mimetype = application/fhir+json; fhirVersion=4.3 -fhirclient.basicauth.enabled = false -fhirclient.basicauth.username = fhiruser -fhirclient.basicauth.password = change-password +fhirclient.truststore.location = fhirClientTrustStore.p12 +fhirclient.truststore.password = change-password fhirclient.clientauth.enabled = true fhirclient.keystore.location = fhirClientKeyStore.p12 fhirclient.keystore.password = change-password fhirclient.keystore.key.password = change-password -fhirclient.truststore.location = fhirClientTrustStore.p12 -fhirclient.truststore.password = change-password - -fhirclient.oAuth2.enabled = false -#Use fhir-client > FHIROAuth2Test.java to generate the accessToken and encode it using "wlp/bin/securityUtility encode" command -fhirclient.oAuth2.accessToken = change-password - -fhirclient.encryption.enabled = false -fhirclient.encryption.keystore.location = fhirkeys.jceks -fhirclient.encryption.keystore.password = change-password -fhirclient.encryption.key.password = change-password fhirclient.logging.enabled = false diff --git a/fhir-server-test/src/test/java/com/ibm/fhir/client/test/FHIRClientTest.java b/fhir-server-test/src/test/java/com/ibm/fhir/client/test/FHIRClientTest.java index ebe103726d9..f19cf0a0c70 100644 --- a/fhir-server-test/src/test/java/com/ibm/fhir/client/test/FHIRClientTest.java +++ b/fhir-server-test/src/test/java/com/ibm/fhir/client/test/FHIRClientTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2017, 2021 + * (C) Copyright IBM Corp. 2017, 2022 * * SPDX-License-Identifier: Apache-2.0 */ @@ -15,7 +15,6 @@ import java.util.Properties; -import jakarta.json.JsonObject; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Response; @@ -29,6 +28,7 @@ import com.ibm.fhir.client.FHIRRequestHeader; import com.ibm.fhir.client.FHIRResponse; import com.ibm.fhir.core.FHIRMediaType; +import com.ibm.fhir.core.FHIRVersionParam; import com.ibm.fhir.model.resource.Bundle; import com.ibm.fhir.model.resource.CapabilityStatement; import com.ibm.fhir.model.resource.OperationOutcome; @@ -45,23 +45,25 @@ import com.ibm.fhir.model.type.code.HTTPVerb; import com.ibm.fhir.model.util.JsonSupport; +import jakarta.json.JsonObject; + /** * Basic tests related to the FHIR Client API. */ public class FHIRClientTest extends FHIRClientTestBase { - private static final String MIMETYPE_JSON = FHIRMediaType.APPLICATION_FHIR_JSON; + private static final String MIMETYPE_JSON_43 = FHIRMediaType.APPLICATION_FHIR_JSON + "; fhirVersion=" + FHIRVersionParam.VERSION_43.value(); private static final String MIMETYPE_XML = FHIRMediaType.APPLICATION_FHIR_XML; private static final String BULKDATA_URI = "http://hl7.org/fhir/uv/bulkdata/CapabilityStatement/bulk-data|1.0.0"; - + private Patient createdPatient = null; private Patient updatedPatient = null; - + @Test public void testFHIRClientCtorProperties1() throws Exception { // by default, our testcase creates a FHIRClient instance using test.properties // so this test will just verify that the default mimetype is present. assertNotNull(client); - assertEquals(MIMETYPE_JSON, client.getDefaultMimeType()); + assertEquals(MIMETYPE_JSON_43, client.getDefaultMimeType()); } @Test @@ -69,10 +71,10 @@ public void testFHIRClientCtorProperties2() throws Exception { // Clone our "testProperties" field. Properties props = new Properties(); props.putAll(testProperties); - + // Set the mimetype we want to test with. props.setProperty(FHIRClient.PROPNAME_DEFAULT_MIMETYPE, MIMETYPE_XML); - + FHIRClient c = FHIRClientFactory.getClient(props); assertNotNull(c); assertEquals(MIMETYPE_XML, c.getDefaultMimeType()); @@ -187,7 +189,7 @@ public void testCreatePatientWithReturnPref() throws Exception { FHIRRequestHeader preferHeader; FHIRResponse response; - + // Create the patient with return=minimal and then validate the response. preferHeader = new FHIRRequestHeader("Prefer", "return=minimal"); response = client.create(patient, preferHeader); @@ -198,7 +200,7 @@ public void testCreatePatientWithReturnPref() throws Exception { assertNotNull(response.getLocationURI()); assertNotNull(response.getETag()); assertNotNull(response.getLastModified()); - + // Create the patient with return=representation and then validate the response. preferHeader = new FHIRRequestHeader("Prefer", "return=representation"); response = client.create(patient, preferHeader); @@ -226,7 +228,7 @@ public void testCreatePatientWithReturnPref() throws Exception { @Test(dependsOnMethods = {"testCreatePatient"}) public void testUpdatePatient() throws Exception { assertNotNull(createdPatient); - + // Read the patient, then modify it. FHIRResponse response = client.read("Patient", createdPatient.getId()); assertNotNull(response); @@ -234,12 +236,12 @@ public void testUpdatePatient() throws Exception { Patient patient = response.getResource(Patient.class); assertNotNull(patient); - // Next, add an additional contact phone number + // Next, add an additional contact phone number patient = patient.toBuilder().contact(Contact.builder() .telecom(ContactPoint.builder().system(ContactPointSystem.PHONE) .use(ContactPointUse.MOBILE) - .value(string("800-328-7448")).build()).build()).build(); - + .value(string("800-328-7448")).build()).build()).build(); + String ifMatchValue = "W/\"" + patient.getMeta().getVersionId().getValue() + "\""; // Update the patient and then validate the response. @@ -260,11 +262,11 @@ public void testUpdatePatient() throws Exception { updatedPatient = response.getResource(Patient.class); assertNotNull(updatedPatient); } - + @Test(dependsOnMethods = {"testCreatePatient"}) public void testUpdatePatientJsonObject() throws Exception { assertNotNull(createdPatient); - + // Read the patient, then modify it. FHIRResponse response = client.read("Patient", createdPatient.getId()); assertNotNull(response); @@ -276,8 +278,8 @@ public void testUpdatePatientJsonObject() throws Exception { patient = patient.toBuilder().contact(Contact.builder() .telecom(ContactPoint.builder().system(ContactPointSystem.PHONE) .use(ContactPointUse.WORK) - .value(string("408-400-7448")).build()).build()).build(); - + .value(string("408-400-7448")).build()).build()).build(); + JsonObject jsonObj = JsonSupport.toJsonObject(patient); // Update the patient and then validate the response. @@ -315,7 +317,7 @@ public void testReadPatientNotFound() throws Exception { FHIRResponse response = client.read("Patient", "INVALID_ID"); assertNotNull(response); assertResponse(response.getResponse(), Response.Status.NOT_FOUND.getStatusCode()); - + OperationOutcome oo = response.getResource(OperationOutcome.class); assertNotNull(oo); } @@ -335,7 +337,7 @@ public void testHistoryPatientNoParams() throws Exception { FHIRResponse response = client.history("Patient", updatedPatient.getId(), null); assertNotNull(response); assertResponse(response.getResponse(), Response.Status.OK.getStatusCode()); - + Bundle bundle = response.getResource(Bundle.class); assertNotNull(bundle); assertNotNull(bundle.getEntry()); @@ -348,7 +350,7 @@ public void testHistoryPatientWithCountPage() throws Exception { FHIRResponse response = client.history("Patient", updatedPatient.getId(), parameters); assertNotNull(response); assertResponse(response.getResponse(), Response.Status.OK.getStatusCode()); - + Bundle bundle = response.getResource(Bundle.class); assertNotNull(bundle); assertNotNull(bundle.getEntry()); @@ -362,7 +364,7 @@ public void testHistoryPatientWithSince() throws Exception { FHIRResponse response = client.history("Patient", updatedPatient.getId(), parameters); assertNotNull(response); assertResponse(response.getResponse(), Response.Status.OK.getStatusCode()); - + Bundle bundle = response.getResource(Bundle.class); assertNotNull(bundle); assertNotNull(bundle.getEntry()); @@ -374,7 +376,7 @@ public void testSearchPatientNoParams() throws Exception { FHIRResponse response = client.search("Patient", null); assertNotNull(response); assertResponse(response.getResponse(), Response.Status.OK.getStatusCode()); - + Bundle bundle = response.getResource(Bundle.class); assertNotNull(bundle); assertNotNull(bundle.getEntry()); @@ -384,11 +386,11 @@ public void testSearchPatientNoParams() throws Exception { @Test(dependsOnMethods = { "testUpdatePatient" }) public void testSearchPatientNoResults() throws Exception { FHIRParameters parameters = new FHIRParameters().searchParam("name", "NOT_A_PATIENT"); - + FHIRResponse response = client.search("Patient", parameters); assertNotNull(response); assertResponse(response.getResponse(), Response.Status.OK.getStatusCode()); - + Bundle bundle = response.getResource(Bundle.class); assertNotNull(bundle); assertNotNull(bundle.getEntry()); @@ -398,11 +400,11 @@ public void testSearchPatientNoResults() throws Exception { @Test(dependsOnMethods = { "testUpdatePatient" }) public void testSearchPatientWithParams1() throws Exception { FHIRParameters parameters = new FHIRParameters().searchParam("name", "Doe"); - + FHIRResponse response = client.search("Patient", parameters); assertNotNull(response); assertResponse(response.getResponse(), Response.Status.OK.getStatusCode()); - + Bundle bundle = response.getResource(Bundle.class); assertNotNull(bundle); assertNotNull(bundle.getEntry()); @@ -414,11 +416,11 @@ public void testSearchPatientWithParams3() throws Exception { FHIRParameters parameters = new FHIRParameters() .searchParam("birthdate", ValuePrefix.LE, "1950-01-01") .searchParam("_id", updatedPatient.getId()); - + FHIRResponse response = client.search("Patient", parameters); assertNotNull(response); assertResponse(response.getResponse(), Response.Status.OK.getStatusCode()); - + Bundle bundle = response.getResource(Bundle.class); assertNotNull(bundle); assertNotNull(bundle.getEntry()); @@ -430,11 +432,11 @@ public void testSearchPatientWithParams4() throws Exception { FHIRParameters parameters = new FHIRParameters() .searchParam("birthdate", ValuePrefix.GE, "1970-01-01") .searchParam("_id", updatedPatient.getId()); - + FHIRResponse response = client.search("Patient", parameters); assertNotNull(response); assertResponse(response.getResponse(), Response.Status.OK.getStatusCode()); - + Bundle bundle = response.getResource(Bundle.class); assertNotNull(bundle); assertNotNull(bundle.getEntry()); @@ -444,11 +446,11 @@ public void testSearchPatientWithParams4() throws Exception { @Test(dependsOnMethods = { "testUpdatePatient" }) public void testSearchPatientWithParams2() throws Exception { FHIRParameters parameters = new FHIRParameters().searchParam("name", Modifier.CONTAINS, "Doe"); - + FHIRResponse response = client.search("Patient", parameters); assertNotNull(response); assertResponse(response.getResponse(), Response.Status.OK.getStatusCode()); - + Bundle bundle = response.getResource(Bundle.class); assertNotNull(bundle); assertNotNull(bundle.getEntry()); @@ -463,7 +465,7 @@ public void testSearchPatientWithParamsBadRequest_preferLenient() throws Excepti FHIRResponse response = client.search("Patient", parameters, preferHeader); assertNotNull(response); assertResponse(response.getResponse(), Response.Status.OK.getStatusCode()); - + Bundle responseBundle = response.getResource(Bundle.class); assertNotNull(responseBundle); assertTrue(responseBundle.getEntry().size() > 0); @@ -477,7 +479,7 @@ public void testSearchPatientWithParamsBadRequest_preferStrict() throws Exceptio FHIRResponse response = client.search("Patient", parameters, preferHeader); assertNotNull(response); assertResponse(response.getResponse(), Response.Status.BAD_REQUEST.getStatusCode()); - + OperationOutcome oo = response.getResource(OperationOutcome.class); assertNotNull(oo); } @@ -491,7 +493,7 @@ public void testValidatePatient() throws Exception { FHIRResponse response = client.validate(patient); assertNotNull(response); assertResponse(response.getResponse(), Response.Status.OK.getStatusCode()); - + OperationOutcome oo = response.getResource(OperationOutcome.class); assertNotNull(oo); } @@ -505,7 +507,7 @@ public void testValidatePatientJsonObject() throws Exception { FHIRResponse response = client.validate(jsonObj); assertNotNull(response); assertResponse(response.getResponse(), Response.Status.OK.getStatusCode()); - + OperationOutcome oo = response.getResource(OperationOutcome.class); assertNotNull(oo); } @@ -513,7 +515,7 @@ public void testValidatePatientJsonObject() throws Exception { @Test(dependsOnMethods = { "testUpdatePatient" }) public void testBatch() throws Exception { Bundle requestBundle = Bundle.builder().type(BundleType.BATCH).build(); - + // read requestBundle = addRequestToBundle(requestBundle, HTTPVerb.GET, "Patient/" + createdPatient.getId(), null); // vread @@ -522,12 +524,12 @@ public void testBatch() throws Exception { requestBundle = addRequestToBundle(requestBundle, HTTPVerb.GET, "Patient/" + updatedPatient.getId() + "/_history", null); // search requestBundle = addRequestToBundle(requestBundle, HTTPVerb.GET, "Patient?family=Doe&_count=3", null); - + FHIRResponse response = client.batch(requestBundle); assertNotNull(response); assertNotNull(response.getResponse()); assertResponse(response.getResponse(), Response.Status.OK.getStatusCode()); - + Bundle responseBundle = response.getResource(Bundle.class); assertNotNull(responseBundle); assertNotNull(responseBundle.getEntry()); @@ -547,12 +549,12 @@ public void testTransaction() throws Exception { requestBundle = addRequestToBundle(requestBundle, HTTPVerb.GET, "Patient/" + updatedPatient.getId() + "/_history", null); // search requestBundle = addRequestToBundle(requestBundle, HTTPVerb.GET, "Patient?family=Doe&_count=3", null); - + FHIRResponse response = client.transaction(requestBundle); assertNotNull(response); assertNotNull(response.getResponse()); assertResponse(response.getResponse(), Response.Status.OK.getStatusCode()); - + Bundle responseBundle = response.getResource(Bundle.class); assertNotNull(responseBundle); assertNotNull(responseBundle.getEntry()); @@ -560,12 +562,12 @@ public void testTransaction() throws Exception { assertEquals(BundleType.TRANSACTION_RESPONSE.getValue(), responseBundle.getType().getValue()); } - + private Bundle addRequestToBundle(Bundle bundle, HTTPVerb method, String url, Resource resource) throws Exception { - - Bundle.Entry.Request request = Bundle.Entry.Request.builder().method(method).url(Uri.of(url)).build(); + + Bundle.Entry.Request request = Bundle.Entry.Request.builder().method(method).url(Uri.of(url)).build(); Bundle.Entry.Builder entryBuilder = Bundle.Entry.builder().request(request); - + if (resource != null) { entryBuilder.resource(resource); } diff --git a/fhir-server-test/src/test/resources/test.properties b/fhir-server-test/src/test/resources/test.properties index 629b05a65ee..5378d3e26c8 100644 --- a/fhir-server-test/src/test/resources/test.properties +++ b/fhir-server-test/src/test/resources/test.properties @@ -3,7 +3,10 @@ # FHIRClient properties: fhirclient.rest.base.url = https://localhost:9443/fhir-server/api/v4 -fhirclient.default.mimetype = application/fhir+json +fhirclient.default.mimetype = application/fhir+json; fhirVersion=4.3 + +fhirclient.truststore.location = fhirClientTrustStore.p12 +fhirclient.truststore.password = change-password fhirclient.basicauth.enabled = false fhirclient.basicauth.username = fhiruser @@ -16,17 +19,6 @@ fhirclient.clientauth.enabled = true fhirclient.keystore.location = fhirClientKeyStore.p12 fhirclient.keystore.password = change-password fhirclient.keystore.key.password = change-password -fhirclient.truststore.location = fhirClientTrustStore.p12 -fhirclient.truststore.password = change-password - -fhirclient.oAuth2.enabled = false -#Use fhir-client > FHIROAuth2Test.java to generate the accessToken and encode it using "wlp/bin/securityUtility encode" command -fhirclient.oAuth2.accessToken = change-password - -#fhirclient.encryption.enabled = false -#fhirclient.encryption.keystore.location = fhirkeys.jceks -#fhirclient.encryption.keystore.password = change-password -#fhirclient.encryption.key.password = change-password # Properties supported by FHIRServerTestBase: test.websocket.url = wss://localhost:9443/fhir-server/api/v4/notification