Merge pull request #618 from hapifhir/ja_20231203_hapi_7_0
Update to HAPI FHIR 7.0.0
This commit is contained in:
2
.github/workflows/smoke-tests.yml
vendored
2
.github/workflows/smoke-tests.yml
vendored
@@ -33,7 +33,7 @@ jobs:
|
|||||||
run: docker pull jetbrains/intellij-http-client
|
run: docker pull jetbrains/intellij-http-client
|
||||||
- name: Start server with jetty
|
- name: Start server with jetty
|
||||||
run: |
|
run: |
|
||||||
mvn -Pjetty jetty:run & export JPA_PROCESS=$!
|
mvn -P jetty spring-boot:run & export JPA_PROCESS=$!
|
||||||
sleep 80
|
sleep 80
|
||||||
- name: Execute smoke tests
|
- 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
|
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
|
||||||
|
|||||||
123
pom.xml
123
pom.xml
@@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir</artifactId>
|
<artifactId>hapi-fhir</artifactId>
|
||||||
<version>6.10.0</version>
|
<version>7.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>hapi-fhir-jpaserver-starter</artifactId>
|
<artifactId>hapi-fhir-jpaserver-starter</artifactId>
|
||||||
@@ -22,8 +22,6 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>11</java.version>
|
<java.version>11</java.version>
|
||||||
<logback-classic.version>1.2.11</logback-classic.version>
|
|
||||||
<slf4j-api.version>1.7.25</slf4j-api.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<prerequisites>
|
<prerequisites>
|
||||||
@@ -53,16 +51,7 @@
|
|||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.jetty.websocket</groupId>
|
|
||||||
<artifactId>websocket-jetty-api</artifactId>
|
|
||||||
<version>${jetty_version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.jetty.websocket</groupId>
|
|
||||||
<artifactId>websocket-jetty-client</artifactId>
|
|
||||||
<version>${jetty_version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.postgresql</groupId>
|
<groupId>org.postgresql</groupId>
|
||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
@@ -180,11 +169,15 @@
|
|||||||
<groupId>ch.qos.logback</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
<artifactId>logback-classic</artifactId>
|
<artifactId>logback-classic</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Needed for JEE/Servlet support -->
|
<!-- Needed for JEE/Servlet support -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>jakarta.servlet</groupId>
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
<artifactId>jakarta.servlet-api</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -201,6 +194,14 @@
|
|||||||
<artifactId>spring-web</artifactId>
|
<artifactId>spring-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- commons-logging is provided by jcl-over-slf4j, and the jar often shows up because of transitive dependencies; this dependency should avoid it -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-logging</groupId>
|
||||||
|
<artifactId>commons-logging</artifactId>
|
||||||
|
<version>1.2</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- You may not need this if you are deploying to an application server which provides database connection pools itself. -->
|
<!-- You may not need this if you are deploying to an application server which provides database connection pools itself. -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
@@ -251,6 +252,12 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- The following dependencies are only needed for automated unit tests, you do not neccesarily need them to run the example. -->
|
<!-- The following dependencies are only needed for automated unit tests, you do not neccesarily need them to run the example. -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>co.elastic.clients</groupId>
|
||||||
|
<artifactId>elasticsearch-java</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-jpaserver-test-utilities</artifactId>
|
<artifactId>hapi-fhir-jpaserver-test-utilities</artifactId>
|
||||||
@@ -263,36 +270,7 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-servlets</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-servlet</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.jetty.websocket</groupId>
|
|
||||||
<artifactId>websocket-jetty-server</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-server</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-util</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-webapp</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.testcontainers</groupId>
|
<groupId>org.testcontainers</groupId>
|
||||||
<artifactId>testcontainers</artifactId>
|
<artifactId>testcontainers</artifactId>
|
||||||
@@ -314,8 +292,8 @@
|
|||||||
For some reason JavaDoc crashed during site generation unless we have this dependency
|
For some reason JavaDoc crashed during site generation unless we have this dependency
|
||||||
-->
|
-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.interceptor</groupId>
|
<groupId>jakarta.interceptor</groupId>
|
||||||
<artifactId>javax.interceptor-api</artifactId>
|
<artifactId>jakarta.interceptor-api</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -324,6 +302,24 @@
|
|||||||
<artifactId>hapi-fhir-test-utilities</artifactId>
|
<artifactId>hapi-fhir-test-utilities</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.eclipse.jetty.ee10</groupId>
|
||||||
|
<artifactId>*</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.eclipse.jetty.ee10.websocket</groupId>
|
||||||
|
<artifactId>*</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>*</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.eclipse.jetty.websocket</groupId>
|
||||||
|
<artifactId>*</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -369,40 +365,20 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>5.7.2</version>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<version>5.7.2</version>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<version>${spring_boot_version}</version>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
<version>${slf4j-api.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-classic</artifactId>
|
|
||||||
<version>${logback-classic.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-core</artifactId>
|
|
||||||
<version>${logback-classic.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@@ -429,6 +405,14 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<!--
|
||||||
|
java -jar ROOT.war doesn't work; there is a bug in spring-boot-3.2.0 due to hibernate search,
|
||||||
|
probably solved in 3.2.1 https://github.com/spring-projects/spring-boot/issues/38585
|
||||||
|
(at the moment only tomcat works)
|
||||||
|
-->
|
||||||
|
<loaderImplementation>CLASSIC</loaderImplementation>
|
||||||
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
@@ -629,6 +613,11 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-jetty</artifactId>
|
||||||
|
<version>${spring_boot_version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import ca.uhn.fhir.batch2.jobs.config.Batch2JobsConfig;
|
|||||||
import ca.uhn.fhir.jpa.batch2.JpaBatch2Config;
|
import ca.uhn.fhir.jpa.batch2.JpaBatch2Config;
|
||||||
import ca.uhn.fhir.jpa.starter.annotations.OnEitherVersion;
|
import ca.uhn.fhir.jpa.starter.annotations.OnEitherVersion;
|
||||||
import ca.uhn.fhir.jpa.starter.cdshooks.StarterCdsHooksConfig;
|
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.StarterCrDstu3Config;
|
||||||
import ca.uhn.fhir.jpa.starter.cr.StarterCrR4Config;
|
import ca.uhn.fhir.jpa.starter.cr.StarterCrR4Config;
|
||||||
import ca.uhn.fhir.jpa.starter.mdm.MdmConfig;
|
import ca.uhn.fhir.jpa.starter.mdm.MdmConfig;
|
||||||
@@ -19,15 +18,12 @@ import org.springframework.boot.SpringApplication;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration;
|
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
|
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Conditional;
|
import org.springframework.context.annotation.Conditional;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
|
||||||
import org.springframework.web.servlet.DispatcherServlet;
|
|
||||||
|
|
||||||
@ServletComponentScan(basePackageClasses = {RestfulServer.class})
|
@ServletComponentScan(basePackageClasses = {RestfulServer.class})
|
||||||
@SpringBootApplication(exclude = {ElasticsearchRestClientAutoConfiguration.class, ThymeleafAutoConfiguration.class})
|
@SpringBootApplication(exclude = {ElasticsearchRestClientAutoConfiguration.class, ThymeleafAutoConfiguration.class})
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServlet;
|
import jakarta.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import static ca.uhn.hapi.fhir.cdshooks.config.CdsHooksConfig.CDS_HOOKS_OBJECT_MAPPER_FACTORY;
|
import static ca.uhn.hapi.fhir.cdshooks.config.CdsHooksConfig.CDS_HOOKS_OBJECT_MAPPER_FACTORY;
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import java.io.IOException;
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
public class ErrorHandling {
|
public class ErrorHandling {
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
|
|||||||
import ca.uhn.fhir.validation.IValidatorModule;
|
import ca.uhn.fhir.validation.IValidatorModule;
|
||||||
import ca.uhn.fhir.validation.ResultSeverityEnum;
|
import ca.uhn.fhir.validation.ResultSeverityEnum;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
import jakarta.persistence.EntityManagerFactory;
|
||||||
import org.hl7.fhir.common.hapi.validation.support.CachingValidationSupport;
|
import org.hl7.fhir.common.hapi.validation.support.CachingValidationSupport;
|
||||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -76,7 +77,6 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
|||||||
import org.springframework.web.cors.CorsConfiguration;
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import javax.persistence.EntityManagerFactory;
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import static ca.uhn.fhir.jpa.starter.common.validation.IRepositoryValidationInterceptorFactory.ENABLE_REPOSITORY_VALIDATING_INTERCEPTOR;
|
import static ca.uhn.fhir.jpa.starter.common.validation.IRepositoryValidationInterceptorFactory.ENABLE_REPOSITORY_VALIDATING_INTERCEPTOR;
|
||||||
@@ -135,9 +135,9 @@ public class StarterJpaConfig {
|
|||||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
|
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
|
||||||
DataSource myDataSource,
|
DataSource myDataSource,
|
||||||
ConfigurableListableBeanFactory myConfigurableListableBeanFactory,
|
ConfigurableListableBeanFactory myConfigurableListableBeanFactory,
|
||||||
FhirContext theFhirContext) {
|
FhirContext theFhirContext, JpaStorageSettings theStorageSettings) {
|
||||||
LocalContainerEntityManagerFactoryBean retVal =
|
LocalContainerEntityManagerFactoryBean retVal =
|
||||||
HapiEntityManagerFactoryUtil.newEntityManagerFactory(myConfigurableListableBeanFactory, theFhirContext);
|
HapiEntityManagerFactoryUtil.newEntityManagerFactory(myConfigurableListableBeanFactory, theFhirContext, theStorageSettings);
|
||||||
retVal.setPersistenceUnitName("HAPI_PU");
|
retVal.setPersistenceUnitName("HAPI_PU");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
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",
|
"hapi.fhir.custom-bean-packages=some.custom.pkg1,some.custom.pkg2",
|
||||||
"spring.datasource.url=jdbc:h2:mem:dbr4",
|
"spring.datasource.url=jdbc:h2:mem:dbr4",
|
||||||
"hapi.fhir.enable_repository_validating_interceptor=true",
|
"hapi.fhir.enable_repository_validating_interceptor=true",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
|
|||||||
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
||||||
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
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-bean-packages=some.custom.pkg1",
|
||||||
"hapi.fhir.custom-interceptor-classes=some.custom.pkg1.CustomInterceptorBean,some.custom.pkg1.CustomInterceptorPojo",
|
"hapi.fhir.custom-interceptor-classes=some.custom.pkg1.CustomInterceptorBean,some.custom.pkg1.CustomInterceptorPojo",
|
||||||
"spring.datasource.url=jdbc:h2:mem:dbr4",
|
"spring.datasource.url=jdbc:h2:mem:dbr4",
|
||||||
|
|||||||
@@ -14,12 +14,11 @@ import java.io.IOException;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.List;
|
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.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.instance.model.api.IIdType;
|
||||||
import org.hl7.fhir.r4.model.Bundle;
|
import org.hl7.fhir.r4.model.Bundle;
|
||||||
import org.hl7.fhir.r4.model.DateTimeType;
|
import org.hl7.fhir.r4.model.DateTimeType;
|
||||||
@@ -30,13 +29,11 @@ import org.hl7.fhir.r4.model.Patient;
|
|||||||
import org.hl7.fhir.r4.model.StringType;
|
import org.hl7.fhir.r4.model.StringType;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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.context.SpringBootTest;
|
||||||
import org.springframework.boot.test.util.TestPropertyValues;
|
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.ApplicationContextInitializer;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
@@ -47,7 +44,7 @@ import org.testcontainers.junit.jupiter.Testcontainers;
|
|||||||
|
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@Testcontainers
|
@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",
|
"spring.datasource.url=jdbc:h2:mem:dbr4",
|
||||||
"hapi.fhir.fhir_version=r4",
|
"hapi.fhir.fhir_version=r4",
|
||||||
@@ -83,19 +80,20 @@ public class ElasticsearchLastNR4IT {
|
|||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeClass() throws IOException {
|
public static void beforeClass() throws IOException {
|
||||||
//Given
|
//Given
|
||||||
RestHighLevelClient elasticsearchHighLevelRestClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient(
|
ElasticsearchClient elasticsearchHighLevelRestClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient(
|
||||||
"http", embeddedElastic.getHost() + ":" + embeddedElastic.getMappedPort(9200), "", "");
|
"http", embeddedElastic.getHost() + ":" + embeddedElastic.getMappedPort(9200), "", "");
|
||||||
|
|
||||||
/* As of 2023-08-10, HAPI FHIR sets SubscriptionConstants.MAX_SUBSCRIPTION_RESULTS to 50000
|
/* 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
|
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
|
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;
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,14 +10,13 @@ import org.junit.jupiter.api.BeforeEach;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
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.annotation.DirtiesContext;
|
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
@ExtendWith(SpringExtension.class)
|
@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",
|
"hapi.fhir.fhir_version=dstu2",
|
||||||
"spring.datasource.url=jdbc:h2:mem:dbr2",
|
"spring.datasource.url=jdbc:h2:mem:dbr2",
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import ca.uhn.fhir.rest.api.MethodOutcome;
|
|||||||
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
||||||
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
||||||
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
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.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.dstu3.model.*;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
@@ -21,9 +21,8 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
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.core.io.ClassPathResource;
|
||||||
import org.springframework.test.annotation.DirtiesContext;
|
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -31,8 +30,6 @@ import java.io.IOException;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Future;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import static ca.uhn.fhir.util.TestUtil.waitForSize;
|
import static ca.uhn.fhir.util.TestUtil.waitForSize;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
@@ -43,7 +40,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||||
classes = {
|
classes = {
|
||||||
Application.class,
|
Application.class,
|
||||||
JpaStarterWebsocketDispatcherConfig.class,
|
|
||||||
RepositoryConfig.class
|
RepositoryConfig.class
|
||||||
}, properties =
|
}, properties =
|
||||||
{
|
{
|
||||||
@@ -188,16 +184,15 @@ class ExampleServerDstu3IT implements IServerSupport {
|
|||||||
* Attach websocket
|
* Attach websocket
|
||||||
*/
|
*/
|
||||||
|
|
||||||
WebSocketClient myWebSocketClient = new WebSocketClient();
|
SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(),
|
||||||
SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(), EncodingEnum.JSON);
|
EncodingEnum.JSON);
|
||||||
|
|
||||||
myWebSocketClient.start();
|
|
||||||
URI echoUri = new URI("ws://localhost:" + port + "/websocket");
|
URI echoUri = new URI("ws://localhost:" + port + "/websocket");
|
||||||
ClientUpgradeRequest request = new ClientUpgradeRequest();
|
|
||||||
ourLog.info("Connecting to : {}", echoUri);
|
|
||||||
Future<Session> 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());
|
ourLog.info("Connected to WS: {}", session.isOpen());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ import org.junit.jupiter.api.BeforeEach;
|
|||||||
import org.junit.jupiter.api.Order;
|
import org.junit.jupiter.api.Order;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
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;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||||
classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class},
|
classes = {Application.class},
|
||||||
properties = {
|
properties = {
|
||||||
"spring.datasource.url=jdbc:h2:mem:dbr4b",
|
"spring.datasource.url=jdbc:h2:mem:dbr4b",
|
||||||
"hapi.fhir.enable_repository_validating_interceptor=true",
|
"hapi.fhir.enable_repository_validating_interceptor=true",
|
||||||
|
|||||||
@@ -1,39 +1,50 @@
|
|||||||
package ca.uhn.fhir.jpa.starter;
|
package ca.uhn.fhir.jpa.starter;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
|
||||||
import ca.uhn.fhir.cr.config.RepositoryConfig;
|
import ca.uhn.fhir.cr.config.RepositoryConfig;
|
||||||
import ca.uhn.fhir.jpa.searchparam.config.NicknameServiceConfig;
|
import ca.uhn.fhir.jpa.searchparam.config.NicknameServiceConfig;
|
||||||
import ca.uhn.fhir.jpa.starter.cr.CrProperties;
|
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.CacheControlDirective;
|
||||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||||
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
||||||
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
||||||
import org.eclipse.jetty.websocket.api.Session;
|
import jakarta.websocket.ContainerProvider;
|
||||||
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
|
import jakarta.websocket.Session;
|
||||||
import org.eclipse.jetty.websocket.client.WebSocketClient;
|
import jakarta.websocket.WebSocketContainer;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
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.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.BeforeEach;
|
||||||
import org.junit.jupiter.api.Order;
|
import org.junit.jupiter.api.Order;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
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.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Future;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static ca.uhn.fhir.util.TestUtil.waitForSize;
|
import static ca.uhn.fhir.util.TestUtil.waitForSize;
|
||||||
import static org.awaitility.Awaitility.await;
|
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.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.opencds.cqf.fhir.utility.r4.Parameters.parameters;
|
import static org.opencds.cqf.fhir.utility.r4.Parameters.parameters;
|
||||||
import static org.opencds.cqf.fhir.utility.r4.Parameters.stringPart;
|
import static org.opencds.cqf.fhir.utility.r4.Parameters.stringPart;
|
||||||
@@ -41,7 +52,6 @@ import static org.opencds.cqf.fhir.utility.r4.Parameters.stringPart;
|
|||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||||
classes = {
|
classes = {
|
||||||
Application.class,
|
Application.class,
|
||||||
JpaStarterWebsocketDispatcherConfig.class,
|
|
||||||
NicknameServiceConfig.class,
|
NicknameServiceConfig.class,
|
||||||
RepositoryConfig.class
|
RepositoryConfig.class
|
||||||
}, properties = {
|
}, properties = {
|
||||||
@@ -60,13 +70,14 @@ import static org.opencds.cqf.fhir.utility.r4.Parameters.stringPart;
|
|||||||
// Override is currently required when using MDM as the construction of the MDM
|
// 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
|
// beans are ambiguous as they are constructed multiple places. This is evident
|
||||||
// when running in a spring boot environment
|
// when running in a spring boot environment
|
||||||
"spring.main.allow-bean-definition-overriding=true" })
|
"spring.main.allow-bean-definition-overriding=true"})
|
||||||
class ExampleServerR4IT implements IServerSupport{
|
class ExampleServerR4IT implements IServerSupport {
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerR4IT.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerR4IT.class);
|
||||||
private IGenericClient ourClient;
|
private IGenericClient ourClient;
|
||||||
private FhirContext ourCtx;
|
private FhirContext ourCtx;
|
||||||
|
|
||||||
@Autowired private CrProperties crProperties;
|
@Autowired
|
||||||
|
private CrProperties crProperties;
|
||||||
|
|
||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
private int port;
|
private int port;
|
||||||
@@ -127,7 +138,7 @@ class ExampleServerR4IT implements IServerSupport{
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Parameters runCqlExecution(Parameters parameters){
|
public Parameters runCqlExecution(Parameters parameters) {
|
||||||
|
|
||||||
var results = ourClient.operation().onServer()
|
var results = ourClient.operation().onServer()
|
||||||
.named("$cql")
|
.named("$cql")
|
||||||
@@ -135,6 +146,7 @@ class ExampleServerR4IT implements IServerSupport{
|
|||||||
.execute();
|
.execute();
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSimpleDateCqlExecutionProvider() {
|
void testSimpleDateCqlExecutionProvider() {
|
||||||
Parameters params = parameters(stringPart("expression", "Interval[Today() - 2 years, Today())"));
|
Parameters params = parameters(stringPart("expression", "Interval[Today() - 2 years, Today())"));
|
||||||
@@ -151,6 +163,7 @@ class ExampleServerR4IT implements IServerSupport{
|
|||||||
//.withResources(resource).execute();
|
//.withResources(resource).execute();
|
||||||
return result.get(0);
|
return result.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testBatchPutWithIdenticalTags() {
|
void testBatchPutWithIdenticalTags() {
|
||||||
String batchPuts = "{\n" +
|
String batchPuts = "{\n" +
|
||||||
@@ -202,7 +215,7 @@ class ExampleServerR4IT implements IServerSupport{
|
|||||||
ourClient.transaction().withBundle(bundle).execute();
|
ourClient.transaction().withBundle(bundle).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
@Test
|
||||||
@Order(1)
|
@Order(1)
|
||||||
void testWebsocketSubscription() throws Exception {
|
void testWebsocketSubscription() throws Exception {
|
||||||
/*
|
/*
|
||||||
@@ -218,27 +231,27 @@ class ExampleServerR4IT implements IServerSupport{
|
|||||||
channel.setPayload("application/json");
|
channel.setPayload("application/json");
|
||||||
subscription.setChannel(channel);
|
subscription.setChannel(channel);
|
||||||
|
|
||||||
|
int initialActiveSubscriptionCount = activeSubscriptionCount();
|
||||||
|
|
||||||
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
|
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
|
||||||
IIdType mySubscriptionId = methodOutcome.getId();
|
IIdType mySubscriptionId = methodOutcome.getId();
|
||||||
|
|
||||||
// Wait for the subscription to be activated
|
// 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
|
* Attach websocket
|
||||||
*/
|
*/
|
||||||
|
|
||||||
WebSocketClient myWebSocketClient = new WebSocketClient();
|
|
||||||
SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(),
|
SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(),
|
||||||
EncodingEnum.JSON);
|
EncodingEnum.JSON);
|
||||||
|
|
||||||
myWebSocketClient.start();
|
|
||||||
URI echoUri = new URI("ws://localhost:" + port + "/websocket");
|
URI echoUri = new URI("ws://localhost:" + port + "/websocket");
|
||||||
ClientUpgradeRequest request = new ClientUpgradeRequest();
|
|
||||||
ourLog.info("Connecting to : {}", echoUri);
|
|
||||||
Future<Session> 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());
|
ourLog.info("Connected to WS: {}", session.isOpen());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
package ca.uhn.fhir.jpa.starter;
|
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.context.FhirContext;
|
||||||
import ca.uhn.fhir.rest.api.CacheControlDirective;
|
import ca.uhn.fhir.rest.api.CacheControlDirective;
|
||||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||||
@@ -11,12 +7,9 @@ import ca.uhn.fhir.rest.api.MethodOutcome;
|
|||||||
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
||||||
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
||||||
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
||||||
import java.net.URI;
|
import jakarta.websocket.ContainerProvider;
|
||||||
import java.util.concurrent.Future;
|
import jakarta.websocket.Session;
|
||||||
import java.util.concurrent.TimeUnit;
|
import jakarta.websocket.WebSocketContainer;
|
||||||
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.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.hl7.fhir.r5.model.Bundle;
|
import org.hl7.fhir.r5.model.Bundle;
|
||||||
import org.hl7.fhir.r5.model.Enumerations;
|
import org.hl7.fhir.r5.model.Enumerations;
|
||||||
@@ -28,11 +21,17 @@ import org.junit.jupiter.api.BeforeEach;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
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 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)
|
@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",
|
"spring.datasource.url=jdbc:h2:mem:dbr5",
|
||||||
"hapi.fhir.fhir_version=r5",
|
"hapi.fhir.fhir_version=r5",
|
||||||
@@ -128,17 +127,15 @@ public class ExampleServerR5IT {
|
|||||||
* Attach websocket
|
* Attach websocket
|
||||||
*/
|
*/
|
||||||
|
|
||||||
WebSocketClient myWebSocketClient = new WebSocketClient();
|
SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(),
|
||||||
SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(), EncodingEnum.JSON);
|
EncodingEnum.JSON);
|
||||||
|
|
||||||
myWebSocketClient.start();
|
|
||||||
|
|
||||||
URI echoUri = new URI(endpoint);
|
URI echoUri = new URI(endpoint);
|
||||||
ClientUpgradeRequest request = new ClientUpgradeRequest();
|
|
||||||
ourLog.info("Connecting to : {}", echoUri);
|
|
||||||
Future<Session> 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());
|
ourLog.info("Connected to WS: {}", session.isOpen());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
package ca.uhn.fhir.jpa.starter;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.webapp.WebAppContext;
|
|
||||||
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
|
|
||||||
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 Jetty10WebSocketServletWebServerCustomizer jetty10WebSocketServletWebServerCustomizer() {
|
|
||||||
return new Jetty10WebSocketServletWebServerCustomizer();
|
|
||||||
}
|
|
||||||
|
|
||||||
static class Jetty10WebSocketServletWebServerCustomizer implements WebServerFactoryCustomizer<JettyServletWebServerFactory> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void customize(JettyServletWebServerFactory factory) {
|
|
||||||
|
|
||||||
factory.addServerCustomizers(server -> {
|
|
||||||
WebAppContext ctx = (WebAppContext) server.getHandler();
|
|
||||||
JettyWebSocketServletContainerInitializer.configure(ctx, null);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,13 +12,13 @@ import org.junit.jupiter.api.BeforeEach;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
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 org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
@ExtendWith(SpringExtension.class)
|
@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",
|
"spring.datasource.url=jdbc:h2:mem:dbr4-mt",
|
||||||
"hapi.fhir.fhir_version=r4",
|
"hapi.fhir.fhir_version=r4",
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
package ca.uhn.fhir.jpa.starter;
|
package ca.uhn.fhir.jpa.starter;
|
||||||
|
|
||||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||||
import org.eclipse.jetty.websocket.api.Session;
|
import jakarta.websocket.ClientEndpoint;
|
||||||
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
|
import jakarta.websocket.OnMessage;
|
||||||
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
|
import jakarta.websocket.OnOpen;
|
||||||
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
|
import jakarta.websocket.Session;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@WebSocket
|
@ClientEndpoint
|
||||||
public class SocketImplementation {
|
public class SocketImplementation {
|
||||||
|
|
||||||
private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(SocketImplementation.class);
|
private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(SocketImplementation.class);
|
||||||
@@ -34,7 +34,7 @@ public class SocketImplementation {
|
|||||||
public void keepAlive() {
|
public void keepAlive() {
|
||||||
if (this.session != null) {
|
if (this.session != null) {
|
||||||
try {
|
try {
|
||||||
session.getRemote().sendString("keep alive");
|
session.getBasicRemote().sendText("keep alive");
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
ourLog.error("Failure", t);
|
ourLog.error("Failure", t);
|
||||||
}
|
}
|
||||||
@@ -47,14 +47,14 @@ public class SocketImplementation {
|
|||||||
*
|
*
|
||||||
* @param session
|
* @param session
|
||||||
*/
|
*/
|
||||||
@OnWebSocketConnect
|
@OnOpen
|
||||||
public void onConnect(Session session) {
|
public void onConnect(Session session) {
|
||||||
ourLog.info("Got connect: {}", session);
|
ourLog.info("Got connect: {}", session);
|
||||||
this.session = session;
|
this.session = session;
|
||||||
try {
|
try {
|
||||||
String sending = "bind " + myCriteria;
|
String sending = "bind " + myCriteria;
|
||||||
ourLog.info("Sending: {}", sending);
|
ourLog.info("Sending: {}", sending);
|
||||||
session.getRemote().sendString(sending);
|
session.getBasicRemote().sendText(sending);
|
||||||
|
|
||||||
ourLog.info("Connection: DONE");
|
ourLog.info("Connection: DONE");
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
@@ -68,7 +68,7 @@ public class SocketImplementation {
|
|||||||
*
|
*
|
||||||
* @param theMsg
|
* @param theMsg
|
||||||
*/
|
*/
|
||||||
@OnWebSocketMessage
|
@OnMessage
|
||||||
public void onMessage(String theMsg) {
|
public void onMessage(String theMsg) {
|
||||||
ourLog.info("Got msg: " + theMsg);
|
ourLog.info("Got msg: " + theMsg);
|
||||||
myMessages.add(theMsg);
|
myMessages.add(theMsg);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
spring:
|
spring:
|
||||||
main:
|
main:
|
||||||
allow-circular-references: true
|
allow-circular-references: true
|
||||||
#allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
flyway:
|
flyway:
|
||||||
enabled: false
|
enabled: false
|
||||||
check-location: false
|
check-location: false
|
||||||
@@ -20,11 +20,20 @@ spring:
|
|||||||
properties:
|
properties:
|
||||||
hibernate.format_sql: false
|
hibernate.format_sql: false
|
||||||
hibernate.show_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.dialect: ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect
|
||||||
|
#########################################
|
||||||
# hibernate.hbm2ddl.auto: update
|
# hibernate.hbm2ddl.auto: update
|
||||||
# hibernate.jdbc.batch_size: 20
|
# hibernate.jdbc.batch_size: 20
|
||||||
# hibernate.cache.use_query_cache: false
|
# hibernate.cache.use_query_cache: false
|
||||||
|
|||||||
Reference in New Issue
Block a user