Get test passing

This commit is contained in:
jamesagnew
2020-06-15 18:22:14 -04:00
parent 3c8565f503
commit d1def4a621
4 changed files with 19 additions and 17 deletions

View File

@@ -13,11 +13,13 @@ import java.io.IOException;
@Configuration @Configuration
public class EmpiConfig { public class EmpiConfig {
@Bean @Bean
IEmpiSettings empiSettings() throws IOException { IEmpiSettings empiSettings() throws IOException {
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 EmpiSettings().setEnabled(HapiProperties.getEmpiEnabled()).setScriptText(json); return null; // new EmpiSettings().setEnabled(HapiProperties.getEmpiEnabled()).setScriptText(json);
} }
} }

View File

@@ -60,8 +60,6 @@ public class HapiProperties {
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_ENABLED = "partitioning.enabled";
static final String PARTITIONING_CROSS_PARTITION_REFERENCE_MODE = "partitioning.cross_partition_reference_mode"; 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";
@@ -79,7 +77,7 @@ public class HapiProperties {
static final String EXPIRE_SEARCH_RESULTS_AFTER_MINS = "retain_cached_searches_mins"; static final String EXPIRE_SEARCH_RESULTS_AFTER_MINS = "retain_cached_searches_mins";
static final String MAX_BINARY_SIZE = "max_binary_size"; static final String MAX_BINARY_SIZE = "max_binary_size";
static final String PARTITIONING_MULTITENANCY_ENABLED = "partitioning.multitenancy.enabled"; static final String PARTITIONING_MULTITENANCY_ENABLED = "partitioning.multitenancy.enabled";
private static final String PARTITIONING_INCLUDE_PARTITION_IN_SEARCH_HASHES = "partitioning.partitioning_include_in_search_hashes";
private static Properties ourProperties; private static Properties ourProperties;
public static boolean isElasticSearchEnabled() { public static boolean isElasticSearchEnabled() {
@@ -388,6 +386,10 @@ public class HapiProperties {
return HapiProperties.getBooleanProperty(PARTITIONING_ENABLED, false); return HapiProperties.getBooleanProperty(PARTITIONING_ENABLED, false);
} }
public static boolean getPartitioningMultitenancyEnabled() {
return HapiProperties.getBooleanProperty(PARTITIONING_MULTITENANCY_ENABLED, false);
}
public static String getPartitioningCrossPartitionReferenceMode() { public static String getPartitioningCrossPartitionReferenceMode() {
return HapiProperties.getProperty(PARTITIONING_CROSS_PARTITION_REFERENCE_MODE, "NOT_ALLOWED"); return HapiProperties.getProperty(PARTITIONING_CROSS_PARTITION_REFERENCE_MODE, "NOT_ALLOWED");
} }
@@ -513,8 +515,5 @@ public class HapiProperties {
return HapiProperties.getBooleanProperty("fhirpath_interceptor.enabled", false); return HapiProperties.getBooleanProperty("fhirpath_interceptor.enabled", false);
} }
public static boolean getPartitioningMultitenancyEnabled() {
return HapiProperties.getBooleanProperty(PARTITIONING_MULTITENANCY_ENABLED, false);
}
} }

View File

@@ -36,8 +36,8 @@ import ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor; import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ResponseValidatingInterceptor; import ca.uhn.fhir.rest.server.interceptor.ResponseValidatingInterceptor;
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
import ca.uhn.fhir.rest.server.interceptor.partition.RequestTenantPartitionInterceptor; import ca.uhn.fhir.rest.server.interceptor.partition.RequestTenantPartitionInterceptor;
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
import ca.uhn.fhir.rest.server.tenant.UrlBaseTenantIdentificationStrategy; import ca.uhn.fhir.rest.server.tenant.UrlBaseTenantIdentificationStrategy;
import ca.uhn.fhir.validation.IValidatorModule; import ca.uhn.fhir.validation.IValidatorModule;
import ca.uhn.fhir.validation.ResultSeverityEnum; import ca.uhn.fhir.validation.ResultSeverityEnum;
@@ -330,11 +330,13 @@ public class JpaRestfulServer extends RestfulServer {
partitionSettings.setIncludePartitionInSearchHashes(HapiProperties.getIncludePartitionInSearchHashes()); partitionSettings.setIncludePartitionInSearchHashes(HapiProperties.getIncludePartitionInSearchHashes());
registerProvider(appCtx.getBean(PartitionManagementProvider.class)); registerProvider(appCtx.getBean(PartitionManagementProvider.class));
if (HapiProperties.getPartitioningMultitenancyEnabled()) { if (HapiProperties.getPartitioningMultitenancyEnabled()) {
registerInterceptor(new RequestTenantPartitionInterceptor()); registerInterceptor(new RequestTenantPartitionInterceptor());
setTenantIdentificationStrategy(new UrlBaseTenantIdentificationStrategy()); setTenantIdentificationStrategy(new UrlBaseTenantIdentificationStrategy());
registerProviders(appCtx.getBean(PartitionManagementProvider.class));
} }
} }
}
} }

View File

@@ -1,16 +1,15 @@
package ca.uhn.fhir.jpa.starter; package ca.uhn.fhir.jpa.starter;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.model.util.ProviderConstants;
import ca.uhn.fhir.rest.api.CacheControlDirective; import ca.uhn.fhir.rest.api.CacheControlDirective;
import ca.uhn.fhir.rest.client.api.IGenericClient; 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.rest.client.interceptor.UrlTenantSelectionInterceptor; import ca.uhn.fhir.rest.client.interceptor.UrlTenantSelectionInterceptor;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
import ca.uhn.fhir.test.utilities.JettyUtil; import ca.uhn.fhir.test.utilities.JettyUtil;
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.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.CodeType; import org.hl7.fhir.r4.model.CodeType;
import org.hl7.fhir.r4.model.IntegerType; import org.hl7.fhir.r4.model.IntegerType;
@@ -39,6 +38,7 @@ public class MultitenantServerR4IT {
HapiProperties.setProperty(HapiProperties.DATASOURCE_URL, "jdbc:h2:mem:dbr4-mt"); HapiProperties.setProperty(HapiProperties.DATASOURCE_URL, "jdbc:h2:mem:dbr4-mt");
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.PARTITIONING_ENABLED, "true");
HapiProperties.setProperty(HapiProperties.PARTITIONING_MULTITENANCY_ENABLED, "true"); HapiProperties.setProperty(HapiProperties.PARTITIONING_MULTITENANCY_ENABLED, "true");
ourCtx = FhirContext.forR4(); ourCtx = FhirContext.forR4();
} }
@@ -70,7 +70,6 @@ public class MultitenantServerR4IT {
} }
@Test @Test
@Ignore
public void testCreateAndReadInTenantB() { public void testCreateAndReadInTenantB() {
ourLog.info("Base URL is: " + HapiProperties.getServerAddress()); ourLog.info("Base URL is: " + HapiProperties.getServerAddress());
@@ -80,7 +79,7 @@ public class MultitenantServerR4IT {
.operation() .operation()
.onServer() .onServer()
.named(ProviderConstants.PARTITION_MANAGEMENT_CREATE_PARTITION) .named(ProviderConstants.PARTITION_MANAGEMENT_CREATE_PARTITION)
.withParameter(Parameters.class, ProviderConstants.PARTITION_MANAGEMENT_PARTITION_ID, new IntegerType(1)) .withParameter(Parameters.class, ProviderConstants.PARTITION_MANAGEMENT_PARTITION_ID, new IntegerType(2))
.andParameter(ProviderConstants.PARTITION_MANAGEMENT_PARTITION_NAME, new CodeType("TENANT-B")) .andParameter(ProviderConstants.PARTITION_MANAGEMENT_PARTITION_NAME, new CodeType("TENANT-B"))
.execute(); .execute();