Skip to content

Commit 9c7bd11

Browse files
authored
Merge pull request #684 from hapifhir/rel_7_3_tracking
Update to HAPI 7.4.0 (tracking branch)
2 parents 6b0d467 + d9840c3 commit 9c7bd11

File tree

8 files changed

+49
-63
lines changed

8 files changed

+49
-63
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<parent>
1515
<groupId>ca.uhn.hapi.fhir</groupId>
1616
<artifactId>hapi-fhir</artifactId>
17-
<version>7.2.1</version>
17+
<version>7.4.0</version>
1818
</parent>
1919

2020
<artifactId>hapi-fhir-jpaserver-starter</artifactId>

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

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import ca.uhn.fhir.jpa.config.HibernatePropertiesProvider;
77
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
88
import ca.uhn.fhir.jpa.model.config.PartitionSettings.CrossPartitionReferenceMode;
9+
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
910
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
1011
import ca.uhn.fhir.jpa.starter.AppProperties;
1112
import ca.uhn.fhir.jpa.starter.util.JpaHibernatePropertiesProvider;
@@ -87,6 +88,40 @@ public FhirServerConfigCommon(AppProperties appProperties) {
8788
}
8889
}
8990

91+
@Bean
92+
public SubscriptionSettings subscriptionSettings(AppProperties appProperties) {
93+
SubscriptionSettings subscriptionSettings = new SubscriptionSettings();
94+
if (appProperties.getSubscription() != null) {
95+
if (appProperties.getSubscription().getEmail() != null)
96+
subscriptionSettings.setEmailFromAddress(
97+
appProperties.getSubscription().getEmail().getFrom());
98+
99+
// Subscriptions are enabled by channel type
100+
if (appProperties.getSubscription().getResthook_enabled()) {
101+
ourLog.info("Enabling REST-hook subscriptions");
102+
subscriptionSettings.addSupportedSubscriptionType(
103+
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK);
104+
}
105+
if (appProperties.getSubscription().getEmail() != null) {
106+
ourLog.info("Enabling email subscriptions");
107+
subscriptionSettings.addSupportedSubscriptionType(
108+
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL);
109+
}
110+
if (appProperties.getSubscription().getWebsocket_enabled()) {
111+
ourLog.info("Enabling websocket subscriptions");
112+
subscriptionSettings.addSupportedSubscriptionType(
113+
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET);
114+
}
115+
116+
}
117+
if (appProperties.getMdm_enabled()) {
118+
// MDM requires the subscription of type message
119+
ourLog.info("Enabling message subscriptions");
120+
subscriptionSettings.addSupportedSubscriptionType(
121+
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.MESSAGE);
122+
}
123+
return subscriptionSettings;
124+
}
90125
/**
91126
* Configure FHIR properties around the JPA server via this bean
92127
*/
@@ -114,10 +149,7 @@ public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
114149
jpaStorageSettings.setDeleteExpungeEnabled(appProperties.getDelete_expunge_enabled());
115150
jpaStorageSettings.setExpungeEnabled(appProperties.getExpunge_enabled());
116151
jpaStorageSettings.setLanguageSearchParameterEnabled(appProperties.getLanguage_search_parameter_enabled());
117-
if (appProperties.getSubscription() != null
118-
&& appProperties.getSubscription().getEmail() != null)
119-
jpaStorageSettings.setEmailFromAddress(
120-
appProperties.getSubscription().getEmail().getFrom());
152+
121153

122154
Integer maxFetchSize = appProperties.getMax_page_size();
123155
jpaStorageSettings.setFetchSizeDefaultMaximum(maxFetchSize);
@@ -131,24 +163,7 @@ public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
131163
Long retainCachedSearchesMinutes = appProperties.getRetain_cached_searches_mins();
132164
jpaStorageSettings.setExpireSearchResultsAfterMillis(retainCachedSearchesMinutes * 60 * 1000);
133165

134-
if (appProperties.getSubscription() != null) {
135-
// Subscriptions are enabled by channel type
136-
if (appProperties.getSubscription().getResthook_enabled()) {
137-
ourLog.info("Enabling REST-hook subscriptions");
138-
jpaStorageSettings.addSupportedSubscriptionType(
139-
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK);
140-
}
141-
if (appProperties.getSubscription().getEmail() != null) {
142-
ourLog.info("Enabling email subscriptions");
143-
jpaStorageSettings.addSupportedSubscriptionType(
144-
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL);
145-
}
146-
if (appProperties.getSubscription().getWebsocket_enabled()) {
147-
ourLog.info("Enabling websocket subscriptions");
148-
jpaStorageSettings.addSupportedSubscriptionType(
149-
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET);
150-
}
151-
}
166+
152167

153168
jpaStorageSettings.setFilterParameterEnabled(appProperties.getFilter_search_enabled());
154169
jpaStorageSettings.setAdvancedHSearchIndexing(appProperties.getAdvanced_lucene_indexing());
@@ -204,13 +219,6 @@ public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
204219
jpaStorageSettings.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_size());
205220
jpaStorageSettings.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_max_size());
206221

207-
if (appProperties.getMdm_enabled()) {
208-
// MDM requires the subscription of type message
209-
ourLog.info("Enabling message subscriptions");
210-
jpaStorageSettings.addSupportedSubscriptionType(
211-
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.MESSAGE);
212-
}
213-
214222
storageSettings(appProperties, jpaStorageSettings);
215223
return jpaStorageSettings;
216224
}
@@ -251,10 +259,6 @@ protected StorageSettings storageSettings(AppProperties appProperties, JpaStorag
251259
jpaStorageSettings.setAllowExternalReferences(appProperties.getAllow_external_references());
252260
jpaStorageSettings.setDefaultSearchParamsCanBeOverridden(
253261
appProperties.getAllow_override_default_search_params());
254-
if (appProperties.getSubscription() != null
255-
&& appProperties.getSubscription().getEmail() != null)
256-
jpaStorageSettings.setEmailFromAddress(
257-
appProperties.getSubscription().getEmail().getFrom());
258262

259263
jpaStorageSettings.setNormalizedQuantitySearchLevel(appProperties.getNormalized_quantity_search_level());
260264

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor;
3131
import ca.uhn.fhir.jpa.interceptor.validation.RepositoryValidatingInterceptor;
3232
import ca.uhn.fhir.jpa.ips.provider.IpsOperationProvider;
33+
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
3334
import ca.uhn.fhir.jpa.packages.IPackageInstallerSvc;
3435
import ca.uhn.fhir.jpa.packages.PackageInstallationSpec;
3536
import ca.uhn.fhir.jpa.partition.PartitionManagementProvider;
@@ -252,6 +253,7 @@ public RestfulServer restfulServer(
252253
IJpaSystemProvider jpaSystemProvider,
253254
ResourceProviderFactory resourceProviderFactory,
254255
JpaStorageSettings jpaStorageSettings,
256+
SubscriptionSettings subscriptionSettings,
255257
ISearchParamRegistry searchParamRegistry,
256258
IValidationSupport theValidationSupport,
257259
DatabaseBackedPagingProvider databaseBackedPagingProvider,
@@ -378,7 +380,7 @@ public RestfulServer restfulServer(
378380

379381
corsInterceptor.ifPresent(fhirServer::registerInterceptor);
380382

381-
if (jpaStorageSettings.getSupportedSubscriptionTypes().size() > 0) {
383+
if (!subscriptionSettings.getSupportedSubscriptionTypes().isEmpty()) {
382384
// Subscription debug logging
383385
fhirServer.registerInterceptor(new SubscriptionDebugLogInterceptor());
384386
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
RepositoryConfig.class
4444
}, properties =
4545
{
46-
"spring.profiles.include=storageSettingsTest",
4746
"spring.datasource.url=jdbc:h2:mem:dbr3",
4847
"hapi.fhir.fhir_version=dstu3",
4948
"hapi.fhir.cr_enabled=true",

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,10 @@
5555
NicknameServiceConfig.class,
5656
RepositoryConfig.class
5757
}, properties = {
58-
"spring.profiles.include=storageSettingsTest",
5958
"spring.datasource.url=jdbc:h2:mem:dbr4",
6059
"hapi.fhir.enable_repository_validating_interceptor=true",
6160
"hapi.fhir.fhir_version=r4",
62-
//"hapi.fhir.subscription.websocket_enabled=true",
61+
"hapi.fhir.subscription.websocket_enabled=true",
6362
//"hapi.fhir.mdm_enabled=true",
6463
"hapi.fhir.cr.enabled=true",
6564
"hapi.fhir.cr.caregaps.section_author=Organization/alphora-author",
@@ -230,7 +229,7 @@ void testWebsocketSubscription() throws Exception {
230229
IIdType mySubscriptionId = methodOutcome.getId();
231230

232231
// Wait for the subscription to be activated
233-
await().atMost(1, TimeUnit.MINUTES).until(()->activeSubscriptionCount(), equalTo(initialActiveSubscriptionCount + 1));
232+
await().atMost(1, TimeUnit.MINUTES).until(this::activeSubscriptionCount, equalTo(initialActiveSubscriptionCount + 1));
234233

235234
/*
236235
* Attach websocket

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

Lines changed: 0 additions & 22 deletions
This file was deleted.

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static org.assertj.core.api.Assertions.assertThat;
44

5+
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
56
import org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType;
67
import org.junit.jupiter.api.Test;
78
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,9 +22,12 @@ class MdmTest {
2122
@Autowired
2223
JpaStorageSettings jpaStorageSettings;
2324

25+
@Autowired
26+
SubscriptionSettings subscriptionSettings;
27+
2428
@Test
2529
void testApplicationStartedSuccessfully() {
2630
assertThat(nicknameService).isNotNull();
27-
assertThat(jpaStorageSettings.getSupportedSubscriptionTypes()).contains(SubscriptionChannelType.MESSAGE);
31+
assertThat(subscriptionSettings.getSupportedSubscriptionTypes()).contains(SubscriptionChannelType.MESSAGE);
2832
}
2933
}

src/test/smoketest/plain_server.http

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Content-Type: application/json
8787
});
8888
const batch_patient_location = response.body.entry[0].response.location;
8989
const indexOfHistory = batch_patient_location.lastIndexOf("/_history");
90-
trimmed_location = batch_patient_location.substring(0, indexOfHistory);
90+
var trimmed_location = batch_patient_location.substring(0, indexOfHistory);
9191
trimmed_location = trimmed_location.replace("Patient/", "")
9292
client.global.set("batch_patient_id", trimmed_location);
9393
%}

0 commit comments

Comments
 (0)