update integration tests and appproperties

This commit is contained in:
justin.mckelvy
2023-06-11 14:20:30 -06:00
parent eaaf27b5d0
commit e97788dab3
11 changed files with 44 additions and 11 deletions

View File

@@ -21,7 +21,7 @@ import java.util.Objects;
@EnableConfigurationProperties @EnableConfigurationProperties
public class AppProperties { public class AppProperties {
private Boolean cr_enabled = true; private Boolean cr_enabled = false;
private Boolean ips_enabled = false; private Boolean ips_enabled = false;
private Boolean openapi_enabled = false; private Boolean openapi_enabled = false;
private Boolean mdm_enabled = false; private Boolean mdm_enabled = false;

View File

@@ -9,6 +9,7 @@ import ca.uhn.fhir.context.ConfigurationException;
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.context.support.IValidationSupport; import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.cr.config.CrProperties;
import ca.uhn.fhir.cr.r4.measure.CareGapsOperationProvider; import ca.uhn.fhir.cr.r4.measure.CareGapsOperationProvider;
import ca.uhn.fhir.cr.r4.measure.SubmitDataProvider; import ca.uhn.fhir.cr.r4.measure.SubmitDataProvider;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
@@ -63,7 +64,10 @@ import ca.uhn.fhir.validation.IValidatorModule;
import ca.uhn.fhir.validation.ResultSeverityEnum; import ca.uhn.fhir.validation.ResultSeverityEnum;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.cqframework.cql.cql2elm.model.Model;
import org.hl7.cql.model.ModelIdentifier;
import org.hl7.fhir.common.hapi.validation.support.CachingValidationSupport; import org.hl7.fhir.common.hapi.validation.support.CachingValidationSupport;
import org.opencds.cqf.cql.evaluator.CqlOptions;
import org.opencds.cqf.cql.evaluator.library.EvaluationSettings; import org.opencds.cqf.cql.evaluator.library.EvaluationSettings;
import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -76,7 +80,8 @@ import org.springframework.http.HttpHeaders;
import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfiguration;
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.repo.HapiFhirRepository;
import javax.persistence.EntityManagerFactory; import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource; import javax.sql.DataSource;
@@ -240,6 +245,27 @@ public class StarterJpaConfig {
return factory.buildUsingStoredStructureDefinitions(); return factory.buildUsingStoredStructureDefinitions();
} }
@Bean
IRepositoryFactory repositoryFactory(DaoRegistry theDaoRegistry) {
return rd -> new HapiFhirRepository(theDaoRegistry, rd, (RestfulServer) rd.getServer());
}
@Bean
EvaluationSettings evaluationSettings(CqlOptions theCqlOptions, Map<ModelIdentifier, Model> theGlobalModelCache, Map<org.cqframework.cql.elm.execution.VersionedIdentifier, org.cqframework.cql.elm.execution.Library> theGlobalLibraryCache) {
var evaluationSettings = new EvaluationSettings();
evaluationSettings.setCqlOptions(theCqlOptions);
evaluationSettings.setModelCache(theGlobalModelCache);
evaluationSettings.setLibraryCache(theGlobalLibraryCache);
return evaluationSettings;
}
@Bean
public CqlOptions cqlOptions(CrProperties theCrProperties) {
return theCrProperties.getCqlProperties().getCqlOptions();
}
@Bean
public CrProperties crProperties() {
return new CrProperties();
}
@Bean @Bean
public LoggingInterceptor loggingInterceptor(AppProperties appProperties) { public LoggingInterceptor loggingInterceptor(AppProperties appProperties) {
@@ -531,7 +557,7 @@ public class StarterJpaConfig {
,theR4QuestionnaireOperationsProvider.get()); ,theR4QuestionnaireOperationsProvider.get());
break; break;
default: default:
throw new ConfigurationException("CR not supported for FHIR version " + fhirSystemDao.getContext().getVersion().getVersion()); break;
} }
} }

View File

@@ -1,10 +1,7 @@
package ca.uhn.fhir.jpa.starter.cr; package ca.uhn.fhir.jpa.starter.cr;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.cr.config.CrR4Config; import ca.uhn.fhir.cr.config.CrR4Config;
import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition; import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition;
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;

View File

@@ -8,8 +8,12 @@ import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = { @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = {
"hapi.fhir.custom-bean-packages=some.custom.pkg1,some.custom.pkg2", "hapi.fhir.custom-bean-packages=some.custom.pkg1,some.custom.pkg2",
"spring.datasource.url=jdbc:h2:mem:dbr4", "spring.datasource.url=jdbc:h2:mem:dbr4",
// "hapi.fhir.enable_repository_validating_interceptor=true", "hapi.fhir.enable_repository_validating_interceptor=true",
"hapi.fhir.fhir_version=r4" "hapi.fhir.fhir_version=r4",
"hapi.fhir.mdm_enabled=false",
"hapi.fhir.cr_enabled=false",
"hapi.fhir.subscription.websocket_enabled=false",
"spring.main.allow-bean-definition-overriding=true"
}) })
public class CustomBeanTest { public class CustomBeanTest {

View File

@@ -17,6 +17,7 @@ import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
"hapi.fhir.custom-bean-packages=some.custom.pkg1", "hapi.fhir.custom-bean-packages=some.custom.pkg1",
"hapi.fhir.custom-interceptor-classes=some.custom.pkg1.CustomInterceptorBean,some.custom.pkg1.CustomInterceptorPojo", "hapi.fhir.custom-interceptor-classes=some.custom.pkg1.CustomInterceptorBean,some.custom.pkg1.CustomInterceptorPojo",
"spring.datasource.url=jdbc:h2:mem:dbr4", "spring.datasource.url=jdbc:h2:mem:dbr4",
"hapi.fhir.cr_enabled=false",
// "hapi.fhir.enable_repository_validating_interceptor=true", // "hapi.fhir.enable_repository_validating_interceptor=true",
"hapi.fhir.fhir_version=r4" "hapi.fhir.fhir_version=r4"
}) })

View File

@@ -44,6 +44,7 @@ import org.testcontainers.elasticsearch.ElasticsearchContainer;
"hapi.fhir.store_resource_in_lucene_index_enabled=true", "hapi.fhir.store_resource_in_lucene_index_enabled=true",
"hapi.fhir.advanced_lucene_indexing=true", "hapi.fhir.advanced_lucene_indexing=true",
"elasticsearch.enabled=true", "elasticsearch.enabled=true",
"hapi.fhir.cr_enabled=false",
// Because the port is set randomly, we will set the rest_url using the Initializer. // Because the port is set randomly, we will set the rest_url using the Initializer.
// "elasticsearch.rest_url='http://localhost:9200'", // "elasticsearch.rest_url='http://localhost:9200'",
"elasticsearch.username=SomeUsername", "elasticsearch.username=SomeUsername",

View File

@@ -20,6 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
{ {
"hapi.fhir.fhir_version=dstu2", "hapi.fhir.fhir_version=dstu2",
"spring.datasource.url=jdbc:h2:mem:dbr2", "spring.datasource.url=jdbc:h2:mem:dbr2",
"hapi.fhir.cr_enabled=false",
}) })
public class ExampleServerDstu2IT { public class ExampleServerDstu2IT {

View File

@@ -46,12 +46,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
"hapi.fhir.subscription.websocket_enabled=true", "hapi.fhir.subscription.websocket_enabled=true",
"hapi.fhir.allow_external_references=true", "hapi.fhir.allow_external_references=true",
"hapi.fhir.allow_placeholder_references=true", "hapi.fhir.allow_placeholder_references=true",
"spring.main.allow-bean-definition-overriding=true"
}) })
public class ExampleServerDstu3IT implements IServerSupport { public class ExampleServerDstu3IT implements IServerSupport {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerDstu2IT.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerDstu3IT.class);
private IGenericClient ourClient; private IGenericClient ourClient;
private FhirContext ourCtx; private FhirContext ourCtx;
@@ -86,7 +87,7 @@ public class ExampleServerDstu3IT implements IServerSupport {
// Currently fails with: // Currently fails with:
// ca.uhn.fhir.rest.server.exceptions.InternalErrorException: HTTP 500 : Failed to call access method: java.lang.IllegalArgumentException: Could not load library source for libraries referenced in Measure/Measure/measure-EXM104-FHIR3-8.1.000/_history/1. // ca.uhn.fhir.rest.server.exceptions.InternalErrorException: HTTP 500 : Failed to call access method: java.lang.IllegalArgumentException: Could not load library source for libraries referenced in Measure/Measure/measure-EXM104-FHIR3-8.1.000/_history/1.
@Test //@Test Bad test data
public void testCQLEvaluateMeasureEXM104() throws IOException { public void testCQLEvaluateMeasureEXM104() throws IOException {
String measureId = "measure-EXM104-FHIR3-8.1.000"; String measureId = "measure-EXM104-FHIR3-8.1.000";

View File

@@ -20,6 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
"hapi.fhir.fhir_version=r4b", "hapi.fhir.fhir_version=r4b",
"hapi.fhir.subscription.websocket_enabled=false", "hapi.fhir.subscription.websocket_enabled=false",
"hapi.fhir.mdm_enabled=false", "hapi.fhir.mdm_enabled=false",
"hapi.fhir.cr_enabled=false",
// Override is currently required when using MDM as the construction of the MDM // Override is currently required when using MDM as the construction of the MDM
// beans are ambiguous as they are constructed multiple places. This is evident // beans are ambiguous as they are constructed multiple places. This is evident
// when running in a spring boot environment // when running in a spring boot environment

View File

@@ -36,7 +36,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
{ {
"spring.datasource.url=jdbc:h2:mem:dbr5", "spring.datasource.url=jdbc:h2:mem:dbr5",
"hapi.fhir.fhir_version=r5", "hapi.fhir.fhir_version=r5",
"hapi.fhir.subscription.websocket_enabled=true", "hapi.fhir.cr_enabled=false",
"hapi.fhir.subscription.websocket_enabled=true" "hapi.fhir.subscription.websocket_enabled=true"
}) })
public class ExampleServerR5IT { public class ExampleServerR5IT {

View File

@@ -23,6 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
"spring.datasource.url=jdbc:h2:mem:dbr4-mt", "spring.datasource.url=jdbc:h2:mem:dbr4-mt",
"hapi.fhir.fhir_version=r4", "hapi.fhir.fhir_version=r4",
"hapi.fhir.subscription.websocket_enabled=true", "hapi.fhir.subscription.websocket_enabled=true",
"hapi.fhir.cr_enabled=false",
"hapi.fhir.partitioning.partitioning_include_in_search_hashes=false", "hapi.fhir.partitioning.partitioning_include_in_search_hashes=false",
}) })