Skip to content

Commit 4ad7c3c

Browse files
authored
Merge pull request #618 from hapifhir/ja_20231203_hapi_7_0
Update to HAPI FHIR 7.0.0
2 parents 9e21d80 + 7171547 commit 4ad7c3c

18 files changed

+238
-276
lines changed

.github/workflows/smoke-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: docker pull jetbrains/intellij-http-client
3434
- name: Start server with jetty
3535
run: |
36-
mvn -Pjetty jetty:run & export JPA_PROCESS=$!
36+
mvn -P jetty spring-boot:run & export JPA_PROCESS=$!
3737
sleep 80
3838
- name: Execute smoke tests
3939
run: docker run --rm -v $PWD:/workdir --add-host host.docker.internal:host-gateway jetbrains/intellij-http-client -D src/test/smoketest/plain_server.http --env-file src/test/smoketest/http-client.env.json --env default

pom.xml

Lines changed: 56 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@
1414
<parent>
1515
<groupId>ca.uhn.hapi.fhir</groupId>
1616
<artifactId>hapi-fhir</artifactId>
17-
<version>6.10.0</version>
17+
<version>7.0.0</version>
1818
</parent>
1919

2020
<artifactId>hapi-fhir-jpaserver-starter</artifactId>
2121
<packaging>war</packaging>
2222

2323
<properties>
2424
<java.version>11</java.version>
25-
<logback-classic.version>1.2.11</logback-classic.version>
26-
<slf4j-api.version>1.7.25</slf4j-api.version>
2725
</properties>
2826

2927
<prerequisites>
@@ -53,16 +51,7 @@
5351
</dependencyManagement>
5452

5553
<dependencies>
56-
<dependency>
57-
<groupId>org.eclipse.jetty.websocket</groupId>
58-
<artifactId>websocket-jetty-api</artifactId>
59-
<version>${jetty_version}</version>
60-
</dependency>
61-
<dependency>
62-
<groupId>org.eclipse.jetty.websocket</groupId>
63-
<artifactId>websocket-jetty-client</artifactId>
64-
<version>${jetty_version}</version>
65-
</dependency>
54+
6655
<dependency>
6756
<groupId>org.postgresql</groupId>
6857
<artifactId>postgresql</artifactId>
@@ -180,11 +169,15 @@
180169
<groupId>ch.qos.logback</groupId>
181170
<artifactId>logback-classic</artifactId>
182171
</dependency>
172+
<dependency>
173+
<groupId>ch.qos.logback</groupId>
174+
<artifactId>logback-core</artifactId>
175+
</dependency>
183176

184177
<!-- Needed for JEE/Servlet support -->
185178
<dependency>
186-
<groupId>javax.servlet</groupId>
187-
<artifactId>javax.servlet-api</artifactId>
179+
<groupId>jakarta.servlet</groupId>
180+
<artifactId>jakarta.servlet-api</artifactId>
188181
<scope>provided</scope>
189182
</dependency>
190183

@@ -201,6 +194,14 @@
201194
<artifactId>spring-web</artifactId>
202195
</dependency>
203196

197+
<!-- commons-logging is provided by jcl-over-slf4j, and the jar often shows up because of transitive dependencies; this dependency should avoid it -->
198+
<dependency>
199+
<groupId>commons-logging</groupId>
200+
<artifactId>commons-logging</artifactId>
201+
<version>1.2</version>
202+
<scope>provided</scope>
203+
</dependency>
204+
204205
<!-- You may not need this if you are deploying to an application server which provides database connection pools itself. -->
205206
<dependency>
206207
<groupId>org.apache.commons</groupId>
@@ -251,6 +252,12 @@
251252
</dependency>
252253

253254
<!-- The following dependencies are only needed for automated unit tests, you do not neccesarily need them to run the example. -->
255+
<dependency>
256+
<groupId>co.elastic.clients</groupId>
257+
<artifactId>elasticsearch-java</artifactId>
258+
<scope>test</scope>
259+
</dependency>
260+
254261
<dependency>
255262
<groupId>ca.uhn.hapi.fhir</groupId>
256263
<artifactId>hapi-fhir-jpaserver-test-utilities</artifactId>
@@ -263,36 +270,7 @@
263270
</exclusion>
264271
</exclusions>
265272
</dependency>
266-
<dependency>
267-
<groupId>org.eclipse.jetty</groupId>
268-
<artifactId>jetty-servlets</artifactId>
269-
<scope>test</scope>
270-
</dependency>
271-
<dependency>
272-
<groupId>org.eclipse.jetty</groupId>
273-
<artifactId>jetty-servlet</artifactId>
274-
<scope>test</scope>
275-
</dependency>
276-
<dependency>
277-
<groupId>org.eclipse.jetty.websocket</groupId>
278-
<artifactId>websocket-jetty-server</artifactId>
279-
<scope>test</scope>
280-
</dependency>
281-
<dependency>
282-
<groupId>org.eclipse.jetty</groupId>
283-
<artifactId>jetty-server</artifactId>
284-
<scope>test</scope>
285-
</dependency>
286-
<dependency>
287-
<groupId>org.eclipse.jetty</groupId>
288-
<artifactId>jetty-util</artifactId>
289-
<scope>test</scope>
290-
</dependency>
291-
<dependency>
292-
<groupId>org.eclipse.jetty</groupId>
293-
<artifactId>jetty-webapp</artifactId>
294-
<scope>test</scope>
295-
</dependency>
273+
296274
<dependency>
297275
<groupId>org.testcontainers</groupId>
298276
<artifactId>testcontainers</artifactId>
@@ -314,8 +292,8 @@
314292
For some reason JavaDoc crashed during site generation unless we have this dependency
315293
-->
316294
<dependency>
317-
<groupId>javax.interceptor</groupId>
318-
<artifactId>javax.interceptor-api</artifactId>
295+
<groupId>jakarta.interceptor</groupId>
296+
<artifactId>jakarta.interceptor-api</artifactId>
319297
<scope>provided</scope>
320298
</dependency>
321299

@@ -324,6 +302,24 @@
324302
<artifactId>hapi-fhir-test-utilities</artifactId>
325303
<version>${project.version}</version>
326304
<scope>test</scope>
305+
<exclusions>
306+
<exclusion>
307+
<groupId>org.eclipse.jetty.ee10</groupId>
308+
<artifactId>*</artifactId>
309+
</exclusion>
310+
<exclusion>
311+
<groupId>org.eclipse.jetty.ee10.websocket</groupId>
312+
<artifactId>*</artifactId>
313+
</exclusion>
314+
<exclusion>
315+
<groupId>org.eclipse.jetty</groupId>
316+
<artifactId>*</artifactId>
317+
</exclusion>
318+
<exclusion>
319+
<groupId>org.eclipse.jetty.websocket</groupId>
320+
<artifactId>*</artifactId>
321+
</exclusion>
322+
</exclusions>
327323
</dependency>
328324

329325
<dependency>
@@ -369,40 +365,20 @@
369365
<dependency>
370366
<groupId>org.junit.jupiter</groupId>
371367
<artifactId>junit-jupiter-api</artifactId>
372-
<version>5.7.2</version>
373368
<scope>test</scope>
374369
</dependency>
375370
<dependency>
376371
<groupId>org.junit.jupiter</groupId>
377372
<artifactId>junit-jupiter-engine</artifactId>
378-
<version>5.7.2</version>
379373
<scope>test</scope>
380374
</dependency>
381375

382376
<dependency>
383377
<groupId>org.springframework.boot</groupId>
384378
<artifactId>spring-boot-starter-test</artifactId>
385-
<version>${spring_boot_version}</version>
386379
<scope>test</scope>
387380
</dependency>
388381

389-
<dependency>
390-
<groupId>org.slf4j</groupId>
391-
<artifactId>slf4j-api</artifactId>
392-
<version>${slf4j-api.version}</version>
393-
</dependency>
394-
395-
<dependency>
396-
<groupId>ch.qos.logback</groupId>
397-
<artifactId>logback-classic</artifactId>
398-
<version>${logback-classic.version}</version>
399-
</dependency>
400-
<dependency>
401-
<groupId>ch.qos.logback</groupId>
402-
<artifactId>logback-core</artifactId>
403-
<version>${logback-classic.version}</version>
404-
</dependency>
405-
406382
</dependencies>
407383

408384
<build>
@@ -429,6 +405,14 @@
429405
<plugin>
430406
<groupId>org.springframework.boot</groupId>
431407
<artifactId>spring-boot-maven-plugin</artifactId>
408+
<configuration>
409+
<!--
410+
java -jar ROOT.war doesn't work; there is a bug in spring-boot-3.2.0 due to hibernate search,
411+
probably solved in 3.2.1 https://github.com/spring-projects/spring-boot/issues/38585
412+
(at the moment only tomcat works)
413+
-->
414+
<loaderImplementation>CLASSIC</loaderImplementation>
415+
</configuration>
432416
<executions>
433417
<execution>
434418
<goals>
@@ -629,6 +613,11 @@
629613
</exclusion>
630614
</exclusions>
631615
</dependency>
616+
<dependency>
617+
<groupId>org.springframework.boot</groupId>
618+
<artifactId>spring-boot-starter-jetty</artifactId>
619+
<version>${spring_boot_version}</version>
620+
</dependency>
632621
</dependencies>
633622
</profile>
634623
<profile>

src/main/java/ca/uhn/fhir/jpa/starter/Application.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import ca.uhn.fhir.jpa.batch2.JpaBatch2Config;
55
import ca.uhn.fhir.jpa.starter.annotations.OnEitherVersion;
66
import ca.uhn.fhir.jpa.starter.cdshooks.StarterCdsHooksConfig;
7-
import ca.uhn.fhir.jpa.starter.common.FhirTesterConfig;
87
import ca.uhn.fhir.jpa.starter.cr.StarterCrDstu3Config;
98
import ca.uhn.fhir.jpa.starter.cr.StarterCrR4Config;
109
import ca.uhn.fhir.jpa.starter.mdm.MdmConfig;
@@ -19,15 +18,12 @@
1918
import org.springframework.boot.autoconfigure.SpringBootApplication;
2019
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration;
2120
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
22-
import org.springframework.boot.builder.SpringApplicationBuilder;
2321
import org.springframework.boot.web.servlet.ServletComponentScan;
2422
import org.springframework.boot.web.servlet.ServletRegistrationBean;
2523
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
2624
import org.springframework.context.annotation.Bean;
2725
import org.springframework.context.annotation.Conditional;
2826
import org.springframework.context.annotation.Import;
29-
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
30-
import org.springframework.web.servlet.DispatcherServlet;
3127

3228
@ServletComponentScan(basePackageClasses = {RestfulServer.class})
3329
@SpringBootApplication(exclude = {ElasticsearchRestClientAutoConfiguration.class, ThymeleafAutoConfiguration.class})

src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/CdsHooksServlet.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919

2020
import java.io.IOException;
2121
import java.util.stream.Collectors;
22-
import javax.servlet.ServletException;
23-
import javax.servlet.http.HttpServlet;
24-
import javax.servlet.http.HttpServletRequest;
25-
import javax.servlet.http.HttpServletResponse;
22+
import jakarta.servlet.ServletException;
23+
import jakarta.servlet.http.HttpServlet;
24+
import jakarta.servlet.http.HttpServletRequest;
25+
import jakarta.servlet.http.HttpServletResponse;
2626

2727
import static ca.uhn.hapi.fhir.cdshooks.config.CdsHooksConfig.CDS_HOOKS_OBJECT_MAPPER_FACTORY;
2828

src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/ErrorHandling.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import java.io.PrintWriter;
88
import java.io.StringWriter;
99
import java.util.Arrays;
10-
import javax.servlet.http.HttpServletResponse;
10+
import jakarta.servlet.http.HttpServletResponse;
1111

1212
public class ErrorHandling {
1313

src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
import ca.uhn.fhir.validation.IValidatorModule;
6363
import ca.uhn.fhir.validation.ResultSeverityEnum;
6464
import com.google.common.base.Strings;
65+
import jakarta.persistence.EntityManagerFactory;
6566
import org.hl7.fhir.common.hapi.validation.support.CachingValidationSupport;
6667
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
6768
import org.springframework.beans.factory.annotation.Autowired;
@@ -76,7 +77,6 @@
7677
import org.springframework.web.cors.CorsConfiguration;
7778

7879
import java.util.*;
79-
import javax.persistence.EntityManagerFactory;
8080
import javax.sql.DataSource;
8181

8282
import static ca.uhn.fhir.jpa.starter.common.validation.IRepositoryValidationInterceptorFactory.ENABLE_REPOSITORY_VALIDATING_INTERCEPTOR;
@@ -133,11 +133,11 @@ public ResourceCountCache resourceCountsCache(IFhirSystemDao<?, ?> theSystemDao)
133133
@Primary
134134
@Bean
135135
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
136-
DataSource myDataSource,
137-
ConfigurableListableBeanFactory myConfigurableListableBeanFactory,
138-
FhirContext theFhirContext) {
136+
DataSource myDataSource,
137+
ConfigurableListableBeanFactory myConfigurableListableBeanFactory,
138+
FhirContext theFhirContext, JpaStorageSettings theStorageSettings) {
139139
LocalContainerEntityManagerFactoryBean retVal =
140-
HapiEntityManagerFactoryUtil.newEntityManagerFactory(myConfigurableListableBeanFactory, theFhirContext);
140+
HapiEntityManagerFactoryUtil.newEntityManagerFactory(myConfigurableListableBeanFactory, theFhirContext, theStorageSettings);
141141
retVal.setPersistenceUnitName("HAPI_PU");
142142

143143
try {

src/test/java/ca/uhn/fhir/jpa/starter/CustomBeanTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import org.springframework.beans.factory.annotation.Autowired;
66
import org.springframework.boot.test.context.SpringBootTest;
77

8-
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = {
8+
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = {
99
"hapi.fhir.custom-bean-packages=some.custom.pkg1,some.custom.pkg2",
1010
"spring.datasource.url=jdbc:h2:mem:dbr4",
1111
"hapi.fhir.enable_repository_validating_interceptor=true",

src/test/java/ca/uhn/fhir/jpa/starter/CustomInterceptorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import ca.uhn.fhir.rest.client.api.IGenericClient;
1414
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
1515

16-
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = {
16+
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = {
1717
"hapi.fhir.custom-bean-packages=some.custom.pkg1",
1818
"hapi.fhir.custom-interceptor-classes=some.custom.pkg1.CustomInterceptorBean,some.custom.pkg1.CustomInterceptorPojo",
1919
"spring.datasource.url=jdbc:h2:mem:dbr4",

src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
import java.util.Date;
1515
import java.util.GregorianCalendar;
1616
import java.util.List;
17-
import javax.annotation.PreDestroy;
1817

18+
import co.elastic.clients.elasticsearch.ElasticsearchClient;
19+
import co.elastic.clients.json.JsonData;
20+
import jakarta.annotation.PreDestroy;
1921
import org.elasticsearch.client.RequestOptions;
20-
import org.elasticsearch.client.RestHighLevelClient;
21-
import org.elasticsearch.client.indices.PutIndexTemplateRequest;
22-
import org.elasticsearch.common.settings.Settings;
2322
import org.hl7.fhir.instance.model.api.IIdType;
2423
import org.hl7.fhir.r4.model.Bundle;
2524
import org.hl7.fhir.r4.model.DateTimeType;
@@ -30,13 +29,11 @@
3029
import org.hl7.fhir.r4.model.StringType;
3130
import org.junit.jupiter.api.BeforeAll;
3231
import org.junit.jupiter.api.BeforeEach;
33-
import org.junit.jupiter.api.Test;
3432
import org.junit.jupiter.api.extension.ExtendWith;
3533
import org.springframework.beans.factory.annotation.Autowired;
36-
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
3734
import org.springframework.boot.test.context.SpringBootTest;
3835
import org.springframework.boot.test.util.TestPropertyValues;
39-
import org.springframework.boot.web.server.LocalServerPort;
36+
import org.springframework.boot.test.web.server.LocalServerPort;
4037
import org.springframework.context.ApplicationContextInitializer;
4138
import org.springframework.context.ConfigurableApplicationContext;
4239
import org.springframework.test.context.ContextConfiguration;
@@ -47,7 +44,7 @@
4744

4845
@ExtendWith(SpringExtension.class)
4946
@Testcontainers
50-
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties =
47+
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties =
5148
{
5249
"spring.datasource.url=jdbc:h2:mem:dbr4",
5350
"hapi.fhir.fhir_version=r4",
@@ -83,19 +80,20 @@ public class ElasticsearchLastNR4IT {
8380
@BeforeAll
8481
public static void beforeClass() throws IOException {
8582
//Given
86-
RestHighLevelClient elasticsearchHighLevelRestClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient(
83+
ElasticsearchClient elasticsearchHighLevelRestClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient(
8784
"http", embeddedElastic.getHost() + ":" + embeddedElastic.getMappedPort(9200), "", "");
8885

8986
/* As of 2023-08-10, HAPI FHIR sets SubscriptionConstants.MAX_SUBSCRIPTION_RESULTS to 50000
9087
which is in excess of elastic's default max_result_window. If MAX_SUBSCRIPTION_RESULTS is changed
9188
to a value <= 10000, the following will no longer be necessary. - dotasek
9289
*/
93-
PutIndexTemplateRequest putIndexTemplateRequest = new PutIndexTemplateRequest("hapi_fhir_template");
94-
putIndexTemplateRequest.patterns(List.of("*"));
95-
Settings settings = Settings.builder().put("index.max_result_window", 50000).build();
96-
putIndexTemplateRequest.settings(settings);
97-
elasticsearchHighLevelRestClient.indices().putTemplate(putIndexTemplateRequest, RequestOptions.DEFAULT);
9890

91+
elasticsearchHighLevelRestClient.indices().putTemplate(t->{
92+
t.name("hapi_fhir_template");
93+
t.indexPatterns("*");
94+
t.settings("index.max_result_window", JsonData.of(50000));
95+
return t;
96+
});
9997

10098
}
10199

0 commit comments

Comments
 (0)