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> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>7.3.5-SNAPSHOT</version> <version>7.3.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version> <version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </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.SearchBuilderFactory;
import ca.uhn.fhir.jpa.dao.mdm.MdmExpansionCacheSvc; import ca.uhn.fhir.jpa.dao.mdm.MdmExpansionCacheSvc;
import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService; 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.dao.JpaPid;
import ca.uhn.fhir.jpa.model.search.SearchBuilderLoadIncludesParameters; import ca.uhn.fhir.jpa.model.search.SearchBuilderLoadIncludesParameters;
import ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails; import ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails;
@ -109,9 +110,8 @@ public class JpaBulkExportProcessor implements IBulkExportProcessor<JpaPid> {
@Autowired @Autowired
private IIdHelperService<JpaPid> myIdHelperService; private IIdHelperService<JpaPid> myIdHelperService;
@SuppressWarnings("rawtypes")
@Autowired @Autowired
protected IMdmLinkDao myMdmLinkDao; protected IMdmLinkDao<JpaPid, MdmLink> myMdmLinkDao;
@Autowired @Autowired
private MdmExpansionCacheSvc myMdmExpansionCacheSvc; 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.api.IBulkExportProcessor;
import ca.uhn.fhir.jpa.bulk.export.svc.BulkExportHelperService; import ca.uhn.fhir.jpa.bulk.export.svc.BulkExportHelperService;
import ca.uhn.fhir.jpa.bulk.export.svc.JpaBulkExportProcessor; 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.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@Configuration @Configuration
public class JpaBulkExportConfig { public class JpaBulkExportConfig {
@Bean @Bean
public IBulkExportProcessor jpaBulkExportProcessor() { public IBulkExportProcessor<JpaPid> jpaBulkExportProcessor() {
return new JpaBulkExportProcessor(); return new JpaBulkExportProcessor();
} }

View File

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

View File

@ -91,24 +91,6 @@ public class JpaCapabilityStatementProvider extends ServerCapabilityStatementPro
theTerser.addElement(theCapabilityStatement, "patchFormat", Constants.CT_XML_PATCH); 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 @Override
protected void postProcessRestResource(FhirTerser theTerser, IBase theResource, String theResourceName) { protected void postProcessRestResource(FhirTerser theTerser, IBase theResource, String theResourceName) {
super.postProcessRestResource(theTerser, theResource, 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.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.util.ResourceCountCache; 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.composite.MetaDt;
import ca.uhn.fhir.model.dstu2.resource.Bundle; import ca.uhn.fhir.model.dstu2.resource.Bundle;
import ca.uhn.fhir.model.dstu2.resource.Conformance; 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.dstu2.valueset.SearchParamTypeEnum;
import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.DecimalDt; 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.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider; import ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider;
import ca.uhn.fhir.util.CoverageIgnore; import ca.uhn.fhir.util.CoverageIgnore;
import ca.uhn.fhir.util.ExtensionConstants; import ca.uhn.fhir.util.ExtensionConstants;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import org.hl7.fhir.dstu2.model.Subscription;
import java.util.Collections; import java.util.Collections;
import java.util.List; 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)) { if (isNotBlank(myImplementationDescription)) {
retVal.getImplementation().setDescription(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.Enumerations.SearchParamType;
import org.hl7.fhir.dstu3.model.Extension; import org.hl7.fhir.dstu3.model.Extension;
import org.hl7.fhir.dstu3.model.Meta; import org.hl7.fhir.dstu3.model.Meta;
import org.hl7.fhir.dstu3.model.UriType;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -176,17 +175,6 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se
massage(retVal); 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); retVal.getImplementation().setDescription(myImplementationDescription);
myCachedValue = retVal; myCachedValue = retVal;
return retVal; return retVal;

View File

@ -28,6 +28,8 @@ public class JpaHapiTransactionService extends HapiTransactionService {
private volatile Boolean myCustomIsolationSupported; private volatile Boolean myCustomIsolationSupported;
public JpaHapiTransactionService() {}
@Override @Override
public boolean isCustomIsolationSupported() { public boolean isCustomIsolationSupported() {
if (myCustomIsolationSupported == null) { 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.mdm.MdmExpansionCacheSvc;
import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService; import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService;
import ca.uhn.fhir.jpa.dao.tx.NonTransactionalHapiTransactionService; 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.dao.JpaPid;
import ca.uhn.fhir.jpa.model.search.SearchBuilderLoadIncludesParameters; import ca.uhn.fhir.jpa.model.search.SearchBuilderLoadIncludesParameters;
import ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails; import ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails;
@ -138,7 +139,7 @@ public class JpaBulkExportProcessorTest {
private IIdHelperService<JpaPid> myIdHelperService; private IIdHelperService<JpaPid> myIdHelperService;
@Mock @Mock
private IMdmLinkDao<JpaPid,?> myMdmLinkDao; private IMdmLinkDao<JpaPid, MdmLink> myMdmLinkDao;
@Mock @Mock
private MdmExpansionCacheSvc myMdmExpansionCacheSvc; private MdmExpansionCacheSvc myMdmExpansionCacheSvc;

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version> <version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </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.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.mdm.helper.MdmHelperR4; 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.channel.config.SubscriptionChannelConfig;
import ca.uhn.fhir.jpa.subscription.submit.config.SubscriptionSubmitterConfig; import ca.uhn.fhir.jpa.subscription.submit.config.SubscriptionSubmitterConfig;
import ca.uhn.fhir.jpa.test.config.TestSubscriptionMatcherInterceptorConfig; import ca.uhn.fhir.jpa.test.config.TestSubscriptionMatcherInterceptorConfig;
@ -19,8 +20,8 @@ public class TestMdmConfigR4 extends BaseTestMdmConfig {
@Primary @Primary
@Bean @Bean
public JpaStorageSettings storageSettings() { public SubscriptionSettings subscriptionSettings() {
JpaStorageSettings retVal = new JpaStorageSettings(); SubscriptionSettings retVal = new SubscriptionSettings();
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.MESSAGE); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.MESSAGE);

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version> <version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </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.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc; import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc;
import ca.uhn.fhir.util.HapiExtensions; 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.apache.commons.lang3.Validate;
import org.hl7.fhir.dstu2.model.Subscription;
import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.r4.model.DateTimeType; import org.hl7.fhir.r4.model.DateTimeType;
@ -70,7 +67,6 @@ public class StorageSettings {
"http://hl7.org/fhir/codesystem-*", "http://hl7.org/fhir/codesystem-*",
"http://hl7.org/fhir/StructureDefinition/*"))); "http://hl7.org/fhir/StructureDefinition/*")));
public static final String DEFAULT_WEBSOCKET_CONTEXT_PATH = "/websocket";
/* /*
* <p> * <p>
* Note the following database documented limitations: * Note the following database documented limitations:
@ -95,18 +91,12 @@ public class StorageSettings {
private Set<String> myTreatBaseUrlsAsLocal = new HashSet<>(); private Set<String> myTreatBaseUrlsAsLocal = new HashSet<>();
private Set<String> myTreatReferencesAsLogical = new HashSet<>(DEFAULT_LOGICAL_BASE_URLS); private Set<String> myTreatReferencesAsLogical = new HashSet<>(DEFAULT_LOGICAL_BASE_URLS);
private boolean myDefaultSearchParamsCanBeOverridden = true; private boolean myDefaultSearchParamsCanBeOverridden = true;
private Set<Subscription.SubscriptionChannelType> mySupportedSubscriptionTypes = new HashSet<>();
private boolean myAutoCreatePlaceholderReferenceTargets; private boolean myAutoCreatePlaceholderReferenceTargets;
private boolean myCrossPartitionSubscriptionEnabled = true;
private Integer myBundleBatchPoolSize = DEFAULT_BUNDLE_BATCH_POOL_SIZE; private Integer myBundleBatchPoolSize = DEFAULT_BUNDLE_BATCH_POOL_SIZE;
private Integer myBundleBatchMaxPoolSize = DEFAULT_BUNDLE_BATCH_MAX_POOL_SIZE; private Integer myBundleBatchMaxPoolSize = DEFAULT_BUNDLE_BATCH_MAX_POOL_SIZE;
private boolean myEnableInMemorySubscriptionMatching = true;
private boolean myTriggerSubscriptionsForNonVersioningChanges;
private boolean myMassIngestionMode; private boolean myMassIngestionMode;
private Integer myMaximumTransactionBundleSize = DEFAULT_MAXIMUM_TRANSACTION_BUNDLE_SIZE; private Integer myMaximumTransactionBundleSize = DEFAULT_MAXIMUM_TRANSACTION_BUNDLE_SIZE;
private boolean myNormalizeTerminologyForBulkExportJobs = false; private boolean myNormalizeTerminologyForBulkExportJobs = false;
private String myEmailFromAddress = "noreply@unknown.com";
private String myWebsocketContextPath = DEFAULT_WEBSOCKET_CONTEXT_PATH;
/** /**
* Update setter javadoc if default changes. * Update setter javadoc if default changes.
*/ */
@ -128,16 +118,6 @@ public class StorageSettings {
private boolean myIndexIdentifierOfType = false; private boolean myIndexIdentifierOfType = false;
private IndexEnabledEnum myIndexMissingFieldsEnabled = IndexEnabledEnum.DISABLED; 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 * Should the {@literal _lamguage} SearchParameter be supported
* on this server? * on this server?
@ -154,26 +134,6 @@ public class StorageSettings {
*/ */
private boolean myValidateResourceStatusForPackageUpload = true; 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 * Constructor
*/ */
@ -270,48 +230,6 @@ public class StorageSettings {
this.myBundleBatchMaxPoolSize = theBundleBatchMaxPoolSize; 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}) * 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. * the server will not create search indexes for search parameters with no values in resources.
@ -459,26 +377,6 @@ public class StorageSettings {
mySequenceValueMassagerClass = theSequenceValueMassagerClass; 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 * If set to <code>true</code> (default is <code>false</code>) the
* <code>:of-type</code> modifier on token search parameters for * <code>:of-type</code> modifier on token search parameters for
@ -779,66 +677,6 @@ public class StorageSettings {
return this; 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> * <p>
* Should searches use the integer field {@code SP_VALUE_LOW_DATE_ORDINAL} and {@code SP_VALUE_HIGH_DATE_ORDINAL} in * 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; 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}. * @return Should the {@literal _lamguage} SearchParameter be supported on this server? Defaults to {@literal false}.
* @since 7.0.0 * @since 7.0.0

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@
*/ */
package ca.uhn.fhir.jpa.subscription.match.matcher.matching; 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.searchparam.matcher.InMemoryMatchResult;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription; import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage; import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage;
@ -34,7 +34,7 @@ public class CompositeInMemoryDaoSubscriptionMatcher implements ISubscriptionMat
private final InMemorySubscriptionMatcher myInMemorySubscriptionMatcher; private final InMemorySubscriptionMatcher myInMemorySubscriptionMatcher;
@Autowired @Autowired
StorageSettings myStorageSettings; SubscriptionSettings mySubscriptionSettings;
public CompositeInMemoryDaoSubscriptionMatcher( public CompositeInMemoryDaoSubscriptionMatcher(
DaoSubscriptionMatcher theDaoSubscriptionMatcher, DaoSubscriptionMatcher theDaoSubscriptionMatcher,
@ -46,7 +46,7 @@ public class CompositeInMemoryDaoSubscriptionMatcher implements ISubscriptionMat
@Override @Override
public InMemoryMatchResult match(CanonicalSubscription theSubscription, ResourceModifiedMessage theMsg) { public InMemoryMatchResult match(CanonicalSubscription theSubscription, ResourceModifiedMessage theMsg) {
InMemoryMatchResult result; InMemoryMatchResult result;
if (myStorageSettings.isEnableInMemorySubscriptionMatching()) { if (mySubscriptionSettings.isEnableInMemorySubscriptionMatching()) {
result = myInMemorySubscriptionMatcher.match(theSubscription, theMsg); result = myInMemorySubscriptionMatcher.match(theSubscription, theMsg);
if (result.supported()) { if (result.supported()) {
result.setInMemory(true); 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.IHapiBootOrder;
import ca.uhn.fhir.context.FhirContext; 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.ChannelConsumerSettings;
import ca.uhn.fhir.jpa.subscription.channel.api.IChannelReceiver; import ca.uhn.fhir.jpa.subscription.channel.api.IChannelReceiver;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory;
@ -63,7 +63,7 @@ public class MatchingQueueSubscriberLoader {
private SubscriptionActivatingSubscriber mySubscriptionActivatingSubscriber; private SubscriptionActivatingSubscriber mySubscriptionActivatingSubscriber;
@Autowired @Autowired
private StorageSettings myStorageSettings; private SubscriptionSettings mySubscriptionSettings;
@EventListener(ContextRefreshedEvent.class) @EventListener(ContextRefreshedEvent.class)
@Order(IHapiBootOrder.SUBSCRIPTION_MATCHING_CHANNEL_HANDLER) @Order(IHapiBootOrder.SUBSCRIPTION_MATCHING_CHANNEL_HANDLER)
@ -92,7 +92,8 @@ public class MatchingQueueSubscriberLoader {
private ChannelConsumerSettings getChannelConsumerSettings() { private ChannelConsumerSettings getChannelConsumerSettings() {
ChannelConsumerSettings channelConsumerSettings = new ChannelConsumerSettings(); ChannelConsumerSettings channelConsumerSettings = new ChannelConsumerSettings();
channelConsumerSettings.setQualifyChannelName(myStorageSettings.isQualifySubscriptionMatchingChannelName()); channelConsumerSettings.setQualifyChannelName(
mySubscriptionSettings.isQualifySubscriptionMatchingChannelName());
return channelConsumerSettings; 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.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; 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.match.registry.SubscriptionCanonicalizer;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType; import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage; import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage;
@ -66,7 +66,7 @@ public class SubscriptionActivatingSubscriber implements MessageHandler {
private SubscriptionCanonicalizer mySubscriptionCanonicalizer; private SubscriptionCanonicalizer mySubscriptionCanonicalizer;
@Autowired @Autowired
private StorageSettings myStorageSettings; private SubscriptionSettings mySubscriptionSettings;
@Autowired @Autowired
private IResourceModifiedMessagePersistenceSvc myResourceModifiedMessagePersistenceSvc; private IResourceModifiedMessagePersistenceSvc myResourceModifiedMessagePersistenceSvc;
@ -126,7 +126,9 @@ public class SubscriptionActivatingSubscriber implements MessageHandler {
// Only activate supported subscriptions // Only activate supported subscriptions
if (subscriptionChannelType == null if (subscriptionChannelType == null
|| !myStorageSettings.getSupportedSubscriptionTypes().contains(subscriptionChannelType.toCanonical())) { || !mySubscriptionSettings
.getSupportedSubscriptionTypes()
.contains(subscriptionChannelType.toCanonical())) {
return false; return false;
} }
@ -177,6 +179,6 @@ public class SubscriptionActivatingSubscriber implements MessageHandler {
public boolean isChannelTypeSupported(IBaseResource theSubscription) { public boolean isChannelTypeSupported(IBaseResource theSubscription) {
Subscription.SubscriptionChannelType channelType = Subscription.SubscriptionChannelType channelType =
mySubscriptionCanonicalizer.getChannelType(theSubscription).toCanonical(); 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; package ca.uhn.fhir.jpa.subscription.model.config;
import ca.uhn.fhir.context.FhirContext; 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.matcher.matching.SubscriptionStrategyEvaluator;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -31,8 +31,8 @@ public class SubscriptionModelConfig {
@Bean @Bean
public SubscriptionCanonicalizer subscriptionCanonicalizer( public SubscriptionCanonicalizer subscriptionCanonicalizer(
FhirContext theFhirContext, StorageSettings theStorageSettings) { FhirContext theFhirContext, SubscriptionSettings theSubscriptionSettings) {
return new SubscriptionCanonicalizer(theFhirContext, theStorageSettings); return new SubscriptionCanonicalizer(theFhirContext, theSubscriptionSettings);
} }
@Bean @Bean

View File

@ -19,20 +19,25 @@
*/ */
package ca.uhn.fhir.jpa.subscription.submit.config; 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.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.AsyncResourceModifiedProcessingSchedulerSvc;
import ca.uhn.fhir.jpa.subscription.async.AsyncResourceModifiedSubmitterSvc; import ca.uhn.fhir.jpa.subscription.async.AsyncResourceModifiedSubmitterSvc;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory;
import ca.uhn.fhir.jpa.subscription.config.SubscriptionConfig; import ca.uhn.fhir.jpa.subscription.config.SubscriptionConfig;
import ca.uhn.fhir.jpa.subscription.model.config.SubscriptionModelConfig; 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.SubscriptionSubmitInterceptorLoader;
import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionValidatingInterceptor; import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionValidatingInterceptor;
import ca.uhn.fhir.jpa.subscription.submit.svc.ResourceModifiedSubmitterSvc; import ca.uhn.fhir.jpa.subscription.submit.svc.ResourceModifiedSubmitterSvc;
import ca.uhn.fhir.jpa.subscription.triggering.ISubscriptionTriggeringSvc; import ca.uhn.fhir.jpa.subscription.triggering.ISubscriptionTriggeringSvc;
import ca.uhn.fhir.jpa.subscription.triggering.SubscriptionTriggeringSvcImpl; 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.IResourceModifiedConsumerWithRetries;
import ca.uhn.fhir.subscription.api.IResourceModifiedMessagePersistenceSvc; 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.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
@ -52,8 +57,18 @@ public class SubscriptionSubmitterConfig {
} }
@Bean @Bean
public SubscriptionSubmitInterceptorLoader subscriptionMatcherInterceptorLoader() { public SubscriptionSubmitInterceptorLoader subscriptionMatcherInterceptorLoader(
return new SubscriptionSubmitInterceptorLoader(); @Nonnull IInterceptorService theInterceptorService,
@Nonnull SubscriptionSettings theSubscriptionSettings,
@Nonnull SubscriptionMatcherInterceptor theSubscriptionMatcherInterceptor,
@Nonnull SubscriptionValidatingInterceptor theSubscriptionValidatingInterceptor,
@Nullable SubscriptionTopicValidatingInterceptor theSubscriptionTopicValidatingInterceptor) {
return new SubscriptionSubmitInterceptorLoader(
theInterceptorService,
theSubscriptionSettings,
theSubscriptionMatcherInterceptor,
theSubscriptionValidatingInterceptor,
theSubscriptionTopicValidatingInterceptor);
} }
@Bean @Bean
@ -67,10 +82,10 @@ public class SubscriptionSubmitterConfig {
IHapiTransactionService theHapiTransactionService, IHapiTransactionService theHapiTransactionService,
IResourceModifiedMessagePersistenceSvc theResourceModifiedMessagePersistenceSvc, IResourceModifiedMessagePersistenceSvc theResourceModifiedMessagePersistenceSvc,
SubscriptionChannelFactory theSubscriptionChannelFactory, SubscriptionChannelFactory theSubscriptionChannelFactory,
StorageSettings theStorageSettings) { SubscriptionSettings theSubscriptionSettings) {
return new ResourceModifiedSubmitterSvc( return new ResourceModifiedSubmitterSvc(
theStorageSettings, theSubscriptionSettings,
theSubscriptionChannelFactory, theSubscriptionChannelFactory,
theResourceModifiedMessagePersistenceSvc, theResourceModifiedMessagePersistenceSvc,
theHapiTransactionService); 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.Interceptor;
import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.interceptor.model.RequestPartitionId; 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.partition.IRequestPartitionHelperSvc;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage; import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage;
import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.RequestDetails;
@ -57,7 +57,7 @@ public class SubscriptionMatcherInterceptor {
private IInterceptorBroadcaster myInterceptorBroadcaster; private IInterceptorBroadcaster myInterceptorBroadcaster;
@Autowired @Autowired
private StorageSettings myStorageSettings; private SubscriptionSettings mySubscriptionSettings;
@Autowired @Autowired
private IRequestPartitionHelperSvc myRequestPartitionHelperSvc; private IRequestPartitionHelperSvc myRequestPartitionHelperSvc;
@ -87,7 +87,7 @@ public class SubscriptionMatcherInterceptor {
@Hook(Pointcut.STORAGE_PRECOMMIT_RESOURCE_UPDATED) @Hook(Pointcut.STORAGE_PRECOMMIT_RESOURCE_UPDATED)
public void resourceUpdated(IBaseResource theOldResource, IBaseResource theNewResource, RequestDetails theRequest) { public void resourceUpdated(IBaseResource theOldResource, IBaseResource theNewResource, RequestDetails theRequest) {
boolean dontTriggerSubscriptionWhenVersionsAreTheSame = boolean dontTriggerSubscriptionWhenVersionsAreTheSame =
!myStorageSettings.isTriggerSubscriptionsForNonVersioningChanges(); !mySubscriptionSettings.isTriggerSubscriptionsForNonVersioningChanges();
boolean resourceVersionsAreTheSame = isSameResourceVersion(theOldResource, theNewResource); boolean resourceVersionsAreTheSame = isSameResourceVersion(theOldResource, theNewResource);
if (dontTriggerSubscriptionWhenVersionsAreTheSame && resourceVersionsAreTheSame) { if (dontTriggerSubscriptionWhenVersionsAreTheSame && resourceVersionsAreTheSame) {

View File

@ -20,43 +20,57 @@
package ca.uhn.fhir.jpa.subscription.submit.interceptor; package ca.uhn.fhir.jpa.subscription.submit.interceptor;
import ca.uhn.fhir.interceptor.api.IInterceptorService; 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 ca.uhn.fhir.jpa.topic.SubscriptionTopicValidatingInterceptor;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import jakarta.annotation.PostConstruct; import jakarta.annotation.PostConstruct;
import org.hl7.fhir.dstu2.model.Subscription; import org.hl7.fhir.dstu2.model.Subscription;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Set; import java.util.Set;
public class SubscriptionSubmitInterceptorLoader { public class SubscriptionSubmitInterceptorLoader {
private static final Logger ourLog = LoggerFactory.getLogger(SubscriptionSubmitInterceptorLoader.class); private static final Logger ourLog = LoggerFactory.getLogger(SubscriptionSubmitInterceptorLoader.class);
@Autowired @Nonnull
private SubscriptionMatcherInterceptor mySubscriptionMatcherInterceptor; private IInterceptorService myInterceptorService;
@Autowired @Nonnull
private SubscriptionValidatingInterceptor mySubscriptionValidatingInterceptor; private final SubscriptionSettings mySubscriptionSettings;
@Autowired(required = false) @Nonnull
private SubscriptionTopicValidatingInterceptor mySubscriptionTopicValidatingInterceptor; private final SubscriptionMatcherInterceptor mySubscriptionMatcherInterceptor;
@Autowired @Nonnull
private StorageSettings myStorageSettings; private final SubscriptionValidatingInterceptor mySubscriptionValidatingInterceptor;
@Autowired @Nullable
private IInterceptorService myInterceptorRegistry; private final SubscriptionTopicValidatingInterceptor mySubscriptionTopicValidatingInterceptor;
private boolean mySubscriptionValidatingInterceptorRegistered; private boolean mySubscriptionValidatingInterceptorRegistered;
private boolean mySubscriptionMatcherInterceptorRegistered; private boolean mySubscriptionMatcherInterceptorRegistered;
private boolean mySubscriptionTopicValidatingInterceptorRegistered; 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 @PostConstruct
public void start() { public void start() {
Set<Subscription.SubscriptionChannelType> supportedSubscriptionTypes = Set<Subscription.SubscriptionChannelType> supportedSubscriptionTypes =
myStorageSettings.getSupportedSubscriptionTypes(); mySubscriptionSettings.getSupportedSubscriptionTypes();
if (supportedSubscriptionTypes.isEmpty()) { if (supportedSubscriptionTypes.isEmpty()) {
ourLog.info( ourLog.info(
@ -64,26 +78,34 @@ public class SubscriptionSubmitInterceptorLoader {
} else { } else {
if (!mySubscriptionMatcherInterceptorRegistered) { if (!mySubscriptionMatcherInterceptorRegistered) {
ourLog.info("Registering subscription matcher interceptor"); ourLog.info("Registering subscription matcher interceptor");
myInterceptorRegistry.registerInterceptor(mySubscriptionMatcherInterceptor); myInterceptorService.registerInterceptor(mySubscriptionMatcherInterceptor);
mySubscriptionMatcherInterceptorRegistered = true; mySubscriptionMatcherInterceptorRegistered = true;
} }
} }
if (!mySubscriptionValidatingInterceptorRegistered) { if (!mySubscriptionValidatingInterceptorRegistered) {
myInterceptorRegistry.registerInterceptor(mySubscriptionValidatingInterceptor); myInterceptorService.registerInterceptor(mySubscriptionValidatingInterceptor);
mySubscriptionValidatingInterceptorRegistered = true; mySubscriptionValidatingInterceptorRegistered = true;
} }
if (mySubscriptionTopicValidatingInterceptor != null && !mySubscriptionTopicValidatingInterceptorRegistered) { if (mySubscriptionTopicValidatingInterceptor != null && !mySubscriptionTopicValidatingInterceptorRegistered) {
myInterceptorRegistry.registerInterceptor(mySubscriptionTopicValidatingInterceptor); myInterceptorService.registerInterceptor(mySubscriptionTopicValidatingInterceptor);
mySubscriptionTopicValidatingInterceptorRegistered = true; mySubscriptionTopicValidatingInterceptorRegistered = true;
} }
} }
protected void setInterceptorService(IInterceptorService theInterceptorService) {
myInterceptorService = theInterceptorService;
}
protected IInterceptorService getInterceptorService() {
return myInterceptorService;
}
@VisibleForTesting @VisibleForTesting
public void unregisterInterceptorsForUnitTest() { public void unregisterInterceptorsForUnitTest() {
myInterceptorRegistry.unregisterInterceptor(mySubscriptionMatcherInterceptor); myInterceptorService.unregisterInterceptor(mySubscriptionMatcherInterceptor);
myInterceptorRegistry.unregisterInterceptor(mySubscriptionValidatingInterceptor); myInterceptorService.unregisterInterceptor(mySubscriptionValidatingInterceptor);
mySubscriptionValidatingInterceptorRegistered = false; mySubscriptionValidatingInterceptorRegistered = false;
mySubscriptionMatcherInterceptorRegistered = 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.Interceptor;
import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.interceptor.model.RequestPartitionId; 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.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; 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.partition.IRequestPartitionHelperSvc;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy; import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy;
@ -72,7 +71,7 @@ public class SubscriptionValidatingInterceptor {
private DaoRegistry myDaoRegistry; private DaoRegistry myDaoRegistry;
@Autowired @Autowired
private StorageSettings myStorageSettings; private SubscriptionSettings mySubscriptionSettings;
@Autowired @Autowired
private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator; private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator;
@ -169,7 +168,7 @@ public class SubscriptionValidatingInterceptor {
try { try {
SubscriptionMatchingStrategy strategy = mySubscriptionStrategyEvaluator.determineStrategy(subscription); SubscriptionMatchingStrategy strategy = mySubscriptionStrategyEvaluator.determineStrategy(subscription);
if (!(SubscriptionMatchingStrategy.IN_MEMORY == strategy) if (!(SubscriptionMatchingStrategy.IN_MEMORY == strategy)
&& myStorageSettings.isOnlyAllowInMemorySubscriptions()) { && mySubscriptionSettings.isOnlyAllowInMemorySubscriptions()) {
throw new InvalidRequestException( throw new InvalidRequestException(
Msg.code(2367) Msg.code(2367)
+ "This server is configured to only allow in-memory subscriptions. This subscription's criteria cannot be evaluated in-memory."); + "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 the subscription has the cross partition tag
if (SubscriptionUtil.isCrossPartition(theSubscription) if (SubscriptionUtil.isCrossPartition(theSubscription)
&& !(theRequestDetails instanceof SystemRequestDetails)) { && !(theRequestDetails instanceof SystemRequestDetails)) {
if (!myStorageSettings.isCrossPartitionSubscriptionEnabled()) { if (!mySubscriptionSettings.isCrossPartitionSubscriptionEnabled()) {
throw new UnprocessableEntityException( throw new UnprocessableEntityException(
Msg.code(2009) + "Cross partition subscription is not enabled on this server"); Msg.code(2009) + "Cross partition subscription is not enabled on this server");
} }
@ -356,8 +355,8 @@ public class SubscriptionValidatingInterceptor {
} }
@VisibleForTesting @VisibleForTesting
public void setStorageSettingsForUnitTest(JpaStorageSettings theStorageSettings) { public void setSubscriptionSettingsForUnitTest(SubscriptionSettings theSubscriptionSettings) {
myStorageSettings = theStorageSettings; mySubscriptionSettings = theSubscriptionSettings;
} }
@VisibleForTesting @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.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.IPersistedResourceModifiedMessage;
import ca.uhn.fhir.jpa.model.entity.IPersistedResourceModifiedMessagePK; 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.ChannelProducerSettings;
import ca.uhn.fhir.jpa.subscription.channel.api.IChannelProducer; import ca.uhn.fhir.jpa.subscription.channel.api.IChannelProducer;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory; 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 static final Logger ourLog = LoggerFactory.getLogger(ResourceModifiedSubmitterSvc.class);
private volatile MessageChannel myMatchingChannel; private volatile MessageChannel myMatchingChannel;
private final StorageSettings myStorageSettings; private final SubscriptionSettings mySubscriptionSettings;
private final SubscriptionChannelFactory mySubscriptionChannelFactory; private final SubscriptionChannelFactory mySubscriptionChannelFactory;
private final IResourceModifiedMessagePersistenceSvc myResourceModifiedMessagePersistenceSvc; private final IResourceModifiedMessagePersistenceSvc myResourceModifiedMessagePersistenceSvc;
private final IHapiTransactionService myHapiTransactionService; private final IHapiTransactionService myHapiTransactionService;
@EventListener(classes = {ContextRefreshedEvent.class}) @EventListener(classes = {ContextRefreshedEvent.class})
public void startIfNeeded() { public void startIfNeeded() {
if (!myStorageSettings.hasSupportedSubscriptionTypes()) { if (!mySubscriptionSettings.hasSupportedSubscriptionTypes()) {
ourLog.debug( ourLog.debug(
"Subscriptions are disabled on this server. Skipping {} channel creation.", "Subscriptions are disabled on this server. Skipping {} channel creation.",
SUBSCRIPTION_MATCHING_CHANNEL_NAME); SUBSCRIPTION_MATCHING_CHANNEL_NAME);
@ -82,11 +82,11 @@ public class ResourceModifiedSubmitterSvc implements IResourceModifiedConsumer,
} }
public ResourceModifiedSubmitterSvc( public ResourceModifiedSubmitterSvc(
StorageSettings theStorageSettings, SubscriptionSettings theSubscriptionSettings,
SubscriptionChannelFactory theSubscriptionChannelFactory, SubscriptionChannelFactory theSubscriptionChannelFactory,
IResourceModifiedMessagePersistenceSvc resourceModifiedMessagePersistenceSvc, IResourceModifiedMessagePersistenceSvc resourceModifiedMessagePersistenceSvc,
IHapiTransactionService theHapiTransactionService) { IHapiTransactionService theHapiTransactionService) {
myStorageSettings = theStorageSettings; mySubscriptionSettings = theSubscriptionSettings;
mySubscriptionChannelFactory = theSubscriptionChannelFactory; mySubscriptionChannelFactory = theSubscriptionChannelFactory;
myResourceModifiedMessagePersistenceSvc = resourceModifiedMessagePersistenceSvc; myResourceModifiedMessagePersistenceSvc = resourceModifiedMessagePersistenceSvc;
myHapiTransactionService = theHapiTransactionService; myHapiTransactionService = theHapiTransactionService;
@ -210,7 +210,8 @@ public class ResourceModifiedSubmitterSvc implements IResourceModifiedConsumer,
private ChannelProducerSettings getChannelProducerSettings() { private ChannelProducerSettings getChannelProducerSettings() {
ChannelProducerSettings channelProducerSettings = new ChannelProducerSettings(); ChannelProducerSettings channelProducerSettings = new ChannelProducerSettings();
channelProducerSettings.setQualifyChannelName(myStorageSettings.isQualifySubscriptionMatchingChannelName()); channelProducerSettings.setQualifyChannelName(
mySubscriptionSettings.isQualifySubscriptionMatchingChannelName());
return channelProducerSettings; return channelProducerSettings;
} }

View File

@ -23,7 +23,6 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.model.RequestPartitionId; 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.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; 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.ISearchBuilder;
import ca.uhn.fhir.jpa.dao.SearchBuilderFactory; import ca.uhn.fhir.jpa.dao.SearchBuilderFactory;
import ca.uhn.fhir.jpa.dao.tx.HapiTransactionService; 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.HapiJob;
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs; import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
import ca.uhn.fhir.jpa.model.sched.ISchedulerService; import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
@ -105,7 +105,7 @@ public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc
private DaoRegistry myDaoRegistry; private DaoRegistry myDaoRegistry;
@Autowired @Autowired
private JpaStorageSettings myStorageSettings; private SubscriptionSettings mySubscriptionSettings;
@Autowired @Autowired
private ISearchCoordinatorSvc<? extends IResourcePersistentId<?>> mySearchCoordinatorSvc; private ISearchCoordinatorSvc<? extends IResourcePersistentId<?>> mySearchCoordinatorSvc;
@ -141,7 +141,7 @@ public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc
@Nullable IIdType theSubscriptionId, @Nullable IIdType theSubscriptionId,
RequestDetails theRequestDetails) { RequestDetails theRequestDetails) {
if (myStorageSettings.getSupportedSubscriptionTypes().isEmpty()) { if (mySubscriptionSettings.getSupportedSubscriptionTypes().isEmpty()) {
throw new PreconditionFailedException(Msg.code(22) + "Subscription processing not active on this server"); 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.channel.subscription.SubscriptionChannelFactory;
import ca.uhn.fhir.jpa.subscription.match.config.SubscriptionProcessorConfig; 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.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.config.SubscriptionSubmitterConfig;
import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionQueryValidator; import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionQueryValidator;
import ca.uhn.fhir.subscription.api.IResourceModifiedMessagePersistenceSvc; import ca.uhn.fhir.subscription.api.IResourceModifiedMessagePersistenceSvc;
@ -40,6 +41,7 @@ public class DaoSubscriptionMatcherTest {
@Autowired(required = false) @Autowired(required = false)
private PlatformTransactionManager myTxManager; private PlatformTransactionManager myTxManager;
@MockBean @MockBean
private JpaStorageSettings myStorageSettings; private JpaStorageSettings myStorageSettings;
@MockBean @MockBean
@ -96,6 +98,11 @@ public class DaoSubscriptionMatcherTest {
public IResourceModifiedMessagePersistenceSvc resourceModifiedMessagePersistenceSvc() { public IResourceModifiedMessagePersistenceSvc resourceModifiedMessagePersistenceSvc() {
return mock(IResourceModifiedMessagePersistenceSvc.class); 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.SubscriptionCanonicalizer;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType; 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.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException; import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
import ca.uhn.fhir.subscription.SubscriptionConstants; import ca.uhn.fhir.subscription.SubscriptionConstants;
@ -59,7 +60,7 @@ public class SubscriptionActivatingSubscriberTest {
private SubscriptionCanonicalizer mySubscriptionCanonicallizer; private SubscriptionCanonicalizer mySubscriptionCanonicallizer;
@Mock @Mock
private JpaStorageSettings myStorageSettings; private SubscriptionSettings myStorageSettings;
@Mock @Mock
private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator; 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.match.registry.SubscriptionRegistry;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage; import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage; 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.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
@ -51,7 +52,7 @@ public class SubscriptionRegisteringSubscriberTest {
@Mock @Mock
private SubscriptionRegistry mySubscriptionRegistry; private SubscriptionRegistry mySubscriptionRegistry;
@Spy @Spy
private SubscriptionCanonicalizer mySubscriptionCanonicalizer = new SubscriptionCanonicalizer(myFhirContext, new StorageSettings()); private SubscriptionCanonicalizer mySubscriptionCanonicalizer = new SubscriptionCanonicalizer(myFhirContext, new SubscriptionSettings());
@Mock @Mock
private DaoRegistry myDaoRegistry; private DaoRegistry myDaoRegistry;
@Mock @Mock

View File

@ -1,10 +1,10 @@
package ca.uhn.fhir.jpa.subscription.match.registry; package ca.uhn.fhir.jpa.subscription.match.registry;
import ca.uhn.fhir.context.FhirContext; 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.CanonicalSubscription;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType; import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType;
import ca.uhn.fhir.jpa.subscription.model.CanonicalTopicSubscriptionFilter; 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.ExtensionDt;
import ca.uhn.fhir.model.api.IFhirVersion; import ca.uhn.fhir.model.api.IFhirVersion;
import ca.uhn.fhir.model.dstu2.FhirDstu2; import ca.uhn.fhir.model.dstu2.FhirDstu2;
@ -43,7 +43,7 @@ class SubscriptionCanonicalizerTest {
FhirContext r4Context = FhirContext.forR4(); FhirContext r4Context = FhirContext.forR4();
private final SubscriptionCanonicalizer testedSC = new SubscriptionCanonicalizer(r4Context, new StorageSettings()); private final SubscriptionCanonicalizer testedSC = new SubscriptionCanonicalizer(r4Context, new SubscriptionSettings());
@Test @Test
void testCanonicalizeR4SendDeleteMessagesSetsExtensionValueNotPresent() { void testCanonicalizeR4SendDeleteMessagesSetsExtensionValueNotPresent() {
@ -84,7 +84,7 @@ class SubscriptionCanonicalizerTest {
@Test @Test
public void testCanonicalizeDstu2SendDeleteMessages() { public void testCanonicalizeDstu2SendDeleteMessages() {
//setup //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(); ca.uhn.fhir.model.dstu2.resource.Subscription dstu2Sub = new ca.uhn.fhir.model.dstu2.resource.Subscription();
ExtensionDt extensionDt = new ExtensionDt(); ExtensionDt extensionDt = new ExtensionDt();
extensionDt.setUrl(EX_SEND_DELETE_MESSAGES); extensionDt.setUrl(EX_SEND_DELETE_MESSAGES);
@ -120,7 +120,7 @@ class SubscriptionCanonicalizerTest {
@ValueSource(strings = {"full-resource", "id-only", "empty"}) @ValueSource(strings = {"full-resource", "id-only", "empty"})
public void testR5Canonicalize_returnsCorrectCanonicalSubscription(String thePayloadContent) { public void testR5Canonicalize_returnsCorrectCanonicalSubscription(String thePayloadContent) {
// setup // 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 payloadContent =
org.hl7.fhir.r5.model.Subscription.SubscriptionPayloadContent.fromCode(thePayloadContent); org.hl7.fhir.r5.model.Subscription.SubscriptionPayloadContent.fromCode(thePayloadContent);
org.hl7.fhir.r5.model.Subscription subscription = buildR5Subscription(payloadContent); 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 // Example drawn from http://build.fhir.org/ig/HL7/fhir-subscription-backport-ig/Subscription-subscription-zulip.json.html
// setup // 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); org.hl7.fhir.r4b.model.Subscription subscription = buildR4BSubscription(thePayloadContent);
// execute // execute
@ -204,9 +204,9 @@ class SubscriptionCanonicalizerTest {
subscription = new org.hl7.fhir.r5.model.Subscription(); subscription = new org.hl7.fhir.r5.model.Subscription();
} }
final StorageSettings storageSettings = new StorageSettings(); final SubscriptionSettings subscriptionSettings = new SubscriptionSettings();
storageSettings.setCrossPartitionSubscriptionEnabled(theCrossPartitionSubscriptionEnabled); subscriptionSettings.setCrossPartitionSubscriptionEnabled(theCrossPartitionSubscriptionEnabled);
final SubscriptionCanonicalizer subscriptionCanonicalizer = new SubscriptionCanonicalizer(theFhirContext, storageSettings); final SubscriptionCanonicalizer subscriptionCanonicalizer = new SubscriptionCanonicalizer(theFhirContext, subscriptionSettings);
final CanonicalSubscription canonicalSubscription = subscriptionCanonicalizer.canonicalize(subscription); final CanonicalSubscription canonicalSubscription = subscriptionCanonicalizer.canonicalize(subscription);
assertEquals(theCrossPartitionSubscriptionEnabled, canonicalSubscription.getCrossPartitionEnabled()); 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 // Example drawn from http://build.fhir.org/ig/HL7/fhir-subscription-backport-ig/Subscription-subscription-zulip.json.html
// setup // setup
SubscriptionCanonicalizer r4Canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4Cached(), new StorageSettings()); SubscriptionCanonicalizer r4Canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4Cached(), new SubscriptionSettings());
// execute // execute
Subscription subscription = SubscriptionTestDataHelper.buildR4TopicSubscriptionWithContent(thePayloadContent); 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.ISubscriptionDeliveryChannelNamer;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelRegistry; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelRegistry;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription; 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.subscription.SubscriptionTestDataHelper;
import ca.uhn.fhir.util.HapiExtensions; import ca.uhn.fhir.util.HapiExtensions;
import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.Extension;
@ -34,7 +35,7 @@ public class SubscriptionRegistryTest {
static FhirContext ourFhirContext = FhirContext.forR4Cached(); static FhirContext ourFhirContext = FhirContext.forR4Cached();
@Spy @Spy
SubscriptionCanonicalizer mySubscriptionCanonicalizer = new SubscriptionCanonicalizer(ourFhirContext, new StorageSettings()); SubscriptionCanonicalizer mySubscriptionCanonicalizer = new SubscriptionCanonicalizer(ourFhirContext, new SubscriptionSettings());
@Spy @Spy
ISubscriptionDeliveryChannelNamer mySubscriptionDeliveryChannelNamer = new TestChannelNamer(); 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.config.SubscriptionProcessorConfig;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender; import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender;
import ca.uhn.fhir.jpa.subscription.module.config.MockFhirClientSearchParamProvider; 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.jpa.subscription.util.SubscriptionDebugLogInterceptor;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.system.HapiSystemProperties; import ca.uhn.fhir.system.HapiSystemProperties;
@ -77,6 +78,11 @@ public abstract class BaseSubscriptionTest {
return new JpaStorageSettings(); return new JpaStorageSettings();
} }
@Bean
public SubscriptionSettings subscriptionSettings() {
return new SubscriptionSettings();
}
@Bean @Bean
public IChannelFactory channelFactory(IChannelNamer theNamer) { public IChannelFactory channelFactory(IChannelNamer theNamer) {
return new LinkedBlockingChannelFactory(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.CanonicalSubscription;
import ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryJsonMessage; import ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryJsonMessage;
import ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage; import ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.util.HapiExtensions; import ca.uhn.fhir.util.HapiExtensions;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; 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.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
public class CanonicalSubscriptionTest { public class CanonicalSubscriptionTest {
@ -70,7 +72,7 @@ public class CanonicalSubscriptionTest {
@Test @Test
public void testCanonicalSubscriptionRetainsMetaTags() throws IOException { 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()); CanonicalSubscription sub1 = canonicalizer.canonicalize(makeMdmSubscription());
assertThat(sub1.getTags()).containsKey(TAG_SYSTEM); assertThat(sub1.getTags()).containsKey(TAG_SYSTEM);
assertEquals(sub1.getTags().get(TAG_SYSTEM), TAG_VALUE); assertEquals(sub1.getTags().get(TAG_SYSTEM), TAG_VALUE);
@ -78,7 +80,7 @@ public class CanonicalSubscriptionTest {
@Test @Test
public void emailDetailsEquals() { 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 sub1 = canonicalizer.canonicalize(makeEmailSubscription());
CanonicalSubscription sub2 = canonicalizer.canonicalize(makeEmailSubscription()); CanonicalSubscription sub2 = canonicalizer.canonicalize(makeEmailSubscription());
assertTrue(sub1.equals(sub2)); assertTrue(sub1.equals(sub2));
@ -86,7 +88,7 @@ public class CanonicalSubscriptionTest {
@Test @Test
public void testSerializeMultiPartitionSubscription(){ public void testSerializeMultiPartitionSubscription(){
SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), new StorageSettings()); SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), new SubscriptionSettings());
Subscription subscription = makeEmailSubscription(); Subscription subscription = makeEmailSubscription();
subscription.addExtension(HapiExtensions.EXTENSION_SUBSCRIPTION_CROSS_PARTITION, new BooleanType().setValue(true)); subscription.addExtension(HapiExtensions.EXTENSION_SUBSCRIPTION_CROSS_PARTITION, new BooleanType().setValue(true));
CanonicalSubscription canonicalSubscription = canonicalizer.canonicalize(subscription); CanonicalSubscription canonicalSubscription = canonicalizer.canonicalize(subscription);
@ -97,8 +99,8 @@ public class CanonicalSubscriptionTest {
@ParameterizedTest @ParameterizedTest
@ValueSource(booleans = {true, false}) @ValueSource(booleans = {true, false})
public void testSerializeIncorrectMultiPartitionSubscription(boolean theIsCrossPartitionEnabled){ public void testSerializeIncorrectMultiPartitionSubscription(boolean theIsCrossPartitionEnabled){
final StorageSettings storageSettings = buildStorageSettings(theIsCrossPartitionEnabled); final SubscriptionSettings subscriptionSettings = buildSubscriptionSettings(theIsCrossPartitionEnabled);
SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), storageSettings); SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), subscriptionSettings);
Subscription subscription = makeEmailSubscription(); Subscription subscription = makeEmailSubscription();
subscription.addExtension(HapiExtensions.EXTENSION_SUBSCRIPTION_CROSS_PARTITION, new StringType().setValue("false")); subscription.addExtension(HapiExtensions.EXTENSION_SUBSCRIPTION_CROSS_PARTITION, new StringType().setValue("false"));
CanonicalSubscription canonicalSubscription = canonicalizer.canonicalize(subscription); CanonicalSubscription canonicalSubscription = canonicalizer.canonicalize(subscription);
@ -109,8 +111,8 @@ public class CanonicalSubscriptionTest {
@ParameterizedTest @ParameterizedTest
@ValueSource(booleans = {true, false}) @ValueSource(booleans = {true, false})
public void testSerializeNonMultiPartitionSubscription(boolean theIsCrossPartitionEnabled){ public void testSerializeNonMultiPartitionSubscription(boolean theIsCrossPartitionEnabled){
final StorageSettings storageSettings = buildStorageSettings(theIsCrossPartitionEnabled); final SubscriptionSettings subscriptionSettings = buildSubscriptionSettings(theIsCrossPartitionEnabled);
SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), storageSettings); SubscriptionCanonicalizer canonicalizer = new SubscriptionCanonicalizer(FhirContext.forR4(), subscriptionSettings);
Subscription subscription = makeEmailSubscription(); Subscription subscription = makeEmailSubscription();
subscription.addExtension(HapiExtensions.EXTENSION_SUBSCRIPTION_CROSS_PARTITION, new BooleanType().setValue(false)); subscription.addExtension(HapiExtensions.EXTENSION_SUBSCRIPTION_CROSS_PARTITION, new BooleanType().setValue(false));
CanonicalSubscription canonicalSubscription = canonicalizer.canonicalize(subscription); CanonicalSubscription canonicalSubscription = canonicalizer.canonicalize(subscription);
@ -128,7 +130,7 @@ public class CanonicalSubscriptionTest {
CanonicalSubscription payload = resourceDeliveryMessage.getPayload().getSubscription(); CanonicalSubscription payload = resourceDeliveryMessage.getPayload().getSubscription();
assertEquals(payload.getCrossPartitionEnabled(), false); assertFalse(payload.getCrossPartitionEnabled());
} }
private Subscription makeEmailSubscription() { private Subscription makeEmailSubscription() {
@ -162,9 +164,9 @@ public class CanonicalSubscriptionTest {
} }
@Nonnull @Nonnull
private static StorageSettings buildStorageSettings(boolean theIsCrossPartitionEnabled) { private static SubscriptionSettings buildSubscriptionSettings(boolean theIsCrossPartitionEnabled) {
final StorageSettings storageSettings = new StorageSettings(); final SubscriptionSettings subscriptionSettings = new SubscriptionSettings();
storageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled); subscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
return storageSettings; 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.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.model.config.PartitionSettings; 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.api.ChannelConsumerSettings;
import ca.uhn.fhir.jpa.subscription.channel.subscription.ISubscriptionDeliveryChannelNamer; import ca.uhn.fhir.jpa.subscription.channel.subscription.ISubscriptionDeliveryChannelNamer;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory; 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.model.ResourceModifiedMessage;
import ca.uhn.fhir.jpa.subscription.module.BaseSubscriptionDstu3Test; import ca.uhn.fhir.jpa.subscription.module.BaseSubscriptionDstu3Test;
import ca.uhn.fhir.jpa.subscription.module.subscriber.SubscriptionMatchingSubscriberTest; 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.model.primitive.IdDt;
import ca.uhn.fhir.rest.annotation.Create; import ca.uhn.fhir.rest.annotation.Create;
import ca.uhn.fhir.rest.annotation.ResourceParam; import ca.uhn.fhir.rest.annotation.ResourceParam;
@ -86,7 +86,7 @@ public abstract class BaseBlockingQueueSubscribableChannelDstu3Test extends Base
@Autowired @Autowired
protected PartitionSettings myPartitionSettings; protected PartitionSettings myPartitionSettings;
@Autowired @Autowired
protected StorageSettings myStorageSettings; protected SubscriptionSettings mySubscriptionSettings;
protected String myCode = "1000000050"; protected String myCode = "1000000050";
@Autowired @Autowired
FhirContext myFhirContext; 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.CanonicalSubscription;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage; import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage;
import ca.uhn.fhir.jpa.subscription.module.standalone.BaseBlockingQueueSubscribableChannelDstu3Test; 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.model.primitive.IdDt;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.server.messaging.BaseResourceModifiedMessage; import ca.uhn.fhir.rest.server.messaging.BaseResourceModifiedMessage;
@ -63,7 +64,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@AfterEach @AfterEach
public void afterEach() { public void afterEach() {
myStorageSettings.setCrossPartitionSubscriptionEnabled(new JpaStorageSettings().isCrossPartitionSubscriptionEnabled()); mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(new SubscriptionSettings().isCrossPartitionSubscriptionEnabled());
} }
@Test @Test
@ -234,7 +235,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@ParameterizedTest @ParameterizedTest
@ValueSource(booleans = {true, false}) @ValueSource(booleans = {true, false})
public void testSubscriptionAndResourceOnDiffPartitionNotMatch(boolean theIsCrossPartitionEnabled) throws InterruptedException { public void testSubscriptionAndResourceOnDiffPartitionNotMatch(boolean theIsCrossPartitionEnabled) throws InterruptedException {
myStorageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled); mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
myPartitionSettings.setPartitioningEnabled(true); myPartitionSettings.setPartitioningEnabled(true);
String payload = "application/fhir+json"; String payload = "application/fhir+json";
@ -257,7 +258,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@ParameterizedTest @ParameterizedTest
@ValueSource(booleans = {true, false}) @ValueSource(booleans = {true, false})
public void testSubscriptionAndResourceOnDiffPartitionNotMatchPart2(boolean theIsCrossPartitionEnabled) throws InterruptedException { public void testSubscriptionAndResourceOnDiffPartitionNotMatchPart2(boolean theIsCrossPartitionEnabled) throws InterruptedException {
myStorageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled); mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
myPartitionSettings.setPartitioningEnabled(true); myPartitionSettings.setPartitioningEnabled(true);
String payload = "application/fhir+json"; String payload = "application/fhir+json";
@ -281,7 +282,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@ParameterizedTest @ParameterizedTest
@ValueSource(booleans = {true, false}) @ValueSource(booleans = {true, false})
public void testSubscriptionOnDefaultPartitionAndResourceOnDiffPartitionNotMatch(boolean theIsCrossPartitionEnabled) throws InterruptedException { public void testSubscriptionOnDefaultPartitionAndResourceOnDiffPartitionNotMatch(boolean theIsCrossPartitionEnabled) throws InterruptedException {
myStorageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled); mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
myPartitionSettings.setPartitioningEnabled(true); myPartitionSettings.setPartitioningEnabled(true);
String payload = "application/fhir+json"; String payload = "application/fhir+json";
@ -305,7 +306,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@ParameterizedTest @ParameterizedTest
@ValueSource(booleans = {true, false}) @ValueSource(booleans = {true, false})
public void testSubscriptionOnAPartitionAndResourceOnDefaultPartitionNotMatch(boolean theIsCrossPartitionEnabled) throws InterruptedException { public void testSubscriptionOnAPartitionAndResourceOnDefaultPartitionNotMatch(boolean theIsCrossPartitionEnabled) throws InterruptedException {
myStorageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled); mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
myPartitionSettings.setPartitioningEnabled(true); myPartitionSettings.setPartitioningEnabled(true);
String payload = "application/fhir+json"; String payload = "application/fhir+json";
@ -350,7 +351,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@ParameterizedTest @ParameterizedTest
@ValueSource(booleans = {true, false}) @ValueSource(booleans = {true, false})
public void testSubscriptionOnOnePartitionDoNotMatchResourceOnMultiplePartitions(boolean theIsCrossPartitionEnabled) throws InterruptedException { public void testSubscriptionOnOnePartitionDoNotMatchResourceOnMultiplePartitions(boolean theIsCrossPartitionEnabled) throws InterruptedException {
myStorageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled); mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
myPartitionSettings.setPartitioningEnabled(true); myPartitionSettings.setPartitioningEnabled(true);
String payload = "application/fhir+json"; String payload = "application/fhir+json";
@ -374,7 +375,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@Test @Test
public void testCrossPartitionSubscriptionForResourceOnTheSamePartitionMatch() throws InterruptedException { public void testCrossPartitionSubscriptionForResourceOnTheSamePartitionMatch() throws InterruptedException {
myPartitionSettings.setPartitioningEnabled(true); myPartitionSettings.setPartitioningEnabled(true);
myStorageSettings.setCrossPartitionSubscriptionEnabled(true); mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(true);
String payload = "application/fhir+json"; String payload = "application/fhir+json";
String code = "1000000050"; String code = "1000000050";
@ -396,7 +397,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@Test @Test
public void testCrossPartitionSubscriptionForResourceOnDifferentPartitionMatch() throws InterruptedException { public void testCrossPartitionSubscriptionForResourceOnDifferentPartitionMatch() throws InterruptedException {
myPartitionSettings.setPartitioningEnabled(true); myPartitionSettings.setPartitioningEnabled(true);
myStorageSettings.setCrossPartitionSubscriptionEnabled(true); mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(true);
String payload = "application/fhir+json"; String payload = "application/fhir+json";
String code = "1000000050"; String code = "1000000050";
@ -419,7 +420,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri
@Test @Test
public void testCrossPartitionSubscriptionForMultipleResourceOnDifferentPartitionMatch() throws InterruptedException { public void testCrossPartitionSubscriptionForMultipleResourceOnDifferentPartitionMatch() throws InterruptedException {
myPartitionSettings.setPartitioningEnabled(true); myPartitionSettings.setPartitioningEnabled(true);
myStorageSettings.setCrossPartitionSubscriptionEnabled(true); mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(true);
String payload = "application/fhir+json"; String payload = "application/fhir+json";
String code = "1000000050"; 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.match.registry.SubscriptionRegistry;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription; import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType; 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.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.subscription.api.IResourceModifiedMessagePersistenceSvc; import ca.uhn.fhir.subscription.api.IResourceModifiedMessagePersistenceSvc;
import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.IdType;
@ -66,6 +67,8 @@ public class WebsocketConnectionValidatorTest {
SubscriptionRegistry mySubscriptionRegistry; SubscriptionRegistry mySubscriptionRegistry;
@MockBean @MockBean
ISearchParamRegistry mySearchParamRegistry; ISearchParamRegistry mySearchParamRegistry;
@MockBean
SubscriptionSettings mySubscriptionSettings;
@Autowired @Autowired
WebsocketConnectionValidator myWebsocketConnectionValidator; 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.FhirContext;
import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.interceptor.api.IInterceptorService; 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.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.cache.IResourceVersionSvc; import ca.uhn.fhir.jpa.cache.IResourceVersionSvc;
import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService; import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService;
import ca.uhn.fhir.jpa.model.config.PartitionSettings; 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.partition.IRequestPartitionHelperSvc;
import ca.uhn.fhir.jpa.searchparam.config.SearchParamConfig; import ca.uhn.fhir.jpa.searchparam.config.SearchParamConfig;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamProvider; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamProvider;
@ -37,10 +38,9 @@ import static org.mockito.Mockito.verify;
}) })
public class SubscriptionSubmitInterceptorLoaderTest { public class SubscriptionSubmitInterceptorLoaderTest {
@Autowired
private SubscriptionSubmitInterceptorLoader mySubscriptionSubmitInterceptorLoader;
@Autowired @Autowired
private SubscriptionMatcherInterceptor mySubscriptionMatcherInterceptor; private SubscriptionMatcherInterceptor mySubscriptionMatcherInterceptor;
@MockBean @MockBean
private IInterceptorService myInterceptorService; private IInterceptorService myInterceptorService;
@ -67,12 +67,14 @@ public class SubscriptionSubmitInterceptorLoaderTest {
} }
@Bean @Bean
public JpaStorageSettings storageSettings() { public SubscriptionSettings subscriptionSettings() {
JpaStorageSettings storageSettings = new JpaStorageSettings(); SubscriptionSettings subscriptionSettings = new SubscriptionSettings();
storageSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); subscriptionSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
return storageSettings; return subscriptionSettings;
} }
@MockBean
public StorageSettings myStorageSettings;
@MockBean @MockBean
private ISearchParamProvider mySearchParamProvider; private ISearchParamProvider mySearchParamProvider;
@MockBean @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.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionStrategyEvaluator; 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.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.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.SimpleBundleProvider; import ca.uhn.fhir.rest.server.SimpleBundleProvider;
@ -62,7 +63,7 @@ public class SubscriptionValidatingInterceptorTest {
@MockBean @MockBean
private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator; private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator;
@MockBean @MockBean
private JpaStorageSettings myStorageSettings; private SubscriptionSettings mySubscriptionSettings;
@MockBean @MockBean
private IRequestPartitionHelperSvc myRequestPartitionHelperSvc; private IRequestPartitionHelperSvc myRequestPartitionHelperSvc;
@Mock @Mock
@ -258,7 +259,7 @@ public class SubscriptionValidatingInterceptorTest {
private void setFhirContext(FhirVersionEnum fhirVersion) { private void setFhirContext(FhirVersionEnum fhirVersion) {
myFhirContext = FhirContext.forCached(fhirVersion); myFhirContext = FhirContext.forCached(fhirVersion);
mySubscriptionValidatingInterceptor.setFhirContext(myFhirContext); mySubscriptionValidatingInterceptor.setFhirContext(myFhirContext);
mySubscriptionValidatingInterceptor.setSubscriptionCanonicalizerForUnitTest(new SubscriptionCanonicalizer(myFhirContext, myStorageSettings)); mySubscriptionValidatingInterceptor.setSubscriptionCanonicalizerForUnitTest(new SubscriptionCanonicalizer(myFhirContext, mySubscriptionSettings));
} }
private static @Nonnull Stream<IBaseResource> subscriptionByFhirVersion(boolean theIncludeR5) { private static @Nonnull Stream<IBaseResource> subscriptionByFhirVersion(boolean theIncludeR5) {
@ -290,7 +291,7 @@ public class SubscriptionValidatingInterceptorTest {
@Bean @Bean
SubscriptionCanonicalizer subscriptionCanonicalizer(FhirContext theFhirContext) { SubscriptionCanonicalizer subscriptionCanonicalizer(FhirContext theFhirContext) {
return new SubscriptionCanonicalizer(theFhirContext, new StorageSettings()); return new SubscriptionCanonicalizer(theFhirContext, new SubscriptionSettings());
} }
@Bean @Bean

View File

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

View File

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

View File

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

View File

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

View File

@ -83,7 +83,7 @@ public class EmailSubscriptionDstu3Test extends BaseResourceProviderDstu3Test {
ourLog.info("After re-registering interceptors"); ourLog.info("After re-registering interceptors");
logAllInterceptors(myInterceptorRegistry); logAllInterceptors(myInterceptorRegistry);
myStorageSettings.setEmailFromAddress("123@hapifhir.io"); mySubscriptionSettings.setEmailFromAddress("123@hapifhir.io");
} }
private Subscription createSubscription(String theCriteria, String thePayload, Consumer<Subscription>... theModifiers) throws InterruptedException { 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.provider.dstu3.BaseResourceProviderDstu3Test;
import ca.uhn.fhir.jpa.subscription.NotificationServlet; import ca.uhn.fhir.jpa.subscription.NotificationServlet;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy; 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.subscription.util.SubscriptionDebugLogInterceptor;
import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil; import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil;
import ca.uhn.fhir.jpa.topic.SubscriptionTopicRegistry; import ca.uhn.fhir.jpa.topic.SubscriptionTopicRegistry;
@ -122,7 +123,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
ourLog.info("After re-registering interceptors"); ourLog.info("After re-registering interceptors");
DaoTestUtils.logAllInterceptors(myInterceptorRegistry); DaoTestUtils.logAllInterceptors(myInterceptorRegistry);
myStorageSettings.setOnlyAllowInMemorySubscriptions(new JpaStorageSettings().isOnlyAllowInMemorySubscriptions()); mySubscriptionSettings.setOnlyAllowInMemorySubscriptions(new SubscriptionSettings().isOnlyAllowInMemorySubscriptions());
} }
@BeforeEach @BeforeEach
@ -214,14 +215,14 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
} }
@Test @Test
public void testForcedInMemoryPreventsDatabaseSubscriptions() throws InterruptedException { public void testForcedInMemoryPreventsDatabaseSubscriptions() throws InterruptedException {
myStorageSettings.setOnlyAllowInMemorySubscriptions(true); mySubscriptionSettings.setOnlyAllowInMemorySubscriptions(true);
String databaseCriteria = "Observation?code=17861-6&context.type=IHD"; String databaseCriteria = "Observation?code=17861-6&context.type=IHD";
try { try {
createSubscription(databaseCriteria, null, ourNotificationListenerServer); createSubscription(databaseCriteria, null, ourNotificationListenerServer);
} catch (UnprocessableEntityException e) { } catch (UnprocessableEntityException e) {
assertThat(e.getMessage()).contains("HAPI-2367: This server is configured to only allow in-memory subscriptions."); 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); private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(WebsocketWithCriteriaDstu3Test.class);
@RegisterExtension @RegisterExtension
private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings); private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> mySubscriptionSettings);
private String myPatientId; private String myPatientId;
private String mySubscriptionId; 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); private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(WebsocketWithSubscriptionIdDstu3Test.class);
@RegisterExtension @RegisterExtension
private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings); private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> mySubscriptionSettings);
private String myPatientId; private String myPatientId;
private String mySubscriptionId; private String mySubscriptionId;
@Autowired @Autowired

View File

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

View File

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

View File

@ -122,18 +122,14 @@ public class PartitioningInterceptorR4Test extends BaseJpaR4SystemTest {
subscription.setChannel(subscriptionChannelComponent); subscription.setChannel(subscriptionChannelComponent);
// set up partitioning for subscriptions // set up partitioning for subscriptions
myStorageSettings.setCrossPartitionSubscriptionEnabled(true); mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(true);
// register interceptors that return different partition ids // register interceptors that return different partition ids
MySubscriptionReadInterceptor readInterceptor = new MySubscriptionReadInterceptor(); MySubscriptionReadInterceptor readInterceptor = new MySubscriptionReadInterceptor();
MySubscriptionWriteInterceptor writeInterceptor = new MySubscriptionWriteInterceptor(); MySubscriptionWriteInterceptor writeInterceptor = new MySubscriptionWriteInterceptor();
myInterceptorRegistry.unregisterInterceptor(myPartitionInterceptor); myInterceptorRegistry.unregisterInterceptor(myPartitionInterceptor);
readInterceptor.setObjectConsumer((obj) -> { readInterceptor.setObjectConsumer((obj) -> readIndex.getAndIncrement());
readIndex.getAndIncrement(); writeInterceptor.setObjectConsumer((ojb) -> writeIndex.getAndIncrement());
});
writeInterceptor.setObjectConsumer((ojb) -> {
writeIndex.getAndIncrement();
});
myInterceptorRegistry.registerInterceptor(readInterceptor); myInterceptorRegistry.registerInterceptor(readInterceptor);
myInterceptorRegistry.registerInterceptor(writeInterceptor); 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.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.subscription.BaseSubscriptionsR4Test; import ca.uhn.fhir.jpa.subscription.BaseSubscriptionsR4Test;
import ca.uhn.fhir.jpa.subscription.resthook.RestHookTestR4Test; 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.ISubscriptionTriggeringSvc;
import ca.uhn.fhir.jpa.subscription.triggering.SubscriptionTriggeringSvcImpl; import ca.uhn.fhir.jpa.subscription.triggering.SubscriptionTriggeringSvcImpl;
import ca.uhn.fhir.jpa.test.util.StoppableSubscriptionDeliveringRestHookSubscriber; import ca.uhn.fhir.jpa.test.util.StoppableSubscriptionDeliveringRestHookSubscriber;
@ -69,7 +70,7 @@ public class PartitionedSubscriptionTriggeringR4Test extends BaseSubscriptionsR4
@BeforeEach @BeforeEach
public void beforeEach() throws ServletException { public void beforeEach() throws ServletException {
myStorageSettings.setCrossPartitionSubscriptionEnabled(true); mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(true);
myPartitionSettings.setPartitioningEnabled(true); myPartitionSettings.setPartitioningEnabled(true);
myPartitionSettings.setIncludePartitionInSearchHashes(new PartitionSettings().isIncludePartitionInSearchHashes()); myPartitionSettings.setIncludePartitionInSearchHashes(new PartitionSettings().isIncludePartitionInSearchHashes());
@ -97,9 +98,9 @@ public class PartitionedSubscriptionTriggeringR4Test extends BaseSubscriptionsR4
public void afterUnregisterRestHookListener() { public void afterUnregisterRestHookListener() {
myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null); myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null);
myStoppableSubscriptionDeliveringRestHookSubscriber.unPause(); myStoppableSubscriptionDeliveringRestHookSubscriber.unPause();
myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(new JpaStorageSettings().isTriggerSubscriptionsForNonVersioningChanges()); mySubscriptionSettings.setTriggerSubscriptionsForNonVersioningChanges(new SubscriptionSettings().isTriggerSubscriptionsForNonVersioningChanges());
myStorageSettings.setCrossPartitionSubscriptionEnabled(false); mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(false);
myPartitionSettings.setPartitioningEnabled(false); myPartitionSettings.setPartitioningEnabled(false);
myPartitionSettings.setUnnamedPartitionMode(false); myPartitionSettings.setUnnamedPartitionMode(false);
@ -146,7 +147,7 @@ public class PartitionedSubscriptionTriggeringR4Test extends BaseSubscriptionsR4
@ParameterizedTest @ParameterizedTest
@ValueSource(booleans = {true, false}) @ValueSource(booleans = {true, false})
public void testCreateSubscriptionInPartitionAndResourceInDifferentPartition(boolean theIsCrossPartitionEnabled) throws Exception { public void testCreateSubscriptionInPartitionAndResourceInDifferentPartition(boolean theIsCrossPartitionEnabled) throws Exception {
myStorageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled); mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
String payload = "application/fhir+json"; String payload = "application/fhir+json";
String code = "1000000050"; String code = "1000000050";
@ -186,7 +187,7 @@ public class PartitionedSubscriptionTriggeringR4Test extends BaseSubscriptionsR4
@ParameterizedTest @ParameterizedTest
@ValueSource(booleans = {true, false}) @ValueSource(booleans = {true, false})
public void testManualTriggeredSubscriptionDoesNotCheckOutsideOfPartition(boolean theIsCrossPartitionEnabled) throws Exception { public void testManualTriggeredSubscriptionDoesNotCheckOutsideOfPartition(boolean theIsCrossPartitionEnabled) throws Exception {
myStorageSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled); mySubscriptionSettings.setCrossPartitionSubscriptionEnabled(theIsCrossPartitionEnabled);
String payload = "application/fhir+json"; String payload = "application/fhir+json";
String code = "1000000050"; String code = "1000000050";
String criteria1 = "Observation?code=SNOMED-CT|" + code + "&_format=xml"; 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.context.FhirContext;
import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.model.RequestPartitionId; 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.DaoRegistry;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc; 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.SubscriptionMatchingStrategy;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionStrategyEvaluator; 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.match.registry.SubscriptionCanonicalizer;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription; 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.jpa.subscription.submit.interceptor.SubscriptionValidatingInterceptor;
import ca.uhn.fhir.rest.api.RestOperationTypeEnum; import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.RequestDetails;
@ -57,18 +56,18 @@ public class SubscriptionValidatingInterceptorTest {
@Mock @Mock
private IRequestPartitionHelperSvc myRequestPartitionHelperSvc; private IRequestPartitionHelperSvc myRequestPartitionHelperSvc;
@Mock @Mock
private JpaStorageSettings myStorageSettings; private SubscriptionSettings mySubscriptionSettings;
private SubscriptionCanonicalizer mySubscriptionCanonicalizer; private SubscriptionCanonicalizer mySubscriptionCanonicalizer;
@BeforeEach @BeforeEach
public void before() { public void before() {
mySvc = new SubscriptionValidatingInterceptor(); mySvc = new SubscriptionValidatingInterceptor();
mySubscriptionCanonicalizer = spy(new SubscriptionCanonicalizer(myCtx, new StorageSettings())); mySubscriptionCanonicalizer = spy(new SubscriptionCanonicalizer(myCtx, new SubscriptionSettings()));
mySvc.setSubscriptionCanonicalizerForUnitTest(mySubscriptionCanonicalizer); mySvc.setSubscriptionCanonicalizerForUnitTest(mySubscriptionCanonicalizer);
mySvc.setDaoRegistryForUnitTest(myDaoRegistry); mySvc.setDaoRegistryForUnitTest(myDaoRegistry);
mySvc.setSubscriptionStrategyEvaluatorForUnitTest(mySubscriptionStrategyEvaluator); mySvc.setSubscriptionStrategyEvaluatorForUnitTest(mySubscriptionStrategyEvaluator);
mySvc.setFhirContext(myCtx); mySvc.setFhirContext(myCtx);
mySvc.setStorageSettingsForUnitTest(myStorageSettings); mySvc.setSubscriptionSettingsForUnitTest(mySubscriptionSettings);
mySvc.setRequestPartitionHelperSvcForUnitTest(myRequestPartitionHelperSvc); mySvc.setRequestPartitionHelperSvcForUnitTest(myRequestPartitionHelperSvc);
} }
@ -205,7 +204,7 @@ public class SubscriptionValidatingInterceptorTest {
@Test @Test
public void testValidate_Cross_Partition_Subscription() { public void testValidate_Cross_Partition_Subscription() {
when(myDaoRegistry.isResourceTypeSupported(eq("Patient"))).thenReturn(true); 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()); when(myRequestPartitionHelperSvc.determineCreatePartitionForRequest(isA(RequestDetails.class), isA(Subscription.class), eq("Subscription"))).thenReturn(RequestPartitionId.defaultPartition());
Subscription subscription = new Subscription(); 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 // No asserts here because the function should throw an UnprocessableEntityException exception if the subscription
// is invalid // is invalid
assertDoesNotThrow(() -> mySvc.resourcePreCreate(subscription, requestDetails, null)); 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(myDaoRegistry, times(1)).isResourceTypeSupported(eq("Patient"));
Mockito.verify(myRequestPartitionHelperSvc, times(1)).determineCreatePartitionForRequest(isA(RequestDetails.class), isA(Subscription.class), eq("Subscription")); Mockito.verify(myRequestPartitionHelperSvc, times(1)).determineCreatePartitionForRequest(isA(RequestDetails.class), isA(Subscription.class), eq("Subscription"));
} }
@Test @Test
public void testValidate_Cross_Partition_Subscription_On_Wrong_Partition() { 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)); when(myRequestPartitionHelperSvc.determineCreatePartitionForRequest(isA(RequestDetails.class), isA(Subscription.class), eq("Subscription"))).thenReturn(RequestPartitionId.fromPartitionId(1));
Subscription subscription = new Subscription(); Subscription subscription = new Subscription();
@ -253,7 +252,7 @@ public class SubscriptionValidatingInterceptorTest {
@Test @Test
public void testValidate_Cross_Partition_Subscription_Without_Setting() { public void testValidate_Cross_Partition_Subscription_Without_Setting() {
when(myStorageSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(false); when(mySubscriptionSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(false);
Subscription subscription = new Subscription(); Subscription subscription = new Subscription();
subscription.setStatus(Subscription.SubscriptionStatus.ACTIVE); 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 // No asserts here because the function should throw an UnprocessableEntityException exception if the subscription
// is invalid // is invalid
mySvc.resourcePreCreate(subscription, requestDetails, null); 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(myDaoRegistry, times(1)).isResourceTypeSupported(eq("Patient"));
Mockito.verify(myRequestPartitionHelperSvc, never()).determineCreatePartitionForRequest(isA(RequestDetails.class), isA(Patient.class), 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() { public void testSubscriptionUpdate() {
// setup // setup
when(myDaoRegistry.isResourceTypeSupported(eq("Patient"))).thenReturn(true); when(myDaoRegistry.isResourceTypeSupported(eq("Patient"))).thenReturn(true);
when(myStorageSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(true); when(mySubscriptionSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(true);
lenient() lenient()
.when(myRequestPartitionHelperSvc.determineReadPartitionForRequestForRead(isA(RequestDetails.class), isA(String.class), isA(IIdType.class))) .when(myRequestPartitionHelperSvc.determineReadPartitionForRequestForRead(isA(RequestDetails.class), isA(String.class), isA(IIdType.class)))
.thenReturn(RequestPartitionId.allPartitions()); .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 static org.junit.jupiter.api.Assertions.assertFalse;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.subscription.BaseSubscriptionsR4Test; 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.submit.interceptor.SynchronousSubscriptionMatcherInterceptor;
import ca.uhn.fhir.jpa.subscription.channel.api.ChannelConsumerSettings; 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.api.IChannelReceiver;
@ -52,7 +53,7 @@ public class AsyncSubscriptionMessageSubmissionIT extends BaseSubscriptionsR4Tes
public void cleanupStoppableSubscriptionDeliveringRestHookSubscriber() { public void cleanupStoppableSubscriptionDeliveringRestHookSubscriber() {
myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null); myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null);
myStoppableSubscriptionDeliveringRestHookSubscriber.unPause(); myStoppableSubscriptionDeliveringRestHookSubscriber.unPause();
myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(new JpaStorageSettings().isTriggerSubscriptionsForNonVersioningChanges()); mySubscriptionSettings.setTriggerSubscriptionsForNonVersioningChanges(new SubscriptionSettings().isTriggerSubscriptionsForNonVersioningChanges());
myStorageSettings.setTagStorageMode(new JpaStorageSettings().getTagStorageMode()); 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.channel.subscription.SubscriptionChannelFactory;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage; import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage; 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.jpa.test.util.StoppableSubscriptionDeliveringRestHookSubscriber;
import ca.uhn.fhir.rest.client.api.Header; import ca.uhn.fhir.rest.client.api.Header;
import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.IGenericClient;
@ -72,7 +73,7 @@ public class MessageSubscriptionR4Test extends BaseSubscriptionsR4Test {
public void cleanupStoppableSubscriptionDeliveringRestHookSubscriber() { public void cleanupStoppableSubscriptionDeliveringRestHookSubscriber() {
myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null); myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null);
myStoppableSubscriptionDeliveringRestHookSubscriber.unPause(); myStoppableSubscriptionDeliveringRestHookSubscriber.unPause();
myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(new JpaStorageSettings().isTriggerSubscriptionsForNonVersioningChanges()); mySubscriptionSettings.setTriggerSubscriptionsForNonVersioningChanges(new SubscriptionSettings().isTriggerSubscriptionsForNonVersioningChanges());
myStorageSettings.setTagStorageMode(new JpaStorageSettings().getTagStorageMode()); myStorageSettings.setTagStorageMode(new JpaStorageSettings().getTagStorageMode());
} }

View File

@ -58,12 +58,12 @@ public class RestHookActivatesPreExistingSubscriptionsR4Test extends BaseResourc
@AfterEach @AfterEach
public void afterUnregisterRestHookListener() { public void afterUnregisterRestHookListener() {
mySubscriptionTestUtil.unregisterSubscriptionInterceptor(); mySubscriptionTestUtil.unregisterSubscriptionInterceptor();
myStorageSettings.clearSupportedSubscriptionTypesForUnitTest(); mySubscriptionSettings.clearSupportedSubscriptionTypesForUnitTest();
} }
@BeforeEach @BeforeEach
public void beforeSetSubscriptionActivatingInterceptor() { 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(); myResourceModifiedSubmitterSvc.startIfNeeded();
mySubscriptionLoader.doSyncSubscriptionsForUnitTest(); 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.i18n.Msg;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.subscription.BaseSubscriptionsR4Test; 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.subscription.submit.svc.ResourceModifiedSubmitterSvc;
import ca.uhn.fhir.jpa.test.util.StoppableSubscriptionDeliveringRestHookSubscriber; import ca.uhn.fhir.jpa.test.util.StoppableSubscriptionDeliveringRestHookSubscriber;
import ca.uhn.fhir.jpa.topic.SubscriptionTopicDispatcher; import ca.uhn.fhir.jpa.topic.SubscriptionTopicDispatcher;
@ -83,7 +84,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test {
ourLog.info("@AfterEach"); ourLog.info("@AfterEach");
myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null); myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null);
myStoppableSubscriptionDeliveringRestHookSubscriber.unPause(); myStoppableSubscriptionDeliveringRestHookSubscriber.unPause();
myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(new JpaStorageSettings().isTriggerSubscriptionsForNonVersioningChanges()); mySubscriptionSettings.setTriggerSubscriptionsForNonVersioningChanges(new SubscriptionSettings().isTriggerSubscriptionsForNonVersioningChanges());
} }
@Test @Test
@ -403,7 +404,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test {
@Test @Test
public void testRestHookSubscriptionMetaAddDoesTriggerNewDeliveryIfConfiguredToDoSo() throws Exception { public void testRestHookSubscriptionMetaAddDoesTriggerNewDeliveryIfConfiguredToDoSo() throws Exception {
myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(true); mySubscriptionSettings.setTriggerSubscriptionsForNonVersioningChanges(true);
String payload = "application/fhir+json"; String payload = "application/fhir+json";
@ -732,7 +733,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test {
@Test @Test
public void testRestHookSubscriptionApplicationJsonDatabase() throws Exception { public void testRestHookSubscriptionApplicationJsonDatabase() throws Exception {
// Same test as above, but now run it using database matching // Same test as above, but now run it using database matching
myStorageSettings.setEnableInMemorySubscriptionMatching(false); mySubscriptionSettings.setEnableInMemorySubscriptionMatching(false);
String payload = "application/json"; String payload = "application/json";
String code = "1000000050"; String code = "1000000050";
@ -1173,8 +1174,8 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test {
*/ */
@Test @Test
public void testSubscriptionDoesntActivateIfRestHookIsNotEnabled() throws InterruptedException { public void testSubscriptionDoesntActivateIfRestHookIsNotEnabled() throws InterruptedException {
Set<org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType> existingSupportedSubscriptionTypes = myStorageSettings.getSupportedSubscriptionTypes(); Set<org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType> existingSupportedSubscriptionTypes = mySubscriptionSettings.getSupportedSubscriptionTypes();
myStorageSettings.clearSupportedSubscriptionTypesForUnitTest(); mySubscriptionSettings.clearSupportedSubscriptionTypesForUnitTest();
try { try {
Subscription subscription = newSubscription("Observation?", "application/fhir+json"); Subscription subscription = newSubscription("Observation?", "application/fhir+json");
@ -1185,7 +1186,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test {
assertEquals(Subscription.SubscriptionStatus.REQUESTED, subscription.getStatus()); assertEquals(Subscription.SubscriptionStatus.REQUESTED, subscription.getStatus());
} finally { } 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.dao.tx.IHapiTransactionService;
import ca.uhn.fhir.jpa.model.entity.PersistedResourceModifiedMessageEntityPK; import ca.uhn.fhir.jpa.model.entity.PersistedResourceModifiedMessageEntityPK;
import ca.uhn.fhir.jpa.model.entity.ResourceModifiedEntity; 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.ChannelProducerSettings;
import ca.uhn.fhir.jpa.subscription.channel.api.IChannelProducer; import ca.uhn.fhir.jpa.subscription.channel.api.IChannelProducer;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage; 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.subscription.submit.svc.ResourceModifiedSubmitterSvc;
import ca.uhn.fhir.jpa.svc.MockHapiTransactionService; import ca.uhn.fhir.jpa.svc.MockHapiTransactionService;
import ca.uhn.fhir.subscription.api.IResourceModifiedMessagePersistenceSvc; 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); private final ch.qos.logback.classic.Logger ourLogger = (Logger) LoggerFactory.getLogger(ResourceModifiedSubmitterSvc.class);
@Mock @Mock
StorageSettings myStorageSettings; SubscriptionSettings mySubscriptionSettings;
@Mock @Mock
SubscriptionChannelFactory mySubscriptionChannelFactory; SubscriptionChannelFactory mySubscriptionChannelFactory;
@Mock @Mock
@ -68,12 +68,12 @@ public class ResourceModifiedSubmitterSvcTest {
@BeforeEach @BeforeEach
public void beforeEach(){ public void beforeEach(){
myCapturingTransactionStatus = new SimpleTransactionStatus(); myCapturingTransactionStatus = new SimpleTransactionStatus();
lenient().when(myStorageSettings.hasSupportedSubscriptionTypes()).thenReturn(true); lenient().when(mySubscriptionSettings.hasSupportedSubscriptionTypes()).thenReturn(true);
lenient().when(mySubscriptionChannelFactory.newMatchingSendingChannel(anyString(), any())).thenReturn(myChannelProducer); lenient().when(mySubscriptionChannelFactory.newMatchingSendingChannel(anyString(), any())).thenReturn(myChannelProducer);
IHapiTransactionService hapiTransactionService = new MockHapiTransactionService(myCapturingTransactionStatus); IHapiTransactionService hapiTransactionService = new MockHapiTransactionService(myCapturingTransactionStatus);
myResourceModifiedSubmitterSvc = new ResourceModifiedSubmitterSvc( myResourceModifiedSubmitterSvc = new ResourceModifiedSubmitterSvc(
myStorageSettings, mySubscriptionSettings,
mySubscriptionChannelFactory, mySubscriptionChannelFactory,
myResourceModifiedMessagePersistenceSvc, myResourceModifiedMessagePersistenceSvc,
hapiTransactionService); hapiTransactionService);
@ -85,7 +85,7 @@ public class ResourceModifiedSubmitterSvcTest {
public void testMethodStartIfNeeded_withQualifySubscriptionMatchingChannelNameProperty_mayQualifyChannelName(boolean theIsQualifySubMatchingChannelName){ public void testMethodStartIfNeeded_withQualifySubscriptionMatchingChannelNameProperty_mayQualifyChannelName(boolean theIsQualifySubMatchingChannelName){
// given // given
boolean expectedResult = theIsQualifySubMatchingChannelName; boolean expectedResult = theIsQualifySubMatchingChannelName;
when(myStorageSettings.isQualifySubscriptionMatchingChannelName()).thenReturn(theIsQualifySubMatchingChannelName); when(mySubscriptionSettings.isQualifySubscriptionMatchingChannelName()).thenReturn(theIsQualifySubMatchingChannelName);
// when // when
myResourceModifiedSubmitterSvc.startIfNeeded(); myResourceModifiedSubmitterSvc.startIfNeeded();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.3.5-SNAPSHOT</version> <version>7.3.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </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.search.reindex.IResourceReindexingSvc;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionLoader; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionLoader;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry; 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.term.api.ITermDeferredStorageSvc;
import ca.uhn.fhir.jpa.util.CircularQueueCaptureQueriesListener; import ca.uhn.fhir.jpa.util.CircularQueueCaptureQueriesListener;
import ca.uhn.fhir.jpa.util.MemoryCacheService; import ca.uhn.fhir.jpa.util.MemoryCacheService;
@ -194,6 +195,8 @@ public abstract class BaseJpaTest extends BaseTest {
@Autowired @Autowired
protected JpaStorageSettings myStorageSettings; protected JpaStorageSettings myStorageSettings;
@Autowired @Autowired
protected SubscriptionSettings mySubscriptionSettings;
@Autowired
protected DatabaseBackedPagingProvider myDatabaseBackedPagingProvider; protected DatabaseBackedPagingProvider myDatabaseBackedPagingProvider;
@Autowired @Autowired
protected IInterceptorService myInterceptorRegistry; 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.config.SubscriptionProcessorConfig;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender; 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.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.subscription.submit.config.SubscriptionSubmitterConfig;
import ca.uhn.fhir.jpa.term.TermCodeSystemDeleteJobSvcWithUniTestFailures; import ca.uhn.fhir.jpa.term.TermCodeSystemDeleteJobSvcWithUniTestFailures;
import ca.uhn.fhir.jpa.term.api.ITermCodeSystemDeleteJobSvc; import ca.uhn.fhir.jpa.term.api.ITermCodeSystemDeleteJobSvc;
@ -68,6 +69,11 @@ public class TestJPAConfig {
return retVal; return retVal;
} }
@Bean
public SubscriptionSettings subscriptionSettings() {
return new SubscriptionSettings();
}
@Bean @Bean
public PartitionSettings partitionSettings() { public PartitionSettings partitionSettings() {
return new PartitionSettings(); return new PartitionSettings();

View File

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

View File

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

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>7.3.5-SNAPSHOT</version> <version>7.3.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </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.HapiJpaConfig;
import ca.uhn.fhir.jpa.config.JpaDstu2Config; import ca.uhn.fhir.jpa.config.JpaDstu2Config;
import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil; 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.HapiFhirH2Dialect;
import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect; import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect;
import ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers; import ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers;
@ -54,12 +55,18 @@ public class TestDstu2Config {
} }
@Bean @Bean
public JpaStorageSettings storageSettings() { public SubscriptionSettings subscriptionSettings() {
JpaStorageSettings retVal = new JpaStorageSettings(); SubscriptionSettings retVal = new SubscriptionSettings();
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET);
retVal.setWebsocketContextPath("/websocketDstu2"); retVal.setWebsocketContextPath("/");
return retVal;
}
@Bean
public JpaStorageSettings storageSettings() {
JpaStorageSettings retVal = new JpaStorageSettings();
retVal.setAllowContainsSearches(true); retVal.setAllowContainsSearches(true);
retVal.setAllowMultipleDelete(true); retVal.setAllowMultipleDelete(true);
retVal.setAllowInlineMatchUrlReferences(true); retVal.setAllowInlineMatchUrlReferences(true);
@ -71,7 +78,6 @@ public class TestDstu2Config {
retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO); retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO);
retVal.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); retVal.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED);
retVal.setFetchSizeDefaultMaximum(10000); retVal.setFetchSizeDefaultMaximum(10000);
retVal.setWebsocketContextPath("/");
retVal.setFilterParameterEnabled(true); retVal.setFilterParameterEnabled(true);
retVal.setDefaultSearchParamsCanBeOverridden(false); retVal.setDefaultSearchParamsCanBeOverridden(false);
retVal.setIndexOnContainedResources(true); 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.HapiJpaConfig;
import ca.uhn.fhir.jpa.config.dstu3.JpaDstu3Config; import ca.uhn.fhir.jpa.config.dstu3.JpaDstu3Config;
import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil; 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.HapiFhirH2Dialect;
import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect; import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
@ -49,12 +50,18 @@ public class TestDstu3Config {
private String myFhirLuceneLocation = System.getProperty(FHIR_LUCENE_LOCATION_DSTU3); private String myFhirLuceneLocation = System.getProperty(FHIR_LUCENE_LOCATION_DSTU3);
@Bean @Bean
public JpaStorageSettings storageSettings() { public SubscriptionSettings subscriptionSettings() {
JpaStorageSettings retVal = new JpaStorageSettings(); SubscriptionSettings retVal = new SubscriptionSettings();
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET);
retVal.setWebsocketContextPath("/websocketDstu3"); retVal.setWebsocketContextPath("/websocketDstu3");
return retVal;
}
@Bean
public JpaStorageSettings storageSettings() {
JpaStorageSettings retVal = new JpaStorageSettings();
retVal.setAllowContainsSearches(true); retVal.setAllowContainsSearches(true);
retVal.setAllowMultipleDelete(true); retVal.setAllowMultipleDelete(true);
retVal.setAllowInlineMatchUrlReferences(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.generator.IpsGeneratorSvcImpl;
import ca.uhn.fhir.jpa.ips.jpa.DefaultJpaIpsGenerationStrategy; import ca.uhn.fhir.jpa.ips.jpa.DefaultJpaIpsGenerationStrategy;
import ca.uhn.fhir.jpa.ips.provider.IpsOperationProvider; 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.HapiFhirH2Dialect;
import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect; import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
@ -55,12 +56,18 @@ public class TestR4Config {
private String myFhirLuceneLocation = System.getProperty(FHIR_LUCENE_LOCATION_R4); private String myFhirLuceneLocation = System.getProperty(FHIR_LUCENE_LOCATION_R4);
@Bean @Bean
public JpaStorageSettings storageSettings() { public SubscriptionSettings subscriptionSettings() {
JpaStorageSettings retVal = new JpaStorageSettings(); SubscriptionSettings retVal = new SubscriptionSettings();
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET);
retVal.setWebsocketContextPath("/websocketR4"); retVal.setWebsocketContextPath("/websocketR4");
return retVal;
}
@Bean
public JpaStorageSettings storageSettings() {
JpaStorageSettings retVal = new JpaStorageSettings();
retVal.setAllowContainsSearches(true); retVal.setAllowContainsSearches(true);
retVal.setAllowMultipleDelete(true); retVal.setAllowMultipleDelete(true);
retVal.setAllowInlineMatchUrlReferences(false); 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.HapiJpaConfig;
import ca.uhn.fhir.jpa.config.r5.JpaR5Config; import ca.uhn.fhir.jpa.config.r5.JpaR5Config;
import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil; 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.HapiFhirH2Dialect;
import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect; import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
@ -54,12 +55,18 @@ public class TestR5Config {
private String myFhirLuceneLocation = System.getProperty(FHIR_LUCENE_LOCATION_R5); private String myFhirLuceneLocation = System.getProperty(FHIR_LUCENE_LOCATION_R5);
@Bean @Bean
public JpaStorageSettings storageSettings() { public SubscriptionSettings subscriptionSettings() {
JpaStorageSettings retVal = new JpaStorageSettings(); SubscriptionSettings retVal = new SubscriptionSettings();
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET);
retVal.setWebsocketContextPath("/websocketR5"); retVal.setWebsocketContextPath("/websocketR5");
return retVal;
}
@Bean
public JpaStorageSettings storageSettings() {
JpaStorageSettings retVal = new JpaStorageSettings();
retVal.setAllowContainsSearches(true); retVal.setAllowContainsSearches(true);
retVal.setAllowMultipleDelete(true); retVal.setAllowMultipleDelete(true);
retVal.setAllowInlineMatchUrlReferences(true); retVal.setAllowInlineMatchUrlReferences(true);

View File

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

View File

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

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