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 2024/09/09 18:23:56 UTC
(camel-quarkus) branch main updated: Fix paths to FHIR DSTU_2_1 & DSTU3 properties files
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 75b08c9d5e Fix paths to FHIR DSTU_2_1 & DSTU3 properties files
75b08c9d5e is described below
commit 75b08c9d5e366ad83ef0432ae5e4f657ac165d26
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Sep 9 17:00:28 2024 +0100
Fix paths to FHIR DSTU_2_1 & DSTU3 properties files
Fixes #6441
---
extensions/fhir/deployment/pom.xml | 6 +++
.../deployment/dstu2_1/FhirDstu2_1Processor.java | 2 +-
.../fhir/deployment/dstu3/FhirDstu3Processor.java | 2 +-
.../component/fhir/FhirConfigurationTest.java | 53 ++++++++++++++++++++++
.../component/fhir/it/FhirTestResource.java | 8 +++-
5 files changed, 68 insertions(+), 3 deletions(-)
diff --git a/extensions/fhir/deployment/pom.xml b/extensions/fhir/deployment/pom.xml
index 05598a5e41..12926b9214 100644
--- a/extensions/fhir/deployment/pom.xml
+++ b/extensions/fhir/deployment/pom.xml
@@ -50,6 +50,12 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-fhir</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5-internal</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/extensions/fhir/deployment/src/main/java/org/apache/camel/quarkus/component/fhir/deployment/dstu2_1/FhirDstu2_1Processor.java b/extensions/fhir/deployment/src/main/java/org/apache/camel/quarkus/component/fhir/deployment/dstu2_1/FhirDstu2_1Processor.java
index 2c340858bd..ed34dfa6a9 100644
--- a/extensions/fhir/deployment/src/main/java/org/apache/camel/quarkus/component/fhir/deployment/dstu2_1/FhirDstu2_1Processor.java
+++ b/extensions/fhir/deployment/src/main/java/org/apache/camel/quarkus/component/fhir/deployment/dstu2_1/FhirDstu2_1Processor.java
@@ -43,7 +43,7 @@ import static org.apache.camel.quarkus.component.fhir.deployment.FhirUtil.getRes
public class FhirDstu2_1Processor {
- private static final String FHIR_VERSION_PROPERTIES = "org/hl7/fhir/dstu2016may/model/fhirversion.properties";
+ private static final String FHIR_VERSION_PROPERTIES = "org/hl7/fhir/dstu2016may/hapi/model/fhirversion.properties";
@BuildStep(onlyIf = FhirFlags.Dstu2_1Enabled.class)
Dstu2_1PropertiesBuildItem fhirProperties() {
diff --git a/extensions/fhir/deployment/src/main/java/org/apache/camel/quarkus/component/fhir/deployment/dstu3/FhirDstu3Processor.java b/extensions/fhir/deployment/src/main/java/org/apache/camel/quarkus/component/fhir/deployment/dstu3/FhirDstu3Processor.java
index ba7d0ae8c1..d9e9384108 100644
--- a/extensions/fhir/deployment/src/main/java/org/apache/camel/quarkus/component/fhir/deployment/dstu3/FhirDstu3Processor.java
+++ b/extensions/fhir/deployment/src/main/java/org/apache/camel/quarkus/component/fhir/deployment/dstu3/FhirDstu3Processor.java
@@ -43,7 +43,7 @@ import static org.apache.camel.quarkus.component.fhir.deployment.FhirUtil.getMod
import static org.apache.camel.quarkus.component.fhir.deployment.FhirUtil.getResourceDefinitions;
public class FhirDstu3Processor {
- private static final String FHIR_VERSION_PROPERTIES = "org/hl7/fhir/dstu3/model/fhirversion.properties";
+ private static final String FHIR_VERSION_PROPERTIES = "org/hl7/fhir/dstu3/hapi/model/fhirversion.properties";
@BuildStep(onlyIf = FhirFlags.Dstu3Enabled.class)
Dstu3PropertiesBuildItem fhirProperties() {
diff --git a/extensions/fhir/deployment/src/test/java/org/apache/camel/quarkus/component/fhir/FhirConfigurationTest.java b/extensions/fhir/deployment/src/test/java/org/apache/camel/quarkus/component/fhir/FhirConfigurationTest.java
new file mode 100644
index 0000000000..e8a72100df
--- /dev/null
+++ b/extensions/fhir/deployment/src/test/java/org/apache/camel/quarkus/component/fhir/FhirConfigurationTest.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.fhir;
+
+import io.quarkus.arc.Arc;
+import io.quarkus.arc.InjectableBean;
+import io.quarkus.test.QuarkusUnitTest;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+class FhirConfigurationTest {
+
+ @RegisterExtension
+ static final QuarkusUnitTest CONFIG = new QuarkusUnitTest()
+ .overrideConfigKey("quarkus.camel.fhir.enable-dstu2", "true")
+ .overrideConfigKey("quarkus.camel.fhir.enable-dstu2_hl7org", "true")
+ .overrideConfigKey("quarkus.camel.fhir.enable-dstu2_1", "true")
+ .overrideConfigKey("quarkus.camel.fhir.enable-dstu3", "true")
+ .overrideConfigKey("quarkus.camel.fhir.enable-r4", "true")
+ .overrideConfigKey("quarkus.camel.fhir.enable-r5", "true")
+ .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class));
+
+ @Test
+ void allModelsEnabled() {
+ Assertions.assertNotNull(getFhirContextBean("DSTU2"));
+ Assertions.assertNotNull(getFhirContextBean("DSTU2_1"));
+ Assertions.assertNotNull(getFhirContextBean("DSTU2_HL7ORG"));
+ Assertions.assertNotNull(getFhirContextBean("DSTU3"));
+ Assertions.assertNotNull(getFhirContextBean("R4"));
+ Assertions.assertNotNull(getFhirContextBean("R5"));
+ }
+
+ private InjectableBean<?> getFhirContextBean(String beanName) {
+ return Arc.container().namedBean(beanName);
+ }
+}
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 39db3174f5..670d6fb599 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
@@ -56,6 +56,12 @@ public class FhirTestResource implements QuarkusTestResourceLifecycleManager {
return Collections.emptyMap();
}
+ if (this.fhirVersion.equals(FhirVersion.DSTU2_1)) {
+ // TODO: https://github.com/hapifhir/hapi-fhir-jpaserver-starter/issues/335
+ // Return a fictional host to allow the application to start, which allows a minimal check that native mode can work
+ return Map.of(String.format("camel.fhir.%s.test-url", fhirVersion.simpleVersion()), "http://localhost:8080");
+ }
+
try {
LOGGER.info("FHIR version {} is enabled. Starting hapi test container for it.", fhirVersion.simpleVersion());
String imageName = fhirVersion.getContainerImageName();
@@ -127,7 +133,7 @@ public class FhirTestResource implements QuarkusTestResourceLifecycleManager {
public String getContainerImageName() {
String imageProperty = "fhir.container.image";
if (name().contains("DSTU")) {
- imageProperty = "fhir-dstu.container-image";
+ imageProperty = "fhir-dstu.container.image";
}
return ConfigProvider.getConfig().getValue(imageProperty, String.class);
}