diff --git a/pom.xml b/pom.xml
index 1fc9a25..3b38277 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.6.0
+ 6.8.0
hapi-fhir-jpaserver-starter
@@ -247,6 +247,12 @@
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-jpaserver-test-utilities
+ ${project.version}
+ test
+
org.eclipse.jetty
jetty-servlets
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 77af694..7a1934f 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
@@ -9,7 +9,7 @@ import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.support.IValidationSupport;
-import ca.uhn.fhir.cr.config.CrProviderLoader;
+
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.jpa.api.IDaoRegistry;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
@@ -18,7 +18,7 @@ import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.binary.interceptor.BinaryStorageInterceptor;
import ca.uhn.fhir.jpa.binary.provider.BinaryAccessProvider;
-import ca.uhn.fhir.jpa.bulk.export.provider.BulkDataExportProvider;
+import ca.uhn.fhir.batch2.jobs.export.BulkDataExportProvider;
import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil;
import ca.uhn.fhir.jpa.config.util.ResourceCountCacheUtil;
import ca.uhn.fhir.jpa.config.util.ValidationSupportConfigUtil;
@@ -111,8 +111,7 @@ public class StarterJpaConfig {
@Autowired
private ConfigurableEnvironment configurableEnvironment;
- @Autowired(required=false)
- private CrProviderLoader crProviderLoader;
+
/**
* Customize the default/max page sizes for search results. You can set these however
diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java
index 9efc086..06d95f4 100644
--- a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java
+++ b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java
@@ -1,6 +1,6 @@
package ca.uhn.fhir.jpa.starter.cr;
-import ca.uhn.fhir.cr.config.CrDstu3Config;
+import ca.uhn.fhir.cr.config.dstu3.CrDstu3Config;
import ca.uhn.fhir.jpa.starter.annotations.OnDSTU3Condition;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java
index a97cea7..586a324 100644
--- a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java
+++ b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java
@@ -1,6 +1,6 @@
package ca.uhn.fhir.jpa.starter.cr;
-import ca.uhn.fhir.cr.config.CrR4Config;
+import ca.uhn.fhir.cr.config.r4.CrR4Config;
import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Import;
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 5cb0a4e..6f358d4 100644
--- a/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java
+++ b/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java
@@ -3,16 +3,23 @@ package ca.uhn.fhir.jpa.starter;
import static org.junit.jupiter.api.Assertions.assertEquals;
import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.jpa.search.lastn.ElasticsearchRestClientFactory;
import ca.uhn.fhir.jpa.search.lastn.ElasticsearchSvcImpl;
+import ca.uhn.fhir.jpa.test.config.TestElasticsearchContainerHelper;
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.io.IOException;
-import java.time.Duration;
-import java.time.temporal.ChronoUnit;
+
import java.util.Date;
import java.util.GregorianCalendar;
+import java.util.List;
import javax.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;
@@ -34,8 +41,11 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.testcontainers.elasticsearch.ElasticsearchContainer;
+import org.testcontainers.junit.jupiter.Container;
+import org.testcontainers.junit.jupiter.Testcontainers;
@ExtendWith(SpringExtension.class)
+@Testcontainers
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties =
{
"spring.datasource.url=jdbc:h2:mem:dbr4",
@@ -43,6 +53,7 @@ import org.testcontainers.elasticsearch.ElasticsearchContainer;
"hapi.fhir.lastn_enabled=true",
"hapi.fhir.store_resource_in_lucene_index_enabled=true",
"hapi.fhir.advanced_lucene_indexing=true",
+
"elasticsearch.enabled=true",
// Because the port is set randomly, we will set the rest_url using the Initializer.
// "elasticsearch.rest_url='http://localhost:9200'",
@@ -61,19 +72,31 @@ public class ElasticsearchLastNR4IT {
private IGenericClient ourClient;
private FhirContext ourCtx;
- private static final String ELASTIC_VERSION = "7.16.3";
- private static final String ELASTIC_IMAGE = "docker.elastic.co/elasticsearch/elasticsearch:" + ELASTIC_VERSION;
- private static ElasticsearchContainer embeddedElastic;
+ @Container
+ public static ElasticsearchContainer embeddedElastic = TestElasticsearchContainerHelper.getEmbeddedElasticSearch();
@Autowired
private ElasticsearchSvcImpl myElasticsearchSvc;
@BeforeAll
- public static void beforeClass() {
- embeddedElastic = new ElasticsearchContainer(ELASTIC_IMAGE).withStartupTimeout(Duration.of(300, ChronoUnit.SECONDS));
- embeddedElastic.start();
+ public static void beforeClass() throws IOException {
+ //Given
+ RestHighLevelClient 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);
+
+
}
-
+
@PreDestroy
public void stop() {
embeddedElastic.stop();
@@ -115,7 +138,7 @@ public class ElasticsearchLastNR4IT {
}
@BeforeEach
- void beforeEach() {
+ void beforeEach() throws IOException {
ourCtx = FhirContext.forR4();
ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
@@ -123,6 +146,7 @@ public class ElasticsearchLastNR4IT {
String ourServerBase = "http://localhost:" + port + "/fhir/";
ourClient = ourCtx.newRestfulGenericClient(ourServerBase);
ourClient.registerInterceptor(new LoggingInterceptor(true));
+
}
static class Initializer
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 d08770a..26f27f6 100644
--- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java
+++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java
@@ -1,6 +1,7 @@
package ca.uhn.fhir.jpa.starter;
import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.jpa.searchparam.config.NicknameServiceConfig;
import ca.uhn.fhir.rest.api.CacheControlDirective;
import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.api.MethodOutcome;
@@ -30,7 +31,7 @@ import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = {
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class, NicknameServiceConfig.class}, properties = {
"spring.datasource.url=jdbc:h2:mem:dbr4",
"hapi.fhir.enable_repository_validating_interceptor=true",
"hapi.fhir.fhir_version=r4",