diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/BinaryStorageIntegrationTest.java b/src/test/java/ca/uhn/fhir/jpa/starter/BinaryStorageIntegrationTest.java index f40368e18f..54ab520b50 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/BinaryStorageIntegrationTest.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/BinaryStorageIntegrationTest.java @@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.support.TransactionTemplate; @@ -142,6 +143,7 @@ private long regularFileCount(Path baseDir) throws IOException { } } +@ActiveProfiles("test") @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, @@ -212,6 +214,7 @@ private Set captureContentIds() { } } +@ActiveProfiles("test") @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, @@ -267,6 +270,7 @@ void cleanUpDirectory() throws IOException { } } +@ActiveProfiles("test") @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class, diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java b/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java index a51f5e31e6..5ec10a635c 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java @@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; import java.io.IOException; import java.util.concurrent.TimeUnit; @@ -36,6 +37,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.fail; +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, NicknameServiceConfig.class, RepositoryConfig.class, TestCdsHooksConfig.class, CrCdsHooksConfig.class, StarterCdsHooksConfig.class}, properties = { "spring.profiles.include=storageSettingsTest", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/CustomBeanTest.java b/src/test/java/ca/uhn/fhir/jpa/starter/CustomBeanTest.java index 3a7dee5484..789eb2d929 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/CustomBeanTest.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/CustomBeanTest.java @@ -4,7 +4,9 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "hapi.fhir.custom-bean-packages=some.custom.pkg1,some.custom.pkg2", "spring.datasource.url=jdbc:h2:mem:dbr4", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/CustomInterceptorTest.java b/src/test/java/ca/uhn/fhir/jpa/starter/CustomInterceptorTest.java index be0415cebb..24260431de 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/CustomInterceptorTest.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/CustomInterceptorTest.java @@ -12,7 +12,9 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; +import org.springframework.test.context.ActiveProfiles; +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "hapi.fhir.custom-bean-packages=some.custom.pkg1", "spring.jpa.properties.hibernate.search.backend.directory.type=local-heap", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/CustomOperationTest.java b/src/test/java/ca/uhn/fhir/jpa/starter/CustomOperationTest.java index 00c68f03e1..b26fd47314 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/CustomOperationTest.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/CustomOperationTest.java @@ -11,7 +11,9 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "hapi.fhir.custom-bean-packages=some.custom.pkg1", "hapi.fhir.custom-provider-classes=some.custom.pkg1.CustomOperationBean,some.custom.pkg1.CustomOperationPojo", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java index c834fc5031..77d5d6b9aa 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ElasticsearchLastNR4IT.java @@ -34,6 +34,7 @@ import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.testcontainers.elasticsearch.ElasticsearchContainer; @@ -43,6 +44,7 @@ @ExtendWith(SpringExtension.class) @Testcontainers @Disabled +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr4", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDbpmR5IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDbpmR5IT.java index f6ce91162f..24d8ad3639 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDbpmR5IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDbpmR5IT.java @@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.support.TransactionTemplate; @@ -26,6 +27,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; @ExtendWith(SpringExtension.class) +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr5_dbpm", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java index 97c5922b7c..6f9ad0c0b0 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java @@ -11,11 +11,13 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.junit.jupiter.api.Assertions.assertEquals; @ExtendWith(SpringExtension.class) +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "hapi.fhir.fhir_version=dstu2", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java index 930001ebfb..abc5eceef5 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java @@ -23,6 +23,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.core.io.ClassPathResource; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; import java.io.File; @@ -37,6 +38,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; @ExtendWith(SpringExtension.class) +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = { Application.class, diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java index e9e90bb40d..5d072bf721 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4BIT.java @@ -11,9 +11,11 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; import static org.junit.jupiter.api.Assertions.assertEquals; +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java index edb0890ffb..1794b224e7 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java @@ -29,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; import java.io.IOException; import java.net.URI; @@ -47,6 +48,7 @@ import static org.opencds.cqf.fhir.utility.r4.Parameters.parameters; import static org.opencds.cqf.fhir.utility.r4.Parameters.stringPart; +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = { Application.class, diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java index 2ea57b6ff6..c23eab36e7 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR5IT.java @@ -17,6 +17,7 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; import java.net.URI; @@ -26,6 +27,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @ExtendWith(SpringExtension.class) +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr5", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/McpTests.java b/src/test/java/ca/uhn/fhir/jpa/starter/McpTests.java index 05f990eada..4fd5dbe61a 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/McpTests.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/McpTests.java @@ -14,6 +14,7 @@ import org.opencds.cqf.fhir.cr.hapi.config.RepositoryConfig; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; import java.time.Duration; import java.util.LinkedHashMap; @@ -22,6 +23,7 @@ import static org.assertj.core.api.Assertions.assertThat; +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, NicknameServiceConfig.class, RepositoryConfig.class}, properties = {"spring.datasource.url=jdbc:h2:mem:dbr4", "hapi.fhir.fhir_version=r4", "hibernate.search.enabled=true", "spring.ai.mcp.server.enabled=true",}) public class McpTests { diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/MdmTest.java b/src/test/java/ca/uhn/fhir/jpa/starter/MdmTest.java index 4d53428e80..d18f3f32b8 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/MdmTest.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/MdmTest.java @@ -9,7 +9,9 @@ import org.springframework.boot.test.context.SpringBootTest; import ca.uhn.fhir.jpa.nickname.INicknameSvc; +import org.springframework.test.context.ActiveProfiles; +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = { "hapi.fhir.fhir_version=r4", "hapi.fhir.mdm_enabled=true" diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java index 3d294655ee..4e16b2d418 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/MultitenantServerR4IT.java @@ -17,11 +17,13 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.junit.jupiter.api.Assertions.assertEquals; @ExtendWith(SpringExtension.class) +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr4-mt", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ParallelUpdatesVersionConflictTest.java b/src/test/java/ca/uhn/fhir/jpa/starter/ParallelUpdatesVersionConflictTest.java index d0f2334a2f..0e4a664a71 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ParallelUpdatesVersionConflictTest.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ParallelUpdatesVersionConflictTest.java @@ -24,9 +24,11 @@ import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; +import org.springframework.test.context.ActiveProfiles; import static org.junit.jupiter.api.Assertions.assertThrows; +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = { "spring.datasource.url=jdbc:h2:mem:dbr4", "hapi.fhir.fhir_version=r4", diff --git a/src/test/resources/application-test.yaml b/src/test/resources/application-test.yaml index 1e08a22438..a8cd4ab0f3 100644 --- a/src/test/resources/application-test.yaml +++ b/src/test/resources/application-test.yaml @@ -1,165 +1,6 @@ - - hapi: fhir: - ### This enables the swagger-ui at /fhir/swagger-ui/index.html as well as the /fhir/api-docs (see https://hapifhir.io/hapi-fhir/docs/server_plain/openapi.html) - openapi_enabled: true - ### This is the FHIR version. Choose between, DSTU2, DSTU3, R4 or R5 fhir_version: R4 - ### enable to use the ApacheProxyAddressStrategy which uses X-Forwarded-* headers - ### to determine the FHIR server address - # use_apache_address_strategy: false - ### forces the use of the https:// protocol for the returned server address. - ### alternatively, it may be set using the X-Forwarded-Proto header. - # use_apache_address_strategy_https: false - ### enable to set the Server URL - # server_address: http://hapi.fhir.org/baseR4 - # defer_indexing_for_codesystems_of_size: 101 - ### Flag is true by default. This flag filters resources during package installation, allowing only those resources with a valid status (e.g. active) to be installed. - # validate_resource_status_for_package_upload: false - # install_transitive_ig_dependencies: true - # implementationguides: - ### example from registry (packages.fhir.org) - # swiss: - # name: swiss.mednet.fhir - # version: 0.8.0 - # reloadExisting : false - # example not from registry - # ips_1_0_0: - # packageUrl: https://build.fhir.org/ig/HL7/fhir-ips/package.tgz - # name: hl7.fhir.uv.ips - # version: 1.0.0 - # supported_resource_types: - # - Patient - # - Observation - # allow_cascading_deletes: true - # allow_contains_searches: true - # allow_external_references: true - # allow_multiple_delete: true - # allow_override_default_search_params: true - # auto_create_placeholder_reference_targets: false - # cr_enabled: true - # default_encoding: JSON - # default_pretty_print: true - # default_page_size: 20 - # delete_expunge_enabled: true - # enable_repository_validating_interceptor: false - # enable_index_missing_fields: false - # enable_index_of_type: true - # enable_index_contained_resource: false - ### !!Extended Lucene/Elasticsearch Indexing is still an experimental feature, expect some features (e.g. _total=accurate) to not work as expected!! - ### more information here: https://hapifhir.io/hapi-fhir/docs/server_jpa/elastic.html advanced_lucene_indexing: false search_index_full_text_enabled: false - # enforce_referential_integrity_on_delete: false - # This is an experimental feature, and does not fully support _total and other FHIR features. - # enforce_referential_integrity_on_delete: false - # enforce_referential_integrity_on_write: false - # etag_support_enabled: true - # expunge_enabled: true - # daoconfig_client_id_strategy: null - # client_id_strategy: ALPHANUMERIC - # fhirpath_interceptor_enabled: false - # filter_search_enabled: true - # graphql_enabled: true - # narrative_enabled: true - # mdm_enabled: true - # local_base_urls: - # - https://hapi.fhir.org/baseR4 mdm_enabled: false - - ### Uncomment the following section, and any sub-properties you need in order to enable - ### partitioning support on this server. - # partitioning: - # allow_references_across_partitions: false - # partitioning_include_in_search_hashes: false - # default_partition_id: 0 - # ### Enable the following setting to enable Database Partitioning Mode - # ### See: https://hapifhir.io/hapi-fhir/docs/server_jpa_partitioning/db_partition_mode.html - # database_partition_mode_enabled: false - # ### Partition Style: Partitioning requires a partition interceptor which helps the server - # ### select which partition(s) should be accessed for a given request. You can supply your - # ### own interceptor (see https://hapifhir.io/hapi-fhir/docs/server_jpa_partitioning/partitioning.html#partition-interceptors ) - # ### but the following setting can also be used to use a built-in form. - # ### Patient ID Partitioning Mode uses the patient/subject ID to determine the partition - # patient_id_partitioning_mode: false - # ### Request tenant mode can be used for a multi-tenancy setup where the request path is - # ### expected to have an additional path element, e.g. GET http://example.com/fhir/TENANT-ID/Patient/A - # request_tenant_partitioning_mode: false - - - #cors: - # allow_Credentials: true - # These are allowed_origin patterns, see: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/cors/CorsConfiguration.html#setAllowedOriginPatterns-java.util.List- - # allowed_origin: - # - '*' - - # Search coordinator thread pool sizes - search-coord-core-pool-size: 20 - search-coord-max-pool-size: 100 - search-coord-queue-capacity: 200 - - # Threadpool size for BATCH'ed GETs in a bundle. - # bundle_batch_pool_size: 10 - # bundle_batch_pool_max_size: 50 - - # logger: - # error_format: 'ERROR - ${requestVerb} ${requestUrl}' - # format: >- - # Path[${servletPath}] Source[${requestHeader.x-forwarded-for}] - # Operation[${operationType} ${operationName} ${idOrResourceName}] - # UA[${requestHeader.user-agent}] Params[${requestParameters}] - # ResponseEncoding[${responseEncodingNoDefault}] - # log_exceptions: true - # name: fhirtest.access - # max_binary_size: 104857600 - # max_page_size: 200 - # retain_cached_searches_mins: 60 - # reuse_cached_search_results_millis: 60000 - tester: - home: - name: Local Tester - server_address: 'http://localhost:8080/fhir' - refuse_to_fetch_third_party_urls: false - fhir_version: R4 - global: - name: Global Tester - server_address: "http://hapi.fhir.org/baseR4" - refuse_to_fetch_third_party_urls: false - fhir_version: R4 -# validation: -# requests_enabled: true -# responses_enabled: true -# binary_storage_enabled: true -# bulk_export_enabled: true -# subscription: -# resthook_enabled: true -# websocket_enabled: false -# email: -# from: some@test.com -# host: google.com -# port: -# username: -# password: -# auth: -# startTlsEnable: -# startTlsRequired: -# quitWait: -# lastn_enabled: true -# store_resource_in_lucene_index_enabled: true -### This is configuration for normalized quantity serach level default is 0 -### 0: NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED - default -### 1: NORMALIZED_QUANTITY_STORAGE_SUPPORTED -### 2: NORMALIZED_QUANTITY_SEARCH_SUPPORTED -# normalized_quantity_search_level: 2 -#elasticsearch: -# debug: -# pretty_print_json_log: false -# refresh_after_write: false -# enabled: false -# password: SomePassword -# required_index_status: YELLOW -# rest_url: 'localhost:9200' -# protocol: 'http' -# schema_management_strategy: CREATE -# username: SomeUsername