From 0133663fbccf9f234c4013fcc03ee64f49425b76 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Sun, 3 Dec 2023 14:23:05 -0500 Subject: [PATCH 01/15] Update to HAPI FHIR 7.0.0 Draft --- pom.xml | 129 ++++++++---- .../ca/uhn/fhir/jpa/starter/Application.java | 7 + .../jpa/starter/cdshooks/CdsHooksServlet.java | 8 +- .../jpa/starter/cdshooks/ErrorHandling.java | 2 +- .../jpa/starter/common/StarterJpaConfig.java | 10 +- .../jpa/starter/ElasticsearchLastNR4IT.java | 24 ++- .../jpa/starter/ExampleServerDstu2IT.java | 3 +- .../jpa/starter/ExampleServerDstu3IT.java | 28 +-- .../fhir/jpa/starter/ExampleServerR4BIT.java | 2 +- .../fhir/jpa/starter/ExampleServerR4IT.java | 186 ++++++++++-------- .../fhir/jpa/starter/ExampleServerR5IT.java | 31 +-- .../jpa/starter/MultitenantServerR4IT.java | 2 +- .../jpa/starter/SocketImplementation.java | 18 +- src/test/resources/application.yaml | 17 +- 14 files changed, 270 insertions(+), 197 deletions(-) diff --git a/pom.xml b/pom.xml index f750d54b05c..89377c904ac 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.10.0 + 6.11.5-SNAPSHOT hapi-fhir-jpaserver-starter @@ -22,8 +22,7 @@ 11 - 1.2.11 - 1.7.25 + 11.0.18 @@ -53,16 +52,7 @@ - - org.eclipse.jetty.websocket - websocket-jetty-api - ${jetty_version} - - - org.eclipse.jetty.websocket - websocket-jetty-client - ${jetty_version} - + org.postgresql postgresql @@ -180,11 +170,15 @@ ch.qos.logback logback-classic + + ch.qos.logback + logback-core + - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api provided @@ -252,47 +246,103 @@ - ca.uhn.hapi.fhir - hapi-fhir-jpaserver-test-utilities - ${project.version} + co.elastic.clients + elasticsearch-java test - - - com.sun.xml.bind - jaxb-impl - - + org.eclipse.jetty jetty-servlets + ${jetty_11_version} test org.eclipse.jetty jetty-servlet + ${jetty_11_version} + test + + + org.eclipse.jetty + jetty-http + ${jetty_11_version} + test + + + org.eclipse.jetty + jetty-io + ${jetty_11_version} + test + + + org.eclipse.jetty + jetty-security + ${jetty_11_version} + test + + + org.eclipse.jetty + jetty-xml + ${jetty_11_version} test org.eclipse.jetty.websocket websocket-jetty-server + ${jetty_11_version} + test + + + org.eclipse.jetty.websocket + websocket-jetty-api + ${jetty_11_version} + test + + + org.eclipse.jetty.websocket + websocket-jetty-client + ${jetty_11_version} + test + + + org.eclipse.jetty.websocket + websocket-core-client + ${jetty_11_version} test org.eclipse.jetty jetty-server + ${jetty_11_version} test org.eclipse.jetty jetty-util + ${jetty_11_version} test org.eclipse.jetty jetty-webapp + ${jetty_11_version} test + + + ca.uhn.hapi.fhir + hapi-fhir-jpaserver-test-utilities + ${project.version} + test + + + com.sun.xml.bind + jaxb-impl + + + + org.testcontainers testcontainers @@ -314,8 +364,8 @@ For some reason JavaDoc crashed during site generation unless we have this dependency --> - javax.interceptor - javax.interceptor-api + jakarta.interceptor + jakarta.interceptor-api provided @@ -324,6 +374,16 @@ hapi-fhir-test-utilities ${project.version} test + + + org.eclipse.jetty.ee10 + * + + + org.eclipse.jetty + * + + @@ -386,23 +446,6 @@ test - - org.slf4j - slf4j-api - ${slf4j-api.version} - - - - ch.qos.logback - logback-classic - ${logback-classic.version} - - - ch.qos.logback - logback-core - ${logback-classic.version} - - diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/Application.java b/src/main/java/ca/uhn/fhir/jpa/starter/Application.java index 9131f8dc9ef..d7527765b66 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/Application.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/Application.java @@ -20,8 +20,10 @@ import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration; import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.boot.web.servlet.server.ServletWebServerFactory; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; @@ -91,6 +93,11 @@ public ServletRegistrationBean overlayRegistrationBean() { return registrationBean; } + @Bean + public ServletWebServerFactory servletWebServerFactory() { + return new JettyServletWebServerFactory(); + } + // @Bean // IRepositoryFactory repositoryFactory(DaoRegistry theDaoRegistry, RestfulServer theRestfulServer) { // return rd -> new HapiFhirRepository(theDaoRegistry, rd, theRestfulServer); diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/CdsHooksServlet.java b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/CdsHooksServlet.java index 5849ec528e6..9b3bf42fbff 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/CdsHooksServlet.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/CdsHooksServlet.java @@ -19,10 +19,10 @@ import java.io.IOException; import java.util.stream.Collectors; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import static ca.uhn.hapi.fhir.cdshooks.config.CdsHooksConfig.CDS_HOOKS_OBJECT_MAPPER_FACTORY; diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/ErrorHandling.java b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/ErrorHandling.java index 38e8d7b4760..bbdaa43470c 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/ErrorHandling.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/ErrorHandling.java @@ -7,7 +7,7 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.util.Arrays; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; public class ErrorHandling { diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java b/src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java index cc8eb187f08..1613e3f1e10 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java @@ -61,6 +61,7 @@ import ca.uhn.fhir.validation.IValidatorModule; import ca.uhn.fhir.validation.ResultSeverityEnum; import com.google.common.base.Strings; +import jakarta.persistence.EntityManagerFactory; import org.hl7.fhir.common.hapi.validation.support.CachingValidationSupport; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; @@ -75,7 +76,6 @@ import org.springframework.web.cors.CorsConfiguration; import java.util.*; -import javax.persistence.EntityManagerFactory; import javax.sql.DataSource; import static ca.uhn.fhir.jpa.starter.common.validation.IRepositoryValidationInterceptorFactory.ENABLE_REPOSITORY_VALIDATING_INTERCEPTOR; @@ -132,11 +132,11 @@ public ResourceCountCache resourceCountsCache(IFhirSystemDao theSystemDao) @Primary @Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory( - DataSource myDataSource, - ConfigurableListableBeanFactory myConfigurableListableBeanFactory, - FhirContext theFhirContext) { + DataSource myDataSource, + ConfigurableListableBeanFactory myConfigurableListableBeanFactory, + FhirContext theFhirContext, JpaStorageSettings theStorageSettings) { LocalContainerEntityManagerFactoryBean retVal = - HapiEntityManagerFactoryUtil.newEntityManagerFactory(myConfigurableListableBeanFactory, theFhirContext); + HapiEntityManagerFactoryUtil.newEntityManagerFactory(myConfigurableListableBeanFactory, theFhirContext, theStorageSettings); retVal.setPersistenceUnitName("HAPI_PU"); try { diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java index 7ab7989f052..c12f531170c 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java @@ -14,12 +14,11 @@ import java.util.Date; import java.util.GregorianCalendar; import java.util.List; -import javax.annotation.PreDestroy; +import co.elastic.clients.elasticsearch.ElasticsearchClient; +import co.elastic.clients.json.JsonData; +import jakarta.annotation.PreDestroy; import org.elasticsearch.client.RequestOptions; -import org.elasticsearch.client.RestHighLevelClient; -import org.elasticsearch.client.indices.PutIndexTemplateRequest; -import org.elasticsearch.common.settings.Settings; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.DateTimeType; @@ -30,13 +29,11 @@ import org.hl7.fhir.r4.model.StringType; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.util.TestPropertyValues; -import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.test.context.ContextConfiguration; @@ -83,19 +80,20 @@ public class ElasticsearchLastNR4IT { @BeforeAll public static void beforeClass() throws IOException { //Given - RestHighLevelClient elasticsearchHighLevelRestClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient( + ElasticsearchClient elasticsearchHighLevelRestClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient( "http", embeddedElastic.getHost() + ":" + embeddedElastic.getMappedPort(9200), "", ""); /* As of 2023-08-10, HAPI FHIR sets SubscriptionConstants.MAX_SUBSCRIPTION_RESULTS to 50000 which is in excess of elastic's default max_result_window. If MAX_SUBSCRIPTION_RESULTS is changed to a value <= 10000, the following will no longer be necessary. - dotasek */ - PutIndexTemplateRequest putIndexTemplateRequest = new PutIndexTemplateRequest("hapi_fhir_template"); - putIndexTemplateRequest.patterns(List.of("*")); - Settings settings = Settings.builder().put("index.max_result_window", 50000).build(); - putIndexTemplateRequest.settings(settings); - elasticsearchHighLevelRestClient.indices().putTemplate(putIndexTemplateRequest, RequestOptions.DEFAULT); + elasticsearchHighLevelRestClient.indices().putTemplate(t->{ + t.name("hapi_fhir_template"); + t.indexPatterns("*"); + t.settings("index.max_result_window", JsonData.of(50000)); + return t; + }); } diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java index bc88d47ce98..e65d52f64c6 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java @@ -10,8 +10,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.test.annotation.DirtiesContext; +import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java index 086b7993281..6c71b7100e6 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java @@ -10,20 +10,20 @@ import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; +import jakarta.websocket.ContainerProvider; +import jakarta.websocket.Session; +import jakarta.websocket.WebSocketContainer; import org.apache.commons.io.FileUtils; -import org.eclipse.jetty.websocket.api.Session; -import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; -import org.eclipse.jetty.websocket.client.WebSocketClient; import org.hl7.fhir.dstu3.model.*; import org.hl7.fhir.instance.model.api.IIdType; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.core.io.ClassPathResource; -import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringExtension; import java.io.File; @@ -164,6 +164,7 @@ private Bundle loadBundle(String theLocation, FhirContext theCtx, IGenericClient } @Test + @Disabled void testWebsocketSubscription() throws Exception { /* * Create subscription @@ -188,17 +189,16 @@ void testWebsocketSubscription() throws Exception { * Attach websocket */ - WebSocketClient myWebSocketClient = new WebSocketClient(); - SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(), EncodingEnum.JSON); + SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(), + EncodingEnum.JSON); - myWebSocketClient.start(); - URI echoUri = new URI("ws://localhost:" + port + "/websocket"); - ClientUpgradeRequest request = new ClientUpgradeRequest(); - ourLog.info("Connecting to : {}", echoUri); - Future connection = myWebSocketClient.connect(mySocketImplementation, echoUri, request); - Session session = connection.get(2, TimeUnit.SECONDS); + URI echoUri = new URI("ws://localhost:" + port + "/websocket"); - ourLog.info("Connected to WS: {}", session.isOpen()); + WebSocketContainer container = ContainerProvider.getWebSocketContainer(); + + ourLog.info("Connecting to : {}", echoUri); + Session session = container.connectToServer(mySocketImplementation, echoUri); + ourLog.info("Connected to WS: {}", session.isOpen()); /* * Create a matching resource diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java index 82e48a36487..be499496ed5 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.boot.test.web.server.LocalServerPort; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java index b41eed59e58..6db67b8ee9a 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java @@ -1,39 +1,51 @@ package ca.uhn.fhir.jpa.starter; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.cr.config.RepositoryConfig; import ca.uhn.fhir.jpa.searchparam.config.NicknameServiceConfig; import ca.uhn.fhir.jpa.starter.cr.CrProperties; +import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.api.CacheControlDirective; import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; -import org.eclipse.jetty.websocket.api.Session; -import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; -import org.eclipse.jetty.websocket.client.WebSocketClient; +import jakarta.websocket.ContainerProvider; +import jakarta.websocket.Session; +import jakarta.websocket.WebSocketContainer; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.r4.model.*; import org.hl7.fhir.instance.model.api.IIdType; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.DateType; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Measure; +import org.hl7.fhir.r4.model.MeasureReport; +import org.hl7.fhir.r4.model.Observation; +import org.hl7.fhir.r4.model.Parameters; +import org.hl7.fhir.r4.model.Patient; +import org.hl7.fhir.r4.model.Period; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Subscription; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.LocalServerPort; - +import org.springframework.boot.test.web.server.LocalServerPort; import java.io.IOException; import java.net.URI; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import static ca.uhn.fhir.util.TestUtil.waitForSize; import static org.awaitility.Awaitility.await; -import static org.junit.jupiter.api.Assertions.*; +import static org.hamcrest.Matchers.equalTo; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.opencds.cqf.fhir.utility.r4.Parameters.parameters; import static org.opencds.cqf.fhir.utility.r4.Parameters.stringPart; @@ -46,27 +58,28 @@ RepositoryConfig.class }, properties = { "spring.profiles.include=storageSettingsTest", - "spring.datasource.url=jdbc:h2:mem:dbr4", - "hapi.fhir.enable_repository_validating_interceptor=true", - "hapi.fhir.fhir_version=r4", - //"hapi.fhir.subscription.websocket_enabled=true", - //"hapi.fhir.mdm_enabled=true", - "hapi.fhir.cr.enabled=true", - "hapi.fhir.cr.caregaps_section_author=Organization/alphora-author", - "hapi.fhir.cr.caregaps_reporter=Organization/alphora", - "hapi.fhir.implementationguides.dk-core.name=hl7.fhir.dk.core", - "hapi.fhir.implementationguides.dk-core.version=1.1.0", - "hapi.fhir.auto_create_placeholder_reference_targets=true", - // Override is currently required when using MDM as the construction of the MDM - // beans are ambiguous as they are constructed multiple places. This is evident - // when running in a spring boot environment - "spring.main.allow-bean-definition-overriding=true" }) -class ExampleServerR4IT implements IServerSupport{ + "spring.datasource.url=jdbc:h2:mem:dbr4", + "hapi.fhir.enable_repository_validating_interceptor=true", + "hapi.fhir.fhir_version=r4", + //"hapi.fhir.subscription.websocket_enabled=true", + //"hapi.fhir.mdm_enabled=true", + "hapi.fhir.cr.enabled=true", + "hapi.fhir.cr.caregaps_section_author=Organization/alphora-author", + "hapi.fhir.cr.caregaps_reporter=Organization/alphora", + "hapi.fhir.implementationguides.dk-core.name=hl7.fhir.dk.core", + "hapi.fhir.implementationguides.dk-core.version=1.1.0", + "hapi.fhir.auto_create_placeholder_reference_targets=true", + // Override is currently required when using MDM as the construction of the MDM + // beans are ambiguous as they are constructed multiple places. This is evident + // when running in a spring boot environment + "spring.main.allow-bean-definition-overriding=true"}) +class ExampleServerR4IT implements IServerSupport { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerR4IT.class); private IGenericClient ourClient; private FhirContext ourCtx; - @Autowired private CrProperties crProperties; + @Autowired + private CrProperties crProperties; @LocalServerPort private int port; @@ -127,7 +140,7 @@ private org.hl7.fhir.r4.model.Bundle loadBundle(String theLocation, FhirContext return result; } - public Parameters runCqlExecution(Parameters parameters){ + public Parameters runCqlExecution(Parameters parameters) { var results = ourClient.operation().onServer() .named("$cql") @@ -135,6 +148,7 @@ public Parameters runCqlExecution(Parameters parameters){ .execute(); return results; } + @Test void testSimpleDateCqlExecutionProvider() { Parameters params = parameters(stringPart("expression", "Interval[Today() - 2 years, Today())")); @@ -148,61 +162,63 @@ private IBaseResource loadRec(String theLocation, FhirContext theCtx, IGenericCl IBaseResource resource = (IBaseResource) theCtx.newJsonParser().parseResource(json); resList.add(resource); var result = theClient.transaction().withResources(resList).execute(); - //.withResources(resource).execute(); + //.withResources(resource).execute(); return result.get(0); } + @Test void testBatchPutWithIdenticalTags() { String batchPuts = "{\n" + - "\t\"resourceType\": \"Bundle\",\n" + - "\t\"id\": \"patients\",\n" + - "\t\"type\": \"batch\",\n" + - "\t\"entry\": [\n" + - "\t\t{\n" + - "\t\t\t\"request\": {\n" + - "\t\t\t\t\"method\": \"PUT\",\n" + - "\t\t\t\t\"url\": \"Patient/pat-1\"\n" + - "\t\t\t},\n" + - "\t\t\t\"resource\": {\n" + - "\t\t\t\t\"resourceType\": \"Patient\",\n" + - "\t\t\t\t\"id\": \"pat-1\",\n" + - "\t\t\t\t\"meta\": {\n" + - "\t\t\t\t\t\"tag\": [\n" + - "\t\t\t\t\t\t{\n" + - "\t\t\t\t\t\t\t\"system\": \"http://mysystem.org\",\n" + - "\t\t\t\t\t\t\t\"code\": \"value2\"\n" + - "\t\t\t\t\t\t}\n" + - "\t\t\t\t\t]\n" + - "\t\t\t\t}\n" + - "\t\t\t},\n" + - "\t\t\t\"fullUrl\": \"/Patient/pat-1\"\n" + - "\t\t},\n" + - "\t\t{\n" + - "\t\t\t\"request\": {\n" + - "\t\t\t\t\"method\": \"PUT\",\n" + - "\t\t\t\t\"url\": \"Patient/pat-2\"\n" + - "\t\t\t},\n" + - "\t\t\t\"resource\": {\n" + - "\t\t\t\t\"resourceType\": \"Patient\",\n" + - "\t\t\t\t\"id\": \"pat-2\",\n" + - "\t\t\t\t\"meta\": {\n" + - "\t\t\t\t\t\"tag\": [\n" + - "\t\t\t\t\t\t{\n" + - "\t\t\t\t\t\t\t\"system\": \"http://mysystem.org\",\n" + - "\t\t\t\t\t\t\t\"code\": \"value2\"\n" + - "\t\t\t\t\t\t}\n" + - "\t\t\t\t\t]\n" + - "\t\t\t\t}\n" + - "\t\t\t},\n" + - "\t\t\t\"fullUrl\": \"/Patient/pat-2\"\n" + - "\t\t}\n" + - "\t]\n" + - "}"; + "\t\"resourceType\": \"Bundle\",\n" + + "\t\"id\": \"patients\",\n" + + "\t\"type\": \"batch\",\n" + + "\t\"entry\": [\n" + + "\t\t{\n" + + "\t\t\t\"request\": {\n" + + "\t\t\t\t\"method\": \"PUT\",\n" + + "\t\t\t\t\"url\": \"Patient/pat-1\"\n" + + "\t\t\t},\n" + + "\t\t\t\"resource\": {\n" + + "\t\t\t\t\"resourceType\": \"Patient\",\n" + + "\t\t\t\t\"id\": \"pat-1\",\n" + + "\t\t\t\t\"meta\": {\n" + + "\t\t\t\t\t\"tag\": [\n" + + "\t\t\t\t\t\t{\n" + + "\t\t\t\t\t\t\t\"system\": \"http://mysystem.org\",\n" + + "\t\t\t\t\t\t\t\"code\": \"value2\"\n" + + "\t\t\t\t\t\t}\n" + + "\t\t\t\t\t]\n" + + "\t\t\t\t}\n" + + "\t\t\t},\n" + + "\t\t\t\"fullUrl\": \"/Patient/pat-1\"\n" + + "\t\t},\n" + + "\t\t{\n" + + "\t\t\t\"request\": {\n" + + "\t\t\t\t\"method\": \"PUT\",\n" + + "\t\t\t\t\"url\": \"Patient/pat-2\"\n" + + "\t\t\t},\n" + + "\t\t\t\"resource\": {\n" + + "\t\t\t\t\"resourceType\": \"Patient\",\n" + + "\t\t\t\t\"id\": \"pat-2\",\n" + + "\t\t\t\t\"meta\": {\n" + + "\t\t\t\t\t\"tag\": [\n" + + "\t\t\t\t\t\t{\n" + + "\t\t\t\t\t\t\t\"system\": \"http://mysystem.org\",\n" + + "\t\t\t\t\t\t\t\"code\": \"value2\"\n" + + "\t\t\t\t\t\t}\n" + + "\t\t\t\t\t]\n" + + "\t\t\t\t}\n" + + "\t\t\t},\n" + + "\t\t\t\"fullUrl\": \"/Patient/pat-2\"\n" + + "\t\t}\n" + + "\t]\n" + + "}"; Bundle bundle = FhirContext.forR4().newJsonParser().parseResource(Bundle.class, batchPuts); ourClient.transaction().withBundle(bundle).execute(); } - //@Test + @Disabled + @Test @Order(1) void testWebsocketSubscription() throws Exception { /* @@ -218,27 +234,27 @@ void testWebsocketSubscription() throws Exception { channel.setPayload("application/json"); subscription.setChannel(channel); + int initialActiveSubscriptionCount = activeSubscriptionCount(); + MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute(); IIdType mySubscriptionId = methodOutcome.getId(); // Wait for the subscription to be activated - await().atMost(1, TimeUnit.MINUTES).until(() -> activeSubscriptionCount() == 3); + await().atMost(1, TimeUnit.MINUTES).until(()->activeSubscriptionCount(), equalTo(initialActiveSubscriptionCount + 1)); /* * Attach websocket */ - WebSocketClient myWebSocketClient = new WebSocketClient(); SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(), EncodingEnum.JSON); - myWebSocketClient.start(); URI echoUri = new URI("ws://localhost:" + port + "/websocket"); - ClientUpgradeRequest request = new ClientUpgradeRequest(); - ourLog.info("Connecting to : {}", echoUri); - Future connection = myWebSocketClient.connect(mySocketImplementation, echoUri, request); - Session session = connection.get(2, TimeUnit.SECONDS); + WebSocketContainer container = ContainerProvider.getWebSocketContainer(); + + ourLog.info("Connecting to : {}", echoUri); + Session session = container.connectToServer(mySocketImplementation, echoUri); ourLog.info("Connected to WS: {}", session.isOpen()); /* @@ -268,11 +284,11 @@ void testCareGaps() throws IOException { assertTrue(reporter.equals("Organization/alphora")); assertTrue(author.equals("Organization/alphora-author")); - String periodStartValid = "2019-01-01"; - String periodEndValid = "2019-12-31"; - String subjectPatientValid = "Patient/numer-EXM125"; - String statusValid = "open-gap"; - String measureIdValid = "BreastCancerScreeningFHIR"; + String periodStartValid = "2019-01-01"; + String periodEndValid = "2019-12-31"; + String subjectPatientValid = "Patient/numer-EXM125"; + String statusValid = "open-gap"; + String measureIdValid = "BreastCancerScreeningFHIR"; loadBundle("r4/CareGaps/authreporter-bundle.json", ourCtx, ourClient); loadBundle("r4/CareGaps/BreastCancerScreeningFHIR-bundle.json", ourCtx, ourClient); diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java index 76d90e0ce79..44c2ed4518c 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java @@ -14,9 +14,10 @@ import java.net.URI; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import org.eclipse.jetty.websocket.api.Session; -import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; -import org.eclipse.jetty.websocket.client.WebSocketClient; + +import jakarta.websocket.ContainerProvider; +import jakarta.websocket.Session; +import jakarta.websocket.WebSocketContainer; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.r5.model.Bundle; import org.hl7.fhir.r5.model.Enumerations; @@ -25,19 +26,20 @@ import org.hl7.fhir.r5.model.Subscription; import org.hl7.fhir.r5.model.SubscriptionTopic; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.junit.jupiter.SpringExtension; @ExtendWith(SpringExtension.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr5", "hapi.fhir.fhir_version=r5", "hapi.fhir.cr_enabled=false", - "hapi.fhir.subscription.websocket_enabled=true" +// "hapi.fhir.subscription.websocket_enabled=true" }) public class ExampleServerR5IT { @@ -66,6 +68,7 @@ void testCreateAndRead() { } @Test + @Disabled void testWebsocketSubscription() throws Exception { String endpoint = "ws://localhost:" + port + "/websocket"; /* @@ -128,18 +131,16 @@ void testWebsocketSubscription() throws Exception { * Attach websocket */ - WebSocketClient myWebSocketClient = new WebSocketClient(); - SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(), EncodingEnum.JSON); + SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(), + EncodingEnum.JSON); - myWebSocketClient.start(); + URI echoUri = new URI(endpoint); - URI echoUri = new URI(endpoint); - ClientUpgradeRequest request = new ClientUpgradeRequest(); - ourLog.info("Connecting to : {}", echoUri); - Future connection = myWebSocketClient.connect(mySocketImplementation, echoUri, request); - Session session = connection.get(2, TimeUnit.SECONDS); + WebSocketContainer container = ContainerProvider.getWebSocketContainer(); - ourLog.info("Connected to WS: {}", session.isOpen()); + ourLog.info("Connecting to : {}", echoUri); + Session session = container.connectToServer(mySocketImplementation, echoUri); + ourLog.info("Connected to WS: {}", session.isOpen()); /* * Create a matching resource diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java index 6729fa623cb..3c50fb653d6 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/SocketImplementation.java b/src/test/java/ca/uhn/fhir/jpa/starter/SocketImplementation.java index 4a536f0f2a1..43667086942 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/SocketImplementation.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/SocketImplementation.java @@ -2,16 +2,16 @@ package ca.uhn.fhir.jpa.starter; import ca.uhn.fhir.rest.api.EncodingEnum; -import org.eclipse.jetty.websocket.api.Session; -import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; -import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.api.annotations.WebSocket; +import jakarta.websocket.ClientEndpoint; +import jakarta.websocket.OnMessage; +import jakarta.websocket.OnOpen; +import jakarta.websocket.Session; import org.slf4j.Logger; import java.util.ArrayList; import java.util.List; -@WebSocket +@ClientEndpoint public class SocketImplementation { private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(SocketImplementation.class); @@ -34,7 +34,7 @@ public List getMessages() { public void keepAlive() { if (this.session != null) { try { - session.getRemote().sendString("keep alive"); + session.getBasicRemote().sendText("keep alive"); } catch (Throwable t) { ourLog.error("Failure", t); } @@ -47,14 +47,14 @@ public void keepAlive() { * * @param session */ - @OnWebSocketConnect + @OnOpen public void onConnect(Session session) { ourLog.info("Got connect: {}", session); this.session = session; try { String sending = "bind " + myCriteria; ourLog.info("Sending: {}", sending); - session.getRemote().sendString(sending); + session.getBasicRemote().sendText(sending); ourLog.info("Connection: DONE"); } catch (Throwable t) { @@ -68,7 +68,7 @@ public void onConnect(Session session) { * * @param theMsg */ - @OnWebSocketMessage + @OnMessage public void onMessage(String theMsg) { ourLog.info("Got msg: " + theMsg); myMessages.add(theMsg); diff --git a/src/test/resources/application.yaml b/src/test/resources/application.yaml index 9f473c574d8..911d9709034 100644 --- a/src/test/resources/application.yaml +++ b/src/test/resources/application.yaml @@ -1,7 +1,7 @@ spring: main: allow-circular-references: true - #allow-bean-definition-overriding: true + allow-bean-definition-overriding: true flyway: enabled: false check-location: false @@ -20,11 +20,20 @@ spring: properties: hibernate.format_sql: false hibernate.show_sql: false - #Hibernate dialect is automatically detected except Postgres and H2. - #If using H2, then supply the value of ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect - #If using postgres, then supply the value of ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect + ######################################### + # Hibernate Dialect Setting + ######################################### + # Use one of the following values: + # ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect + # ca.uhn.fhir.jpa.model.dialect.HapiFhirDerbyDialect + # ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgresDialect + # ca.uhn.fhir.jpa.model.dialect.HapiFhirOracleDialect + # ca.uhn.fhir.jpa.model.dialect.HapiFhirSQLServerDialect + # ca.uhn.fhir.jpa.model.dialect.HapiFhirMySQLDialect (Deprecated!) + ######################################### hibernate.dialect: ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect + ######################################### # hibernate.hbm2ddl.auto: update # hibernate.jdbc.batch_size: 20 # hibernate.cache.use_query_cache: false From b74657325308fe3e6b805ab6ec3ed1c074d719c8 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Fri, 15 Dec 2023 08:56:17 -0500 Subject: [PATCH 02/15] Enable subscriptions and upgrade to jetty 12 --- pom.xml | 54 ++++++------------- .../jpa/starter/ExampleServerDstu3IT.java | 1 - .../fhir/jpa/starter/ExampleServerR4IT.java | 1 - .../fhir/jpa/starter/ExampleServerR5IT.java | 18 +++---- .../JpaStarterWebsocketDispatcherConfig.java | 12 ++--- 5 files changed, 30 insertions(+), 56 deletions(-) diff --git a/pom.xml b/pom.xml index 89377c904ac..cc566ee8075 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.11.5-SNAPSHOT + 6.11.7-SNAPSHOT hapi-fhir-jpaserver-starter @@ -22,7 +22,6 @@ 11 - 11.0.18 @@ -253,80 +252,63 @@ org.eclipse.jetty - jetty-servlets - ${jetty_11_version} + jetty-http test org.eclipse.jetty - jetty-servlet - ${jetty_11_version} + jetty-io test org.eclipse.jetty - jetty-http - ${jetty_11_version} + jetty-security test org.eclipse.jetty - jetty-io - ${jetty_11_version} + jetty-xml test - org.eclipse.jetty - jetty-security - ${jetty_11_version} + org.eclipse.jetty.ee10 + jetty-ee10-servlet test - org.eclipse.jetty - jetty-xml - ${jetty_11_version} + org.eclipse.jetty.ee10 + jetty-ee10-servlets test - org.eclipse.jetty.websocket - websocket-jetty-server - ${jetty_11_version} + org.eclipse.jetty.ee10.websocket + jetty-ee10-websocket-jakarta-client test - org.eclipse.jetty.websocket - websocket-jetty-api - ${jetty_11_version} + org.eclipse.jetty.ee10.websocket + jetty-ee10-websocket-jakarta-server test - org.eclipse.jetty.websocket - websocket-jetty-client - ${jetty_11_version} + org.eclipse.jetty.ee10.websocket + jetty-ee10-websocket-jetty-server + ${jetty_version} test org.eclipse.jetty.websocket - websocket-core-client - ${jetty_11_version} + jetty-websocket-jetty-server test org.eclipse.jetty jetty-server - ${jetty_11_version} test org.eclipse.jetty jetty-util - ${jetty_11_version} - test - - - org.eclipse.jetty - jetty-webapp - ${jetty_11_version} test @@ -429,13 +411,11 @@ org.junit.jupiter junit-jupiter-api - 5.7.2 test org.junit.jupiter junit-jupiter-engine - 5.7.2 test diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java index 6c71b7100e6..19b453fe561 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java @@ -164,7 +164,6 @@ private Bundle loadBundle(String theLocation, FhirContext theCtx, IGenericClient } @Test - @Disabled void testWebsocketSubscription() throws Exception { /* * Create subscription diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java index 6db67b8ee9a..9eebaa0ecb1 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java @@ -217,7 +217,6 @@ void testBatchPutWithIdenticalTags() { ourClient.transaction().withBundle(bundle).execute(); } - @Disabled @Test @Order(1) void testWebsocketSubscription() throws Exception { diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java index 44c2ed4518c..e26ad37a5e1 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java @@ -1,9 +1,5 @@ package ca.uhn.fhir.jpa.starter; -import static ca.uhn.fhir.util.TestUtil.waitForSize; -import static org.awaitility.Awaitility.await; -import static org.junit.jupiter.api.Assertions.assertEquals; - import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.rest.api.CacheControlDirective; import ca.uhn.fhir.rest.api.EncodingEnum; @@ -11,10 +7,6 @@ import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; -import java.net.URI; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; - import jakarta.websocket.ContainerProvider; import jakarta.websocket.Session; import jakarta.websocket.WebSocketContainer; @@ -26,20 +18,25 @@ import org.hl7.fhir.r5.model.Subscription; import org.hl7.fhir.r5.model.SubscriptionTopic; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.junit.jupiter.SpringExtension; +import java.net.URI; + +import static ca.uhn.fhir.util.TestUtil.waitForSize; +import static org.awaitility.Awaitility.await; +import static org.junit.jupiter.api.Assertions.assertEquals; + @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr5", "hapi.fhir.fhir_version=r5", "hapi.fhir.cr_enabled=false", -// "hapi.fhir.subscription.websocket_enabled=true" + "hapi.fhir.subscription.websocket_enabled=true" }) public class ExampleServerR5IT { @@ -68,7 +65,6 @@ void testCreateAndRead() { } @Test - @Disabled void testWebsocketSubscription() throws Exception { String endpoint = "ws://localhost:" + port + "/websocket"; /* diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java b/src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java index 3503338fc79..34c8949c0c2 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.starter; -import org.eclipse.jetty.webapp.WebAppContext; -import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer; +import org.eclipse.jetty.ee10.webapp.WebAppContext; +import org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer; import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; import org.springframework.boot.web.server.WebServerFactoryCustomizer; import org.springframework.context.annotation.Bean; @@ -15,18 +15,18 @@ public class JpaStarterWebsocketDispatcherConfig { @Bean - public Jetty10WebSocketServletWebServerCustomizer jetty10WebSocketServletWebServerCustomizer() { - return new Jetty10WebSocketServletWebServerCustomizer(); + public Jetty12WebSocketServletWebServerCustomizer jetty10WebSocketServletWebServerCustomizer() { + return new Jetty12WebSocketServletWebServerCustomizer(); } - static class Jetty10WebSocketServletWebServerCustomizer implements WebServerFactoryCustomizer { + static class Jetty12WebSocketServletWebServerCustomizer implements WebServerFactoryCustomizer { @Override public void customize(JettyServletWebServerFactory factory) { factory.addServerCustomizers(server -> { WebAppContext ctx = (WebAppContext) server.getHandler(); - JettyWebSocketServletContainerInitializer.configure(ctx, null); + JakartaWebSocketServletContainerInitializer.configure(ctx, null); }); } From 00eb114a509d812ed8af52526f7e4d74956d9ec4 Mon Sep 17 00:00:00 2001 From: Matteo Steccolini Date: Fri, 15 Dec 2023 15:27:14 +0100 Subject: [PATCH 03/15] bump parent 6.11.5 -> 6.11.7 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 72670c6c31e..9d8d15b0d30 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.11.5-SNAPSHOT + 6.11.7-SNAPSHOT hapi-fhir-jpaserver-starter From c8a71c2e6499779e818375bea01e08f623f51cb9 Mon Sep 17 00:00:00 2001 From: Matteo Steccolini Date: Fri, 15 Dec 2023 15:53:07 +0100 Subject: [PATCH 04/15] removed version of junit dependencies to use the managed version --- pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9d8d15b0d30..d02c88387db 100644 --- a/pom.xml +++ b/pom.xml @@ -429,13 +429,11 @@ org.junit.jupiter junit-jupiter-api - 5.7.2 test org.junit.jupiter junit-jupiter-engine - 5.7.2 test From eafa7cfb4cff9d385f0c3cbb97a909d34f1fd924 Mon Sep 17 00:00:00 2001 From: Matteo Steccolini Date: Mon, 18 Dec 2023 09:07:59 +0100 Subject: [PATCH 05/15] servletWebServerFactory made lazy to run as web application --- src/main/java/ca/uhn/fhir/jpa/starter/Application.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/Application.java b/src/main/java/ca/uhn/fhir/jpa/starter/Application.java index c626c969616..36a432c1c0d 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/Application.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/Application.java @@ -28,6 +28,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Import; +import org.springframework.context.annotation.Lazy; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; @@ -72,6 +73,7 @@ public ServletRegistrationBean hapiServletRegistration(RestfulServer restfulServ } @Bean + @Lazy public ServletWebServerFactory servletWebServerFactory() { return new JettyServletWebServerFactory(); } From e49a9219aff03f748422e10ad8aa17b0e4b3bf4c Mon Sep 17 00:00:00 2001 From: Matteo Steccolini Date: Thu, 21 Dec 2023 11:54:23 +0100 Subject: [PATCH 06/15] servletWebServerFactory definitely breaks things (spring-boot not starting with tomcat, and running as web application doesn't work if the bean is not at least lazy) I'm removing it, it shouldn't be necessary (to run spring-spring boot with jetty, it's enough to enable the jetty profile?) --- src/main/java/ca/uhn/fhir/jpa/starter/Application.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/Application.java b/src/main/java/ca/uhn/fhir/jpa/starter/Application.java index 36a432c1c0d..4714aa8f724 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/Application.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/Application.java @@ -72,10 +72,4 @@ public ServletRegistrationBean hapiServletRegistration(RestfulServer restfulServ return servletRegistrationBean; } - @Bean - @Lazy - public ServletWebServerFactory servletWebServerFactory() { - return new JettyServletWebServerFactory(); - } - } From a2a7e7681a126b651cc00140c2fe8ffbbe72e69b Mon Sep 17 00:00:00 2001 From: Matteo Steccolini Date: Thu, 21 Dec 2023 16:32:12 +0100 Subject: [PATCH 07/15] fix test/compile/runtime dependencies of jetty to get spring-boot runnability with jetty and tomcat, tests, and deployment as web application --- pom.xml | 83 ++++----------------------------------------------------- 1 file changed, 5 insertions(+), 78 deletions(-) diff --git a/pom.xml b/pom.xml index 71daa34d0ef..f48e7665547 100644 --- a/pom.xml +++ b/pom.xml @@ -250,68 +250,6 @@ test - - org.eclipse.jetty - jetty-http - test - - - org.eclipse.jetty - jetty-io - test - - - org.eclipse.jetty - jetty-security - test - - - org.eclipse.jetty - jetty-xml - test - - - org.eclipse.jetty.ee10 - jetty-ee10-servlet - test - - - org.eclipse.jetty.ee10 - jetty-ee10-servlets - test - - - org.eclipse.jetty.ee10.websocket - jetty-ee10-websocket-jakarta-client - test - - - org.eclipse.jetty.ee10.websocket - jetty-ee10-websocket-jakarta-server - test - - - org.eclipse.jetty.ee10.websocket - jetty-ee10-websocket-jetty-server - ${jetty_version} - test - - - org.eclipse.jetty.websocket - jetty-websocket-jetty-server - test - - - org.eclipse.jetty - jetty-server - test - - - org.eclipse.jetty - jetty-util - test - - ca.uhn.hapi.fhir hapi-fhir-jpaserver-test-utilities @@ -356,16 +294,6 @@ hapi-fhir-test-utilities ${project.version} test - - - org.eclipse.jetty.ee10 - * - - - org.eclipse.jetty - * - - @@ -632,12 +560,6 @@ org.springframework.boot spring-boot-starter-web ${spring_boot_version} - - - org.springframework.boot - spring-boot-starter-tomcat - - @@ -658,6 +580,11 @@ + + org.springframework.boot + spring-boot-starter-jetty + ${spring_boot_version} + From 36598c2e7e818d159a59dd52356d125bdcadcabc Mon Sep 17 00:00:00 2001 From: Matteo Steccolini Date: Thu, 21 Dec 2023 16:52:16 +0100 Subject: [PATCH 08/15] created a separated tomcat profile to run spring-boot with default server --- pom.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pom.xml b/pom.xml index f48e7665547..06d1a9c7e4b 100644 --- a/pom.xml +++ b/pom.xml @@ -560,6 +560,12 @@ org.springframework.boot spring-boot-starter-web ${spring_boot_version} + + + org.springframework.boot + spring-boot-starter-tomcat + + @@ -586,6 +592,15 @@ ${spring_boot_version} + + tomcat + + + org.springframework.boot + spring-boot-starter-web + ${spring_boot_version} + + ossrh-repo From 142191b2bdc4ee0623ad956cd6b537516d16e965 Mon Sep 17 00:00:00 2001 From: Matteo Steccolini Date: Thu, 21 Dec 2023 16:58:28 +0100 Subject: [PATCH 09/15] unused imports in Application.java --- src/main/java/ca/uhn/fhir/jpa/starter/Application.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/Application.java b/src/main/java/ca/uhn/fhir/jpa/starter/Application.java index 4714aa8f724..bec7871ea50 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/Application.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/Application.java @@ -4,7 +4,6 @@ import ca.uhn.fhir.jpa.batch2.JpaBatch2Config; import ca.uhn.fhir.jpa.starter.annotations.OnEitherVersion; import ca.uhn.fhir.jpa.starter.cdshooks.StarterCdsHooksConfig; -import ca.uhn.fhir.jpa.starter.common.FhirTesterConfig; import ca.uhn.fhir.jpa.starter.cr.StarterCrDstu3Config; import ca.uhn.fhir.jpa.starter.cr.StarterCrR4Config; import ca.uhn.fhir.jpa.starter.mdm.MdmConfig; @@ -19,18 +18,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration; import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletRegistrationBean; -import org.springframework.boot.web.servlet.server.ServletWebServerFactory; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Import; -import org.springframework.context.annotation.Lazy; -import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; -import org.springframework.web.servlet.DispatcherServlet; @ServletComponentScan(basePackageClasses = {RestfulServer.class}) @SpringBootApplication(exclude = {ElasticsearchRestClientAutoConfiguration.class, ThymeleafAutoConfiguration.class}) From bf683478bce0c9120f148118a6162d2d1e9b610e Mon Sep 17 00:00:00 2001 From: Matteo Steccolini Date: Fri, 22 Dec 2023 11:49:14 +0100 Subject: [PATCH 10/15] fix for tests not working added required jetty dependencies through spring-boot-starter-jetty so this is the only dependency with scope=testing and transitive dependencies (core jetty libraries) aren't marked as such mvn -P jetty spring-boot:run seems to work --- pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pom.xml b/pom.xml index 06d1a9c7e4b..c452a72060f 100644 --- a/pom.xml +++ b/pom.xml @@ -354,6 +354,13 @@ test + + org.springframework.boot + spring-boot-starter-jetty + ${spring_boot_version} + test + + From f24968a47df5d0f2f46d024819ccacf80a5e82e9 Mon Sep 17 00:00:00 2001 From: Matteo Steccolini Date: Fri, 22 Dec 2023 15:32:20 +0100 Subject: [PATCH 11/15] Update smoke-tests.yml jetty-maven-plugin is obsolete, and jetty-ee10-maven-plugin doesn't work at the moment. Using spring-boot to run local server. --- .github/workflows/smoke-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml index 31568a35ef2..6e76e829d58 100644 --- a/.github/workflows/smoke-tests.yml +++ b/.github/workflows/smoke-tests.yml @@ -33,7 +33,7 @@ jobs: run: docker pull jetbrains/intellij-http-client - name: Start server with jetty run: | - mvn jetty:run & export JPA_PROCESS=$! + mvn -P jetty spring-boot:run & export JPA_PROCESS=$! sleep 80 - name: Execute smoke tests 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 From e7b1b892713290558e8cffbd643caf554e905b50 Mon Sep 17 00:00:00 2001 From: Matteo Steccolini Date: Wed, 3 Jan 2024 08:45:48 +0100 Subject: [PATCH 12/15] reverting profiles to the current situation in the master branch: spring-boot:run by defaults starts tomcat, while the jetty profile enables jetty added a fix to run the generated war with spring-boot on tomcat, due to issues with spring-boot 3.2.0 https://github.com/spring-projects/spring-boot/issues/38585 the jar generated with jetty doesn't work at the moment --- pom.xml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index c452a72060f..facd1d66ff2 100644 --- a/pom.xml +++ b/pom.xml @@ -387,6 +387,14 @@ org.springframework.boot spring-boot-maven-plugin + + + CLASSIC + @@ -567,12 +575,6 @@ org.springframework.boot spring-boot-starter-web ${spring_boot_version} - - - org.springframework.boot - spring-boot-starter-tomcat - - @@ -599,15 +601,6 @@ ${spring_boot_version} - - tomcat - - - org.springframework.boot - spring-boot-starter-web - ${spring_boot_version} - - ossrh-repo From 0a95e71cbc26b46f38a4df56e7f1e342fc690ac7 Mon Sep 17 00:00:00 2001 From: Matteo Steccolini Date: Wed, 3 Jan 2024 15:12:38 +0100 Subject: [PATCH 13/15] fixed integration test execution; tests are now done with tomcat, unless "jetty" profile is active (in which case they're done with jetty) Test class JpaStarterWebsocketDispatcherConfig emptied, not sure if necessary (it's now missing jetty dependencies) --- pom.xml | 26 +++++++---- .../JpaStarterWebsocketDispatcherConfig.java | 44 +++++++++---------- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/pom.xml b/pom.xml index facd1d66ff2..21e428b0886 100644 --- a/pom.xml +++ b/pom.xml @@ -294,6 +294,24 @@ hapi-fhir-test-utilities ${project.version} test + + + org.eclipse.jetty.ee10 + * + + + org.eclipse.jetty.ee10.websocket + * + + + org.eclipse.jetty + * + + + org.eclipse.jetty.websocket + * + + @@ -350,14 +368,6 @@ org.springframework.boot spring-boot-starter-test - ${spring_boot_version} - test - - - - org.springframework.boot - spring-boot-starter-jetty - ${spring_boot_version} test diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java b/src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java index 34c8949c0c2..639fda5c439 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java @@ -1,10 +1,10 @@ package ca.uhn.fhir.jpa.starter; -import org.eclipse.jetty.ee10.webapp.WebAppContext; -import org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer; -import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; -import org.springframework.boot.web.server.WebServerFactoryCustomizer; -import org.springframework.context.annotation.Bean; +//import org.eclipse.jetty.ee10.webapp.WebAppContext; +//import org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer; +//import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; +//import org.springframework.boot.web.server.WebServerFactoryCustomizer; +//import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** @@ -14,21 +14,21 @@ @Configuration public class JpaStarterWebsocketDispatcherConfig { - @Bean - public Jetty12WebSocketServletWebServerCustomizer jetty10WebSocketServletWebServerCustomizer() { - return new Jetty12WebSocketServletWebServerCustomizer(); - } - - static class Jetty12WebSocketServletWebServerCustomizer implements WebServerFactoryCustomizer { - - @Override - public void customize(JettyServletWebServerFactory factory) { - - factory.addServerCustomizers(server -> { - WebAppContext ctx = (WebAppContext) server.getHandler(); - JakartaWebSocketServletContainerInitializer.configure(ctx, null); - }); - - } - } +// @Bean +// public Jetty12WebSocketServletWebServerCustomizer jetty10WebSocketServletWebServerCustomizer() { +// return new Jetty12WebSocketServletWebServerCustomizer(); +// } +// +// static class Jetty12WebSocketServletWebServerCustomizer implements WebServerFactoryCustomizer { +// +// @Override +// public void customize(JettyServletWebServerFactory factory) { +// +// factory.addServerCustomizers(server -> { +// WebAppContext ctx = (WebAppContext) server.getHandler(); +// JakartaWebSocketServletContainerInitializer.configure(ctx, null); +// }); +// +// } +// } } From d762c18765ab13deff274ffdaeb3c40297af4f79 Mon Sep 17 00:00:00 2001 From: Matteo Steccolini Date: Thu, 25 Jan 2024 08:53:29 +0100 Subject: [PATCH 14/15] requested changes: upgrade to hapi-fhir-7.0.0-SNAPSHOT, removed empty JpaStarterWebsocketDispatcherConfig and references unrequested changes: commons-logging dependency marked provided (to avoid redundant jar inclusion), removed unused imports in classes that were modified --- pom.xml | 10 +++++- .../uhn/fhir/jpa/starter/CustomBeanTest.java | 2 +- .../jpa/starter/CustomInterceptorTest.java | 2 +- .../jpa/starter/ElasticsearchLastNR4IT.java | 2 +- .../jpa/starter/ExampleServerDstu2IT.java | 2 +- .../jpa/starter/ExampleServerDstu3IT.java | 4 --- .../fhir/jpa/starter/ExampleServerR4BIT.java | 2 +- .../fhir/jpa/starter/ExampleServerR4IT.java | 2 -- .../JpaStarterWebsocketDispatcherConfig.java | 34 ------------------- .../jpa/starter/MultitenantServerR4IT.java | 2 +- 10 files changed, 15 insertions(+), 47 deletions(-) delete mode 100644 src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java diff --git a/pom.xml b/pom.xml index 21e428b0886..d79dd8d122f 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.11.7-SNAPSHOT + 7.0.0-SNAPSHOT hapi-fhir-jpaserver-starter @@ -194,6 +194,14 @@ spring-web + + + commons-logging + commons-logging + 1.2 + provided + + org.apache.commons diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/CustomBeanTest.java b/src/test/java/ca/uhn/fhir/jpa/starter/CustomBeanTest.java index d5a3d18af5e..3a7dee54843 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/CustomBeanTest.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/CustomBeanTest.java @@ -5,7 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = { +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "hapi.fhir.custom-bean-packages=some.custom.pkg1,some.custom.pkg2", "spring.datasource.url=jdbc:h2:mem:dbr4", "hapi.fhir.enable_repository_validating_interceptor=true", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/CustomInterceptorTest.java b/src/test/java/ca/uhn/fhir/jpa/starter/CustomInterceptorTest.java index 859752a25d9..daf64384c73 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/CustomInterceptorTest.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/CustomInterceptorTest.java @@ -13,7 +13,7 @@ import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = { +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "hapi.fhir.custom-bean-packages=some.custom.pkg1", "hapi.fhir.custom-interceptor-classes=some.custom.pkg1.CustomInterceptorBean,some.custom.pkg1.CustomInterceptorPojo", "spring.datasource.url=jdbc:h2:mem:dbr4", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java index c12f531170c..9d4c033c436 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java @@ -44,7 +44,7 @@ @ExtendWith(SpringExtension.class) @Testcontainers -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr4", "hapi.fhir.fhir_version=r4", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java index e65d52f64c6..e8fd9ade47b 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java @@ -16,7 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @ExtendWith(SpringExtension.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "hapi.fhir.fhir_version=dstu2", "spring.datasource.url=jdbc:h2:mem:dbr2", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java index 19b453fe561..2aadf2ebcfc 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java @@ -17,7 +17,6 @@ import org.hl7.fhir.dstu3.model.*; import org.hl7.fhir.instance.model.api.IIdType; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; @@ -31,8 +30,6 @@ import java.net.URI; import java.util.Collection; import java.util.List; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; import static ca.uhn.fhir.util.TestUtil.waitForSize; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -43,7 +40,6 @@ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = { Application.class, - JpaStarterWebsocketDispatcherConfig.class, RepositoryConfig.class }, properties = { diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java index be499496ed5..46acecd3975 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java @@ -15,7 +15,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, + classes = {Application.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr4b", "hapi.fhir.enable_repository_validating_interceptor=true", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java index 9eebaa0ecb1..9c0f85d0c9d 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java @@ -27,7 +27,6 @@ import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Subscription; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -53,7 +52,6 @@ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = { Application.class, - JpaStarterWebsocketDispatcherConfig.class, NicknameServiceConfig.class, RepositoryConfig.class }, properties = { diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java b/src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java deleted file mode 100644 index 639fda5c439..00000000000 --- a/src/test/java/ca/uhn/fhir/jpa/starter/JpaStarterWebsocketDispatcherConfig.java +++ /dev/null @@ -1,34 +0,0 @@ -package ca.uhn.fhir.jpa.starter; - -//import org.eclipse.jetty.ee10.webapp.WebAppContext; -//import org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer; -//import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; -//import org.springframework.boot.web.server.WebServerFactoryCustomizer; -//import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * This class ensures that websockets work with - * Spring + Spring Boot + Jetty - */ -@Configuration -public class JpaStarterWebsocketDispatcherConfig { - -// @Bean -// public Jetty12WebSocketServletWebServerCustomizer jetty10WebSocketServletWebServerCustomizer() { -// return new Jetty12WebSocketServletWebServerCustomizer(); -// } -// -// static class Jetty12WebSocketServletWebServerCustomizer implements WebServerFactoryCustomizer { -// -// @Override -// public void customize(JettyServletWebServerFactory factory) { -// -// factory.addServerCustomizers(server -> { -// WebAppContext ctx = (WebAppContext) server.getHandler(); -// JakartaWebSocketServletContainerInitializer.configure(ctx, null); -// }); -// -// } -// } -} diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java index 3c50fb653d6..bbe1348b7f8 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java @@ -18,7 +18,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @ExtendWith(SpringExtension.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr4-mt", "hapi.fhir.fhir_version=r4", From 71715476b10e17ae45dbfe3eabcd57c3cbd7b564 Mon Sep 17 00:00:00 2001 From: "dotasek.dev" Date: Tue, 27 Feb 2024 14:42:15 -0500 Subject: [PATCH 15/15] Bump to HAPI release 7.0.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d79dd8d122f..06092a3c039 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ ca.uhn.hapi.fhir hapi-fhir - 7.0.0-SNAPSHOT + 7.0.0 hapi-fhir-jpaserver-starter