Extract Subscription Settings from Storage Settings (#5887)

* first cut

* first cut

* cleanup

* that took way too long

* fix test

* licenses

* merge master

* merge master

* changelog

* review feedback

* bump version
This commit is contained in:
Ken Stevens 2024-06-14 20:31:55 -04:00 committed by GitHub
parent 024d848690
commit 57d1815b46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
149 changed files with 727 additions and 542 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-bom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<packaging>pom</packaging>
<name>HAPI FHIR BOM</name>
@ -12,7 +12,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -0,0 +1,4 @@
---
type: change
issue: 5887
title: "Extract Subscription Settings from Storage Settings so they can be managed independently."

View File

@ -11,7 +11,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -37,6 +37,7 @@ import ca.uhn.fhir.jpa.dao.ISearchBuilder;
import ca.uhn.fhir.jpa.dao.SearchBuilderFactory;
import ca.uhn.fhir.jpa.dao.mdm.MdmExpansionCacheSvc;
import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService;
import ca.uhn.fhir.jpa.entity.MdmLink;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
import ca.uhn.fhir.jpa.model.search.SearchBuilderLoadIncludesParameters;
import ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails;
@ -109,9 +110,8 @@ public class JpaBulkExportProcessor implements IBulkExportProcessor<JpaPid> {
@Autowired
private IIdHelperService<JpaPid> myIdHelperService;
@SuppressWarnings("rawtypes")
@Autowired
protected IMdmLinkDao myMdmLinkDao;
protected IMdmLinkDao<JpaPid, MdmLink> myMdmLinkDao;
@Autowired
private MdmExpansionCacheSvc myMdmExpansionCacheSvc;

View File

@ -22,13 +22,14 @@ package ca.uhn.fhir.jpa.config;
import ca.uhn.fhir.jpa.bulk.export.api.IBulkExportProcessor;
import ca.uhn.fhir.jpa.bulk.export.svc.BulkExportHelperService;
import ca.uhn.fhir.jpa.bulk.export.svc.JpaBulkExportProcessor;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class JpaBulkExportConfig {
@Bean
public IBulkExportProcessor jpaBulkExportProcessor() {
public IBulkExportProcessor<JpaPid> jpaBulkExportProcessor() {
return new JpaBulkExportProcessor();
}

View File

@ -36,6 +36,8 @@ public class RequestPartitionHelperSvc extends BaseRequestPartitionHelperSvc {
@Autowired
IPartitionLookupSvc myPartitionConfigSvc;
public RequestPartitionHelperSvc() {}
@Override
public RequestPartitionId validateAndNormalizePartitionIds(RequestPartitionId theRequestPartitionId) {
List<String> names = null;

View File

@ -91,24 +91,6 @@ public class JpaCapabilityStatementProvider extends ServerCapabilityStatementPro
theTerser.addElement(theCapabilityStatement, "patchFormat", Constants.CT_XML_PATCH);
}
@Override
protected void postProcessRest(FhirTerser theTerser, IBase theRest) {
super.postProcessRest(theTerser, theRest);
if (myStorageSettings
.getSupportedSubscriptionTypes()
.contains(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET)) {
if (isNotBlank(myStorageSettings.getWebsocketContextPath())) {
ExtensionUtil.setExtension(
myContext,
theRest,
Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL,
"uri",
myStorageSettings.getWebsocketContextPath());
}
}
}
@Override
protected void postProcessRestResource(FhirTerser theTerser, IBase theResource, String theResourceName) {
super.postProcessRestResource(theTerser, theResource, theResourceName);

View File

@ -25,7 +25,6 @@ import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.util.ResourceCountCache;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.dstu2.composite.MetaDt;
import ca.uhn.fhir.model.dstu2.resource.Bundle;
import ca.uhn.fhir.model.dstu2.resource.Conformance;
@ -37,15 +36,12 @@ import ca.uhn.fhir.model.dstu2.valueset.ResourceTypeEnum;
import ca.uhn.fhir.model.dstu2.valueset.SearchParamTypeEnum;
import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.DecimalDt;
import ca.uhn.fhir.model.primitive.UriDt;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider;
import ca.uhn.fhir.util.CoverageIgnore;
import ca.uhn.fhir.util.ExtensionConstants;
import jakarta.servlet.http.HttpServletRequest;
import org.hl7.fhir.dstu2.model.Subscription;
import java.util.Collections;
import java.util.List;
@ -135,17 +131,6 @@ public class JpaConformanceProviderDstu2 extends ServerConformanceProvider {
}
}
if (myStorageSettings
.getSupportedSubscriptionTypes()
.contains(Subscription.SubscriptionChannelType.WEBSOCKET)) {
if (isNotBlank(myStorageSettings.getWebsocketContextPath())) {
ExtensionDt websocketExtension = new ExtensionDt();
websocketExtension.setUrl(Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL);
websocketExtension.setValue(new UriDt(myStorageSettings.getWebsocketContextPath()));
retVal.getRestFirstRep().addUndeclaredExtension(websocketExtension);
}
}
if (isNotBlank(myImplementationDescription)) {
retVal.getImplementation().setDescription(myImplementationDescription);
}

View File

@ -43,7 +43,6 @@ import org.hl7.fhir.dstu3.model.DecimalType;
import org.hl7.fhir.dstu3.model.Enumerations.SearchParamType;
import org.hl7.fhir.dstu3.model.Extension;
import org.hl7.fhir.dstu3.model.Meta;
import org.hl7.fhir.dstu3.model.UriType;
import java.util.Collections;
import java.util.List;
@ -176,17 +175,6 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se
massage(retVal);
if (myStorageSettings
.getSupportedSubscriptionTypes()
.contains(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET)) {
if (isNotBlank(myStorageSettings.getWebsocketContextPath())) {
Extension websocketExtension = new Extension();
websocketExtension.setUrl(Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL);
websocketExtension.setValue(new UriType(myStorageSettings.getWebsocketContextPath()));
retVal.getRestFirstRep().addExtension(websocketExtension);
}
}
retVal.getImplementation().setDescription(myImplementationDescription);
myCachedValue = retVal;
return retVal;

View File

@ -28,6 +28,8 @@ public class JpaHapiTransactionService extends HapiTransactionService {
private volatile Boolean myCustomIsolationSupported;
public JpaHapiTransactionService() {}
@Override
public boolean isCustomIsolationSupported() {
if (myCustomIsolationSupported == null) {

View File

@ -16,6 +16,7 @@ import ca.uhn.fhir.jpa.dao.SearchBuilderFactory;
import ca.uhn.fhir.jpa.dao.mdm.MdmExpansionCacheSvc;
import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService;
import ca.uhn.fhir.jpa.dao.tx.NonTransactionalHapiTransactionService;
import ca.uhn.fhir.jpa.entity.MdmLink;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
import ca.uhn.fhir.jpa.model.search.SearchBuilderLoadIncludesParameters;
import ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails;
@ -138,7 +139,7 @@ public class JpaBulkExportProcessorTest {
private IIdHelperService<JpaPid> myIdHelperService;
@Mock
private IMdmLinkDao<JpaPid,?> myMdmLinkDao;
private IMdmLinkDao<JpaPid, MdmLink> myMdmLinkDao;
@Mock
private MdmExpansionCacheSvc myMdmExpansionCacheSvc;

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -24,7 +24,7 @@ import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.junit.jupiter.MockitoExtension;
import javax.annotation.Nonnull;
import jakarta.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;

View File

@ -3,7 +3,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.mdm.config;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.mdm.helper.MdmHelperR4;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.channel.config.SubscriptionChannelConfig;
import ca.uhn.fhir.jpa.subscription.submit.config.SubscriptionSubmitterConfig;
import ca.uhn.fhir.jpa.test.config.TestSubscriptionMatcherInterceptorConfig;
@ -19,8 +20,8 @@ public class TestMdmConfigR4 extends BaseTestMdmConfig {
@Primary
@Bean
public JpaStorageSettings storageSettings() {
JpaStorageSettings retVal = new JpaStorageSettings();
public SubscriptionSettings subscriptionSettings() {
SubscriptionSettings retVal = new SubscriptionSettings();
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.MESSAGE);

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -0,0 +1,238 @@
/*-
* #%L
* HAPI FHIR JPA Model
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.jpa.model.config;
import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.collections4.CollectionUtils;
import org.hl7.fhir.dstu2.model.Subscription;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
public abstract class BaseSubscriptionSettings {
public static final String DEFAULT_EMAIL_FROM_ADDRESS = "noreply@unknown.com";
public static final String DEFAULT_WEBSOCKET_CONTEXT_PATH = "/websocket";
private final Set<Subscription.SubscriptionChannelType> mySupportedSubscriptionTypes = new HashSet<>();
private String myEmailFromAddress = DEFAULT_EMAIL_FROM_ADDRESS;
private String myWebsocketContextPath = DEFAULT_WEBSOCKET_CONTEXT_PATH;
private boolean myQualifySubscriptionMatchingChannelName = true;
private boolean myCrossPartitionSubscriptionEnabled = true;
private boolean myEnableInMemorySubscriptionMatching = true;
private boolean myTriggerSubscriptionsForNonVersioningChanges;
/**
* @since 6.8.0
* Prevents any non IN-MEMORY Search params from being created by users.
*/
private boolean myAllowOnlyInMemorySubscriptions = false;
/**
* This setting indicates which subscription channel types are supported by the server. Any subscriptions submitted
* to the server matching these types will be activated.
*/
public void addSupportedSubscriptionType(Subscription.SubscriptionChannelType theSubscriptionChannelType) {
mySupportedSubscriptionTypes.add(theSubscriptionChannelType);
}
/**
* This setting indicates which subscription channel types are supported by the server. Any subscriptions submitted
* to the server matching these types will be activated.
*/
public Set<Subscription.SubscriptionChannelType> getSupportedSubscriptionTypes() {
return Collections.unmodifiableSet(mySupportedSubscriptionTypes);
}
/**
* Indicate whether a subscription channel type is supported by this server.
*
* @return true if at least one subscription channel type is supported by this server false otherwise.
*/
public boolean hasSupportedSubscriptionTypes() {
return CollectionUtils.isNotEmpty(mySupportedSubscriptionTypes);
}
@VisibleForTesting
public void clearSupportedSubscriptionTypesForUnitTest() {
mySupportedSubscriptionTypes.clear();
}
/**
* If e-mail subscriptions are supported, the From address used when sending e-mails
*/
public String getEmailFromAddress() {
return myEmailFromAddress;
}
/**
* Set the from address used for sending emails when using email subscriptions
*/
public void setEmailFromAddress(String theEmailFromAddress) {
myEmailFromAddress = theEmailFromAddress;
}
/**
* If websocket subscriptions are enabled, this specifies the context path that listens to them. Default value "/websocket".
*/
public String getWebsocketContextPath() {
return myWebsocketContextPath;
}
/**
* Set the websocket endpoint context path to use when websocket subscriptions are enabled. Default value "/websocket".
*/
public void setWebsocketContextPath(String theWebsocketContextPath) {
myWebsocketContextPath = theWebsocketContextPath;
}
/**
* This setting returns whether the channel name should be qualified or not.
*
* @return whether the channel name is qualified or not
* @since 6.4.0
*/
public boolean isQualifySubscriptionMatchingChannelName() {
return myQualifySubscriptionMatchingChannelName;
}
/**
* This setting controls whether the channel name
* should be qualified or not.
* Default is true, ie, the channel name will be qualified.
*
* @since 6.4.0
*/
public void setQualifySubscriptionMatchingChannelName(boolean theQualifySubscriptionMatchingChannelName) {
myQualifySubscriptionMatchingChannelName = theQualifySubscriptionMatchingChannelName;
}
/**
* If enabled, the server will support cross-partition subscription.
* This subscription will be the responsible for all the requests from all the partitions on this server.
* For example, if the server has 3 partitions, P1, P2, P3
* The subscription will live in the DEFAULT partition. Resource posted to DEFAULT, P1, P2, and P3 will trigger this subscription.
* <p>
* Default is <code>false</code>
* </p>
*
* @since 5.7.0
*/
public boolean isCrossPartitionSubscriptionEnabled() {
return myCrossPartitionSubscriptionEnabled;
}
/**
* If enabled, the server will support cross-partition subscription.
* This subscription will be the responsible for all the requests from all the partitions on this server.
* For example, if the server has 3 partitions, P1, P2, P3
* The subscription will live in the DEFAULT partition. Resource posted to DEFAULT, P1, P2, and P3 will trigger this subscription.
* <p>
* Default is <code>false</code>
* </p>
*
* @since 5.7.0
*/
public void setCrossPartitionSubscriptionEnabled(boolean theAllowCrossPartitionSubscription) {
myCrossPartitionSubscriptionEnabled = theAllowCrossPartitionSubscription;
}
/**
* If set to true, the server will prevent the creation of Subscriptions which cannot be evaluated IN-MEMORY. This can improve
* overall server performance.
*
* @since 6.8.0
*/
public void setOnlyAllowInMemorySubscriptions(boolean theAllowOnlyInMemorySearchParams) {
myAllowOnlyInMemorySubscriptions = theAllowOnlyInMemorySearchParams;
}
/**
* If set to true, the server will prevent the creation of Subscriptions which cannot be evaluated IN-MEMORY. This can improve
* overall server performance.
*
* @since 6.8.0
* @return Returns the value of {@link #setOnlyAllowInMemorySubscriptions(boolean)}
*/
public boolean isOnlyAllowInMemorySubscriptions() {
return myAllowOnlyInMemorySubscriptions;
}
/**
* If set to <code>false</code> (default is true) the server will not use
* in-memory subscription searching and instead use the database matcher for all subscription
* criteria matching.
* <p>
* When there are subscriptions registered
* on the server, the default behaviour is to compare the changed resource to the
* subscription criteria directly in-memory without going out to the database.
* Certain types of subscription criteria, e.g. chained references of queries with
* qualifiers or prefixes, are not supported by the in-memory matcher and will fall back
* to a database matcher.
* <p>
* The database matcher performs a query against the
* database by prepending ?id=XYZ to the subscription criteria where XYZ is the id of the changed entity
*
* @since 3.6.1
*/
public boolean isEnableInMemorySubscriptionMatching() {
return myEnableInMemorySubscriptionMatching;
}
/**
* If set to <code>false</code> (default is true) the server will not use
* in-memory subscription searching and instead use the database matcher for all subscription
* criteria matching.
* <p>
* When there are subscriptions registered
* on the server, the default behaviour is to compare the changed resource to the
* subscription criteria directly in-memory without going out to the database.
* Certain types of subscription criteria, e.g. chained references of queries with
* qualifiers or prefixes, are not supported by the in-memory matcher and will fall back
* to a database matcher.
* <p>
* The database matcher performs a query against the
* database by prepending ?id=XYZ to the subscription criteria where XYZ is the id of the changed entity
*
* @since 3.6.1
*/
public void setEnableInMemorySubscriptionMatching(boolean theEnableInMemorySubscriptionMatching) {
myEnableInMemorySubscriptionMatching = theEnableInMemorySubscriptionMatching;
}
/**
* If set to true (default is false) then subscriptions will be triggered for resource updates even if they
* do not trigger a new version (e.g. $meta-add and $meta-delete).
*
* @since 5.5.0
*/
public boolean isTriggerSubscriptionsForNonVersioningChanges() {
return myTriggerSubscriptionsForNonVersioningChanges;
}
/**
* If set to true (default is false) then subscriptions will be triggered for resource updates even if they
* do not trigger a new version (e.g. $meta-add and $meta-delete).
*
* @since 5.5.0
*/
public void setTriggerSubscriptionsForNonVersioningChanges(boolean theTriggerSubscriptionsForNonVersioningChanges) {
myTriggerSubscriptionsForNonVersioningChanges = theTriggerSubscriptionsForNonVersioningChanges;
}
}

View File

@ -0,0 +1,23 @@
/*-
* #%L
* HAPI FHIR JPA Model
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.jpa.model.config;
// Empty subclass to avoid bean wiring conflicts in projects that want to define a different implementation
public class SubscriptionSettings extends BaseSubscriptionSettings {}

View File

@ -25,10 +25,7 @@ import ca.uhn.fhir.jpa.util.ISequenceValueMassager;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc;
import ca.uhn.fhir.util.HapiExtensions;
import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.dstu2.model.Subscription;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.r4.model.DateTimeType;
@ -70,7 +67,6 @@ public class StorageSettings {
"http://hl7.org/fhir/codesystem-*",
"http://hl7.org/fhir/StructureDefinition/*")));
public static final String DEFAULT_WEBSOCKET_CONTEXT_PATH = "/websocket";
/*
* <p>
* Note the following database documented limitations:
@ -95,18 +91,12 @@ public class StorageSettings {
private Set<String> myTreatBaseUrlsAsLocal = new HashSet<>();
private Set<String> myTreatReferencesAsLogical = new HashSet<>(DEFAULT_LOGICAL_BASE_URLS);
private boolean myDefaultSearchParamsCanBeOverridden = true;
private Set<Subscription.SubscriptionChannelType> mySupportedSubscriptionTypes = new HashSet<>();
private boolean myAutoCreatePlaceholderReferenceTargets;
private boolean myCrossPartitionSubscriptionEnabled = true;
private Integer myBundleBatchPoolSize = DEFAULT_BUNDLE_BATCH_POOL_SIZE;
private Integer myBundleBatchMaxPoolSize = DEFAULT_BUNDLE_BATCH_MAX_POOL_SIZE;
private boolean myEnableInMemorySubscriptionMatching = true;
private boolean myTriggerSubscriptionsForNonVersioningChanges;
private boolean myMassIngestionMode;
private Integer myMaximumTransactionBundleSize = DEFAULT_MAXIMUM_TRANSACTION_BUNDLE_SIZE;
private boolean myNormalizeTerminologyForBulkExportJobs = false;
private String myEmailFromAddress = "noreply@unknown.com";
private String myWebsocketContextPath = DEFAULT_WEBSOCKET_CONTEXT_PATH;
/**
* Update setter javadoc if default changes.
*/
@ -128,16 +118,6 @@ public class StorageSettings {
private boolean myIndexIdentifierOfType = false;
private IndexEnabledEnum myIndexMissingFieldsEnabled = IndexEnabledEnum.DISABLED;
/**
* @since 6.8.0
* Prevents any non IN-MEMORY Search params from being created by users.
*/
private boolean myAllowOnlyInMemorySubscriptions = false;
/**
* Since 6.4.0
*/
private boolean myQualifySubscriptionMatchingChannelName = true;
/**
* Should the {@literal _lamguage} SearchParameter be supported
* on this server?
@ -154,26 +134,6 @@ public class StorageSettings {
*/
private boolean myValidateResourceStatusForPackageUpload = true;
/**
* If set to true, the server will prevent the creation of Subscriptions which cannot be evaluated IN-MEMORY. This can improve
* overall server performance.
*
* @since 6.8.0
*/
public void setOnlyAllowInMemorySubscriptions(boolean theAllowOnlyInMemorySearchParams) {
myAllowOnlyInMemorySubscriptions = theAllowOnlyInMemorySearchParams;
}
/**
* If set to true, the server will prevent the creation of Subscriptions which cannot be evaluated IN-MEMORY. This can improve
* overall server performance.
*
* @since 6.8.0
* @return Returns the value of {@link #setOnlyAllowInMemorySubscriptions(boolean)}
*/
public boolean isOnlyAllowInMemorySubscriptions() {
return myAllowOnlyInMemorySubscriptions;
}
/**
* Constructor
*/
@ -270,48 +230,6 @@ public class StorageSettings {
this.myBundleBatchMaxPoolSize = theBundleBatchMaxPoolSize;
}
/**
* If set to <code>false</code> (default is true) the server will not use
* in-memory subscription searching and instead use the database matcher for all subscription
* criteria matching.
* <p>
* When there are subscriptions registered
* on the server, the default behaviour is to compare the changed resource to the
* subscription criteria directly in-memory without going out to the database.
* Certain types of subscription criteria, e.g. chained references of queries with
* qualifiers or prefixes, are not supported by the in-memory matcher and will fall back
* to a database matcher.
* <p>
* The database matcher performs a query against the
* database by prepending ?id=XYZ to the subscription criteria where XYZ is the id of the changed entity
*
* @since 3.6.1
*/
public boolean isEnableInMemorySubscriptionMatching() {
return myEnableInMemorySubscriptionMatching;
}
/**
* If set to <code>false</code> (default is true) the server will not use
* in-memory subscription searching and instead use the database matcher for all subscription
* criteria matching.
* <p>
* When there are subscriptions registered
* on the server, the default behaviour is to compare the changed resource to the
* subscription criteria directly in-memory without going out to the database.
* Certain types of subscription criteria, e.g. chained references of queries with
* qualifiers or prefixes, are not supported by the in-memory matcher and will fall back
* to a database matcher.
* <p>
* The database matcher performs a query against the
* database by prepending ?id=XYZ to the subscription criteria where XYZ is the id of the changed entity
*
* @since 3.6.1
*/
public void setEnableInMemorySubscriptionMatching(boolean theEnableInMemorySubscriptionMatching) {
myEnableInMemorySubscriptionMatching = theEnableInMemorySubscriptionMatching;
}
/**
* If set to {@link IndexEnabledEnum#DISABLED} (default is {@link IndexEnabledEnum#DISABLED})
* the server will not create search indexes for search parameters with no values in resources.
@ -459,26 +377,6 @@ public class StorageSettings {
mySequenceValueMassagerClass = theSequenceValueMassagerClass;
}
/**
* If set to true (default is false) then subscriptions will be triggered for resource updates even if they
* do not trigger a new version (e.g. $meta-add and $meta-delete).
*
* @since 5.5.0
*/
public boolean isTriggerSubscriptionsForNonVersioningChanges() {
return myTriggerSubscriptionsForNonVersioningChanges;
}
/**
* If set to true (default is false) then subscriptions will be triggered for resource updates even if they
* do not trigger a new version (e.g. $meta-add and $meta-delete).
*
* @since 5.5.0
*/
public void setTriggerSubscriptionsForNonVersioningChanges(boolean theTriggerSubscriptionsForNonVersioningChanges) {
myTriggerSubscriptionsForNonVersioningChanges = theTriggerSubscriptionsForNonVersioningChanges;
}
/**
* If set to <code>true</code> (default is <code>false</code>) the
* <code>:of-type</code> modifier on token search parameters for
@ -779,66 +677,6 @@ public class StorageSettings {
return this;
}
/**
* This setting indicates which subscription channel types are supported by the server. Any subscriptions submitted
* to the server matching these types will be activated.
*/
public StorageSettings addSupportedSubscriptionType(
Subscription.SubscriptionChannelType theSubscriptionChannelType) {
mySupportedSubscriptionTypes.add(theSubscriptionChannelType);
return this;
}
/**
* This setting indicates which subscription channel types are supported by the server. Any subscriptions submitted
* to the server matching these types will be activated.
*/
public Set<Subscription.SubscriptionChannelType> getSupportedSubscriptionTypes() {
return Collections.unmodifiableSet(mySupportedSubscriptionTypes);
}
/**
* Indicate whether a subscription channel type is supported by this server.
*
* @return true if at least one subscription channel type is supported by this server false otherwise.
*/
public boolean hasSupportedSubscriptionTypes() {
return CollectionUtils.isNotEmpty(mySupportedSubscriptionTypes);
}
@VisibleForTesting
public void clearSupportedSubscriptionTypesForUnitTest() {
mySupportedSubscriptionTypes.clear();
}
/**
* If e-mail subscriptions are supported, the From address used when sending e-mails
*/
public String getEmailFromAddress() {
return myEmailFromAddress;
}
/**
* If e-mail subscriptions are supported, the From address used when sending e-mails
*/
public void setEmailFromAddress(String theEmailFromAddress) {
myEmailFromAddress = theEmailFromAddress;
}
/**
* If websocket subscriptions are enabled, this specifies the context path that listens to them. Default value "/websocket".
*/
public String getWebsocketContextPath() {
return myWebsocketContextPath;
}
/**
* If websocket subscriptions are enabled, this specifies the context path that listens to them. Default value "/websocket".
*/
public void setWebsocketContextPath(String theWebsocketContextPath) {
myWebsocketContextPath = theWebsocketContextPath;
}
/**
* <p>
* Should searches use the integer field {@code SP_VALUE_LOW_DATE_ORDINAL} and {@code SP_VALUE_HIGH_DATE_ORDINAL} in
@ -1258,58 +1096,6 @@ public class StorageSettings {
myAutoSupportDefaultSearchParams = theAutoSupportDefaultSearchParams;
}
/**
* If enabled, the server will support cross-partition subscription.
* This subscription will be the responsible for all the requests from all the partitions on this server.
* For example, if the server has 3 partitions, P1, P2, P3
* The subscription will live in the DEFAULT partition. Resource posted to DEFAULT, P1, P2, and P3 will trigger this subscription.
* <p>
* Default is <code>false</code>
* </p>
*
* @since 5.7.0
*/
public boolean isCrossPartitionSubscriptionEnabled() {
return myCrossPartitionSubscriptionEnabled;
}
/**
* If enabled, the server will support cross-partition subscription.
* This subscription will be the responsible for all the requests from all the partitions on this server.
* For example, if the server has 3 partitions, P1, P2, P3
* The subscription will live in the DEFAULT partition. Resource posted to DEFAULT, P1, P2, and P3 will trigger this subscription.
* <p>
* Default is <code>false</code>
* </p>
*
* @since 5.7.0
*/
public void setCrossPartitionSubscriptionEnabled(boolean theAllowCrossPartitionSubscription) {
myCrossPartitionSubscriptionEnabled = theAllowCrossPartitionSubscription;
}
/**
* This setting controls whether the {@link BaseChannelSettings#isQualifyChannelName}
* should be qualified or not.
* Default is true, ie, the channel name will be qualified.
*
* @since 6.4.0
*/
public void setQualifySubscriptionMatchingChannelName(boolean theQualifySubscriptionMatchingChannelName) {
myQualifySubscriptionMatchingChannelName = theQualifySubscriptionMatchingChannelName;
}
/**
* This setting return whether the {@link BaseChannelSettings#isQualifyChannelName}
* should be qualified or not.
*
* @return whether the {@link BaseChannelSettings#isQualifyChannelName} is qualified or not
* @since 6.4.0
*/
public boolean isQualifySubscriptionMatchingChannelName() {
return myQualifySubscriptionMatchingChannelName;
}
/**
* @return Should the {@literal _lamguage} SearchParameter be supported on this server? Defaults to {@literal false}.
* @since 7.0.0

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -19,7 +19,7 @@
*/
package ca.uhn.fhir.jpa.subscription.match.config;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.match.deliver.websocket.SubscriptionWebsocketHandler;
import ca.uhn.fhir.jpa.subscription.match.deliver.websocket.WebsocketConnectionValidator;
import org.springframework.beans.factory.annotation.Autowired;
@ -38,7 +38,7 @@ import org.springframework.web.socket.handler.PerConnectionWebSocketHandler;
public class WebsocketDispatcherConfig implements WebSocketConfigurer {
@Autowired
StorageSettings myStorageSettings;
SubscriptionSettings mySubscriptionSettings;
@Bean
public WebsocketConnectionValidator websocketConnectionValidator() {
@ -48,7 +48,7 @@ public class WebsocketDispatcherConfig implements WebSocketConfigurer {
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry theRegistry) {
theRegistry
.addHandler(subscriptionWebSocketHandler(), myStorageSettings.getWebsocketContextPath())
.addHandler(subscriptionWebSocketHandler(), mySubscriptionSettings.getWebsocketContextPath())
.setAllowedOrigins("*");
}

View File

@ -20,7 +20,7 @@
package ca.uhn.fhir.jpa.subscription.match.deliver.email;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.match.deliver.BaseSubscriptionDeliverySubscriber;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription;
import ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage;
@ -44,7 +44,7 @@ public class SubscriptionDeliveringEmailSubscriber extends BaseSubscriptionDeliv
private Logger ourLog = LoggerFactory.getLogger(SubscriptionDeliveringEmailSubscriber.class);
@Autowired
private StorageSettings myStorageSettings;
private SubscriptionSettings mySubscriptionSettings;
@Autowired
private FhirContext myCtx;
@ -80,7 +80,7 @@ public class SubscriptionDeliveringEmailSubscriber extends BaseSubscriptionDeliv
}
String from = processEmailAddressUri(
defaultString(subscription.getEmailDetails().getFrom(), myStorageSettings.getEmailFromAddress()));
defaultString(subscription.getEmailDetails().getFrom(), mySubscriptionSettings.getEmailFromAddress()));
String subjectTemplate =
defaultString(subscription.getEmailDetails().getSubjectTemplate(), provideDefaultSubjectTemplate());

View File

@ -19,7 +19,7 @@
*/
package ca.uhn.fhir.jpa.subscription.match.matcher.matching;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage;
@ -34,7 +34,7 @@ public class CompositeInMemoryDaoSubscriptionMatcher implements ISubscriptionMat
private final InMemorySubscriptionMatcher myInMemorySubscriptionMatcher;
@Autowired
StorageSettings myStorageSettings;
SubscriptionSettings mySubscriptionSettings;
public CompositeInMemoryDaoSubscriptionMatcher(
DaoSubscriptionMatcher theDaoSubscriptionMatcher,
@ -46,7 +46,7 @@ public class CompositeInMemoryDaoSubscriptionMatcher implements ISubscriptionMat
@Override
public InMemoryMatchResult match(CanonicalSubscription theSubscription, ResourceModifiedMessage theMsg) {
InMemoryMatchResult result;
if (myStorageSettings.isEnableInMemorySubscriptionMatching()) {
if (mySubscriptionSettings.isEnableInMemorySubscriptionMatching()) {
result = myInMemorySubscriptionMatcher.match(theSubscription, theMsg);
if (result.supported()) {
result.setInMemory(true);

View File

@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.subscription.match.matcher.subscriber;
import ca.uhn.fhir.IHapiBootOrder;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.channel.api.ChannelConsumerSettings;
import ca.uhn.fhir.jpa.subscription.channel.api.IChannelReceiver;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory;
@ -63,7 +63,7 @@ public class MatchingQueueSubscriberLoader {
private SubscriptionActivatingSubscriber mySubscriptionActivatingSubscriber;
@Autowired
private StorageSettings myStorageSettings;
private SubscriptionSettings mySubscriptionSettings;
@EventListener(ContextRefreshedEvent.class)
@Order(IHapiBootOrder.SUBSCRIPTION_MATCHING_CHANNEL_HANDLER)
@ -92,7 +92,8 @@ public class MatchingQueueSubscriberLoader {
private ChannelConsumerSettings getChannelConsumerSettings() {
ChannelConsumerSettings channelConsumerSettings = new ChannelConsumerSettings();
channelConsumerSettings.setQualifyChannelName(myStorageSettings.isQualifySubscriptionMatchingChannelName());
channelConsumerSettings.setQualifyChannelName(
mySubscriptionSettings.isQualifySubscriptionMatchingChannelName());
return channelConsumerSettings;
}

View File

@ -23,7 +23,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage;
@ -66,7 +66,7 @@ public class SubscriptionActivatingSubscriber implements MessageHandler {
private SubscriptionCanonicalizer mySubscriptionCanonicalizer;
@Autowired
private StorageSettings myStorageSettings;
private SubscriptionSettings mySubscriptionSettings;
@Autowired
private IResourceModifiedMessagePersistenceSvc myResourceModifiedMessagePersistenceSvc;
@ -126,7 +126,9 @@ public class SubscriptionActivatingSubscriber implements MessageHandler {
// Only activate supported subscriptions
if (subscriptionChannelType == null
|| !myStorageSettings.getSupportedSubscriptionTypes().contains(subscriptionChannelType.toCanonical())) {
|| !mySubscriptionSettings
.getSupportedSubscriptionTypes()
.contains(subscriptionChannelType.toCanonical())) {
return false;
}
@ -177,6 +179,6 @@ public class SubscriptionActivatingSubscriber implements MessageHandler {
public boolean isChannelTypeSupported(IBaseResource theSubscription) {
Subscription.SubscriptionChannelType channelType =
mySubscriptionCanonicalizer.getChannelType(theSubscription).toCanonical();
return myStorageSettings.getSupportedSubscriptionTypes().contains(channelType);
return mySubscriptionSettings.getSupportedSubscriptionTypes().contains(channelType);
}
}

View File

@ -20,7 +20,7 @@
package ca.uhn.fhir.jpa.subscription.model.config;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionStrategyEvaluator;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer;
import org.springframework.context.annotation.Bean;
@ -31,8 +31,8 @@ public class SubscriptionModelConfig {
@Bean
public SubscriptionCanonicalizer subscriptionCanonicalizer(
FhirContext theFhirContext, StorageSettings theStorageSettings) {
return new SubscriptionCanonicalizer(theFhirContext, theStorageSettings);
FhirContext theFhirContext, SubscriptionSettings theSubscriptionSettings) {
return new SubscriptionCanonicalizer(theFhirContext, theSubscriptionSettings);
}
@Bean

View File

@ -19,20 +19,25 @@
*/
package ca.uhn.fhir.jpa.subscription.submit.config;
import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.async.AsyncResourceModifiedProcessingSchedulerSvc;
import ca.uhn.fhir.jpa.subscription.async.AsyncResourceModifiedSubmitterSvc;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory;
import ca.uhn.fhir.jpa.subscription.config.SubscriptionConfig;
import ca.uhn.fhir.jpa.subscription.model.config.SubscriptionModelConfig;
import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionMatcherInterceptor;
import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionSubmitInterceptorLoader;
import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionValidatingInterceptor;
import ca.uhn.fhir.jpa.subscription.submit.svc.ResourceModifiedSubmitterSvc;
import ca.uhn.fhir.jpa.subscription.triggering.ISubscriptionTriggeringSvc;
import ca.uhn.fhir.jpa.subscription.triggering.SubscriptionTriggeringSvcImpl;
import ca.uhn.fhir.jpa.topic.SubscriptionTopicValidatingInterceptor;
import ca.uhn.fhir.subscription.api.IResourceModifiedConsumerWithRetries;
import ca.uhn.fhir.subscription.api.IResourceModifiedMessagePersistenceSvc;
import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@ -52,8 +57,18 @@ public class SubscriptionSubmitterConfig {
}
@Bean
public SubscriptionSubmitInterceptorLoader subscriptionMatcherInterceptorLoader() {
return new SubscriptionSubmitInterceptorLoader();
public SubscriptionSubmitInterceptorLoader subscriptionMatcherInterceptorLoader(
@Nonnull IInterceptorService theInterceptorService,
@Nonnull SubscriptionSettings theSubscriptionSettings,
@Nonnull SubscriptionMatcherInterceptor theSubscriptionMatcherInterceptor,
@Nonnull SubscriptionValidatingInterceptor theSubscriptionValidatingInterceptor,
@Nullable SubscriptionTopicValidatingInterceptor theSubscriptionTopicValidatingInterceptor) {
return new SubscriptionSubmitInterceptorLoader(
theInterceptorService,
theSubscriptionSettings,
theSubscriptionMatcherInterceptor,
theSubscriptionValidatingInterceptor,
theSubscriptionTopicValidatingInterceptor);
}
@Bean
@ -67,10 +82,10 @@ public class SubscriptionSubmitterConfig {
IHapiTransactionService theHapiTransactionService,
IResourceModifiedMessagePersistenceSvc theResourceModifiedMessagePersistenceSvc,
SubscriptionChannelFactory theSubscriptionChannelFactory,
StorageSettings theStorageSettings) {
SubscriptionSettings theSubscriptionSettings) {
return new ResourceModifiedSubmitterSvc(
theStorageSettings,
theSubscriptionSettings,
theSubscriptionChannelFactory,
theResourceModifiedMessagePersistenceSvc,
theHapiTransactionService);

View File

@ -26,7 +26,7 @@ import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.interceptor.api.Interceptor;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage;
import ca.uhn.fhir.rest.api.server.RequestDetails;
@ -57,7 +57,7 @@ public class SubscriptionMatcherInterceptor {
private IInterceptorBroadcaster myInterceptorBroadcaster;
@Autowired
private StorageSettings myStorageSettings;
private SubscriptionSettings mySubscriptionSettings;
@Autowired
private IRequestPartitionHelperSvc myRequestPartitionHelperSvc;
@ -87,7 +87,7 @@ public class SubscriptionMatcherInterceptor {
@Hook(Pointcut.STORAGE_PRECOMMIT_RESOURCE_UPDATED)
public void resourceUpdated(IBaseResource theOldResource, IBaseResource theNewResource, RequestDetails theRequest) {
boolean dontTriggerSubscriptionWhenVersionsAreTheSame =
!myStorageSettings.isTriggerSubscriptionsForNonVersioningChanges();
!mySubscriptionSettings.isTriggerSubscriptionsForNonVersioningChanges();
boolean resourceVersionsAreTheSame = isSameResourceVersion(theOldResource, theNewResource);
if (dontTriggerSubscriptionWhenVersionsAreTheSame && resourceVersionsAreTheSame) {

View File

@ -20,43 +20,57 @@
package ca.uhn.fhir.jpa.subscription.submit.interceptor;
import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.topic.SubscriptionTopicValidatingInterceptor;
import com.google.common.annotations.VisibleForTesting;
import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import jakarta.annotation.PostConstruct;
import org.hl7.fhir.dstu2.model.Subscription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Set;
public class SubscriptionSubmitInterceptorLoader {
private static final Logger ourLog = LoggerFactory.getLogger(SubscriptionSubmitInterceptorLoader.class);
@Autowired
private SubscriptionMatcherInterceptor mySubscriptionMatcherInterceptor;
@Nonnull
private IInterceptorService myInterceptorService;
@Autowired
private SubscriptionValidatingInterceptor mySubscriptionValidatingInterceptor;
@Nonnull
private final SubscriptionSettings mySubscriptionSettings;
@Autowired(required = false)
private SubscriptionTopicValidatingInterceptor mySubscriptionTopicValidatingInterceptor;
@Nonnull
private final SubscriptionMatcherInterceptor mySubscriptionMatcherInterceptor;
@Autowired
private StorageSettings myStorageSettings;
@Nonnull
private final SubscriptionValidatingInterceptor mySubscriptionValidatingInterceptor;
@Autowired
private IInterceptorService myInterceptorRegistry;
@Nullable
private final SubscriptionTopicValidatingInterceptor mySubscriptionTopicValidatingInterceptor;
private boolean mySubscriptionValidatingInterceptorRegistered;
private boolean mySubscriptionMatcherInterceptorRegistered;
private boolean mySubscriptionTopicValidatingInterceptorRegistered;
public SubscriptionSubmitInterceptorLoader(
@Nonnull IInterceptorService theInterceptorService,
@Nonnull SubscriptionSettings theSubscriptionSettings,
@Nonnull SubscriptionMatcherInterceptor theSubscriptionMatcherInterceptor,
@Nonnull SubscriptionValidatingInterceptor theSubscriptionValidatingInterceptor,
@Nullable SubscriptionTopicValidatingInterceptor theSubscriptionTopicValidatingInterceptor) {
setInterceptorService(theInterceptorService);
mySubscriptionSettings = theSubscriptionSettings;
mySubscriptionMatcherInterceptor = theSubscriptionMatcherInterceptor;
mySubscriptionValidatingInterceptor = theSubscriptionValidatingInterceptor;
mySubscriptionTopicValidatingInterceptor = theSubscriptionTopicValidatingInterceptor;
}
@PostConstruct
public void start() {
Set<Subscription.SubscriptionChannelType> supportedSubscriptionTypes =
myStorageSettings.getSupportedSubscriptionTypes();
mySubscriptionSettings.getSupportedSubscriptionTypes();
if (supportedSubscriptionTypes.isEmpty()) {
ourLog.info(
@ -64,26 +78,34 @@ public class SubscriptionSubmitInterceptorLoader {
} else {
if (!mySubscriptionMatcherInterceptorRegistered) {
ourLog.info("Registering subscription matcher interceptor");
myInterceptorRegistry.registerInterceptor(mySubscriptionMatcherInterceptor);
myInterceptorService.registerInterceptor(mySubscriptionMatcherInterceptor);
mySubscriptionMatcherInterceptorRegistered = true;
}
}
if (!mySubscriptionValidatingInterceptorRegistered) {
myInterceptorRegistry.registerInterceptor(mySubscriptionValidatingInterceptor);
myInterceptorService.registerInterceptor(mySubscriptionValidatingInterceptor);
mySubscriptionValidatingInterceptorRegistered = true;
}
if (mySubscriptionTopicValidatingInterceptor != null && !mySubscriptionTopicValidatingInterceptorRegistered) {
myInterceptorRegistry.registerInterceptor(mySubscriptionTopicValidatingInterceptor);
myInterceptorService.registerInterceptor(mySubscriptionTopicValidatingInterceptor);
mySubscriptionTopicValidatingInterceptorRegistered = true;
}
}
protected void setInterceptorService(IInterceptorService theInterceptorService) {
myInterceptorService = theInterceptorService;
}
protected IInterceptorService getInterceptorService() {
return myInterceptorService;
}
@VisibleForTesting
public void unregisterInterceptorsForUnitTest() {
myInterceptorRegistry.unregisterInterceptor(mySubscriptionMatcherInterceptor);
myInterceptorRegistry.unregisterInterceptor(mySubscriptionValidatingInterceptor);
myInterceptorService.unregisterInterceptor(mySubscriptionMatcherInterceptor);
myInterceptorService.unregisterInterceptor(mySubscriptionValidatingInterceptor);
mySubscriptionValidatingInterceptorRegistered = false;
mySubscriptionMatcherInterceptorRegistered = false;
}

View File

@ -26,10 +26,9 @@ import ca.uhn.fhir.interceptor.api.Hook;
import ca.uhn.fhir.interceptor.api.Interceptor;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy;
@ -72,7 +71,7 @@ public class SubscriptionValidatingInterceptor {
private DaoRegistry myDaoRegistry;
@Autowired
private StorageSettings myStorageSettings;
private SubscriptionSettings mySubscriptionSettings;
@Autowired
private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator;
@ -169,7 +168,7 @@ public class SubscriptionValidatingInterceptor {
try {
SubscriptionMatchingStrategy strategy = mySubscriptionStrategyEvaluator.determineStrategy(subscription);
if (!(SubscriptionMatchingStrategy.IN_MEMORY == strategy)
&& myStorageSettings.isOnlyAllowInMemorySubscriptions()) {
&& mySubscriptionSettings.isOnlyAllowInMemorySubscriptions()) {
throw new InvalidRequestException(
Msg.code(2367)
+ "This server is configured to only allow in-memory subscriptions. This subscription's criteria cannot be evaluated in-memory.");
@ -244,7 +243,7 @@ public class SubscriptionValidatingInterceptor {
// If the subscription has the cross partition tag
if (SubscriptionUtil.isCrossPartition(theSubscription)
&& !(theRequestDetails instanceof SystemRequestDetails)) {
if (!myStorageSettings.isCrossPartitionSubscriptionEnabled()) {
if (!mySubscriptionSettings.isCrossPartitionSubscriptionEnabled()) {
throw new UnprocessableEntityException(
Msg.code(2009) + "Cross partition subscription is not enabled on this server");
}
@ -356,8 +355,8 @@ public class SubscriptionValidatingInterceptor {
}
@VisibleForTesting
public void setStorageSettingsForUnitTest(JpaStorageSettings theStorageSettings) {
myStorageSettings = theStorageSettings;
public void setSubscriptionSettingsForUnitTest(SubscriptionSettings theSubscriptionSettings) {
mySubscriptionSettings = theSubscriptionSettings;
}
@VisibleForTesting

View File

@ -21,9 +21,9 @@ package ca.uhn.fhir.jpa.subscription.submit.svc;
*/
import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.model.entity.IPersistedResourceModifiedMessage;
import ca.uhn.fhir.jpa.model.entity.IPersistedResourceModifiedMessagePK;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.subscription.channel.api.ChannelProducerSettings;
import ca.uhn.fhir.jpa.subscription.channel.api.IChannelProducer;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory;
@ -62,14 +62,14 @@ public class ResourceModifiedSubmitterSvc implements IResourceModifiedConsumer,
private static final Logger ourLog = LoggerFactory.getLogger(ResourceModifiedSubmitterSvc.class);
private volatile MessageChannel myMatchingChannel;
private final StorageSettings myStorageSettings;
private final SubscriptionSettings mySubscriptionSettings;
private final SubscriptionChannelFactory mySubscriptionChannelFactory;
private final IResourceModifiedMessagePersistenceSvc myResourceModifiedMessagePersistenceSvc;
private final IHapiTransactionService myHapiTransactionService;
@EventListener(classes = {ContextRefreshedEvent.class})
public void startIfNeeded() {
if (!myStorageSettings.hasSupportedSubscriptionTypes()) {
if (!mySubscriptionSettings.hasSupportedSubscriptionTypes()) {
ourLog.debug(
"Subscriptions are disabled on this server. Skipping {} channel creation.",
SUBSCRIPTION_MATCHING_CHANNEL_NAME);
@ -82,11 +82,11 @@ public class ResourceModifiedSubmitterSvc implements IResourceModifiedConsumer,
}
public ResourceModifiedSubmitterSvc(
StorageSettings theStorageSettings,
SubscriptionSettings theSubscriptionSettings,
SubscriptionChannelFactory theSubscriptionChannelFactory,
IResourceModifiedMessagePersistenceSvc resourceModifiedMessagePersistenceSvc,
IHapiTransactionService theHapiTransactionService) {
myStorageSettings = theStorageSettings;
mySubscriptionSettings = theSubscriptionSettings;
mySubscriptionChannelFactory = theSubscriptionChannelFactory;
myResourceModifiedMessagePersistenceSvc = resourceModifiedMessagePersistenceSvc;
myHapiTransactionService = theHapiTransactionService;
@ -210,7 +210,8 @@ public class ResourceModifiedSubmitterSvc implements IResourceModifiedConsumer,
private ChannelProducerSettings getChannelProducerSettings() {
ChannelProducerSettings channelProducerSettings = new ChannelProducerSettings();
channelProducerSettings.setQualifyChannelName(myStorageSettings.isQualifySubscriptionMatchingChannelName());
channelProducerSettings.setQualifyChannelName(
mySubscriptionSettings.isQualifySubscriptionMatchingChannelName());
return channelProducerSettings;
}

View File

@ -23,7 +23,6 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc;
@ -31,6 +30,7 @@ import ca.uhn.fhir.jpa.api.svc.ISearchSvc;
import ca.uhn.fhir.jpa.dao.ISearchBuilder;
import ca.uhn.fhir.jpa.dao.SearchBuilderFactory;
import ca.uhn.fhir.jpa.dao.tx.HapiTransactionService;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.model.sched.HapiJob;
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
@ -105,7 +105,7 @@ public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc
private DaoRegistry myDaoRegistry;
@Autowired
private JpaStorageSettings myStorageSettings;
private SubscriptionSettings mySubscriptionSettings;
@Autowired
private ISearchCoordinatorSvc<? extends IResourcePersistentId<?>> mySearchCoordinatorSvc;
@ -141,7 +141,7 @@ public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc
@Nullable IIdType theSubscriptionId,
RequestDetails theRequestDetails) {
if (myStorageSettings.getSupportedSubscriptionTypes().isEmpty()) {
if (mySubscriptionSettings.getSupportedSubscriptionTypes().isEmpty()) {
throw new PreconditionFailedException(Msg.code(22) + "Subscription processing not active on this server");
}

View File

@ -13,6 +13,7 @@ import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamProvider;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory;
import ca.uhn.fhir.jpa.subscription.match.config.SubscriptionProcessorConfig;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.submit.config.SubscriptionSubmitterConfig;
import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionQueryValidator;
import ca.uhn.fhir.subscription.api.IResourceModifiedMessagePersistenceSvc;
@ -40,6 +41,7 @@ public class DaoSubscriptionMatcherTest {
@Autowired(required = false)
private PlatformTransactionManager myTxManager;
@MockBean
private JpaStorageSettings myStorageSettings;
@MockBean
@ -96,6 +98,11 @@ public class DaoSubscriptionMatcherTest {
public IResourceModifiedMessagePersistenceSvc resourceModifiedMessagePersistenceSvc() {
return mock(IResourceModifiedMessagePersistenceSvc.class);
}
@Bean
public SubscriptionSettings subscriptionSettings() {
return new SubscriptionSettings();
}
}
}

View File

@ -8,6 +8,7 @@ import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionStrategyE
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
import ca.uhn.fhir.subscription.SubscriptionConstants;
@ -59,7 +60,7 @@ public class SubscriptionActivatingSubscriberTest {
private SubscriptionCanonicalizer mySubscriptionCanonicallizer;
@Mock
private JpaStorageSettings myStorageSettings;
private SubscriptionSettings myStorageSettings;
@Mock
private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator;

View File

@ -9,6 +9,7 @@ import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
@ -51,7 +52,7 @@ public class SubscriptionRegisteringSubscriberTest {
@Mock
private SubscriptionRegistry mySubscriptionRegistry;
@Spy
private SubscriptionCanonicalizer mySubscriptionCanonicalizer = new SubscriptionCanonicalizer(myFhirContext, new StorageSettings());
private SubscriptionCanonicalizer mySubscriptionCanonicalizer = new SubscriptionCanonicalizer(myFhirContext, new SubscriptionSettings());
@Mock
private DaoRegistry myDaoRegistry;
@Mock

View File

@ -1,10 +1,10 @@
package ca.uhn.fhir.jpa.subscription.match.registry;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType;
import ca.uhn.fhir.jpa.subscription.model.CanonicalTopicSubscriptionFilter;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.IFhirVersion;
import ca.uhn.fhir.model.dstu2.FhirDstu2;
@ -43,7 +43,7 @@ class SubscriptionCanonicalizerTest {
FhirContext r4Context = FhirContext.forR4();
private final SubscriptionCanonicalizer testedSC = new SubscriptionCanonicalizer(r4Context, new StorageSettings());
private final SubscriptionCanonicalizer testedSC = new SubscriptionCanonicalizer(r4Context, new SubscriptionSettings());
@Test
void testCanonicalizeR4SendDeleteMessagesSetsExtensionValueNotPresent() {
@ -84,7 +84,7 @@ class SubscriptionCanonicalizerTest {
@Test
public void testCanonicalizeDstu2SendDeleteMessages() {
//setup
SubscriptionCanonicalizer dstu2Canonicalizer = new SubscriptionCanonicalizer(FhirContext.forDstu2Cached(), new StorageSettings());
SubscriptionCanonicalizer dstu2Canonicalizer = new SubscriptionCanonicalizer(FhirContext.forDstu2Cached(), new SubscriptionSettings());
ca.uhn.fhir.model.dstu2.resource.Subscription dstu2Sub = new ca.uhn.fhir.model.dstu2.resource.Subscription();
ExtensionDt extensionDt = new ExtensionDt();
extensionDt.setUrl(EX_SEND_DELETE_MESSAGES);
@ -120,7 +120,7 @@ class SubscriptionCanonicalizerTest {
@ValueSource(strings = {"full-resource", "id-only", "empty"})
public void testR5Canonicalize_returnsCorrectCanonicalSubscription(String thePayloadContent) {
// setup
SubscriptionCanonicalizer r5Canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR5Cached(), new StorageSettings());
SubscriptionCanonicalizer r5Canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR5Cached(), new SubscriptionSettings());
org.hl7.fhir.r5.model.Subscription.SubscriptionPayloadContent payloadContent =
org.hl7.fhir.r5.model.Subscription.SubscriptionPayloadContent.fromCode(thePayloadContent);
org.hl7.fhir.r5.model.Subscription subscription = buildR5Subscription(payloadContent);
@ -160,7 +160,7 @@ class SubscriptionCanonicalizerTest {
// Example drawn from http://build.fhir.org/ig/HL7/fhir-subscription-backport-ig/Subscription-subscription-zulip.json.html
// setup
SubscriptionCanonicalizer r4bCanonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4BCached(), new StorageSettings());
SubscriptionCanonicalizer r4bCanonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4BCached(), new SubscriptionSettings());
org.hl7.fhir.r4b.model.Subscription subscription = buildR4BSubscription(thePayloadContent);
// execute
@ -204,9 +204,9 @@ class SubscriptionCanonicalizerTest {
subscription = new org.hl7.fhir.r5.model.Subscription();
}
final StorageSettings storageSettings = new StorageSettings();
storageSettings.setCrossPartitionSubscriptionEnabled(theCrossPartitionSubscriptionEnabled);
final SubscriptionCanonicalizer subscriptionCanonicalizer = new SubscriptionCanonicalizer(theFhirContext, storageSettings);
final SubscriptionSettings subscriptionSettings = new SubscriptionSettings();
subscriptionSettings.setCrossPartitionSubscriptionEnabled(theCrossPartitionSubscriptionEnabled);
final SubscriptionCanonicalizer subscriptionCanonicalizer = new SubscriptionCanonicalizer(theFhirContext, subscriptionSettings);
final CanonicalSubscription canonicalSubscription = subscriptionCanonicalizer.canonicalize(subscription);
assertEquals(theCrossPartitionSubscriptionEnabled, canonicalSubscription.getCrossPartitionEnabled());
@ -247,7 +247,7 @@ class SubscriptionCanonicalizerTest {
// Example drawn from http://build.fhir.org/ig/HL7/fhir-subscription-backport-ig/Subscription-subscription-zulip.json.html
// setup
SubscriptionCanonicalizer r4Canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4Cached(), new StorageSettings());
SubscriptionCanonicalizer r4Canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4Cached(), new SubscriptionSettings());
// execute
Subscription subscription = SubscriptionTestDataHelper.buildR4TopicSubscriptionWithContent(thePayloadContent);

View File

@ -6,6 +6,7 @@ import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.subscription.channel.subscription.ISubscriptionDeliveryChannelNamer;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelRegistry;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.subscription.SubscriptionTestDataHelper;
import ca.uhn.fhir.util.HapiExtensions;
import org.hl7.fhir.r4.model.Extension;
@ -34,7 +35,7 @@ public class SubscriptionRegistryTest {
static FhirContext ourFhirContext = FhirContext.forR4Cached();
@Spy
SubscriptionCanonicalizer mySubscriptionCanonicalizer = new SubscriptionCanonicalizer(ourFhirContext, new StorageSettings());
SubscriptionCanonicalizer mySubscriptionCanonicalizer = new SubscriptionCanonicalizer(ourFhirContext, new SubscriptionSettings());
@Spy
ISubscriptionDeliveryChannelNamer mySubscriptionDeliveryChannelNamer = new TestChannelNamer();

View File

@ -13,6 +13,7 @@ import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFact
import ca.uhn.fhir.jpa.subscription.match.config.SubscriptionProcessorConfig;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender;
import ca.uhn.fhir.jpa.subscription.module.config.MockFhirClientSearchParamProvider;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.system.HapiSystemProperties;
@ -77,6 +78,11 @@ public abstract class BaseSubscriptionTest {
return new JpaStorageSettings();
}
@Bean
public SubscriptionSettings subscriptionSettings() {
return new SubscriptionSettings();
}
@Bean
public IChannelFactory channelFactory(IChannelNamer theNamer) {
return new LinkedBlockingChannelFactory(theNamer);

View File

@ -6,6 +6,7 @@ import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription;
import ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryJsonMessage;
import ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.util.HapiExtensions;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -27,6 +28,7 @@ import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class CanonicalSubscriptionTest {
@ -70,7 +72,7 @@ public class CanonicalSubscriptionTest {
@Test
public void testCanonicalSubscriptionRetainsMetaTags() throws IOException {
SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), new StorageSettings());
SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), new SubscriptionSettings());
CanonicalSubscription sub1 = canonicalizer.canonicalize(makeMdmSubscription());
assertThat(sub1.getTags()).containsKey(TAG_SYSTEM);
assertEquals(sub1.getTags().get(TAG_SYSTEM), TAG_VALUE);
@ -78,7 +80,7 @@ public class CanonicalSubscriptionTest {
@Test
public void emailDetailsEquals() {
SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), new StorageSettings());
SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), new SubscriptionSettings());
CanonicalSubscription sub1 = canonicalizer.canonicalize(makeEmailSubscription());
CanonicalSubscription sub2 = canonicalizer.canonicalize(makeEmailSubscription());
assertTrue(sub1.equals(sub2));
@ -86,7 +88,7 @@ public class CanonicalSubscriptionTest {
@Test
public void testSerializeMultiPartitionSubscription(){
SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), new StorageSettings());
SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), new SubscriptionSettings());
Subscription subscription = makeEmailSubscription();
subscription.addExtension(HapiExtensions.EXTENSION_SUBSCRIPTION_CROSS_PARTITION, new BooleanType().setValue(true));
CanonicalSubscription canonicalSubscription = canonicalizer.canonicalize(subscription);
@ -97,8 +99,8 @@ public class CanonicalSubscriptionTest {
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testSerializeIncorrectMultiPartitionSubscription(boolean theIsCrossPartitionEnabled){
final StorageSettings storageSettings = buildStorageSettings(theIsCrossPartitionEnabled);
SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), storageSettings);
final SubscriptionSettings subscriptionSettings = buildSubscriptionSettings(theIsCrossPartitionEnabled);
SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), subscriptionSettings);
Subscription subscription = makeEmailSubscription();
subscription.addExtension(HapiExtensions.EXTENSION_SUBSCRIPTION_CROSS_PARTITION, new StringType().setValue("false"));
CanonicalSubscription canonicalSubscription = canonicalizer.canonicalize(subscription);
@ -109,8 +111,8 @@ public class CanonicalSubscriptionTest {
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testSerializeNonMultiPartitionSubscription(boolean theIsCrossPartitionEnabled){
final StorageSettings storageSettings = buildStorageSettings(theIsCrossPartitionEnabled);
SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), storageSettings);
final SubscriptionSettings subscriptionSettings = buildSubscriptionSettings(theIsCrossPartitionEnabled);
SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), subscriptionSettings);
Subscription subscription = makeEmailSubscription();
subscription.addExtension(HapiExtensions.EXTENSION_SUBSCRIPTION_CROSS_PARTITION, new BooleanType().setValue(false));
CanonicalSubscription canonicalSubscription = canonicalizer.canonicalize(subscription);
@ -128,7 +130,7 @@ public class CanonicalSubscriptionTest {
CanonicalSubscription payload = resourceDeliveryMessage.getPayload().getSubscription();
assertEquals(payload.getCrossPartitionEnabled(), false);
assertFalse(payload.getCrossPartitionEnabled());
}
private Subscription makeEmailSubscription() {
@ -162,9 +164,9 @@ public class CanonicalSubscriptionTest {
}
@Nonnull
private static StorageSettings buildStorageSettings(boolean theIsCrossPartitionEnabled) {
final StorageSettings storageSettings = new StorageSettings();
storageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
return storageSettings;
private static SubscriptionSettings buildSubscriptionSettings(boolean theIsCrossPartitionEnabled) {
final SubscriptionSettings subscriptionSettings = new SubscriptionSettings();
subscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
return subscriptionSettings;
}
}

View File

@ -7,7 +7,6 @@ import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.subscription.channel.api.ChannelConsumerSettings;
import ca.uhn.fhir.jpa.subscription.channel.subscription.ISubscriptionDeliveryChannelNamer;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory;
@ -18,6 +17,7 @@ import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage;
import ca.uhn.fhir.jpa.subscription.module.BaseSubscriptionDstu3Test;
import ca.uhn.fhir.jpa.subscription.module.subscriber.SubscriptionMatchingSubscriberTest;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.annotation.Create;
import ca.uhn.fhir.rest.annotation.ResourceParam;
@ -86,7 +86,7 @@ public abstract class BaseBlockingQueueSubscribableChannelDstu3Test extends Base
@Autowired
protected PartitionSettings myPartitionSettings;
@Autowired
protected StorageSettings myStorageSettings;
protected SubscriptionSettings mySubscriptionSettings;
protected String myCode = "1000000050";
@Autowired
FhirContext myFhirContext;

View File

@ -14,6 +14,7 @@ import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage;
import ca.uhn.fhir.jpa.subscription.module.standalone.BaseBlockingQueueSubscribableChannelDstu3Test;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.server.messaging.BaseResourceModifiedMessage;
@ -63,7 +64,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@AfterEach
public void afterEach() {
myStorageSettings.setCrossPartitionSubscriptionEnabled(new JpaStorageSettings().isCrossPartitionSubscriptionEnabled());
mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(new SubscriptionSettings().isCrossPartitionSubscriptionEnabled());
}
@Test
@ -234,7 +235,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testSubscriptionAndResourceOnDiffPartitionNotMatch(boolean theIsCrossPartitionEnabled) throws InterruptedException {
myStorageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
myPartitionSettings.setPartitioningEnabled(true);
String payload = "application/fhir+json";
@ -257,7 +258,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testSubscriptionAndResourceOnDiffPartitionNotMatchPart2(boolean theIsCrossPartitionEnabled) throws InterruptedException {
myStorageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
myPartitionSettings.setPartitioningEnabled(true);
String payload = "application/fhir+json";
@ -281,7 +282,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testSubscriptionOnDefaultPartitionAndResourceOnDiffPartitionNotMatch(boolean theIsCrossPartitionEnabled) throws InterruptedException {
myStorageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
myPartitionSettings.setPartitioningEnabled(true);
String payload = "application/fhir+json";
@ -305,7 +306,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testSubscriptionOnAPartitionAndResourceOnDefaultPartitionNotMatch(boolean theIsCrossPartitionEnabled) throws InterruptedException {
myStorageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
myPartitionSettings.setPartitioningEnabled(true);
String payload = "application/fhir+json";
@ -350,7 +351,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testSubscriptionOnOnePartitionDoNotMatchResourceOnMultiplePartitions(boolean theIsCrossPartitionEnabled) throws InterruptedException {
myStorageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
myPartitionSettings.setPartitioningEnabled(true);
String payload = "application/fhir+json";
@ -374,7 +375,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@Test
public void testCrossPartitionSubscriptionForResourceOnTheSamePartitionMatch() throws InterruptedException {
myPartitionSettings.setPartitioningEnabled(true);
myStorageSettings.setCrossPartitionSubscriptionEnabled(true);
mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(true);
String payload = "application/fhir+json";
String code = "1000000050";
@ -396,7 +397,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@Test
public void testCrossPartitionSubscriptionForResourceOnDifferentPartitionMatch() throws InterruptedException {
myPartitionSettings.setPartitioningEnabled(true);
myStorageSettings.setCrossPartitionSubscriptionEnabled(true);
mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(true);
String payload = "application/fhir+json";
String code = "1000000050";
@ -419,7 +420,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@Test
public void testCrossPartitionSubscriptionForMultipleResourceOnDifferentPartitionMatch() throws InterruptedException {
myPartitionSettings.setPartitioningEnabled(true);
myStorageSettings.setCrossPartitionSubscriptionEnabled(true);
mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(true);
String payload = "application/fhir+json";
String code = "1000000050";

View File

@ -19,6 +19,7 @@ import ca.uhn.fhir.jpa.subscription.match.registry.ActiveSubscription;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.subscription.api.IResourceModifiedMessagePersistenceSvc;
import org.hl7.fhir.r4.model.IdType;
@ -66,6 +67,8 @@ public class WebsocketConnectionValidatorTest {
SubscriptionRegistry mySubscriptionRegistry;
@MockBean
ISearchParamRegistry mySearchParamRegistry;
@MockBean
SubscriptionSettings mySubscriptionSettings;
@Autowired
WebsocketConnectionValidator myWebsocketConnectionValidator;

View File

@ -3,11 +3,12 @@ package ca.uhn.fhir.jpa.subscription.submit.interceptor;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.cache.IResourceVersionSvc;
import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc;
import ca.uhn.fhir.jpa.searchparam.config.SearchParamConfig;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamProvider;
@ -37,10 +38,9 @@ import static org.mockito.Mockito.verify;
})
public class SubscriptionSubmitInterceptorLoaderTest {
@Autowired
private SubscriptionSubmitInterceptorLoader mySubscriptionSubmitInterceptorLoader;
@Autowired
private SubscriptionMatcherInterceptor mySubscriptionMatcherInterceptor;
@MockBean
private IInterceptorService myInterceptorService;
@ -67,12 +67,14 @@ public class SubscriptionSubmitInterceptorLoaderTest {
}
@Bean
public JpaStorageSettings storageSettings() {
JpaStorageSettings storageSettings = new JpaStorageSettings();
storageSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
return storageSettings;
public SubscriptionSettings subscriptionSettings() {
SubscriptionSettings subscriptionSettings = new SubscriptionSettings();
subscriptionSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
return subscriptionSettings;
}
@MockBean
public StorageSettings myStorageSettings;
@MockBean
private ISearchParamProvider mySearchParamProvider;
@MockBean

View File

@ -12,6 +12,7 @@ import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionStrategyEvaluator;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.SimpleBundleProvider;
@ -62,7 +63,7 @@ public class SubscriptionValidatingInterceptorTest {
@MockBean
private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator;
@MockBean
private JpaStorageSettings myStorageSettings;
private SubscriptionSettings mySubscriptionSettings;
@MockBean
private IRequestPartitionHelperSvc myRequestPartitionHelperSvc;
@Mock
@ -258,7 +259,7 @@ public class SubscriptionValidatingInterceptorTest {
private void setFhirContext(FhirVersionEnum fhirVersion) {
myFhirContext = FhirContext.forCached(fhirVersion);
mySubscriptionValidatingInterceptor.setFhirContext(myFhirContext);
mySubscriptionValidatingInterceptor.setSubscriptionCanonicalizerForUnitTest(new SubscriptionCanonicalizer(myFhirContext, myStorageSettings));
mySubscriptionValidatingInterceptor.setSubscriptionCanonicalizerForUnitTest(new SubscriptionCanonicalizer(myFhirContext, mySubscriptionSettings));
}
private static @Nonnull Stream<IBaseResource> subscriptionByFhirVersion(boolean theIncludeR5) {
@ -290,7 +291,7 @@ public class SubscriptionValidatingInterceptorTest {
@Bean
SubscriptionCanonicalizer subscriptionCanonicalizer(FhirContext theFhirContext) {
return new SubscriptionCanonicalizer(theFhirContext, new StorageSettings());
return new SubscriptionCanonicalizer(theFhirContext, new SubscriptionSettings());
}
@Bean

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class WebsocketWithCriteriaDstu2Test extends BaseResourceProviderDstu2Test {
private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(WebsocketWithCriteriaDstu2Test.class);
@RegisterExtension
private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings);
private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> mySubscriptionSettings);
private String myPatientId;
private String mySubscriptionId;

View File

@ -42,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class WebsocketWithSubscriptionIdDstu2Test extends BaseResourceProviderDstu2Test {
private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(WebsocketWithSubscriptionIdDstu2Test.class);
@RegisterExtension
private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings);
private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> mySubscriptionSettings);
private String myPatientId;
private String mySubscriptionId;
@Autowired

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -83,7 +83,7 @@ public class EmailSubscriptionDstu3Test extends BaseResourceProviderDstu3Test {
ourLog.info("After re-registering interceptors");
logAllInterceptors(myInterceptorRegistry);
myStorageSettings.setEmailFromAddress("123@hapifhir.io");
mySubscriptionSettings.setEmailFromAddress("123@hapifhir.io");
}
private Subscription createSubscription(String theCriteria, String thePayload, Consumer<Subscription>... theModifiers) throws InterruptedException {

View File

@ -11,6 +11,7 @@ import ca.uhn.fhir.jpa.dao.DaoTestUtils;
import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
import ca.uhn.fhir.jpa.subscription.NotificationServlet;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor;
import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil;
import ca.uhn.fhir.jpa.topic.SubscriptionTopicRegistry;
@ -122,7 +123,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
ourLog.info("After re-registering interceptors");
DaoTestUtils.logAllInterceptors(myInterceptorRegistry);
myStorageSettings.setOnlyAllowInMemorySubscriptions(new JpaStorageSettings().isOnlyAllowInMemorySubscriptions());
mySubscriptionSettings.setOnlyAllowInMemorySubscriptions(new SubscriptionSettings().isOnlyAllowInMemorySubscriptions());
}
@BeforeEach
@ -214,14 +215,14 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
}
@Test
public void testForcedInMemoryPreventsDatabaseSubscriptions() throws InterruptedException {
myStorageSettings.setOnlyAllowInMemorySubscriptions(true);
mySubscriptionSettings.setOnlyAllowInMemorySubscriptions(true);
String databaseCriteria = "Observation?code=17861-6&context.type=IHD";
try {
createSubscription(databaseCriteria, null, ourNotificationListenerServer);
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage()).contains("HAPI-2367: This server is configured to only allow in-memory subscriptions.");
}
myStorageSettings.setOnlyAllowInMemorySubscriptions(false);
mySubscriptionSettings.setOnlyAllowInMemorySubscriptions(false);
}

View File

@ -25,7 +25,7 @@ public class WebsocketWithCriteriaDstu3Test extends BaseResourceProviderDstu3Tes
private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(WebsocketWithCriteriaDstu3Test.class);
@RegisterExtension
private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings);
private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> mySubscriptionSettings);
private String myPatientId;
private String mySubscriptionId;

View File

@ -41,7 +41,7 @@ public class WebsocketWithSubscriptionIdDstu3Test extends BaseResourceProviderDs
private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(WebsocketWithSubscriptionIdDstu3Test.class);
@RegisterExtension
private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings);
private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> mySubscriptionSettings);
private String myPatientId;
private String mySubscriptionId;
@Autowired

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -157,7 +157,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test
@AfterEach
public void afterResetDao() {
myStorageSettings.clearSupportedSubscriptionTypesForUnitTest();
mySubscriptionSettings.clearSupportedSubscriptionTypesForUnitTest();
myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete());
myStorageSettings.setAutoCreatePlaceholderReferenceTargets(new JpaStorageSettings().isAutoCreatePlaceholderReferenceTargets());
myStorageSettings.setAutoVersionReferenceAtPaths(new JpaStorageSettings().getAutoVersionReferenceAtPaths());

View File

@ -122,18 +122,14 @@ public class PartitioningInterceptorR4Test extends BaseJpaR4SystemTest {
subscription.setChannel(subscriptionChannelComponent);
// set up partitioning for subscriptions
myStorageSettings.setCrossPartitionSubscriptionEnabled(true);
mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(true);
// register interceptors that return different partition ids
MySubscriptionReadInterceptor readInterceptor = new MySubscriptionReadInterceptor();
MySubscriptionWriteInterceptor writeInterceptor = new MySubscriptionWriteInterceptor();
myInterceptorRegistry.unregisterInterceptor(myPartitionInterceptor);
readInterceptor.setObjectConsumer((obj) -> {
readIndex.getAndIncrement();
});
writeInterceptor.setObjectConsumer((ojb) -> {
writeIndex.getAndIncrement();
});
readInterceptor.setObjectConsumer((obj) -> readIndex.getAndIncrement());
writeInterceptor.setObjectConsumer((ojb) -> writeIndex.getAndIncrement());
myInterceptorRegistry.registerInterceptor(readInterceptor);
myInterceptorRegistry.registerInterceptor(writeInterceptor);

View File

@ -13,6 +13,7 @@ import ca.uhn.fhir.jpa.entity.PartitionEntity;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.subscription.BaseSubscriptionsR4Test;
import ca.uhn.fhir.jpa.subscription.resthook.RestHookTestR4Test;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.triggering.ISubscriptionTriggeringSvc;
import ca.uhn.fhir.jpa.subscription.triggering.SubscriptionTriggeringSvcImpl;
import ca.uhn.fhir.jpa.test.util.StoppableSubscriptionDeliveringRestHookSubscriber;
@ -69,7 +70,7 @@ public class PartitionedSubscriptionTriggeringR4Test extends BaseSubscriptionsR4
@BeforeEach
public void beforeEach() throws ServletException {
myStorageSettings.setCrossPartitionSubscriptionEnabled(true);
mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(true);
myPartitionSettings.setPartitioningEnabled(true);
myPartitionSettings.setIncludePartitionInSearchHashes(new PartitionSettings().isIncludePartitionInSearchHashes());
@ -97,9 +98,9 @@ public class PartitionedSubscriptionTriggeringR4Test extends BaseSubscriptionsR4
public void afterUnregisterRestHookListener() {
myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null);
myStoppableSubscriptionDeliveringRestHookSubscriber.unPause();
myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(new JpaStorageSettings().isTriggerSubscriptionsForNonVersioningChanges());
mySubscriptionSettings.setTriggerSubscriptionsForNonVersioningChanges(new SubscriptionSettings().isTriggerSubscriptionsForNonVersioningChanges());
myStorageSettings.setCrossPartitionSubscriptionEnabled(false);
mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(false);
myPartitionSettings.setPartitioningEnabled(false);
myPartitionSettings.setUnnamedPartitionMode(false);
@ -146,7 +147,7 @@ public class PartitionedSubscriptionTriggeringR4Test extends BaseSubscriptionsR4
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testCreateSubscriptionInPartitionAndResourceInDifferentPartition(boolean theIsCrossPartitionEnabled) throws Exception {
myStorageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
String payload = "application/fhir+json";
String code = "1000000050";
@ -186,7 +187,7 @@ public class PartitionedSubscriptionTriggeringR4Test extends BaseSubscriptionsR4
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testManualTriggeredSubscriptionDoesNotCheckOutsideOfPartition(boolean theIsCrossPartitionEnabled) throws Exception {
myStorageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
String payload = "application/fhir+json";
String code = "1000000050";
String criteria1 = "Observation?code=SNOMED-CT|" + code + "&_format=xml";

View File

@ -4,14 +4,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionStrategyEvaluator;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionValidatingInterceptor;
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
import ca.uhn.fhir.rest.api.server.RequestDetails;
@ -57,18 +56,18 @@ public class SubscriptionValidatingInterceptorTest {
@Mock
private IRequestPartitionHelperSvc myRequestPartitionHelperSvc;
@Mock
private JpaStorageSettings myStorageSettings;
private SubscriptionSettings mySubscriptionSettings;
private SubscriptionCanonicalizer mySubscriptionCanonicalizer;
@BeforeEach
public void before() {
mySvc = new SubscriptionValidatingInterceptor();
mySubscriptionCanonicalizer = spy(new SubscriptionCanonicalizer(myCtx, new StorageSettings()));
mySubscriptionCanonicalizer = spy(new SubscriptionCanonicalizer(myCtx, new SubscriptionSettings()));
mySvc.setSubscriptionCanonicalizerForUnitTest(mySubscriptionCanonicalizer);
mySvc.setDaoRegistryForUnitTest(myDaoRegistry);
mySvc.setSubscriptionStrategyEvaluatorForUnitTest(mySubscriptionStrategyEvaluator);
mySvc.setFhirContext(myCtx);
mySvc.setStorageSettingsForUnitTest(myStorageSettings);
mySvc.setSubscriptionSettingsForUnitTest(mySubscriptionSettings);
mySvc.setRequestPartitionHelperSvcForUnitTest(myRequestPartitionHelperSvc);
}
@ -205,7 +204,7 @@ public class SubscriptionValidatingInterceptorTest {
@Test
public void testValidate_Cross_Partition_Subscription() {
when(myDaoRegistry.isResourceTypeSupported(eq("Patient"))).thenReturn(true);
when(myStorageSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(true);
when(mySubscriptionSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(true);
when(myRequestPartitionHelperSvc.determineCreatePartitionForRequest(isA(RequestDetails.class), isA(Subscription.class), eq("Subscription"))).thenReturn(RequestPartitionId.defaultPartition());
Subscription subscription = new Subscription();
@ -222,14 +221,14 @@ public class SubscriptionValidatingInterceptorTest {
// No asserts here because the function should throw an UnprocessableEntityException exception if the subscription
// is invalid
assertDoesNotThrow(() -> mySvc.resourcePreCreate(subscription, requestDetails, null));
Mockito.verify(myStorageSettings, times(1)).isCrossPartitionSubscriptionEnabled();
Mockito.verify(mySubscriptionSettings, times(1)).isCrossPartitionSubscriptionEnabled();
Mockito.verify(myDaoRegistry, times(1)).isResourceTypeSupported(eq("Patient"));
Mockito.verify(myRequestPartitionHelperSvc, times(1)).determineCreatePartitionForRequest(isA(RequestDetails.class), isA(Subscription.class), eq("Subscription"));
}
@Test
public void testValidate_Cross_Partition_Subscription_On_Wrong_Partition() {
when(myStorageSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(true);
when(mySubscriptionSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(true);
when(myRequestPartitionHelperSvc.determineCreatePartitionForRequest(isA(RequestDetails.class), isA(Subscription.class), eq("Subscription"))).thenReturn(RequestPartitionId.fromPartitionId(1));
Subscription subscription = new Subscription();
@ -253,7 +252,7 @@ public class SubscriptionValidatingInterceptorTest {
@Test
public void testValidate_Cross_Partition_Subscription_Without_Setting() {
when(myStorageSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(false);
when(mySubscriptionSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(false);
Subscription subscription = new Subscription();
subscription.setStatus(Subscription.SubscriptionStatus.ACTIVE);
@ -292,7 +291,7 @@ public class SubscriptionValidatingInterceptorTest {
// No asserts here because the function should throw an UnprocessableEntityException exception if the subscription
// is invalid
mySvc.resourcePreCreate(subscription, requestDetails, null);
Mockito.verify(myStorageSettings, never()).isCrossPartitionSubscriptionEnabled();
Mockito.verify(mySubscriptionSettings, never()).isCrossPartitionSubscriptionEnabled();
Mockito.verify(myDaoRegistry, times(1)).isResourceTypeSupported(eq("Patient"));
Mockito.verify(myRequestPartitionHelperSvc, never()).determineCreatePartitionForRequest(isA(RequestDetails.class), isA(Patient.class), eq("Patient"));
}
@ -301,7 +300,7 @@ public class SubscriptionValidatingInterceptorTest {
public void testSubscriptionUpdate() {
// setup
when(myDaoRegistry.isResourceTypeSupported(eq("Patient"))).thenReturn(true);
when(myStorageSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(true);
when(mySubscriptionSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(true);
lenient()
.when(myRequestPartitionHelperSvc.determineReadPartitionForRequestForRead(isA(RequestDetails.class), isA(String.class), isA(IIdType.class)))
.thenReturn(RequestPartitionId.allPartitions());

View File

@ -4,6 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.subscription.BaseSubscriptionsR4Test;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.submit.interceptor.SynchronousSubscriptionMatcherInterceptor;
import ca.uhn.fhir.jpa.subscription.channel.api.ChannelConsumerSettings;
import ca.uhn.fhir.jpa.subscription.channel.api.IChannelReceiver;
@ -52,7 +53,7 @@ public class AsyncSubscriptionMessageSubmissionIT extends BaseSubscriptionsR4Tes
public void cleanupStoppableSubscriptionDeliveringRestHookSubscriber() {
myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null);
myStoppableSubscriptionDeliveringRestHookSubscriber.unPause();
myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(new JpaStorageSettings().isTriggerSubscriptionsForNonVersioningChanges());
mySubscriptionSettings.setTriggerSubscriptionsForNonVersioningChanges(new SubscriptionSettings().isTriggerSubscriptionsForNonVersioningChanges());
myStorageSettings.setTagStorageMode(new JpaStorageSettings().getTagStorageMode());
}

View File

@ -13,6 +13,7 @@ import ca.uhn.fhir.jpa.subscription.channel.api.IChannelReceiver;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.test.util.StoppableSubscriptionDeliveringRestHookSubscriber;
import ca.uhn.fhir.rest.client.api.Header;
import ca.uhn.fhir.rest.client.api.IGenericClient;
@ -72,7 +73,7 @@ public class MessageSubscriptionR4Test extends BaseSubscriptionsR4Test {
public void cleanupStoppableSubscriptionDeliveringRestHookSubscriber() {
myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null);
myStoppableSubscriptionDeliveringRestHookSubscriber.unPause();
myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(new JpaStorageSettings().isTriggerSubscriptionsForNonVersioningChanges());
mySubscriptionSettings.setTriggerSubscriptionsForNonVersioningChanges(new SubscriptionSettings().isTriggerSubscriptionsForNonVersioningChanges());
myStorageSettings.setTagStorageMode(new JpaStorageSettings().getTagStorageMode());
}

View File

@ -58,12 +58,12 @@ public class RestHookActivatesPreExistingSubscriptionsR4Test extends BaseResourc
@AfterEach
public void afterUnregisterRestHookListener() {
mySubscriptionTestUtil.unregisterSubscriptionInterceptor();
myStorageSettings.clearSupportedSubscriptionTypesForUnitTest();
mySubscriptionSettings.clearSupportedSubscriptionTypesForUnitTest();
}
@BeforeEach
public void beforeSetSubscriptionActivatingInterceptor() {
myStorageSettings.addSupportedSubscriptionType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK);
mySubscriptionSettings.addSupportedSubscriptionType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK);
myResourceModifiedSubmitterSvc.startIfNeeded();
mySubscriptionLoader.doSyncSubscriptionsForUnitTest();
}

View File

@ -8,6 +8,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.subscription.BaseSubscriptionsR4Test;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.submit.svc.ResourceModifiedSubmitterSvc;
import ca.uhn.fhir.jpa.test.util.StoppableSubscriptionDeliveringRestHookSubscriber;
import ca.uhn.fhir.jpa.topic.SubscriptionTopicDispatcher;
@ -83,7 +84,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test {
ourLog.info("@AfterEach");
myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null);
myStoppableSubscriptionDeliveringRestHookSubscriber.unPause();
myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(new JpaStorageSettings().isTriggerSubscriptionsForNonVersioningChanges());
mySubscriptionSettings.setTriggerSubscriptionsForNonVersioningChanges(new SubscriptionSettings().isTriggerSubscriptionsForNonVersioningChanges());
}
@Test
@ -403,7 +404,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test {
@Test
public void testRestHookSubscriptionMetaAddDoesTriggerNewDeliveryIfConfiguredToDoSo() throws Exception {
myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(true);
mySubscriptionSettings.setTriggerSubscriptionsForNonVersioningChanges(true);
String payload = "application/fhir+json";
@ -732,7 +733,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test {
@Test
public void testRestHookSubscriptionApplicationJsonDatabase() throws Exception {
// Same test as above, but now run it using database matching
myStorageSettings.setEnableInMemorySubscriptionMatching(false);
mySubscriptionSettings.setEnableInMemorySubscriptionMatching(false);
String payload = "application/json";
String code = "1000000050";
@ -1173,8 +1174,8 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test {
*/
@Test
public void testSubscriptionDoesntActivateIfRestHookIsNotEnabled() throws InterruptedException {
Set<org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType> existingSupportedSubscriptionTypes = myStorageSettings.getSupportedSubscriptionTypes();
myStorageSettings.clearSupportedSubscriptionTypesForUnitTest();
Set<org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType> existingSupportedSubscriptionTypes = mySubscriptionSettings.getSupportedSubscriptionTypes();
mySubscriptionSettings.clearSupportedSubscriptionTypesForUnitTest();
try {
Subscription subscription = newSubscription("Observation?", "application/fhir+json");
@ -1185,7 +1186,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test {
assertEquals(Subscription.SubscriptionStatus.REQUESTED, subscription.getStatus());
} finally {
existingSupportedSubscriptionTypes.forEach(t -> myStorageSettings.addSupportedSubscriptionType(t));
existingSupportedSubscriptionTypes.forEach(t -> mySubscriptionSettings.addSupportedSubscriptionType(t));
}
}

View File

@ -6,11 +6,11 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService;
import ca.uhn.fhir.jpa.model.entity.PersistedResourceModifiedMessageEntityPK;
import ca.uhn.fhir.jpa.model.entity.ResourceModifiedEntity;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.subscription.channel.api.ChannelProducerSettings;
import ca.uhn.fhir.jpa.subscription.channel.api.IChannelProducer;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.submit.svc.ResourceModifiedSubmitterSvc;
import ca.uhn.fhir.jpa.svc.MockHapiTransactionService;
import ca.uhn.fhir.subscription.api.IResourceModifiedMessagePersistenceSvc;
@ -49,7 +49,7 @@ public class ResourceModifiedSubmitterSvcTest {
private final ch.qos.logback.classic.Logger ourLogger = (Logger) LoggerFactory.getLogger(ResourceModifiedSubmitterSvc.class);
@Mock
StorageSettings myStorageSettings;
SubscriptionSettings mySubscriptionSettings;
@Mock
SubscriptionChannelFactory mySubscriptionChannelFactory;
@Mock
@ -68,12 +68,12 @@ public class ResourceModifiedSubmitterSvcTest {
@BeforeEach
public void beforeEach(){
myCapturingTransactionStatus = new SimpleTransactionStatus();
lenient().when(myStorageSettings.hasSupportedSubscriptionTypes()).thenReturn(true);
lenient().when(mySubscriptionSettings.hasSupportedSubscriptionTypes()).thenReturn(true);
lenient().when(mySubscriptionChannelFactory.newMatchingSendingChannel(anyString(), any())).thenReturn(myChannelProducer);
IHapiTransactionService hapiTransactionService = new MockHapiTransactionService(myCapturingTransactionStatus);
myResourceModifiedSubmitterSvc = new ResourceModifiedSubmitterSvc(
myStorageSettings,
mySubscriptionSettings,
mySubscriptionChannelFactory,
myResourceModifiedMessagePersistenceSvc,
hapiTransactionService);
@ -85,7 +85,7 @@ public class ResourceModifiedSubmitterSvcTest {
public void testMethodStartIfNeeded_withQualifySubscriptionMatchingChannelNameProperty_mayQualifyChannelName(boolean theIsQualifySubMatchingChannelName){
// given
boolean expectedResult = theIsQualifySubMatchingChannelName;
when(myStorageSettings.isQualifySubscriptionMatchingChannelName()).thenReturn(theIsQualifySubMatchingChannelName);
when(mySubscriptionSettings.isQualifySubscriptionMatchingChannelName()).thenReturn(theIsQualifySubMatchingChannelName);
// when
myResourceModifiedSubmitterSvc.startIfNeeded();

View File

@ -26,7 +26,7 @@ public class WebsocketWithCriteriaR4Test extends BaseResourceProviderR4Test {
private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(WebsocketWithCriteriaR4Test.class);
@RegisterExtension
private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings);
private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> mySubscriptionSettings);
private String myPatientId;
private String mySubscriptionId;

View File

@ -42,7 +42,7 @@ public class WebsocketWithSubscriptionIdR4Test extends BaseResourceProviderR4Tes
private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(WebsocketWithSubscriptionIdR4Test.class);
@RegisterExtension
private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings);
private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> mySubscriptionSettings);
private String myPatientId;
private String mySubscriptionId;
@Autowired

View File

@ -1,6 +1,7 @@
package ca.uhn.fhir.jpa.term;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.context.support.ConceptValidationOptions;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.context.support.ValueSetExpansionOptions;
@ -18,11 +19,13 @@ import ca.uhn.fhir.jpa.entity.TermValueSetPreExpansionStatusEnum;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.search.builder.SearchBuilder;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc;
import ca.uhn.fhir.jpa.term.api.ITermReadSvc;
import ca.uhn.fhir.jpa.term.custom.CustomTerminologySet;
import ca.uhn.fhir.jpa.util.SqlQuery;
import ca.uhn.fhir.jpa.util.ValueSetTestUtil;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import com.google.common.collect.Lists;
@ -99,6 +102,12 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test implements IValueSet
return myStorageSettings;
}
@Test
public void testValueSetUrlSP() {
RuntimeSearchParam sp = mySearchParamRegistry.getActiveSearchParam("ValueSet", "url");
assertEquals("url", sp.getName());
}
@Test
public void testDeletePreExpandedValueSet() throws IOException {
myStorageSettings.setPreExpandValueSets(true);

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,6 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.submit.svc.ResourceModifiedSubmitterSvc;
import ca.uhn.fhir.jpa.test.util.StoppableSubscriptionDeliveringRestHookSubscriber;
import ca.uhn.fhir.model.primitive.IdDt;
@ -65,7 +66,7 @@ public class RestHookTestR4BTest extends BaseSubscriptionsR4BTest {
ourLog.info("@AfterEach");
myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null);
myStoppableSubscriptionDeliveringRestHookSubscriber.unPause();
myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(new JpaStorageSettings().isTriggerSubscriptionsForNonVersioningChanges());
mySubscriptionSettings.setTriggerSubscriptionsForNonVersioningChanges(new SubscriptionSettings().isTriggerSubscriptionsForNonVersioningChanges());
}
@ -367,7 +368,7 @@ public class RestHookTestR4BTest extends BaseSubscriptionsR4BTest {
@Test
public void testRestHookSubscriptionMetaAddDoesTriggerNewDeliveryIfConfiguredToDoSo() throws Exception {
myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(true);
mySubscriptionSettings.setTriggerSubscriptionsForNonVersioningChanges(true);
String code = "1000000050";
String criteria1 = "Observation?code=SNOMED-CT|" + code + "&_format=xml";
@ -686,7 +687,7 @@ public class RestHookTestR4BTest extends BaseSubscriptionsR4BTest {
@Test
public void testRestHookSubscriptionApplicationJsonDatabase() throws Exception {
// Same test as above, but now run it using database matching
myStorageSettings.setEnableInMemorySubscriptionMatching(false);
mySubscriptionSettings.setEnableInMemorySubscriptionMatching(false);
String code = "1000000050";
String criteria1 = "Observation?code=SNOMED-CT|" + code + "&_format=xml";
String criteria2 = "Observation?code=SNOMED-CT|" + code + "111&_format=xml";
@ -1103,8 +1104,8 @@ public class RestHookTestR4BTest extends BaseSubscriptionsR4BTest {
*/
@Test
public void testSubscriptionDoesntActivateIfRestHookIsNotEnabled() throws InterruptedException {
Set<org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType> existingSupportedSubscriptionTypes = myStorageSettings.getSupportedSubscriptionTypes();
myStorageSettings.clearSupportedSubscriptionTypesForUnitTest();
Set<org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType> existingSupportedSubscriptionTypes = mySubscriptionSettings.getSupportedSubscriptionTypes();
mySubscriptionSettings.clearSupportedSubscriptionTypesForUnitTest();
try {
Subscription subscription = newSubscriptionWithStatus("Observation?", "application/fhir+json", Enumerations.SubscriptionStatus.REQUESTED);
@ -1115,7 +1116,7 @@ public class RestHookTestR4BTest extends BaseSubscriptionsR4BTest {
assertEquals(Enumerations.SubscriptionStatus.REQUESTED, subscription.getStatus());
} finally {
existingSupportedSubscriptionTypes.forEach(t -> myStorageSettings.addSupportedSubscriptionType(t));
existingSupportedSubscriptionTypes.forEach(t -> mySubscriptionSettings.addSupportedSubscriptionType(t));
}
}

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -529,7 +529,7 @@ public class RestHookTestR5IT extends BaseSubscriptionsR5Test {
@Test
public void testRestHookSubscriptionApplicationJsonDatabase() throws Exception {
// Same test as above, but now run it using database matching
myStorageSettings.setEnableInMemorySubscriptionMatching(false);
mySubscriptionSettings.setEnableInMemorySubscriptionMatching(false);
testRestHookSubscriptionApplicationJson();
}

View File

@ -29,7 +29,7 @@ public class WebsocketWithSubscriptionIdR5Test extends BaseSubscriptionsR5Test {
@RegisterExtension
private final WebsocketSubscriptionClient myWebsocketClientExtension =
new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings);
new WebsocketSubscriptionClient(() -> myServer, () -> mySubscriptionSettings);
@Autowired
private SubscriptionTestUtil mySubscriptionTestUtil;

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -78,6 +78,7 @@ import ca.uhn.fhir.jpa.search.cache.ISearchResultCacheSvc;
import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionLoader;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc;
import ca.uhn.fhir.jpa.util.CircularQueueCaptureQueriesListener;
import ca.uhn.fhir.jpa.util.MemoryCacheService;
@ -194,6 +195,8 @@ public abstract class BaseJpaTest extends BaseTest {
@Autowired
protected JpaStorageSettings myStorageSettings;
@Autowired
protected SubscriptionSettings mySubscriptionSettings;
@Autowired
protected DatabaseBackedPagingProvider myDatabaseBackedPagingProvider;
@Autowired
protected IInterceptorService myInterceptorRegistry;

View File

@ -32,6 +32,7 @@ import ca.uhn.fhir.jpa.subscription.channel.config.SubscriptionChannelConfig;
import ca.uhn.fhir.jpa.subscription.match.config.SubscriptionProcessorConfig;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender;
import ca.uhn.fhir.jpa.subscription.match.deliver.resthook.SubscriptionDeliveringRestHookSubscriber;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.submit.config.SubscriptionSubmitterConfig;
import ca.uhn.fhir.jpa.term.TermCodeSystemDeleteJobSvcWithUniTestFailures;
import ca.uhn.fhir.jpa.term.api.ITermCodeSystemDeleteJobSvc;
@ -68,6 +69,11 @@ public class TestJPAConfig {
return retVal;
}
@Bean
public SubscriptionSettings subscriptionSettings() {
return new SubscriptionSettings();
}
@Bean
public PartitionSettings partitionSettings() {
return new PartitionSettings();

View File

@ -20,7 +20,6 @@
package ca.uhn.fhir.jpa.test.util;
import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.cache.IResourceChangeListenerCacheRefresher;
import ca.uhn.fhir.jpa.subscription.channel.impl.LinkedBlockingChannel;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelRegistry;
@ -29,6 +28,7 @@ import ca.uhn.fhir.jpa.subscription.match.deliver.email.EmailSenderImpl;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.SubscriptionDeliveringEmailSubscriber;
import ca.uhn.fhir.jpa.subscription.match.registry.ActiveSubscription;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionSubmitInterceptorLoader;
import ca.uhn.fhir.jpa.subscription.submit.svc.ResourceModifiedSubmitterSvc;
import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor;
@ -41,7 +41,7 @@ public class SubscriptionTestUtil {
private static final SubscriptionDebugLogInterceptor ourSubscriptionDebugLogInterceptor = new SubscriptionDebugLogInterceptor();
@Autowired
private JpaStorageSettings myStorageSettings;
private SubscriptionSettings mySubscriptionSettings;
@Autowired
private SubscriptionSubmitInterceptorLoader mySubscriptionSubmitInterceptorLoader;
@Autowired
@ -76,27 +76,27 @@ public class SubscriptionTestUtil {
}
public void registerEmailInterceptor() {
myStorageSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL);
mySubscriptionSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL);
mySubscriptionSubmitInterceptorLoader.start();
}
public void registerRestHookInterceptor() {
myStorageSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
mySubscriptionSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
mySubscriptionSubmitInterceptorLoader.start();
}
public void registerMessageInterceptor() {
myStorageSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.MESSAGE);
mySubscriptionSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.MESSAGE);
mySubscriptionSubmitInterceptorLoader.start();
}
public void registerWebSocketInterceptor() {
myStorageSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET);
mySubscriptionSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET);
mySubscriptionSubmitInterceptorLoader.start();
}
public void unregisterSubscriptionInterceptor() {
myStorageSettings.clearSupportedSubscriptionTypesForUnitTest();
mySubscriptionSettings.clearSupportedSubscriptionTypesForUnitTest();
mySubscriptionSubmitInterceptorLoader.unregisterInterceptorsForUnitTest();
}

View File

@ -19,7 +19,7 @@
*/
package ca.uhn.fhir.jpa.util;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.subscription.SocketImplementation;
import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
@ -40,7 +40,7 @@ import java.util.function.Supplier;
public class WebsocketSubscriptionClient implements AfterEachCallback {
private static final Logger ourLog = LoggerFactory.getLogger(WebsocketSubscriptionClient.class);
private final Supplier<RestfulServerExtension> myServerSupplier;
private final Supplier<StorageSettings> myStorageSettings;
private final Supplier<SubscriptionSettings> mySubscriptionSettingsSupplier;
private jakarta.websocket.Session mySession;
private SocketImplementation mySocketImplementation;
@ -48,12 +48,12 @@ public class WebsocketSubscriptionClient implements AfterEachCallback {
* Constructor
*/
public WebsocketSubscriptionClient(
Supplier<RestfulServerExtension> theServerSupplier, Supplier<StorageSettings> theStorageSettings) {
Supplier<RestfulServerExtension> theServerSupplier, Supplier<SubscriptionSettings> theStorageSettings) {
assert theServerSupplier != null;
assert theStorageSettings != null;
myServerSupplier = theServerSupplier;
myStorageSettings = theStorageSettings;
mySubscriptionSettingsSupplier = theStorageSettings;
}
public void bind(String theSubscriptionId) {
@ -67,7 +67,7 @@ public class WebsocketSubscriptionClient implements AfterEachCallback {
try {
URI echoUri = new URI("ws://localhost:" + server.getPort() + server.getWebsocketContextPath()
+ myStorageSettings.get().getWebsocketContextPath());
+ mySubscriptionSettingsSupplier.get().getWebsocketContextPath());
WebSocketContainer container = ContainerProvider.getWebSocketContainer();
mySession = container.connectToServer(mySocketImplementation, echoUri);

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.config.HapiJpaConfig;
import ca.uhn.fhir.jpa.config.JpaDstu2Config;
import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect;
import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect;
import ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers;
@ -54,12 +55,18 @@ public class TestDstu2Config {
}
@Bean
public JpaStorageSettings storageSettings() {
JpaStorageSettings retVal = new JpaStorageSettings();
public SubscriptionSettings subscriptionSettings() {
SubscriptionSettings retVal = new SubscriptionSettings();
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET);
retVal.setWebsocketContextPath("/websocketDstu2");
retVal.setWebsocketContextPath("/");
return retVal;
}
@Bean
public JpaStorageSettings storageSettings() {
JpaStorageSettings retVal = new JpaStorageSettings();
retVal.setAllowContainsSearches(true);
retVal.setAllowMultipleDelete(true);
retVal.setAllowInlineMatchUrlReferences(true);
@ -71,7 +78,6 @@ public class TestDstu2Config {
retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO);
retVal.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED);
retVal.setFetchSizeDefaultMaximum(10000);
retVal.setWebsocketContextPath("/");
retVal.setFilterParameterEnabled(true);
retVal.setDefaultSearchParamsCanBeOverridden(false);
retVal.setIndexOnContainedResources(true);

View File

@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.config.HapiJpaConfig;
import ca.uhn.fhir.jpa.config.dstu3.JpaDstu3Config;
import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect;
import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
@ -49,12 +50,18 @@ public class TestDstu3Config {
private String myFhirLuceneLocation = System.getProperty(FHIR_LUCENE_LOCATION_DSTU3);
@Bean
public JpaStorageSettings storageSettings() {
JpaStorageSettings retVal = new JpaStorageSettings();
public SubscriptionSettings subscriptionSettings() {
SubscriptionSettings retVal = new SubscriptionSettings();
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET);
retVal.setWebsocketContextPath("/websocketDstu3");
return retVal;
}
@Bean
public JpaStorageSettings storageSettings() {
JpaStorageSettings retVal = new JpaStorageSettings();
retVal.setAllowContainsSearches(true);
retVal.setAllowMultipleDelete(true);
retVal.setAllowInlineMatchUrlReferences(true);

View File

@ -10,6 +10,7 @@ import ca.uhn.fhir.jpa.ips.generator.IIpsGeneratorSvc;
import ca.uhn.fhir.jpa.ips.generator.IpsGeneratorSvcImpl;
import ca.uhn.fhir.jpa.ips.jpa.DefaultJpaIpsGenerationStrategy;
import ca.uhn.fhir.jpa.ips.provider.IpsOperationProvider;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect;
import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
@ -55,12 +56,18 @@ public class TestR4Config {
private String myFhirLuceneLocation = System.getProperty(FHIR_LUCENE_LOCATION_R4);
@Bean
public JpaStorageSettings storageSettings() {
JpaStorageSettings retVal = new JpaStorageSettings();
public SubscriptionSettings subscriptionSettings() {
SubscriptionSettings retVal = new SubscriptionSettings();
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET);
retVal.setWebsocketContextPath("/websocketR4");
return retVal;
}
@Bean
public JpaStorageSettings storageSettings() {
JpaStorageSettings retVal = new JpaStorageSettings();
retVal.setAllowContainsSearches(true);
retVal.setAllowMultipleDelete(true);
retVal.setAllowInlineMatchUrlReferences(false);

View File

@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.config.HapiJpaConfig;
import ca.uhn.fhir.jpa.config.r5.JpaR5Config;
import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect;
import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
@ -54,12 +55,18 @@ public class TestR5Config {
private String myFhirLuceneLocation = System.getProperty(FHIR_LUCENE_LOCATION_R5);
@Bean
public JpaStorageSettings storageSettings() {
JpaStorageSettings retVal = new JpaStorageSettings();
public SubscriptionSettings subscriptionSettings() {
SubscriptionSettings retVal = new SubscriptionSettings();
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET);
retVal.setWebsocketContextPath("/websocketR5");
return retVal;
}
@Bean
public JpaStorageSettings storageSettings() {
JpaStorageSettings retVal = new JpaStorageSettings();
retVal.setAllowContainsSearches(true);
retVal.setAllowMultipleDelete(true);
retVal.setAllowInlineMatchUrlReferences(true);

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version>
<version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

Some files were not shown because too many files have changed in this diff Show More