From 70414f67cc1ebc9a39fc38730ca4886bbc04a952 Mon Sep 17 00:00:00 2001 From: Jan Zickermann <jan.zickermann@dataport.de> Date: Mon, 27 Jan 2025 14:17:46 +0100 Subject: [PATCH] OZG-4095 config: Use `stage` profile --- pom.xml | 7 ++++- src/main/resources/application-stage.yml | 26 ++++++++++++++++++ src/main/resources/application.yml | 27 +------------------ .../osiv2/OsiPostfachRemoteServiceITCase.java | 2 +- .../OsiPostfachRemoteServiceRemoteITCase.java | 10 +++---- src/test/resources/application-itcase.yml | 3 --- 6 files changed, 39 insertions(+), 36 deletions(-) create mode 100644 src/main/resources/application-stage.yml diff --git a/pom.xml b/pom.xml index 8991d23..86abf55 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ <groupId>de.ozgcloud.osiv2</groupId> <artifactId>osiv2-postfach</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.0-SNAPSHOT</version> <name>OZG-Cloud-OSIv2-Postfach</name> <description>OSIv2-Postfach-Anbindung für OZG-Cloud-Nachrichten</description> @@ -25,6 +25,11 @@ </properties> <dependencies> <!-- OZG-Cloud --> + <dependency> + <groupId>de.ozgcloud.api-lib</groupId> + <artifactId>ozg-cloud-spring-boot-starter</artifactId> + <version>${api-lib.version}</version> + </dependency> <dependency> <groupId>de.ozgcloud.nachrichten</groupId> <artifactId>nachrichten-manager-postfach-interface</artifactId> diff --git a/src/main/resources/application-stage.yml b/src/main/resources/application-stage.yml new file mode 100644 index 0000000..f7c2e25 --- /dev/null +++ b/src/main/resources/application-stage.yml @@ -0,0 +1,26 @@ +spring: + security: + oauth2: + client: + registration: + osi2: + client-id: 'OZG-Kopfstelle' + client-secret: 'changeme' + scope: default, access_urn:dataport:osi:sh:stage:ozgkopfstelle + authorization-grant-type: 'client_credentials' + client-authentication-method: client_secret_post + provider: + osi2: + token-uri: 'https://idp.serviceportal-stage.schleswig-holstein.de/webidp2/connect/token' +ozgcloud: + osiv2-postfach: + enabled: true + api: + resource: 'urn:dataport:osi:postfach:rz2:stage:sh' + url: 'https://api-gateway-stage.dataport.de:443/api/osi_postfach/1.0.0' + tenant: 'SH' + name-identifier: 'ozgkopfstelle' + http-proxy: + enabled: true + host: 127.0.0.1 + port: 3128 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 1d1f1bf..065fffe 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,28 +1,3 @@ spring: jackson: - default-property-inclusion: NON_NULL - security: - oauth2: - client: - registration: - osi2: - client-id: 'OZG-Kopfstelle' - client-secret: 'changeme' - scope: default, access_urn:dataport:osi:sh:stage:ozgkopfstelle - authorization-grant-type: 'client_credentials' - client-authentication-method: client_secret_post - provider: - osi2: - token-uri: 'https://idp.serviceportal-stage.schleswig-holstein.de/webidp2/connect/token' -ozgcloud: - osiv2-postfach: - enabled: false - api: - resource: 'urn:dataport:osi:postfach:rz2:stage:sh' - url: 'https://api-gateway-stage.dataport.de:443/api/osi_postfach/1.0.0' - tenant: 'SH' - name-identifier: 'ozgkopfstelle' - http-proxy: - enabled: true - host: 127.0.0.1 - port: 3128 + default-property-inclusion: NON_NULL \ No newline at end of file diff --git a/src/test/java/de/ozgcloud/nachrichten/postfach/osiv2/OsiPostfachRemoteServiceITCase.java b/src/test/java/de/ozgcloud/nachrichten/postfach/osiv2/OsiPostfachRemoteServiceITCase.java index 2771bbd..dcfa4c5 100644 --- a/src/test/java/de/ozgcloud/nachrichten/postfach/osiv2/OsiPostfachRemoteServiceITCase.java +++ b/src/test/java/de/ozgcloud/nachrichten/postfach/osiv2/OsiPostfachRemoteServiceITCase.java @@ -38,7 +38,7 @@ import de.ozgcloud.nachrichten.postfach.osiv2.gen.model.MessageExchangeReceiveMe import lombok.SneakyThrows; @SpringBootTest(classes = TestApplication.class) -@ActiveProfiles("itcase") +@ActiveProfiles({"itcase", "stage"}) @TestPropertySource(properties = { "ozgcloud.osiv2-postfach.http-proxy.enabled=false", }) diff --git a/src/test/java/de/ozgcloud/nachrichten/postfach/osiv2/OsiPostfachRemoteServiceRemoteITCase.java b/src/test/java/de/ozgcloud/nachrichten/postfach/osiv2/OsiPostfachRemoteServiceRemoteITCase.java index 9978f98..9301a37 100644 --- a/src/test/java/de/ozgcloud/nachrichten/postfach/osiv2/OsiPostfachRemoteServiceRemoteITCase.java +++ b/src/test/java/de/ozgcloud/nachrichten/postfach/osiv2/OsiPostfachRemoteServiceRemoteITCase.java @@ -23,7 +23,7 @@ import de.ozgcloud.nachrichten.postfach.osiv2.factory.PostfachAddressTestFactory import de.ozgcloud.nachrichten.postfach.osiv2.factory.PostfachNachrichtTestFactory; @SpringBootTest(classes = TestApplication.class) -@ActiveProfiles("local") +@ActiveProfiles({ "local", "stage" }) @EnabledIfEnvironmentVariable(named = "SH_STAGE_CLIENT_SECRET", matches = ".+") public class OsiPostfachRemoteServiceRemoteITCase { @@ -78,10 +78,10 @@ public class OsiPostfachRemoteServiceRemoteITCase { @DisplayName("receive all messages") @Nested - class TestReceiveAllMessages{ + class TestReceiveAllMessages { @Test - void shouldReceiveAllMessage(){ + void shouldReceiveAllMessage() { Stream<PostfachNachricht> allMessages = osiPostfachRemoteService.getAllMessages(); var messages = allMessages.toList(); @@ -93,10 +93,10 @@ public class OsiPostfachRemoteServiceRemoteITCase { @Disabled @DisplayName("delete message") @Nested - class TestDeleteMessageById{ + class TestDeleteMessageById { @Test - void shouldDeleteMessage(){ + void shouldDeleteMessage() { assertThatCode(() -> osiPostfachRemoteService.deleteMessage("5dd65c1e-bd41-4c3d-bf98-be769ca341dc")) .doesNotThrowAnyException(); } diff --git a/src/test/resources/application-itcase.yml b/src/test/resources/application-itcase.yml index d8cacf7..dcbea65 100644 --- a/src/test/resources/application-itcase.yml +++ b/src/test/resources/application-itcase.yml @@ -1,6 +1,3 @@ -ozgcloud: - osiv2-postfach: - enabled: true logging: level: de.ozgcloud.nachrichten.postfach.osiv2: DEBUG -- GitLab