just need to merge the email TLS
This commit is contained in:
9
pom.xml
9
pom.xml
@@ -12,7 +12,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir</artifactId>
|
<artifactId>hapi-fhir</artifactId>
|
||||||
<version>5.0.0-SNAPSHOT</version>
|
<version>5.1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>hapi-fhir-jpaserver-starter</artifactId>
|
<artifactId>hapi-fhir-jpaserver-starter</artifactId>
|
||||||
@@ -255,7 +255,12 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.awaitility</groupId>
|
||||||
|
<artifactId>awaitility</artifactId>
|
||||||
|
<version>4.0.0-rc1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package ca.uhn.fhir.jpa.starter;
|
package ca.uhn.fhir.jpa.starter;
|
||||||
|
|
||||||
import ca.uhn.fhir.empi.api.IEmpiSettings;
|
import ca.uhn.fhir.empi.api.IEmpiSettings;
|
||||||
import ca.uhn.fhir.empi.rules.config.EmpiSettingsImpl;
|
import ca.uhn.fhir.empi.rules.config.EmpiSettings;
|
||||||
import ca.uhn.fhir.jpa.empi.config.EmpiConsumerConfig;
|
import ca.uhn.fhir.jpa.empi.config.EmpiConsumerConfig;
|
||||||
import ca.uhn.fhir.jpa.empi.config.EmpiSubmitterConfig;
|
import ca.uhn.fhir.jpa.empi.config.EmpiSubmitterConfig;
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
@@ -22,6 +22,6 @@ public class EmpiConfig {
|
|||||||
DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
|
DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
|
||||||
Resource resource = resourceLoader.getResource("empi-rules.json");
|
Resource resource = resourceLoader.getResource("empi-rules.json");
|
||||||
String json = IOUtils.toString(resource.getInputStream(), Charsets.UTF_8);
|
String json = IOUtils.toString(resource.getInputStream(), Charsets.UTF_8);
|
||||||
return new EmpiSettingsImpl().setEnabled(HapiProperties.getEmpiEnabled()).setScriptText(json);
|
return new EmpiSettings().setEnabled(HapiProperties.getEmpiEnabled()).setScriptText(json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,11 +201,10 @@ public class FhirServerConfigCommon {
|
|||||||
retVal.setSmtpServerPort(this.emailPort);
|
retVal.setSmtpServerPort(this.emailPort);
|
||||||
retVal.setSmtpServerUsername(this.emailUsername);
|
retVal.setSmtpServerUsername(this.emailUsername);
|
||||||
retVal.setSmtpServerPassword(this.emailPassword);
|
retVal.setSmtpServerPassword(this.emailPassword);
|
||||||
// FIXME KHS add these once this has merged in hapi
|
retVal.setAuth(this.emailAuth);
|
||||||
// retVal.setAuth(this.emailAuth);
|
retVal.setStartTlsEnable(this.emailStartTlsEnable);
|
||||||
// retVal.setStartTlsEnable(this.emailStartTlsEnable);
|
retVal.setStartTlsRequired(this.emailStartTlsRequired);
|
||||||
// retVal.setStartTlsRequired(this.emailStartTlsRequired);
|
retVal.setQuitWait(this.emailQuitWait);
|
||||||
// retVal.setQuitWait(this.emailQuitWait);
|
|
||||||
|
|
||||||
Validate.notNull(mySubscriptionDeliveryHandlerFactory, "No subscription delivery handler");
|
Validate.notNull(mySubscriptionDeliveryHandlerFactory, "No subscription delivery handler");
|
||||||
mySubscriptionDeliveryHandlerFactory.setEmailSender(retVal);
|
mySubscriptionDeliveryHandlerFactory.setEmailSender(retVal);
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ public class HapiProperties {
|
|||||||
static final String SUBSCRIPTION_RESTHOOK_ENABLED = "subscription.resthook.enabled";
|
static final String SUBSCRIPTION_RESTHOOK_ENABLED = "subscription.resthook.enabled";
|
||||||
static final String SUBSCRIPTION_WEBSOCKET_ENABLED = "subscription.websocket.enabled";
|
static final String SUBSCRIPTION_WEBSOCKET_ENABLED = "subscription.websocket.enabled";
|
||||||
static final String EMPI_ENABLED = "empi.enabled";
|
static final String EMPI_ENABLED = "empi.enabled";
|
||||||
|
static final String PARTITIONING_ENABLED = "partitioning.enabled";
|
||||||
|
static final String PARTITIONING_CROSS_PARTITION_REFERENCE_MODE = "partitioning.cross_partition_reference_mode";
|
||||||
|
private static final String PARTITIONING_INCLUDE_PARTITION_IN_SEARCH_HASHES = "partitioning.partitioning_include_in_search_hashes";
|
||||||
|
|
||||||
static final String ALLOWED_BUNDLE_TYPES = "allowed_bundle_types";
|
static final String ALLOWED_BUNDLE_TYPES = "allowed_bundle_types";
|
||||||
static final String TEST_PORT = "test.port";
|
static final String TEST_PORT = "test.port";
|
||||||
static final String TESTER_CONFIG_REFUSE_TO_FETCH_THIRD_PARTY_URLS = "tester.config.refuse_to_fetch_third_party_urls";
|
static final String TESTER_CONFIG_REFUSE_TO_FETCH_THIRD_PARTY_URLS = "tester.config.refuse_to_fetch_third_party_urls";
|
||||||
@@ -378,6 +382,18 @@ public class HapiProperties {
|
|||||||
return HapiProperties.getBooleanProperty(EMPI_ENABLED, false);
|
return HapiProperties.getBooleanProperty(EMPI_ENABLED, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Boolean getPartitioningEnabled() {
|
||||||
|
return HapiProperties.getBooleanProperty(PARTITIONING_ENABLED, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getPartitioningCrossPartitionReferenceMode() {
|
||||||
|
return HapiProperties.getProperty(PARTITIONING_CROSS_PARTITION_REFERENCE_MODE, "NOT_ALLOWED");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getIncludePartitionInSearchHashes() {
|
||||||
|
return HapiProperties.getBooleanProperty(PARTITIONING_INCLUDE_PARTITION_IN_SEARCH_HASHES, true);
|
||||||
|
}
|
||||||
|
|
||||||
public static Boolean getAllowContainsSearches() {
|
public static Boolean getAllowContainsSearches() {
|
||||||
return HapiProperties.getBooleanProperty(ALLOW_CONTAINS_SEARCHES, true);
|
return HapiProperties.getBooleanProperty(ALLOW_CONTAINS_SEARCHES, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package ca.uhn.fhir.jpa.starter;
|
|||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||||
|
import ca.uhn.fhir.empi.provider.EmpiProviderDstu3;
|
||||||
|
import ca.uhn.fhir.empi.provider.EmpiProviderR4;
|
||||||
|
import ca.uhn.fhir.empi.rules.config.EmpiSettings;
|
||||||
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
|
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
|
||||||
import ca.uhn.fhir.interceptor.api.IInterceptorService;
|
import ca.uhn.fhir.interceptor.api.IInterceptorService;
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
@@ -10,6 +13,8 @@ import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
|
|||||||
import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor;
|
import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor;
|
||||||
import ca.uhn.fhir.jpa.bulk.BulkDataExportProvider;
|
import ca.uhn.fhir.jpa.bulk.BulkDataExportProvider;
|
||||||
import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor;
|
import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor;
|
||||||
|
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||||
|
import ca.uhn.fhir.jpa.partition.PartitionManagementProvider;
|
||||||
import ca.uhn.fhir.jpa.provider.GraphQLProvider;
|
import ca.uhn.fhir.jpa.provider.GraphQLProvider;
|
||||||
import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu2;
|
import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu2;
|
||||||
import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2;
|
import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2;
|
||||||
@@ -37,11 +42,9 @@ import ca.uhn.fhir.rest.server.interceptor.ResponseValidatingInterceptor;
|
|||||||
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
|
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
|
||||||
import ca.uhn.fhir.validation.IValidatorModule;
|
import ca.uhn.fhir.validation.IValidatorModule;
|
||||||
import ca.uhn.fhir.validation.ResultSeverityEnum;
|
import ca.uhn.fhir.validation.ResultSeverityEnum;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
import org.hl7.fhir.dstu3.model.Bundle;
|
import org.hl7.fhir.dstu3.model.Bundle;
|
||||||
import org.hl7.fhir.r4.model.Bundle.BundleType;
|
|
||||||
import org.hl7.fhir.dstu3.model.Meta;
|
import org.hl7.fhir.dstu3.model.Meta;
|
||||||
|
import org.hl7.fhir.r4.model.Bundle.BundleType;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.web.cors.CorsConfiguration;
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
@@ -49,7 +52,9 @@ import org.springframework.web.cors.CorsConfiguration;
|
|||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
public class JpaRestfulServer extends RestfulServer {
|
public class JpaRestfulServer extends RestfulServer {
|
||||||
|
|
||||||
@@ -287,31 +292,7 @@ public class JpaRestfulServer extends RestfulServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validation
|
// Validation
|
||||||
IValidatorModule validatorModule;
|
IValidatorModule validatorModule = appCtx.getBean(IValidatorModule.class);
|
||||||
// FIXME KHS
|
|
||||||
/*
|
|
||||||
switch (fhirVersion) {
|
|
||||||
case DSTU2:
|
|
||||||
validatorModule = appCtx.getBean("myInstanceValidatorDstu2", IValidatorModule.class);
|
|
||||||
break;
|
|
||||||
case DSTU3:
|
|
||||||
validatorModule = appCtx.getBean("myInstanceValidatorDstu3", IValidatorModule.class);
|
|
||||||
break;
|
|
||||||
case R4:
|
|
||||||
validatorModule = appCtx.getBean("myInstanceValidatorR4", IValidatorModule.class);
|
|
||||||
break;
|
|
||||||
case R5:
|
|
||||||
validatorModule = appCtx.getBean("myInstanceValidatorR5", IValidatorModule.class);
|
|
||||||
break;
|
|
||||||
// These versions are not supported by HAPI FHIR JPA
|
|
||||||
case DSTU2_HL7ORG:
|
|
||||||
case DSTU2_1:
|
|
||||||
default:
|
|
||||||
validatorModule = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
validatorModule = appCtx.getBean(IValidatorModule.class);
|
|
||||||
if (validatorModule != null) {
|
if (validatorModule != null) {
|
||||||
if (HapiProperties.getValidateRequestsEnabled()) {
|
if (HapiProperties.getValidateRequestsEnabled()) {
|
||||||
RequestValidatingInterceptor interceptor = new RequestValidatingInterceptor();
|
RequestValidatingInterceptor interceptor = new RequestValidatingInterceptor();
|
||||||
@@ -351,11 +332,13 @@ public class JpaRestfulServer extends RestfulServer {
|
|||||||
registerProvider(appCtx.getBean(BulkDataExportProvider.class));
|
registerProvider(appCtx.getBean(BulkDataExportProvider.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (HapiProperties.getPartitioningEnabled()) {
|
||||||
if (HapiProperties.getEmpiEnabled()) {
|
PartitionSettings partitionSettings = appCtx.getBean(PartitionSettings.class);
|
||||||
// FIXME KHS
|
partitionSettings.setPartitioningEnabled(true);
|
||||||
}
|
PartitionSettings.CrossPartitionReferenceMode mode = PartitionSettings.CrossPartitionReferenceMode.valueOf(HapiProperties.getPartitioningCrossPartitionReferenceMode());
|
||||||
|
partitionSettings.setAllowReferencesAcrossPartitions(mode);
|
||||||
|
partitionSettings.setIncludePartitionInSearchHashes(HapiProperties.getIncludePartitionInSearchHashes());
|
||||||
|
registerProvider(appCtx.getBean(PartitionManagementProvider.class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,33 @@
|
|||||||
{
|
{
|
||||||
"resourceSearchParams" : [ {
|
"candidateSearchParams" : [ {
|
||||||
"resourceType" : "Patient",
|
"resourceType" : "Patient",
|
||||||
"searchParam" : "birthdate"
|
"searchParam" : "birthdate"
|
||||||
}, {
|
}, {
|
||||||
"resourceType" : "All",
|
"resourceType" : "*",
|
||||||
"searchParam" : "identifier"
|
"searchParam" : "identifier"
|
||||||
|
},{
|
||||||
|
"resourceType" : "Patient",
|
||||||
|
"searchParam" : "general-practitioner"
|
||||||
} ],
|
} ],
|
||||||
"filterSearchParams" : [ {
|
"candidateFilterSearchParams" : [ {
|
||||||
"resourceType" : "All",
|
"resourceType" : "*",
|
||||||
"searchParam" : "active",
|
"searchParam" : "active",
|
||||||
"fixedValue" : "true"
|
"fixedValue" : "true"
|
||||||
} ],
|
} ],
|
||||||
"matchFields" : [ {
|
"matchFields" : [ {
|
||||||
"name" : "given-name",
|
"name" : "given-name",
|
||||||
"resourceType" : "All",
|
"resourceType" : "*",
|
||||||
"resourcePath" : "name.given",
|
"resourcePath" : "name.given",
|
||||||
"metric" : "COSINE",
|
"metric" : "COSINE",
|
||||||
"matchThreshold" : 0.8
|
"matchThreshold" : 0.8
|
||||||
}, {
|
}, {
|
||||||
"name" : "last-name",
|
"name" : "last-name",
|
||||||
"resourceType" : "All",
|
"resourceType" : "*",
|
||||||
"resourcePath" : "name.family",
|
"resourcePath" : "name.family",
|
||||||
"metric" : "JARO_WINKLER",
|
"metric" : "JARO_WINKLER",
|
||||||
"matchThreshold" : 0.8
|
"matchThreshold" : 0.8
|
||||||
}],
|
}],
|
||||||
"weightMap" : {
|
"matchResultMap" : {
|
||||||
"given-name" : "POSSIBLE_MATCH",
|
"given-name" : "POSSIBLE_MATCH",
|
||||||
"given-name,last-name" : "MATCH"
|
"given-name,last-name" : "MATCH"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -148,7 +148,10 @@ email.password=
|
|||||||
# Enable Websocket Subscription Channel
|
# Enable Websocket Subscription Channel
|
||||||
subscription.websocket.enabled=false
|
subscription.websocket.enabled=false
|
||||||
|
|
||||||
########
|
|
||||||
# EMPI
|
# EMPI
|
||||||
########
|
|
||||||
empi.enabled=false
|
empi.enabled=false
|
||||||
|
|
||||||
|
# Partitioning
|
||||||
|
partitioning.enabled=false
|
||||||
|
partitioning.cross_partition_reference_mode=NOT_ALLOWED
|
||||||
|
partitioning.partitioning_include_in_search_hashes=true
|
||||||
|
|||||||
@@ -9,6 +9,25 @@
|
|||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
|
<appender name="EMPI_TROUBLESHOOTING" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"><level>DEBUG</level></filter>
|
||||||
|
<file>${smile.basedir}/log/empi-troubleshooting.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||||
|
<fileNamePattern>${smile.basedir}/log/empi-troubleshooting.log.%i.gz</fileNamePattern>
|
||||||
|
<minIndex>1</minIndex>
|
||||||
|
<maxIndex>9</maxIndex>
|
||||||
|
</rollingPolicy>
|
||||||
|
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||||
|
<maxFileSize>5MB</maxFileSize>
|
||||||
|
</triggeringPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n${log.stackfilter.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<logger name="ca.uhn.fhir.log.empi_troubleshooting" level="TRACE">
|
||||||
|
<appender-ref ref="EMPI_TROUBLESHOOTING"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
<root level="INFO">
|
<root level="INFO">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
</root>
|
</root>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import ca.uhn.fhir.rest.client.api.IGenericClient;
|
|||||||
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
||||||
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
||||||
import ca.uhn.fhir.test.utilities.JettyUtil;
|
import ca.uhn.fhir.test.utilities.JettyUtil;
|
||||||
|
import ca.uhn.fhir.util.BundleUtil;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.webapp.WebAppContext;
|
import org.eclipse.jetty.webapp.WebAppContext;
|
||||||
import org.eclipse.jetty.websocket.api.Session;
|
import org.eclipse.jetty.websocket.api.Session;
|
||||||
@@ -17,6 +18,8 @@ import org.hl7.fhir.instance.model.api.IIdType;
|
|||||||
import org.hl7.fhir.r4.model.Bundle;
|
import org.hl7.fhir.r4.model.Bundle;
|
||||||
import org.hl7.fhir.r4.model.Observation;
|
import org.hl7.fhir.r4.model.Observation;
|
||||||
import org.hl7.fhir.r4.model.Patient;
|
import org.hl7.fhir.r4.model.Patient;
|
||||||
|
import org.hl7.fhir.r4.model.Person;
|
||||||
|
import org.hl7.fhir.r4.model.Reference;
|
||||||
import org.hl7.fhir.r4.model.Subscription;
|
import org.hl7.fhir.r4.model.Subscription;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
@@ -24,11 +27,16 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static ca.uhn.fhir.util.TestUtil.waitForSize;
|
import static ca.uhn.fhir.util.TestUtil.waitForSize;
|
||||||
|
import static org.awaitility.Awaitility.await;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class ExampleServerR4IT {
|
public class ExampleServerR4IT {
|
||||||
|
|
||||||
@@ -43,6 +51,7 @@ public class ExampleServerR4IT {
|
|||||||
HapiProperties.setProperty(HapiProperties.DATASOURCE_URL, "jdbc:h2:mem:dbr4");
|
HapiProperties.setProperty(HapiProperties.DATASOURCE_URL, "jdbc:h2:mem:dbr4");
|
||||||
HapiProperties.setProperty(HapiProperties.FHIR_VERSION, "R4");
|
HapiProperties.setProperty(HapiProperties.FHIR_VERSION, "R4");
|
||||||
HapiProperties.setProperty(HapiProperties.SUBSCRIPTION_WEBSOCKET_ENABLED, "true");
|
HapiProperties.setProperty(HapiProperties.SUBSCRIPTION_WEBSOCKET_ENABLED, "true");
|
||||||
|
HapiProperties.setProperty(HapiProperties.EMPI_ENABLED, "true");
|
||||||
ourCtx = FhirContext.forR4();
|
ourCtx = FhirContext.forR4();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +66,28 @@ public class ExampleServerR4IT {
|
|||||||
|
|
||||||
Patient pt2 = ourClient.read().resource(Patient.class).withId(id).execute();
|
Patient pt2 = ourClient.read().resource(Patient.class).withId(id).execute();
|
||||||
assertEquals(methodName, pt2.getName().get(0).getFamily());
|
assertEquals(methodName, pt2.getName().get(0).getFamily());
|
||||||
|
|
||||||
|
|
||||||
|
// Test EMPI
|
||||||
|
|
||||||
|
// Wait until the EMPI message has been processed
|
||||||
|
await().until(() -> getPeople().size() > 0);
|
||||||
|
List<Person> persons = getPeople();
|
||||||
|
|
||||||
|
// Verify a Person was created that links to our Patient
|
||||||
|
Optional<String> personLinkToCreatedPatient = persons.stream()
|
||||||
|
.map(Person::getLink)
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.map(Person.PersonLinkComponent::getTarget)
|
||||||
|
.map(Reference::getReference)
|
||||||
|
.filter(pid -> id.toUnqualifiedVersionless().getValue().equals(pid))
|
||||||
|
.findAny();
|
||||||
|
assertTrue(personLinkToCreatedPatient.isPresent());
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Person> getPeople() {
|
||||||
|
Bundle bundle = ourClient.search().forResource(Person.class).cacheControl(new CacheControlDirective().setNoCache(true)).returnBundle(Bundle.class).execute();
|
||||||
|
return BundleUtil.toListOfResourcesOfType(ourCtx, bundle, Person.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -78,7 +109,7 @@ public class ExampleServerR4IT {
|
|||||||
IIdType mySubscriptionId = methodOutcome.getId();
|
IIdType mySubscriptionId = methodOutcome.getId();
|
||||||
|
|
||||||
// Wait for the subscription to be activated
|
// Wait for the subscription to be activated
|
||||||
waitForSize(1, () -> ourClient.search().forResource(Subscription.class).where(Subscription.STATUS.exactly().code("active")).cacheControl(new CacheControlDirective().setNoCache(true)).returnBundle(Bundle.class).execute().getEntry().size());
|
await().until(() -> activeSubscriptionCount() == 3);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attach websocket
|
* Attach websocket
|
||||||
@@ -117,6 +148,10 @@ public class ExampleServerR4IT {
|
|||||||
ourClient.delete().resourceById(mySubscriptionId).execute();
|
ourClient.delete().resourceById(mySubscriptionId).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int activeSubscriptionCount() {
|
||||||
|
return ourClient.search().forResource(Subscription.class).where(Subscription.STATUS.exactly().code("active")).cacheControl(new CacheControlDirective().setNoCache(true)).returnBundle(Bundle.class).execute().getEntry().size();
|
||||||
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void afterClass() throws Exception {
|
public static void afterClass() throws Exception {
|
||||||
ourServer.stop();
|
ourServer.stop();
|
||||||
|
|||||||
@@ -14,7 +14,13 @@ import org.eclipse.jetty.websocket.api.Session;
|
|||||||
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
|
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
|
||||||
import org.eclipse.jetty.websocket.client.WebSocketClient;
|
import org.eclipse.jetty.websocket.client.WebSocketClient;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.hl7.fhir.r5.model.*;
|
import org.hl7.fhir.r5.model.Bundle;
|
||||||
|
import org.hl7.fhir.r5.model.Coding;
|
||||||
|
import org.hl7.fhir.r5.model.Enumerations;
|
||||||
|
import org.hl7.fhir.r5.model.Observation;
|
||||||
|
import org.hl7.fhir.r5.model.Patient;
|
||||||
|
import org.hl7.fhir.r5.model.Subscription;
|
||||||
|
import org.hl7.fhir.r5.model.SubscriptionTopic;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -62,7 +68,7 @@ public class ExampleServerR5IT {
|
|||||||
/*
|
/*
|
||||||
* Create topic
|
* Create topic
|
||||||
*/
|
*/
|
||||||
Topic topic = new Topic();
|
SubscriptionTopic topic = new SubscriptionTopic();
|
||||||
topic.getResourceTrigger().getQueryCriteria().setCurrent("Observation?status=final");
|
topic.getResourceTrigger().getQueryCriteria().setCurrent("Observation?status=final");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -71,14 +77,12 @@ public class ExampleServerR5IT {
|
|||||||
Subscription subscription = new Subscription();
|
Subscription subscription = new Subscription();
|
||||||
subscription.getTopic().setResource(topic);
|
subscription.getTopic().setResource(topic);
|
||||||
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
|
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
|
||||||
subscription.setStatus(Subscription.SubscriptionStatus.REQUESTED);
|
subscription.setStatus(Enumerations.SubscriptionState.REQUESTED);
|
||||||
|
|
||||||
Subscription.SubscriptionChannelComponent channel = new Subscription.SubscriptionChannelComponent();
|
subscription.setContentType("application/json");
|
||||||
channel.getType().addCoding()
|
Coding channelType = new Coding().setSystem("http://terminology.hl7.org/CodeSystem/subscription-channel-type")
|
||||||
.setSystem("http://terminology.hl7.org/CodeSystem/subscription-channel-type")
|
.setCode("websocket");;
|
||||||
.setCode("websocket");
|
subscription.setChannelType(channelType);
|
||||||
channel.getPayload().setContentType("application/json");
|
|
||||||
subscription.setChannel(channel);
|
|
||||||
|
|
||||||
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
|
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
|
||||||
IIdType mySubscriptionId = methodOutcome.getId();
|
IIdType mySubscriptionId = methodOutcome.getId();
|
||||||
|
|||||||
Reference in New Issue
Block a user