Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.8.x] Fix paths to FHIR DSTU_2_1 & DSTU3 properties files #6459

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions extensions/fhir/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ public Map<String, String> start() {
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();
Expand Down Expand Up @@ -127,7 +133,7 @@ public String getContextPath() {
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);
}
Expand Down
Loading