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 2022/03/15 11:58:30 UTC
[camel-spring-boot] 01/02: CAMEL-17797: Test with FHIR version R4
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-spring-boot.git
commit a37606f8fd4e57502ae6f53959f1ebae6fa603ce
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Mar 15 09:36:39 2022 +0000
CAMEL-17797: Test with FHIR version R4
---
.../component/fhir/AbstractFhirTestSupport.java | 6 ++--
.../component/fhir/CustomFhirConfiguration.java | 4 +--
.../camel/component/fhir/FhirCapabilitiesTest.java | 4 +--
.../component/fhir/FhirConfigurationTest.java | 4 +--
.../camel/component/fhir/FhirCreateTest.java | 4 +--
.../component/fhir/FhirExtraParametersTest.java | 4 +--
.../camel/component/fhir/FhirHistoryTest.java | 4 +--
.../camel/component/fhir/FhirLoadPageTest.java | 6 ++--
.../apache/camel/component/fhir/FhirMetaTest.java | 4 +--
.../camel/component/fhir/FhirOperationTest.java | 8 ++---
.../apache/camel/component/fhir/FhirPatchTest.java | 2 +-
.../apache/camel/component/fhir/FhirReadTest.java | 4 +--
.../camel/component/fhir/FhirSearchTest.java | 4 +--
.../apache/camel/component/fhir/FhirServer.java | 2 +-
.../camel/component/fhir/FhirSimpleTest.java | 6 ++--
.../camel/component/fhir/FhirTransactionTest.java | 6 ++--
.../camel/component/fhir/FhirUpdateTest.java | 2 +-
.../camel/component/fhir/FhirValidateTest.java | 34 +++++++++++++++++-----
.../camel/component/fhir/PatientProcessor.java | 2 +-
.../fhir/dataformat/FhirJsonDataFormatTest.java | 12 ++++----
.../FhirJsonDataformatErrorHandlerTest.java | 4 +--
.../fhir/dataformat/FhirXmlDataFormatTest.java | 10 +++----
.../FhirXmlDataformatErrorHandlerTest.java | 4 +--
23 files changed, 80 insertions(+), 60 deletions(-)
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/AbstractFhirTestSupport.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/AbstractFhirTestSupport.java
index 20b2c55..6bba262 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/AbstractFhirTestSupport.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/AbstractFhirTestSupport.java
@@ -25,9 +25,9 @@ import org.apache.camel.CamelExecutionException;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.test.infra.fhir.services.FhirService;
import org.apache.camel.test.infra.fhir.services.FhirServiceFactory;
-import org.hl7.fhir.dstu3.model.Bundle;
-import org.hl7.fhir.dstu3.model.HumanName;
-import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.HumanName;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/CustomFhirConfiguration.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/CustomFhirConfiguration.java
index 1a947b6..6d1859e 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/CustomFhirConfiguration.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/CustomFhirConfiguration.java
@@ -32,8 +32,8 @@ public class CustomFhirConfiguration {
fhirConfiguration.setPassword("tatum");
fhirConfiguration.setSessionCookie("mycookie=Chips Ahoy");
fhirConfiguration.setAccessToken("token");
- fhirConfiguration.setServerUrl("http://localhost:8080/hapi-fhir-jpaserver-example/baseDstu3");
- fhirConfiguration.setFhirVersion("DSTU3");
+ fhirConfiguration.setServerUrl("http://localhost:8080/hapi-fhir-jpaserver-example/baseR4");
+ fhirConfiguration.setFhirVersion("R4");
return fhirConfiguration;
}
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirCapabilitiesTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirCapabilitiesTest.java
index d971908..5183c9a 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirCapabilitiesTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirCapabilitiesTest.java
@@ -24,8 +24,8 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirCapabilitiesApiMethod;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.CapabilityStatement;
-import org.hl7.fhir.dstu3.model.Enumerations;
+import org.hl7.fhir.r4.model.CapabilityStatement;
+import org.hl7.fhir.r4.model.Enumerations;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirConfigurationTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirConfigurationTest.java
index 3b2e90b..06f3ae2 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirConfigurationTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirConfigurationTest.java
@@ -60,7 +60,7 @@ public class FhirConfigurationTest extends AbstractFhirTestSupport {
private static final String TEST_URI = "fhir://" + PATH_PREFIX + "/resource?inBody=resourceAsString&log=true&"
+ "encoding=JSON&summary=TEXT&compress=true&username=art&password=tatum&sessionCookie=mycookie%3DChips%20Ahoy"
- + "&accessToken=token&serverUrl=http://localhost:8080/hapi-fhir-jpaserver-example/baseDstu3&fhirVersion=DSTU3";
+ + "&accessToken=token&serverUrl=http://localhost:8080/hapi-fhir-jpaserver-example/baseR4&fhirVersion=R4";
@Autowired
private IClientInterceptor mockClientInterceptor;
@@ -95,7 +95,7 @@ public class FhirConfigurationTest extends AbstractFhirTestSupport {
GenericClient client = (GenericClient) endpoint.getClient();
FhirConfiguration configuration = endpoint.getConfiguration();
assertEquals(this.componentConfiguration, configuration);
- assertEquals("http://localhost:8080/hapi-fhir-jpaserver-example/baseDstu3", client.getUrlBase());
+ assertEquals("http://localhost:8080/hapi-fhir-jpaserver-example/baseR4", client.getUrlBase());
assertEquals(EncodingEnum.JSON, client.getEncoding());
assertEquals(SummaryEnum.TEXT, client.getSummary());
List<Object> interceptors = client.getInterceptorService().getAllRegisteredInterceptors();
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirCreateTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirCreateTest.java
index e444821..0352272 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirCreateTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirCreateTest.java
@@ -25,8 +25,8 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirCreateApiMethod;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.HumanName;
-import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.r4.model.HumanName;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirExtraParametersTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirExtraParametersTest.java
index 1e5a611..dab4490 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirExtraParametersTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirExtraParametersTest.java
@@ -24,8 +24,8 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirSearchApiMethod;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.Bundle;
-import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirHistoryTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirHistoryTest.java
index ac84026..261beff 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirHistoryTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirHistoryTest.java
@@ -24,8 +24,8 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirHistoryApiMethod;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.Bundle;
-import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirLoadPageTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirLoadPageTest.java
index 3938dcc..ee2d744 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirLoadPageTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirLoadPageTest.java
@@ -27,11 +27,11 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirLoadPageApiMethod;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.Bundle;
-import org.hl7.fhir.dstu3.model.HumanName;
-import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.HumanName;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirMetaTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirMetaTest.java
index 59e5c7f..3e343e8 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirMetaTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirMetaTest.java
@@ -24,9 +24,9 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirMetaApiMethod;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.Meta;
-import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseMetaType;
+import org.hl7.fhir.r4.model.Meta;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirOperationTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirOperationTest.java
index 9113306..3cc0988 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirOperationTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirOperationTest.java
@@ -23,10 +23,10 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirOperationApiMethod;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.Bundle;
-import org.hl7.fhir.dstu3.model.IdType;
-import org.hl7.fhir.dstu3.model.Parameters;
-import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.IdType;
+import org.hl7.fhir.r4.model.Parameters;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirPatchTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirPatchTest.java
index 0009b8d..55429cb 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirPatchTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirPatchTest.java
@@ -27,9 +27,9 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirPatchApiMethod;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirReadTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirReadTest.java
index 37c07af..01a87d7 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirReadTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirReadTest.java
@@ -24,8 +24,8 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirReadApiMethod;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.IdType;
-import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.r4.model.IdType;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirSearchTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirSearchTest.java
index 388e867..1578fb8 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirSearchTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirSearchTest.java
@@ -21,8 +21,8 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirSearchApiMethod;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.Bundle;
-import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirServer.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirServer.java
index f022e1d..6dacbd2 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirServer.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirServer.java
@@ -30,7 +30,7 @@ public class FhirServer {
@Bean
FhirContext fhirContext(){
- FhirContext fhirContext = new FhirContext(FhirVersionEnum.DSTU3);
+ FhirContext fhirContext = new FhirContext(FhirVersionEnum.R4);
// Set proxy so that FHIR resource URLs returned by the server are using the correct host and port
fhirContext.getRestfulClientFactory().setProxy(AbstractFhirTestSupport.service.getHost(), AbstractFhirTestSupport.service.getPort());
return fhirContext;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirSimpleTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirSimpleTest.java
index 997e278..197e25b 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirSimpleTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirSimpleTest.java
@@ -23,8 +23,8 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirCreateApiMethod;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.HumanName;
-import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.r4.model.HumanName;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@@ -79,7 +79,7 @@ public class FhirSimpleTest extends AbstractFhirTestSupport {
public void configure() {
from("direct://RESOURCE")
.to("fhir://" + PATH_PREFIX + "/resource?inBody=resource&serverUrl=" + service.getServiceBaseURL()
- + "&fhirVersion=DSTU3");
+ + "&fhirVersion=R4");
}
};
}
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirTransactionTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirTransactionTest.java
index 9c7afcf..85181d6 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirTransactionTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirTransactionTest.java
@@ -27,10 +27,10 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirTransactionApiMethod;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.Bundle;
-import org.hl7.fhir.dstu3.model.HumanName;
-import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.HumanName;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirUpdateTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirUpdateTest.java
index f41fda5..0f46574 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirUpdateTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirUpdateTest.java
@@ -28,7 +28,7 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirUpdateApiMethod;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirValidateTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirValidateTest.java
index b10c96c..6e692d2 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirValidateTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/FhirValidateTest.java
@@ -22,9 +22,10 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirValidateApiMethod;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.HumanName;
-import org.hl7.fhir.dstu3.model.OperationOutcome;
-import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.r4.model.HumanName;
+import org.hl7.fhir.r4.model.Narrative;
+import org.hl7.fhir.r4.model.OperationOutcome;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,6 +34,9 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.annotation.DirtiesContext;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -60,27 +64,43 @@ public class FhirValidateTest extends AbstractFhirTestSupport {
@Test
public void testResource() throws Exception {
Patient bobbyHebb = new Patient().addName(new HumanName().addGiven("Bobby").setFamily("Hebb"));
+ bobbyHebb.getText().setStatus(Narrative.NarrativeStatus.GENERATED);
+ bobbyHebb.getText().setDivAsString("<div>This is the narrative text</div>");
+
// using org.hl7.fhir.instance.model.api.IBaseResource message body for single parameter "resource"
MethodOutcome result = requestBody("direct://RESOURCE", bobbyHebb);
assertNotNull(result, "resource result");
LOG.debug("resource: " + result);
- assertNotNull(result.getOperationOutcome());
- assertTrue(((OperationOutcome) result.getOperationOutcome()).getText().getDivAsString()
+ OperationOutcome operationOutcome = (OperationOutcome) result.getOperationOutcome();
+ assertNotNull(operationOutcome);
+
+ List<OperationOutcome.OperationOutcomeIssueComponent> issue = operationOutcome.getIssue();
+ assertNotNull(issue);
+ assertEquals(1, issue.size());
+ assertTrue(issue.get(0).getDiagnostics()
.contains("No issues detected during validation"));
}
@Test
public void testResourceAsString() throws Exception {
Patient bobbyHebb = new Patient().addName(new HumanName().addGiven("Bobby").setFamily("Hebb"));
+ bobbyHebb.getText().setStatus(Narrative.NarrativeStatus.GENERATED);
+ bobbyHebb.getText().setDivAsString("<div>This is the narrative text</div>");
+
// using org.hl7.fhir.instance.model.api.IBaseResource message body for single parameter "resource"
MethodOutcome result
= requestBody("direct://RESOURCE_AS_STRING", this.fhirContext.newXmlParser().encodeResourceToString(bobbyHebb));
assertNotNull(result, "resource result");
LOG.debug("resource: " + result);
- assertNotNull(result.getOperationOutcome());
- assertTrue(((OperationOutcome) result.getOperationOutcome()).getText().getDivAsString()
+ OperationOutcome operationOutcome = (OperationOutcome) result.getOperationOutcome();
+ assertNotNull(operationOutcome);
+
+ List<OperationOutcome.OperationOutcomeIssueComponent> issue = operationOutcome.getIssue();
+ assertNotNull(issue);
+ assertEquals(1, issue.size());
+ assertTrue(issue.get(0).getDiagnostics()
.contains("No issues detected during validation"));
}
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/PatientProcessor.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/PatientProcessor.java
index 6589f5c..c7f8457 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/PatientProcessor.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/PatientProcessor.java
@@ -20,7 +20,7 @@ import ca.uhn.hl7v2.model.v24.message.ORU_R01;
import ca.uhn.hl7v2.model.v24.segment.PID;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.r4.model.Patient;
/**
* Simple Patient processor that converts the Patient segment of a {@link ORU_R01} message into a FHIR dtsu3
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataFormatTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataFormatTest.java
index d632125..8e9f701 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataFormatTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataFormatTest.java
@@ -26,11 +26,11 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.Address;
-import org.hl7.fhir.dstu3.model.Base;
-import org.hl7.fhir.dstu3.model.HumanName;
-import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.hl7.fhir.r4.model.Address;
+import org.hl7.fhir.r4.model.Base;
+import org.hl7.fhir.r4.model.HumanName;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -94,7 +94,7 @@ public class FhirJsonDataFormatTest {
Exchange exchange = mockEndpoint.getExchanges().get(0);
InputStream inputStream = exchange.getIn().getBody(InputStream.class);
- IBaseResource iBaseResource = FhirContext.forDstu3().newJsonParser().parseResource(new InputStreamReader(inputStream));
+ IBaseResource iBaseResource = FhirContext.forR4().newJsonParser().parseResource(new InputStreamReader(inputStream));
assertTrue(patient.equalsDeep((Base) iBaseResource), "Patients should be equal!");
}
@@ -113,7 +113,7 @@ public class FhirJsonDataFormatTest {
@Override
public void configure() {
from("direct:marshal")
- .marshal().fhirJson("DSTU3")
+ .marshal().fhirJson("R4")
.to("mock:result");
from("direct:unmarshal")
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java
index c6bab37..d423592 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java
@@ -30,7 +30,7 @@ import org.apache.camel.component.fhir.FhirJsonDataFormat;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -58,7 +58,7 @@ public class FhirJsonDataformatErrorHandlerTest {
= "{\"resourceType\":\"Patient\",\"extension\":[ {\"valueDateTime\":\"2011-01-02T11:13:15\"} ]}";
private MockEndpoint mockEndpoint;
- private final FhirContext fhirContext = FhirContext.forDstu3();
+ private final FhirContext fhirContext = FhirContext.forR4();
@Autowired
CamelContext camelContext;
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataFormatTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataFormatTest.java
index 91cc471..348f736 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataFormatTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataFormatTest.java
@@ -26,11 +26,11 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.Address;
-import org.hl7.fhir.dstu3.model.Base;
-import org.hl7.fhir.dstu3.model.HumanName;
-import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.hl7.fhir.r4.model.Address;
+import org.hl7.fhir.r4.model.Base;
+import org.hl7.fhir.r4.model.HumanName;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -95,7 +95,7 @@ public class FhirXmlDataFormatTest {
Exchange exchange = mockEndpoint.getExchanges().get(0);
InputStream inputStream = exchange.getIn().getBody(InputStream.class);
final IBaseResource iBaseResource
- = FhirContext.forDstu3().newXmlParser().parseResource(new InputStreamReader(inputStream));
+ = FhirContext.forR4().newXmlParser().parseResource(new InputStreamReader(inputStream));
assertTrue(patient.equalsDeep((Base) iBaseResource), "Patients should be equal!");
}
diff --git a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataformatErrorHandlerTest.java b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataformatErrorHandlerTest.java
index 506fdf0..f92504f 100644
--- a/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataformatErrorHandlerTest.java
+++ b/components-starter/camel-fhir-starter/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataformatErrorHandlerTest.java
@@ -30,7 +30,7 @@ import org.apache.camel.component.fhir.FhirXmlDataFormat;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -56,7 +56,7 @@ public class FhirXmlDataformatErrorHandlerTest {
private static final String INPUT = "<Patient><active value=\"true\"/><active value=\"false\"/></Patient>";
private MockEndpoint mockEndpoint;
- private final FhirContext fhirContext = FhirContext.forDstu3();
+ private final FhirContext fhirContext = FhirContext.forR4();
@Autowired
CamelContext camelContext;
@Autowired