Skip to content

Commit

Permalink
Fix paths to FHIR DSTU_2_1 & DSTU3 properties files
Browse files Browse the repository at this point in the history
Fixes #6441
  • Loading branch information
jamesnetherton committed Sep 9, 2024
1 parent 5e68c56 commit 75b08c9
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 3 deletions.
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

0 comments on commit 75b08c9

Please sign in to comment.