From 3c6ed0e6ff2d7ae62aaa1a26933482f31e32c5ac Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Sat, 18 Jan 2025 16:04:19 +0100 Subject: [PATCH] set proper profiles --- .../debitor/HsBookingDebitorRepository.java | 4 +- .../BookingItemCreatedEventRepository.java | 2 + .../booking/item/HsBookingItemController.java | 2 + .../item/HsBookingItemRbacRepository.java | 2 + .../item/HsBookingItemRealRepository.java | 2 + .../booking/item/HsBookingItemRepository.java | 3 + .../project/HsBookingProjectController.java | 2 + .../HsBookingProjectRbacRepository.java | 2 + .../HsBookingProjectRealRepository.java | 2 + .../project/HsBookingProjectRepository.java | 2 + .../asset/HsHostingAssetController.java | 2 + .../asset/HsHostingAssetPropsController.java | 2 + .../asset/HsHostingAssetRbacRepository.java | 3 +- .../asset/HsHostingAssetRealRepository.java | 2 + .../asset/HsHostingAssetRepository.java | 2 + .../HsBookingItemCreatedListener.java | 2 + src/main/resources/application.yml | 55 +-------------- .../db/changelog/1-rbac/1050-rbac-base.sql | 2 +- .../db/changelog/1-rbac/1080-rbac-global.sql | 4 +- .../2018-rbactest-customer-test-data.sql | 2 +- .../2028-rbactest-package-test-data.sql | 2 +- .../2038-rbactest-domain-test-data.sql | 2 +- .../5018-hs-office-contact-test-data.sql | 2 +- .../5028-hs-office-person-test-data.sql | 2 +- .../5038-hs-office-relation-test-data.sql | 2 +- .../5048-hs-office-partner-test-data.sql | 2 +- .../5058-hs-office-bankaccount-test-data.sql | 2 +- .../5068-hs-office-debitor-test-data.sql | 2 +- .../5078-hs-office-sepamandate-test-data.sql | 2 +- .../5108-hs-office-membership-test-data.sql | 2 +- .../5118-hs-office-coopshares-test-data.sql | 2 +- .../5128-hs-office-coopassets-test-data.sql | 2 +- .../6208-hs-booking-project-test-data.sql | 2 +- .../6308-hs-booking-item-test-data.sql | 2 +- .../7018-hs-hosting-asset-test-data.sql | 2 +- .../db/changelog/db.changelog-master.yaml | 68 +++++++++---------- .../config/ActuatorSanitizerUnitTest.java | 2 +- ...asAuthenticationFilterIntegrationTest.java | 2 +- .../WebSecurityConfigIntegrationTest.java | 2 +- ...HsBookingItemControllerAcceptanceTest.java | 2 +- .../item/HsBookingItemControllerRestTest.java | 2 +- ...ookingProjectControllerAcceptanceTest.java | 2 +- ...sHostingAssetControllerAcceptanceTest.java | 2 +- .../HsHostingAssetControllerRestTest.java | 2 +- ...ingAssetPropsControllerAcceptanceTest.java | 2 +- .../hs/migration/ImportHostingAssets.java | 2 + .../hs/migration/ImportOfficeData.java | 2 + 47 files changed, 102 insertions(+), 117 deletions(-) diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/debitor/HsBookingDebitorRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/debitor/HsBookingDebitorRepository.java index 8d0bbe30..7273c444 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/debitor/HsBookingDebitorRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/debitor/HsBookingDebitorRepository.java @@ -2,12 +2,14 @@ package net.hostsharing.hsadminng.hs.booking.debitor; import io.micrometer.core.annotation.Timed; import org.springframework.data.repository.Repository; +import org.springframework.context.annotation.Profile; import java.util.List; import java.util.Optional; import java.util.UUID; -public interface HsBookingDebitorRepository extends Repository { +@Profile("!only-office") +public interface HsBookingDebitorRepository extends Repository { @Timed("app.booking.debitor.repo.findByUuid") Optional findByUuid(UUID id); diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/BookingItemCreatedEventRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/BookingItemCreatedEventRepository.java index f94f1458..2ae18218 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/BookingItemCreatedEventRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/BookingItemCreatedEventRepository.java @@ -1,10 +1,12 @@ package net.hostsharing.hsadminng.hs.booking.item; import io.micrometer.core.annotation.Timed; +import org.springframework.context.annotation.Profile; import org.springframework.data.repository.Repository; import java.util.UUID; +@Profile("!only-office") public interface BookingItemCreatedEventRepository extends Repository { @Timed("app.booking.items.repo.save") diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java index 6facc03f..6b563041 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java @@ -16,6 +16,7 @@ import net.hostsharing.hsadminng.mapper.StrictMapper; import net.hostsharing.hsadminng.persistence.EntityManagerWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; +import org.springframework.context.annotation.Profile; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RestController; @@ -30,6 +31,7 @@ import static java.util.Optional.ofNullable; import static net.hostsharing.hsadminng.mapper.PostgresDateRange.toPostgresDateRange; @RestController +@Profile("!only-office") public class HsBookingItemController implements HsBookingItemsApi { @Autowired diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRbacRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRbacRepository.java index 392b7077..6715e610 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRbacRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRbacRepository.java @@ -1,12 +1,14 @@ package net.hostsharing.hsadminng.hs.booking.item; import io.micrometer.core.annotation.Timed; +import org.springframework.context.annotation.Profile; import org.springframework.data.repository.Repository; import java.util.List; import java.util.Optional; import java.util.UUID; +@Profile("!only-office") public interface HsBookingItemRbacRepository extends HsBookingItemRepository, Repository { diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRealRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRealRepository.java index 706b1349..ef4c205b 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRealRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRealRepository.java @@ -1,12 +1,14 @@ package net.hostsharing.hsadminng.hs.booking.item; import io.micrometer.core.annotation.Timed; +import org.springframework.context.annotation.Profile; import org.springframework.data.repository.Repository; import java.util.List; import java.util.Optional; import java.util.UUID; +@Profile("!only-office") public interface HsBookingItemRealRepository extends HsBookingItemRepository, Repository { diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRepository.java index 67cb8efc..310027cb 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRepository.java @@ -1,10 +1,13 @@ package net.hostsharing.hsadminng.hs.booking.item; +import org.springframework.context.annotation.Profile; + import java.util.List; import java.util.Optional; import java.util.UUID; +@Profile("!only-office") public interface HsBookingItemRepository { Optional findByUuid(final UUID bookingItemUuid); diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectController.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectController.java index 98b856b9..11c135dd 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectController.java @@ -9,6 +9,7 @@ import net.hostsharing.hsadminng.hs.booking.generated.api.v1.model.HsBookingProj import net.hostsharing.hsadminng.hs.booking.generated.api.v1.model.HsBookingProjectResource; import net.hostsharing.hsadminng.mapper.StrictMapper; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Profile; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RestController; @@ -20,6 +21,7 @@ import java.util.UUID; import java.util.function.BiConsumer; @RestController +@Profile("!only-office") public class HsBookingProjectController implements HsBookingProjectsApi { @Autowired diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRbacRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRbacRepository.java index 63065bb2..a9360b34 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRbacRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRbacRepository.java @@ -1,12 +1,14 @@ package net.hostsharing.hsadminng.hs.booking.project; import io.micrometer.core.annotation.Timed; +import org.springframework.context.annotation.Profile; import org.springframework.data.repository.Repository; import java.util.List; import java.util.Optional; import java.util.UUID; +@Profile("!only-office") public interface HsBookingProjectRbacRepository extends HsBookingProjectRepository, Repository { diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRealRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRealRepository.java index 66b978b5..cc2e9a28 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRealRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRealRepository.java @@ -1,12 +1,14 @@ package net.hostsharing.hsadminng.hs.booking.project; import io.micrometer.core.annotation.Timed; +import org.springframework.context.annotation.Profile; import org.springframework.data.repository.Repository; import java.util.List; import java.util.Optional; import java.util.UUID; +@Profile("!only-office") public interface HsBookingProjectRealRepository extends HsBookingProjectRepository, Repository { diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRepository.java index 0b9c7871..1f652196 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRepository.java @@ -1,11 +1,13 @@ package net.hostsharing.hsadminng.hs.booking.project; import io.micrometer.core.annotation.Timed; +import org.springframework.context.annotation.Profile; import java.util.List; import java.util.Optional; import java.util.UUID; +@Profile("!only-office") public interface HsBookingProjectRepository { @Timed("app.booking.projects.repo.findByUuid") diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetController.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetController.java index f9a45f70..7d12d714 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetController.java @@ -15,6 +15,7 @@ import net.hostsharing.hsadminng.mapper.KeyValueMap; import net.hostsharing.hsadminng.mapper.StrictMapper; import net.hostsharing.hsadminng.persistence.EntityManagerWrapper; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Profile; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RestController; @@ -27,6 +28,7 @@ import java.util.UUID; import java.util.function.BiConsumer; @RestController +@Profile("!only-office") public class HsHostingAssetController implements HsHostingAssetsApi { @Autowired diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsController.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsController.java index b4c56f4c..d843ff87 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsController.java @@ -4,6 +4,7 @@ import io.micrometer.core.annotation.Timed; import net.hostsharing.hsadminng.hs.hosting.asset.validators.HostingAssetEntityValidatorRegistry; import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.api.HsHostingAssetPropsApi; import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.model.HsHostingAssetTypeResource; +import org.springframework.context.annotation.Profile; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RestController; @@ -12,6 +13,7 @@ import java.util.Map; @RestController +@Profile("!only-office") public class HsHostingAssetPropsController implements HsHostingAssetPropsApi { @Override diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRbacRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRbacRepository.java index 75a9863f..bdb6a65e 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRbacRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRbacRepository.java @@ -1,6 +1,7 @@ package net.hostsharing.hsadminng.hs.hosting.asset; import io.micrometer.core.annotation.Timed; +import org.springframework.context.annotation.Profile; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; @@ -8,7 +9,7 @@ import java.util.List; import java.util.Optional; import java.util.UUID; - +@Profile("!only-office") public interface HsHostingAssetRbacRepository extends HsHostingAssetRepository, Repository { @Timed("app.hostingAsset.repo.findByUuid.rbac") diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRealRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRealRepository.java index 64fc44bd..4853b665 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRealRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRealRepository.java @@ -1,6 +1,7 @@ package net.hostsharing.hsadminng.hs.hosting.asset; import io.micrometer.core.annotation.Timed; +import org.springframework.context.annotation.Profile; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; @@ -9,6 +10,7 @@ import java.util.List; import java.util.Optional; import java.util.UUID; +@Profile("!only-office") public interface HsHostingAssetRealRepository extends HsHostingAssetRepository, Repository { @Timed("app.hostingAsset.repo.findByUuid.real") diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRepository.java index a473accc..c87f6a2c 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRepository.java @@ -1,11 +1,13 @@ package net.hostsharing.hsadminng.hs.hosting.asset; import io.micrometer.core.annotation.Timed; +import org.springframework.context.annotation.Profile; import java.util.List; import java.util.Optional; import java.util.UUID; +@Profile("!only-office") public interface HsHostingAssetRepository { @Timed("app.hosting.assets.repo.findByUuid") diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/factories/HsBookingItemCreatedListener.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/factories/HsBookingItemCreatedListener.java index 73291368..d26ebe55 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/factories/HsBookingItemCreatedListener.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/factories/HsBookingItemCreatedListener.java @@ -13,9 +13,11 @@ import net.hostsharing.hsadminng.mapper.StrictMapper; import net.hostsharing.hsadminng.persistence.EntityManagerWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; +import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; @Component +@Profile("!only-office") public class HsBookingItemCreatedListener implements ApplicationListener { @Autowired diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 4943eb60..60fd285e 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -30,6 +30,7 @@ management: enabled: true spring: + datasource: driver-class-name: org.postgresql.Driver password: password @@ -46,8 +47,7 @@ spring: dialect: net.hostsharing.hsadminng.config.PostgresCustomDialect liquibase: - # default just as a marker to show from which profile it comes - contexts: default,dev,rbac-test,office,office-test,booking,booking-test,hosting,hosting-test,pg_stat_statements + contexts: ${spring.profiles.active} # keep this in sync with test/.../application.yml springdoc: @@ -66,54 +66,3 @@ metrics: http: server: requests: true - ---- - -# the 'dev-all' profile automatically creates the PgSql users and runs all modules without test-data -spring: - config: - activate: - on-profile: dev-all - liquibase: - contexts: dev,office,booking,hosting,pg_stat_statements - ---- - -# the 'dev-all' profile automatically creates the PgSql users and runs all modules with test-data -spring: - config: - activate: - on-profile: dev-all-test - liquibase: - contexts: dev,rbac-test,office,office-test,booking,booking-test,hosting,hosting-test,pg_stat_statements - ---- - -# the 'dev-office' profile automatically creates the PgSql users and runs only the office module without test-data -spring: - config: - activate: - on-profile: dev-office - liquibase: - contexts: dev,office,pg_stat_statements - ---- - -# the 'dev-office' profile automatically creates the PgSql users and runs only the office module with test-data -spring: - config: - activate: - on-profile: dev-office-test - liquibase: - contexts: dev,rbac-test,office,office-test,pg_stat_statements - ---- - -# the 'prod-office' profile expects that the PgSql users are already created and runs only the office module without test-data -spring: - config: - activate: - on-profile: prod-office - liquibase: - contexts: office - diff --git a/src/main/resources/db/changelog/1-rbac/1050-rbac-base.sql b/src/main/resources/db/changelog/1-rbac/1050-rbac-base.sql index bdcd9368..04bd36d2 100644 --- a/src/main/resources/db/changelog/1-rbac/1050-rbac-base.sql +++ b/src/main/resources/db/changelog/1-rbac/1050-rbac-base.sql @@ -870,7 +870,7 @@ $$; -- ============================================================================ ---changeset michael.hoennig:rbac-base-PGSQL-ROLES context:dev,tc endDelimiter:--// +--changeset michael.hoennig:rbac-base-PGSQL-ROLES context:!external-db endDelimiter:--// -- ---------------------------------------------------------------------------- do $$ diff --git a/src/main/resources/db/changelog/1-rbac/1080-rbac-global.sql b/src/main/resources/db/changelog/1-rbac/1080-rbac-global.sql index 28575733..22ff2310 100644 --- a/src/main/resources/db/changelog/1-rbac/1080-rbac-global.sql +++ b/src/main/resources/db/changelog/1-rbac/1080-rbac-global.sql @@ -170,7 +170,7 @@ commit; -- ============================================================================ ---changeset michael.hoennig:rbac-global-ADMIN-USERS context:dev,tc endDelimiter:--// +--changeset michael.hoennig:rbac-global-ADMIN-USERS context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- /* Create two users and assign both to the administrators' role. @@ -192,7 +192,7 @@ $$; -- ============================================================================ ---changeset michael.hoennig:rbac-global-TEST context:dev,tc runAlways:true endDelimiter:--// +--changeset michael.hoennig:rbac-global-TEST context:!without-test-data runAlways:true endDelimiter:--// -- ---------------------------------------------------------------------------- /* diff --git a/src/main/resources/db/changelog/2-rbactest/201-rbactest-customer/2018-rbactest-customer-test-data.sql b/src/main/resources/db/changelog/2-rbactest/201-rbactest-customer/2018-rbactest-customer-test-data.sql index 18c23fe4..0f9e8a8a 100644 --- a/src/main/resources/db/changelog/2-rbactest/201-rbactest-customer/2018-rbactest-customer-test-data.sql +++ b/src/main/resources/db/changelog/2-rbactest/201-rbactest-customer/2018-rbactest-customer-test-data.sql @@ -67,7 +67,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:test-customer-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:test-customer-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/2-rbactest/202-rbactest-package/2028-rbactest-package-test-data.sql b/src/main/resources/db/changelog/2-rbactest/202-rbactest-package/2028-rbactest-package-test-data.sql index eae1342f..dc62a8f1 100644 --- a/src/main/resources/db/changelog/2-rbactest/202-rbactest-package/2028-rbactest-package-test-data.sql +++ b/src/main/resources/db/changelog/2-rbactest/202-rbactest-package/2028-rbactest-package-test-data.sql @@ -59,7 +59,7 @@ $$; -- ============================================================================ ---changeset michael.hoennig:test-package-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:test-package-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/2-rbactest/203-rbactest-domain/2038-rbactest-domain-test-data.sql b/src/main/resources/db/changelog/2-rbactest/203-rbactest-domain/2038-rbactest-domain-test-data.sql index 5fbbfa8c..eb0a3af5 100644 --- a/src/main/resources/db/changelog/2-rbactest/203-rbactest-domain/2038-rbactest-domain-test-data.sql +++ b/src/main/resources/db/changelog/2-rbactest/203-rbactest-domain/2038-rbactest-domain-test-data.sql @@ -52,7 +52,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:hs-domain-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:hs-domain-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/5-hs-office/501-contact/5018-hs-office-contact-test-data.sql b/src/main/resources/db/changelog/5-hs-office/501-contact/5018-hs-office-contact-test-data.sql index 036fd7e2..f44772ff 100644 --- a/src/main/resources/db/changelog/5-hs-office/501-contact/5018-hs-office-contact-test-data.sql +++ b/src/main/resources/db/changelog/5-hs-office/501-contact/5018-hs-office-contact-test-data.sql @@ -55,7 +55,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:hs-office-contact-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:hs-office-contact-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data.sql b/src/main/resources/db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data.sql index 49380a13..1be4c25d 100644 --- a/src/main/resources/db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data.sql +++ b/src/main/resources/db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data.sql @@ -34,7 +34,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:hs-office-person-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:hs-office-person-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/5-hs-office/503-relation/5038-hs-office-relation-test-data.sql b/src/main/resources/db/changelog/5-hs-office/503-relation/5038-hs-office-relation-test-data.sql index 6673d572..28ce12bd 100644 --- a/src/main/resources/db/changelog/5-hs-office/503-relation/5038-hs-office-relation-test-data.sql +++ b/src/main/resources/db/changelog/5-hs-office/503-relation/5038-hs-office-relation-test-data.sql @@ -80,7 +80,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:hs-office-relation-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:hs-office-relation-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/5-hs-office/504-partner/5048-hs-office-partner-test-data.sql b/src/main/resources/db/changelog/5-hs-office/504-partner/5048-hs-office-partner-test-data.sql index 3a6ced65..03cce30d 100644 --- a/src/main/resources/db/changelog/5-hs-office/504-partner/5048-hs-office-partner-test-data.sql +++ b/src/main/resources/db/changelog/5-hs-office/504-partner/5048-hs-office-partner-test-data.sql @@ -66,7 +66,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:hs-office-partner-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:hs-office-partner-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/5-hs-office/505-bankaccount/5058-hs-office-bankaccount-test-data.sql b/src/main/resources/db/changelog/5-hs-office/505-bankaccount/5058-hs-office-bankaccount-test-data.sql index 7aedc340..7c7f5884 100644 --- a/src/main/resources/db/changelog/5-hs-office/505-bankaccount/5058-hs-office-bankaccount-test-data.sql +++ b/src/main/resources/db/changelog/5-hs-office/505-bankaccount/5058-hs-office-bankaccount-test-data.sql @@ -26,7 +26,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:hs-office-bankaccount-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:hs-office-bankaccount-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/5-hs-office/506-debitor/5068-hs-office-debitor-test-data.sql b/src/main/resources/db/changelog/5-hs-office/506-debitor/5068-hs-office-debitor-test-data.sql index 1133621d..78a8c7f9 100644 --- a/src/main/resources/db/changelog/5-hs-office/506-debitor/5068-hs-office-debitor-test-data.sql +++ b/src/main/resources/db/changelog/5-hs-office/506-debitor/5068-hs-office-debitor-test-data.sql @@ -45,7 +45,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:hs-office-debitor-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:hs-office-debitor-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/5-hs-office/507-sepamandate/5078-hs-office-sepamandate-test-data.sql b/src/main/resources/db/changelog/5-hs-office/507-sepamandate/5078-hs-office-sepamandate-test-data.sql index 4bed9841..f8698197 100644 --- a/src/main/resources/db/changelog/5-hs-office/507-sepamandate/5078-hs-office-sepamandate-test-data.sql +++ b/src/main/resources/db/changelog/5-hs-office/507-sepamandate/5078-hs-office-sepamandate-test-data.sql @@ -38,7 +38,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:hs-office-sepaMandate-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:hs-office-sepaMandate-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/5-hs-office/510-membership/5108-hs-office-membership-test-data.sql b/src/main/resources/db/changelog/5-hs-office/510-membership/5108-hs-office-membership-test-data.sql index f67424a9..b5355871 100644 --- a/src/main/resources/db/changelog/5-hs-office/510-membership/5108-hs-office-membership-test-data.sql +++ b/src/main/resources/db/changelog/5-hs-office/510-membership/5108-hs-office-membership-test-data.sql @@ -28,7 +28,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:hs-office-membership-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:hs-office-membership-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/5-hs-office/511-coopshares/5118-hs-office-coopshares-test-data.sql b/src/main/resources/db/changelog/5-hs-office/511-coopshares/5118-hs-office-coopshares-test-data.sql index 5dd06009..b5d5e5a2 100644 --- a/src/main/resources/db/changelog/5-hs-office/511-coopshares/5118-hs-office-coopshares-test-data.sql +++ b/src/main/resources/db/changelog/5-hs-office/511-coopshares/5118-hs-office-coopshares-test-data.sql @@ -38,7 +38,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:hs-office-coopSharesTransaction-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:hs-office-coopSharesTransaction-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/5-hs-office/512-coopassets/5128-hs-office-coopassets-test-data.sql b/src/main/resources/db/changelog/5-hs-office/512-coopassets/5128-hs-office-coopassets-test-data.sql index 2ce3186b..78cf0302 100644 --- a/src/main/resources/db/changelog/5-hs-office/512-coopassets/5128-hs-office-coopassets-test-data.sql +++ b/src/main/resources/db/changelog/5-hs-office/512-coopassets/5128-hs-office-coopassets-test-data.sql @@ -44,7 +44,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:hs-office-coopAssetsTransaction-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:hs-office-coopAssetsTransaction-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/6-hs-booking/620-booking-project/6208-hs-booking-project-test-data.sql b/src/main/resources/db/changelog/6-hs-booking/620-booking-project/6208-hs-booking-project-test-data.sql index a5dd9596..6773973c 100644 --- a/src/main/resources/db/changelog/6-hs-booking/620-booking-project/6208-hs-booking-project-test-data.sql +++ b/src/main/resources/db/changelog/6-hs-booking/620-booking-project/6208-hs-booking-project-test-data.sql @@ -34,7 +34,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:hs-booking-project-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:hs-booking-project-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/6-hs-booking/630-booking-item/6308-hs-booking-item-test-data.sql b/src/main/resources/db/changelog/6-hs-booking/630-booking-item/6308-hs-booking-item-test-data.sql index a0b7470a..12c9d254 100644 --- a/src/main/resources/db/changelog/6-hs-booking/630-booking-item/6308-hs-booking-item-test-data.sql +++ b/src/main/resources/db/changelog/6-hs-booking/630-booking-item/6308-hs-booking-item-test-data.sql @@ -40,7 +40,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:hs-booking-item-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:hs-booking-item-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/7-hs-hosting/701-hosting-asset/7018-hs-hosting-asset-test-data.sql b/src/main/resources/db/changelog/7-hs-hosting/701-hosting-asset/7018-hs-hosting-asset-test-data.sql index 99b9f6f7..7337101d 100644 --- a/src/main/resources/db/changelog/7-hs-hosting/701-hosting-asset/7018-hs-hosting-asset-test-data.sql +++ b/src/main/resources/db/changelog/7-hs-hosting/701-hosting-asset/7018-hs-hosting-asset-test-data.sql @@ -105,7 +105,7 @@ end; $$; -- ============================================================================ ---changeset michael.hoennig:hs-hosting-asset-TEST-DATA-GENERATION –context=dev,tc endDelimiter:--// +--changeset michael.hoennig:hs-hosting-asset-TEST-DATA-GENERATION context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ diff --git a/src/main/resources/db/changelog/db.changelog-master.yaml b/src/main/resources/db/changelog/db.changelog-master.yaml index 19cb724f..2eb8908c 100644 --- a/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/src/main/resources/db/changelog/db.changelog-master.yaml @@ -53,34 +53,34 @@ databaseChangeLog: - include: file: db/changelog/2-rbactest/200-rbactest-schema.sql - context: rbac-test + context: "!without-test-data" - include: file: db/changelog/2-rbactest/201-rbactest-customer/2010-rbactest-customer.sql - context: rbac-test + context: "!without-test-data" - include: file: db/changelog/2-rbactest/201-rbactest-customer/2013-rbactest-customer-rbac.sql - context: rbac-test + context: "!without-test-data" - include: file: db/changelog/2-rbactest/201-rbactest-customer/2018-rbactest-customer-test-data.sql - context: rbac-test + context: "!without-test-data" - include: file: db/changelog/2-rbactest/202-rbactest-package/2020-rbactest-package.sql - context: rbac-test + context: "!without-test-data" - include: file: db/changelog/2-rbactest/202-rbactest-package/2023-rbactest-package-rbac.sql - context: rbac-test + context: "!without-test-data" - include: file: db/changelog/2-rbactest/202-rbactest-package/2028-rbactest-package-test-data.sql - context: rbac-test + context: "!without-test-data" - include: file: db/changelog/2-rbactest/203-rbactest-domain/2030-rbactest-domain.sql - context: rbac-test + context: "!without-test-data" - include: file: db/changelog/2-rbactest/203-rbactest-domain/2033-rbactest-domain-rbac.sql - context: rbac-test + context: "!without-test-data" - include: file: db/changelog/2-rbactest/203-rbactest-domain/2038-rbactest-domain-test-data.sql - context: rbac-test + context: "!without-test-data" - include: file: db/changelog/5-hs-office/500-hs-office-schema.sql @@ -92,21 +92,21 @@ databaseChangeLog: file: db/changelog/5-hs-office/501-contact/5016-hs-office-contact-migration.sql - include: file: db/changelog/5-hs-office/501-contact/5018-hs-office-contact-test-data.sql - context: office-test + context: "!without-test-data" - include: file: db/changelog/5-hs-office/502-person/5020-hs-office-person.sql - include: file: db/changelog/5-hs-office/502-person/5023-hs-office-person-rbac.sql - include: file: db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data.sql - context: office-test + context: "!without-test-data" - include: file: db/changelog/5-hs-office/503-relation/5030-hs-office-relation.sql - include: file: db/changelog/5-hs-office/503-relation/5033-hs-office-relation-rbac.sql - include: file: db/changelog/5-hs-office/503-relation/5038-hs-office-relation-test-data.sql - context: office-test + context: "!without-test-data" - include: file: db/changelog/5-hs-office/504-partner/5040-hs-office-partner.sql - include: @@ -117,21 +117,21 @@ databaseChangeLog: file: db/changelog/5-hs-office/504-partner/5046-hs-office-partner-migration.sql - include: file: db/changelog/5-hs-office/504-partner/5048-hs-office-partner-test-data.sql - context: office-test + context: "!without-test-data" - include: file: db/changelog/5-hs-office/505-bankaccount/5050-hs-office-bankaccount.sql - include: file: db/changelog/5-hs-office/505-bankaccount/5053-hs-office-bankaccount-rbac.sql - include: file: db/changelog/5-hs-office/505-bankaccount/5058-hs-office-bankaccount-test-data.sql - context: office-test + context: "!without-test-data" - include: file: db/changelog/5-hs-office/506-debitor/5060-hs-office-debitor.sql - include: file: db/changelog/5-hs-office/506-debitor/5063-hs-office-debitor-rbac.sql - include: file: db/changelog/5-hs-office/506-debitor/5068-hs-office-debitor-test-data.sql - context: office-test + context: "!without-test-data" - include: file: db/changelog/5-hs-office/507-sepamandate/5070-hs-office-sepamandate.sql - include: @@ -140,14 +140,14 @@ databaseChangeLog: file: db/changelog/5-hs-office/507-sepamandate/5076-hs-office-sepamandate-migration.sql - include: file: db/changelog/5-hs-office/507-sepamandate/5078-hs-office-sepamandate-test-data.sql - context: office-test + context: "!without-test-data" - include: file: db/changelog/5-hs-office/510-membership/5100-hs-office-membership.sql - include: file: db/changelog/5-hs-office/510-membership/5103-hs-office-membership-rbac.sql - include: file: db/changelog/5-hs-office/510-membership/5108-hs-office-membership-test-data.sql - context: office-test + context: "!without-test-data" - include: file: db/changelog/5-hs-office/511-coopshares/5110-hs-office-coopshares.sql - include: @@ -156,7 +156,7 @@ databaseChangeLog: file: db/changelog/5-hs-office/511-coopshares/5116-hs-office-coopshares-migration.sql - include: file: db/changelog/5-hs-office/511-coopshares/5118-hs-office-coopshares-test-data.sql - context: office-test + context: "!without-test-data" - include: file: db/changelog/5-hs-office/512-coopassets/5120-hs-office-coopassets.sql - include: @@ -165,52 +165,52 @@ databaseChangeLog: file: db/changelog/5-hs-office/512-coopassets/5126-hs-office-coopassets-migration.sql - include: file: db/changelog/5-hs-office/512-coopassets/5128-hs-office-coopassets-test-data.sql - context: office-test + context: "!without-test-data" - include: file: db/changelog/6-hs-booking/600-hs-booking-schema.sql - context: booking + context: "!only-office" - include: file: db/changelog/6-hs-booking/610-booking-debitor/6100-hs-booking-debitor.sql - context: booking + context: "!only-office" - include: file: db/changelog/6-hs-booking/620-booking-project/6200-hs-booking-project.sql - context: booking + context: "!only-office" - include: file: db/changelog/6-hs-booking/620-booking-project/6203-hs-booking-project-rbac.sql - context: booking + context: "!only-office" - include: file: db/changelog/6-hs-booking/620-booking-project/6208-hs-booking-project-test-data.sql - context: booking-test + context: "!only-office and !without-test-data" - include: file: db/changelog/6-hs-booking/630-booking-item/6300-hs-booking-item.sql - context: booking + context: "!only-office" - include: file: db/changelog/6-hs-booking/630-booking-item/6303-hs-booking-item-rbac.sql - context: booking + context: "!only-office" - include: file: db/changelog/6-hs-booking/630-booking-item/6308-hs-booking-item-test-data.sql - context: booking-test + context: "!only-office and !without-test-data" - include: file: db/changelog/7-hs-hosting/700-hs-hosting-schema.sql - context: hosting + context: "!only-office" - include: file: db/changelog/7-hs-hosting/701-hosting-asset/7010-hs-hosting-asset.sql - context: hosting + context: "!only-office" - include: file: db/changelog/7-hs-hosting/701-hosting-asset/7013-hs-hosting-asset-rbac.sql - context: hosting + context: "!only-office" - include: file: db/changelog/7-hs-hosting/701-hosting-asset/7016-hs-hosting-asset-migration.sql - context: hosting + context: "!only-office" - include: file: db/changelog/7-hs-hosting/701-hosting-asset/7018-hs-hosting-asset-test-data.sql - context: hosting-test + context: "!only-office and !without-test-data" - include: file: db/changelog/9-hs-global/9000-statistics.sql - context: hosting + context: "!only-office" - include: file: db/changelog/9-hs-global/9100-hs-integration-schema.sql diff --git a/src/test/java/net/hostsharing/hsadminng/config/ActuatorSanitizerUnitTest.java b/src/test/java/net/hostsharing/hsadminng/config/ActuatorSanitizerUnitTest.java index a804251e..6c0d0ae0 100644 --- a/src/test/java/net/hostsharing/hsadminng/config/ActuatorSanitizerUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/config/ActuatorSanitizerUnitTest.java @@ -9,7 +9,7 @@ import java.util.List; import static org.assertj.core.api.Assertions.assertThat; -class ActuatorSanitizerTest { +class ActuatorSanitizerUnitTest { private ActuatorSanitizer actuatorSanitizer; diff --git a/src/test/java/net/hostsharing/hsadminng/config/CasAuthenticationFilterIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/config/CasAuthenticationFilterIntegrationTest.java index 0c705e25..07169115 100644 --- a/src/test/java/net/hostsharing/hsadminng/config/CasAuthenticationFilterIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/config/CasAuthenticationFilterIntegrationTest.java @@ -17,7 +17,7 @@ import static org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric; import static org.assertj.core.api.Assertions.assertThat; import static com.github.tomakehurst.wiremock.client.WireMock.*; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@TestPropertySource(properties = "server.port=0") +@TestPropertySource(properties = {"server.port=0", "hsadminng.cas.server=http://localhost:8088/cas"}) @ActiveProfiles("wiremock") // IMPORTANT: To test prod config, do not use test profile! class CasAuthenticationFilterIntegrationTest { diff --git a/src/test/java/net/hostsharing/hsadminng/config/WebSecurityConfigIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/config/WebSecurityConfigIntegrationTest.java index 00444c3a..6991176e 100644 --- a/src/test/java/net/hostsharing/hsadminng/config/WebSecurityConfigIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/config/WebSecurityConfigIntegrationTest.java @@ -22,7 +22,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@TestPropertySource(properties = {"management.port=0", "server.port=0"}) +@TestPropertySource(properties = {"management.port=0", "server.port=0", "hsadminng.cas.server=http://localhost:8088/cas"}) @ActiveProfiles("wiremock") // IMPORTANT: To test prod config, do not use test profile! class WebSecurityConfigIntegrationTest { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java index ab3b3d08..11293384 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java @@ -46,7 +46,7 @@ import static org.hamcrest.Matchers.matchesRegex; webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = { HsadminNgApplication.class, DisableSecurityConfig.class, JpaAttempt.class } ) -@ActiveProfiles("test") +@ActiveProfiles({"test", "booking", "hosting"}) @Transactional @TestClassOrder(ClassOrderer.OrderAnnotation.class) // fail early on fetching problems class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerRestTest.java index 0d7b11f7..aa904bf5 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerRestTest.java @@ -42,7 +42,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @WebMvcTest(HsBookingItemController.class) @Import({StrictMapper.class, JsonObjectMapperConfiguration.class, DisableSecurityConfig.class}) @RunWith(SpringRunner.class) -@ActiveProfiles("test") +@ActiveProfiles({"test", "booking", "hosting"}) class HsBookingItemControllerRestTest { @Autowired diff --git a/src/test/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectControllerAcceptanceTest.java index 37b54e7e..bd7a65ed 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectControllerAcceptanceTest.java @@ -27,7 +27,7 @@ import static org.hamcrest.Matchers.matchesRegex; webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = { HsadminNgApplication.class, DisableSecurityConfig.class, JpaAttempt.class } ) -@ActiveProfiles("test") +@ActiveProfiles({"test", "booking", "hosting"}) @Transactional class HsBookingProjectControllerAcceptanceTest extends ContextBasedTestWithCleanup { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerAcceptanceTest.java index ea7c93b1..4680d661 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerAcceptanceTest.java @@ -47,7 +47,7 @@ import static org.hamcrest.Matchers.matchesRegex; webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = { HsadminNgApplication.class, DisableSecurityConfig.class, DisableSecurityConfig.class, JpaAttempt.class } ) -@ActiveProfiles("test") +@ActiveProfiles({"test", "hosting"}) @TestClassOrder(ClassOrderer.OrderAnnotation.class) // fail early on fetching problems class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerRestTest.java index 3b10e26e..d55bc92b 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerRestTest.java @@ -56,7 +56,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @WebMvcTest(HsHostingAssetController.class) @Import({ StrictMapper.class, JsonObjectMapperConfiguration.class, DisableSecurityConfig.class }) @RunWith(SpringRunner.class) -@ActiveProfiles("test") +@ActiveProfiles({"test", "hosting"}) public class HsHostingAssetControllerRestTest { @Autowired diff --git a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsControllerAcceptanceTest.java index de7dd82d..cc802f8d 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsControllerAcceptanceTest.java @@ -15,7 +15,7 @@ import static net.hostsharing.hsadminng.test.JsonMatcher.lenientlyEquals; webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = { HsadminNgApplication.class, DisableSecurityConfig.class, JpaAttempt.class } ) -@ActiveProfiles("test") +@ActiveProfiles({"test", "hosting"}) class HsHostingAssetPropsControllerAcceptanceTest { @LocalServerPort diff --git a/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java b/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java index a831f637..256de796 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java @@ -32,6 +32,7 @@ import org.springframework.context.annotation.Import; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.test.annotation.Commit; import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ActiveProfiles; import java.io.Reader; import java.net.IDN; @@ -121,6 +122,7 @@ import static org.assertj.core.api.Assumptions.assumeThat; }) @DirtiesContext @Import({ Context.class, JpaAttempt.class }) +@ActiveProfiles("without-test-data") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) @ExtendWith(OrderedDependedTestsExtension.class) public class ImportHostingAssets extends BaseOfficeDataImport { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportOfficeData.java b/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportOfficeData.java index 5f632f88..c3111c01 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportOfficeData.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportOfficeData.java @@ -7,6 +7,7 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.context.annotation.Import; import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ActiveProfiles; /* * This 'test' includes the complete legacy 'office' data import. @@ -51,6 +52,7 @@ import org.springframework.test.annotation.DirtiesContext; "spring.datasource.password=${HSADMINNG_POSTGRES_ADMIN_PASSWORD:password}", "hsadminng.superuser=${HSADMINNG_SUPERUSER:superuser-alex@hostsharing.net}" }) +@ActiveProfiles("without-test-data") @DirtiesContext @Import({ Context.class, JpaAttempt.class }) @TestMethodOrder(MethodOrderer.OrderAnnotation.class)