You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2023/02/14 07:18:47 UTC

[camel-quarkus] branch main updated: Adapt FHIR tests after upgrade to 6.x

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new 86cd389b06 Adapt FHIR tests after upgrade to 6.x
86cd389b06 is described below

commit 86cd389b062b57f252ccd39b2c875721a772cace
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Feb 13 08:53:10 2023 +0000

    Adapt FHIR tests after upgrade to 6.x
    
    Fixes #4497
---
 .../component/fhir/it/FhirDstu2Hl7OrgResource.java | 25 ++++++------
 .../component/fhir/it/FhirDstu2Resource.java       | 25 ++++++------
 .../component/fhir/it/FhirDstu2_1Resource.java     | 25 ++++++------
 .../component/fhir/it/FhirDstu3Resource.java       | 25 ++++++------
 .../quarkus/component/fhir/it/FhirR4Resource.java  | 24 +++++------
 .../quarkus/component/fhir/it/FhirR5Resource.java  | 46 +++++++++++++++-------
 .../component/fhir/it/AbstractFhirTest.java        |  2 +-
 .../component/fhir/it/FhirTestResource.java        | 17 ++++++--
 integration-tests/pom.xml                          |  2 +-
 tooling/scripts/test-categories.yaml               |  1 +
 10 files changed, 111 insertions(+), 81 deletions(-)

diff --git a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Hl7OrgResource.java b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Hl7OrgResource.java
index d204dd0408..67b70174f4 100644
--- a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Hl7OrgResource.java
+++ b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Hl7OrgResource.java
@@ -234,19 +234,19 @@ public class FhirDstu2Hl7OrgResource {
         patient.addName().addGiven(PATIENT_FIRST_NAME).addFamily(PATIENT_LAST_NAME);
         patient.setId(id);
 
-        IBaseOperationOutcome result = producerTemplate.requestBody("direct:delete-dstu2-hl7org", patient,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBody("direct:delete-dstu2-hl7org", patient,
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byId")
     @DELETE
     @Produces(MediaType.TEXT_PLAIN)
     public String deletePatientById(@QueryParam("id") String id) {
-        IBaseOperationOutcome result = producerTemplate.requestBody("direct:deleteById-dstu2-hl7org",
+        MethodOutcome result = producerTemplate.requestBody("direct:deleteById-dstu2-hl7org",
                 new IdType(id),
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byIdPart")
@@ -256,10 +256,10 @@ public class FhirDstu2Hl7OrgResource {
         Map<String, Object> headers = new HashMap<>();
         headers.put("CamelFhir.type", "Patient");
         headers.put("CamelFhir.stringId", id);
-        IBaseOperationOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteByStringId-dstu2-hl7org", null,
+        MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteByStringId-dstu2-hl7org", null,
                 headers,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byUrl")
@@ -272,11 +272,12 @@ public class FhirDstu2Hl7OrgResource {
         }
 
         String body = String.format("Patient?given=%s&family=%s", PATIENT_FIRST_NAME, PATIENT_LAST_NAME);
-        IBaseOperationOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteConditionalByUrl-dstu2-hl7org",
+        MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteConditionalByUrl-dstu2-hl7org",
                 body,
                 headers,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+                MethodOutcome.class);
+        IBaseOperationOutcome operationOutcome = result.getOperationOutcome();
+        return operationOutcome.getIdElement().getIdPart();
     }
 
     /////////////////////
diff --git a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Resource.java b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Resource.java
index 27535c98df..dddec0e08a 100644
--- a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Resource.java
+++ b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2Resource.java
@@ -236,19 +236,19 @@ public class FhirDstu2Resource {
         patient.addName().addGiven(PATIENT_FIRST_NAME).setFamily(Arrays.asList(new StringDt(PATIENT_LAST_NAME)));
         patient.setId(id);
 
-        IBaseOperationOutcome result = producerTemplate.requestBody("direct:delete-dstu2", patient,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBody("direct:delete-dstu2", patient,
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byId")
     @DELETE
     @Produces(MediaType.TEXT_PLAIN)
     public String deletePatientById(@QueryParam("id") String id) {
-        IBaseOperationOutcome result = producerTemplate.requestBody("direct:deleteById-dstu2",
+        MethodOutcome result = producerTemplate.requestBody("direct:deleteById-dstu2",
                 new IdDt(id),
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byIdPart")
@@ -258,9 +258,9 @@ public class FhirDstu2Resource {
         Map<String, Object> headers = new HashMap<>();
         headers.put("CamelFhir.type", "Patient");
         headers.put("CamelFhir.stringId", id);
-        IBaseOperationOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteByStringId-dstu2", null, headers,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteByStringId-dstu2", null, headers,
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byUrl")
@@ -273,10 +273,11 @@ public class FhirDstu2Resource {
         }
 
         String body = String.format("Patient?given=%s&family=%s", PATIENT_FIRST_NAME, PATIENT_LAST_NAME);
-        IBaseOperationOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteConditionalByUrl-dstu2", body,
+        MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteConditionalByUrl-dstu2", body,
                 headers,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+                MethodOutcome.class);
+        IBaseOperationOutcome operationOutcome = result.getOperationOutcome();
+        return operationOutcome.getIdElement().getIdPart();
     }
 
     /////////////////////
diff --git a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2_1Resource.java b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2_1Resource.java
index abc19ea44b..af5d2ad2ea 100644
--- a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2_1Resource.java
+++ b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu2_1Resource.java
@@ -69,7 +69,6 @@ import org.hl7.fhir.dstu2016may.model.Parameters;
 import org.hl7.fhir.dstu2016may.model.Patient;
 import org.hl7.fhir.instance.model.api.IBaseBundle;
 import org.hl7.fhir.instance.model.api.IBaseMetaType;
-import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
 import org.hl7.fhir.instance.model.api.IBaseResource;
 
 import static org.apache.camel.quarkus.component.fhir.it.FhirConstants.PATIENT_ADDRESS;
@@ -231,19 +230,19 @@ public class FhirDstu2_1Resource {
         patient.addName().addGiven(PATIENT_FIRST_NAME).addFamily(PATIENT_LAST_NAME);
         patient.setId(id);
 
-        IBaseOperationOutcome result = producerTemplate.requestBody("direct:delete-dstu2-1", patient,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBody("direct:delete-dstu2-1", patient,
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byId")
     @DELETE
     @Produces(MediaType.TEXT_PLAIN)
     public String deletePatientById(@QueryParam("id") String id) {
-        IBaseOperationOutcome result = producerTemplate.requestBody("direct:deleteById-dstu2-1",
+        MethodOutcome result = producerTemplate.requestBody("direct:deleteById-dstu2-1",
                 new IdType(id),
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byIdPart")
@@ -253,9 +252,9 @@ public class FhirDstu2_1Resource {
         Map<String, Object> headers = new HashMap<>();
         headers.put("CamelFhir.type", "Patient");
         headers.put("CamelFhir.stringId", id);
-        IBaseOperationOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteByStringId-dstu2-1", null, headers,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteByStringId-dstu2-1", null, headers,
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byUrl")
@@ -268,10 +267,10 @@ public class FhirDstu2_1Resource {
         }
 
         String body = String.format("Patient?given=%s&family=%s", PATIENT_FIRST_NAME, PATIENT_LAST_NAME);
-        IBaseOperationOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteConditionalByUrl-dstu2-1", body,
+        MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteConditionalByUrl-dstu2-1", body,
                 headers,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     /////////////////////
diff --git a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu3Resource.java b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu3Resource.java
index 524f13b3f4..ed89c4310d 100644
--- a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu3Resource.java
+++ b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirDstu3Resource.java
@@ -232,18 +232,18 @@ public class FhirDstu3Resource {
         patient.addName().addGiven(PATIENT_FIRST_NAME).setFamily(PATIENT_LAST_NAME);
         patient.setId(id);
 
-        IBaseOperationOutcome result = producerTemplate.requestBody("direct:delete-dstu3", patient,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBody("direct:delete-dstu3", patient,
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byId")
     @DELETE
     @Produces(MediaType.TEXT_PLAIN)
     public String deletePatientById(@QueryParam("id") String id) {
-        IBaseOperationOutcome result = producerTemplate.requestBody("direct:deleteById-dstu3", new IdType(id),
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBody("direct:deleteById-dstu3", new IdType(id),
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byIdPart")
@@ -253,9 +253,9 @@ public class FhirDstu3Resource {
         Map<String, Object> headers = new HashMap<>();
         headers.put("CamelFhir.type", "Patient");
         headers.put("CamelFhir.stringId", id);
-        IBaseOperationOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteByStringId-dstu3", null, headers,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteByStringId-dstu3", null, headers,
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byUrl")
@@ -268,10 +268,11 @@ public class FhirDstu3Resource {
         }
 
         String body = String.format("Patient?given=%s&family=%s", PATIENT_FIRST_NAME, PATIENT_LAST_NAME);
-        IBaseOperationOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteConditionalByUrl-dstu3", body,
+        MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteConditionalByUrl-dstu3", body,
                 headers,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+                MethodOutcome.class);
+        IBaseOperationOutcome operationOutcome = result.getOperationOutcome();
+        return operationOutcome.getIdElement().getIdPart();
     }
 
     /////////////////////
diff --git a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR4Resource.java b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR4Resource.java
index e0aaff180a..806ed1e877 100644
--- a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR4Resource.java
+++ b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR4Resource.java
@@ -61,7 +61,6 @@ import org.apache.camel.component.fhir.internal.FhirHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.hl7.fhir.instance.model.api.IBaseBundle;
 import org.hl7.fhir.instance.model.api.IBaseMetaType;
-import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
 import org.hl7.fhir.instance.model.api.IBaseResource;
 import org.hl7.fhir.r4.model.Bundle;
 import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
@@ -233,17 +232,17 @@ public class FhirR4Resource {
         patient.addName().addGiven(PATIENT_FIRST_NAME).setFamily(PATIENT_LAST_NAME);
         patient.setId(id);
 
-        IBaseOperationOutcome result = producerTemplate.requestBody("direct:delete-r4", patient, IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBody("direct:delete-r4", patient, MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byId")
     @DELETE
     @Produces(MediaType.TEXT_PLAIN)
     public String deletePatientById(@QueryParam("id") String id) {
-        IBaseOperationOutcome result = producerTemplate.requestBody("direct:deleteById-r4", new IdType(id),
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBody("direct:deleteById-r4", new IdType(id),
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byIdPart")
@@ -253,9 +252,9 @@ public class FhirR4Resource {
         Map<String, Object> headers = new HashMap<>();
         headers.put("CamelFhir.type", "Patient");
         headers.put("CamelFhir.stringId", id);
-        IBaseOperationOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteByStringId-r4", null, headers,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteByStringId-r4", null, headers,
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byUrl")
@@ -268,9 +267,10 @@ public class FhirR4Resource {
         }
 
         String body = String.format("Patient?given=%s&family=%s", PATIENT_FIRST_NAME, PATIENT_LAST_NAME);
-        IBaseOperationOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteConditionalByUrl-r4", body, headers,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteConditionalByUrl-r4", body, headers,
+                MethodOutcome.class);
+        OperationOutcome operationOutcome = (OperationOutcome) result.getOperationOutcome();
+        return operationOutcome.getIssue().get(0).getId();
     }
 
     /////////////////////
diff --git a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR5Resource.java b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR5Resource.java
index 466329a993..5f1a929a2b 100644
--- a/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR5Resource.java
+++ b/integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR5Resource.java
@@ -61,7 +61,6 @@ import org.apache.camel.component.fhir.internal.FhirHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.hl7.fhir.instance.model.api.IBaseBundle;
 import org.hl7.fhir.instance.model.api.IBaseMetaType;
-import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
 import org.hl7.fhir.instance.model.api.IBaseResource;
 import org.hl7.fhir.r5.model.Bundle;
 import org.hl7.fhir.r5.model.CapabilityStatement;
@@ -231,17 +230,17 @@ public class FhirR5Resource {
         patient.addName().addGiven(PATIENT_FIRST_NAME).setFamily(PATIENT_LAST_NAME);
         patient.setId(id);
 
-        IBaseOperationOutcome result = producerTemplate.requestBody("direct:delete-r5", patient, IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBody("direct:delete-r5", patient, MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byId")
     @DELETE
     @Produces(MediaType.TEXT_PLAIN)
     public String deletePatientById(@QueryParam("id") String id) {
-        IBaseOperationOutcome result = producerTemplate.requestBody("direct:deleteById-r5", new IdType(id),
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBody("direct:deleteById-r5", new IdType(id),
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byIdPart")
@@ -251,9 +250,9 @@ public class FhirR5Resource {
         Map<String, Object> headers = new HashMap<>();
         headers.put("CamelFhir.type", "Patient");
         headers.put("CamelFhir.stringId", id);
-        IBaseOperationOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteByStringId-r5", null, headers,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteByStringId-r5", null, headers,
+                MethodOutcome.class);
+        return result.getId().getIdPart();
     }
 
     @Path("/deletePatient/byUrl")
@@ -266,9 +265,10 @@ public class FhirR5Resource {
         }
 
         String body = String.format("Patient?given=%s&family=%s", PATIENT_FIRST_NAME, PATIENT_LAST_NAME);
-        IBaseOperationOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteConditionalByUrl-r5", body, headers,
-                IBaseOperationOutcome.class);
-        return result.getIdElement().getIdPart();
+        MethodOutcome result = producerTemplate.requestBodyAndHeaders("direct:deleteConditionalByUrl-r5", body, headers,
+                MethodOutcome.class);
+        OperationOutcome operationOutcome = (OperationOutcome) result.getOperationOutcome();
+        return operationOutcome.getIssue().get(0).getId();
     }
 
     /////////////////////
@@ -328,7 +328,7 @@ public class FhirR5Resource {
                 .returnBundle(Bundle.class)
                 .execute();
 
-        String nextPageLink = bundle.getLink("next").getUrl();
+        String nextPageLink = getNextLink(bundle).getUrl();
 
         Map<String, Object> headers = new HashMap<>();
         headers.put("CamelFhir.url", nextPageLink);
@@ -364,7 +364,10 @@ public class FhirR5Resource {
                 .returnBundle(Bundle.class)
                 .execute();
 
-        String nextPageLink = bundle.getLink("next").getUrl();
+        // TODO: Work around bug in R5 link retrieval in hapi-fhir-core. Remove when upgraded to hapi-fhir-core >= 5.6.84
+        // String nextPageLink = bundle.getLink("next").getUrl();
+        String nextPageLink = getNextLink(bundle).getUrl();
+
         bundle = getFhirClient()
                 .loadPage()
                 .byUrl(nextPageLink)
@@ -1195,4 +1198,19 @@ public class FhirR5Resource {
         FhirComponent component = context.getComponent("fhir-r5", FhirComponent.class);
         return FhirHelper.createClient(component.getConfiguration(), context);
     }
+
+    // TODO: Remove this. Work around bug in R5 link retrieval in hapi-fhir-core. Remove when upgraded to hapi-fhir-core >= 5.6.84
+    private static Bundle.BundleLinkComponent getNextLink(Bundle bundle) {
+        Bundle.BundleLinkComponent nextPageLink = null;
+        for (Bundle.BundleLinkComponent next : bundle.getLink()) {
+            if ("next".equals(next.getRelation().toCode())) {
+                nextPageLink = next;
+            }
+        }
+
+        if (nextPageLink == null) {
+            throw new IllegalStateException("Next page link cannot be null");
+        }
+        return nextPageLink;
+    }
 }
diff --git a/integration-tests/fhir/src/test/java/org/apache/camel/quarkus/component/fhir/it/AbstractFhirTest.java b/integration-tests/fhir/src/test/java/org/apache/camel/quarkus/component/fhir/it/AbstractFhirTest.java
index 1678e65e17..357dfd541a 100644
--- a/integration-tests/fhir/src/test/java/org/apache/camel/quarkus/component/fhir/it/AbstractFhirTest.java
+++ b/integration-tests/fhir/src/test/java/org/apache/camel/quarkus/component/fhir/it/AbstractFhirTest.java
@@ -371,7 +371,7 @@ abstract class AbstractFhirTest {
                 .get("/meta/getFromServer")
                 .then()
                 .statusCode(200)
-                .body(greaterThanOrEqualTo("2"));
+                .body(greaterThanOrEqualTo("1"));
     }
 
     @ParameterizedTest
diff --git a/integration-tests/fhir/src/test/java/org/apache/camel/quarkus/component/fhir/it/FhirTestResource.java b/integration-tests/fhir/src/test/java/org/apache/camel/quarkus/component/fhir/it/FhirTestResource.java
index 9d67ec1eb4..2e4db84c4b 100644
--- a/integration-tests/fhir/src/test/java/org/apache/camel/quarkus/component/fhir/it/FhirTestResource.java
+++ b/integration-tests/fhir/src/test/java/org/apache/camel/quarkus/component/fhir/it/FhirTestResource.java
@@ -33,12 +33,12 @@ public class FhirTestResource implements QuarkusTestResourceLifecycleManager {
     private static final Logger LOGGER = LoggerFactory.getLogger(FhirTestResource.class);
     private static final String FHIR_DSTU_CONTAINER_TAG = "v4.2.0";
     private static final String FHIR_DSTU_CONTEXT_PATH = "/hapi-fhir-jpaserver/fhir";
-    private static final String FHIR_R_CONTAINER_TAG = "v5.7.0";
+    private static final String FHIR_R_CONTAINER_TAG = "v6.2.2";
     private static final String FHIR_R_CONTEXT_PATH = "/fhir";
     private static final int CONTAINER_PORT = 8080;
 
     private FhirVersion fhirVersion;
-    private GenericContainer container;
+    private GenericContainer<?> container;
 
     @Override
     public void init(Map<String, String> initArgs) {
@@ -60,9 +60,11 @@ public class FhirTestResource implements QuarkusTestResourceLifecycleManager {
         try {
             LOGGER.info("FHIR version {} is enabled. Starting hapi test container for it.", fhirVersion.simpleVersion());
             String imageName = fhirVersion.getContainerImageName();
-            container = new GenericContainer(imageName)
+            container = new GenericContainer<>(imageName)
                     .withExposedPorts(CONTAINER_PORT)
-                    .withEnv("HAPI_FHIR_VERSION", fhirVersion.getFhirContainerVersionEnvVarValue())
+                    .withEnv(fhirVersion.getFhirContainerVersionEnvVarName(), fhirVersion.getFhirContainerVersionEnvVarValue())
+                    .withEnv("hapi.fhir.allow_multiple_delete", "true")
+                    .withEnv("hapi.fhir.reuse_cached_search_results_millis", "-1")
                     .waitingFor(Wait.forHttp(fhirVersion.getHealthEndpointPath()).withStartupTimeout(Duration.ofMinutes(5)));
 
             container.start();
@@ -110,6 +112,13 @@ public class FhirTestResource implements QuarkusTestResourceLifecycleManager {
             return fhirImageTag;
         }
 
+        public String getFhirContainerVersionEnvVarName() {
+            if (contextPath.equals(FHIR_DSTU_CONTEXT_PATH)) {
+                return "HAPI_FHIR_VERSION";
+            }
+            return "hapi.fhir.fhir_version";
+        }
+
         public String getFhirContainerVersionEnvVarValue() {
             // Cannot pass DSTU2_HL7ORG as the version to the mock server. However, it is analogous to DSTU2 anyway
             if (this == DSTU2_HL7ORG) {
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index b97e7d0930..36e6d00e86 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -89,7 +89,7 @@
         <module>dropbox</module>
         <!--<module>elasticsearch-rest</module>-->
         <module>exec</module>
-        <!--<module>fhir</module> https://github.com/apache/camel-quarkus/issues/4497 -->
+        <module>fhir</module>
         <module>file</module>
         <module>flatpack</module>
         <module>fop</module>
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index b5871c44d5..8fd0b4b554 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -176,6 +176,7 @@ group-12:
   - vertx-websocket
 group-13:
   - box
+  - fhir
   - github
   - google
   - groovy-dsl