From 47b58e2cb46f1fce2ef7aef6a540a5eed156090c Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Tue, 29 Oct 2024 16:48:38 +0100 Subject: [PATCH] OZG-6721 OZG-6915 Map settings to OrganisationsEinheitSettings --- .../de/ozgcloud/alfa/postfach/PostfachProperties.java | 2 +- .../ozgcloud/alfa/postfach/PostfachSettingsService.java | 2 +- .../alfa/postfach/PostfachSettingsServiceTest.java | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/alfa-service/src/main/java/de/ozgcloud/alfa/postfach/PostfachProperties.java b/alfa-service/src/main/java/de/ozgcloud/alfa/postfach/PostfachProperties.java index a7298837a5..5a7e9f401e 100644 --- a/alfa-service/src/main/java/de/ozgcloud/alfa/postfach/PostfachProperties.java +++ b/alfa-service/src/main/java/de/ozgcloud/alfa/postfach/PostfachProperties.java @@ -46,6 +46,6 @@ public class PostfachProperties { /** * Settings that are linked to an Organisationseinheit. Configured by administration config server. */ - private Map<String, OrganisationsEinheitSettings> organisationsEinheitSettings = Map.of(); + private Map<String, Map<String, Object>> organisationsEinheitSettings = Map.of(); } diff --git a/alfa-service/src/main/java/de/ozgcloud/alfa/postfach/PostfachSettingsService.java b/alfa-service/src/main/java/de/ozgcloud/alfa/postfach/PostfachSettingsService.java index ce91372b01..0d3ff32f19 100644 --- a/alfa-service/src/main/java/de/ozgcloud/alfa/postfach/PostfachSettingsService.java +++ b/alfa-service/src/main/java/de/ozgcloud/alfa/postfach/PostfachSettingsService.java @@ -77,7 +77,7 @@ class PostfachSettingsService { } Optional<OrganisationsEinheitSettings> getOrganisationsEinheitSettings(final String organisationId) { - return Optional.ofNullable(postfachProperties.getOrganisationsEinheitSettings().get(organisationId)); + return Optional.ofNullable(postfachProperties.getOrganisationsEinheitSettings().get(organisationId)).map(this::mapOrganisationsEinheitSettings); } OrganisationsEinheitSettings mapOrganisationsEinheitSettings(Map<String, Object> organisationsEinheitSettings) { diff --git a/alfa-service/src/test/java/de/ozgcloud/alfa/postfach/PostfachSettingsServiceTest.java b/alfa-service/src/test/java/de/ozgcloud/alfa/postfach/PostfachSettingsServiceTest.java index ea0f34531c..6a5a5e6c6f 100644 --- a/alfa-service/src/test/java/de/ozgcloud/alfa/postfach/PostfachSettingsServiceTest.java +++ b/alfa-service/src/test/java/de/ozgcloud/alfa/postfach/PostfachSettingsServiceTest.java @@ -362,12 +362,12 @@ class PostfachSettingsServiceTest { class TestGetOrganisationsEinheitSettings { private final OrganisationsEinheitSettings organisationsEinheitSettings = OrganisationsEinheitSettingsTestFactory.create(); - private final Map<String, Object> organisationsEinheitSettingsMap = Map.of(PostfachSettingsService.FIELD_SIGNATUR, signatur); + private final Map<String, Object> organisationsEinheitSettingsMap = Map.of(PostfachSettingsService.FIELD_SIGNATUR, OrganisationsEinheitSettingsTestFactory.TEST_SIGNATUR); @BeforeEach void setUp() { when(postfachProperties.getOrganisationsEinheitSettings()).thenReturn( - Map.of(OrganisationsEinheitTestFactory.ID, organisationsEinheitSettings)); + Map.of(OrganisationsEinheitTestFactory.ID, organisationsEinheitSettingsMap)); } @Test @@ -381,14 +381,14 @@ class PostfachSettingsServiceTest { void shouldMapToOrganisationsEinheitSettings() { service.getOrganisationsEinheitSettings(OrganisationsEinheitTestFactory.ID); - verify(service).mapOrganisationsEinheitSettings() + verify(service).mapOrganisationsEinheitSettings(organisationsEinheitSettingsMap); } @Test void shouldReturnSettings() { var settings = service.getOrganisationsEinheitSettings(OrganisationsEinheitTestFactory.ID); - assertThat(settings).hasValue(organisationsEinheitSettings); + assertThat(settings).isPresent().get().usingRecursiveComparison().isEqualTo(organisationsEinheitSettings); } @Test -- GitLab