diff --git a/nachrichten-manager-server/pom.xml b/nachrichten-manager-server/pom.xml index 6aa11d0d7a51c504265f929af26aefb599195117..62b4aea0d3127fc92d8f287429a87272e5716a6e 100644 --- a/nachrichten-manager-server/pom.xml +++ b/nachrichten-manager-server/pom.xml @@ -48,7 +48,7 @@ <bayernid-proxy-interface.version>0.7.0</bayernid-proxy-interface.version> <vorgang-manager.version>2.17.0</vorgang-manager.version> <muk-postfach.version>0.1.0</muk-postfach.version> - <osiv2-postfach.version>0.1.55-SNAPSHOT</osiv2-postfach.version> + <osiv2-postfach.version>0.1.0-SNAPSHOT</osiv2-postfach.version> <api-lib.version>0.16.0</api-lib.version> </properties> diff --git a/nachrichten-manager-server/src/main/resources/application.yaml b/nachrichten-manager-server/src/main/resources/application.yaml deleted file mode 100644 index ee8f0aa38c6f6e82059d6f38524bc9944ad3eead..0000000000000000000000000000000000000000 --- a/nachrichten-manager-server/src/main/resources/application.yaml +++ /dev/null @@ -1,8 +0,0 @@ -spring: - security: - oauth2: - client: - registration: - other: - provider: - other: \ No newline at end of file diff --git a/nachrichten-manager-server/src/test/java/de/ozgcloud/nachrichten/postfach/Osi2PostfachServiceITCase.java b/nachrichten-manager-server/src/test/java/de/ozgcloud/nachrichten/postfach/Osi2PostfachServiceITCase.java index 55a583adc8bfcf43df8423b7730819f8f1535ca5..516d16bdece9753b194ae5d714d65f97f0f54666 100644 --- a/nachrichten-manager-server/src/test/java/de/ozgcloud/nachrichten/postfach/Osi2PostfachServiceITCase.java +++ b/nachrichten-manager-server/src/test/java/de/ozgcloud/nachrichten/postfach/Osi2PostfachServiceITCase.java @@ -9,27 +9,33 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; -import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.ActiveProfiles; -import de.ozgcloud.common.test.ITCase; +import de.ozgcloud.nachrichten.NachrichtenManagerTestApplication; import de.ozgcloud.nachrichten.attributes.ClientAttributeService; import de.ozgcloud.nachrichten.email.EmailGrpcService; +import de.ozgcloud.nachrichten.postfach.osiv2.config.Osi2PostfachProperties; import de.ozgcloud.nachrichten.postfach.osiv2.transfer.PostfachApiFacadeService; import de.ozgcloud.vorgang.callcontext.WithMockCustomUser; -@ITCase -@TestPropertySource(properties = { - "ozgcloud.osiv2-postfach.enabled=true" -}) +@SpringBootTest(classes = NachrichtenManagerTestApplication.class, + properties = { + "ozgcloud.osiv2-postfach.enabled=true" + }) +@ActiveProfiles({ "itcase", "stage" }) class Osi2PostfachServiceITCase { @Autowired private PostfachService postfachService; + @Autowired + private Osi2PostfachProperties.ApiConfiguration osi2ApiConfiguration; + @MockBean private ApplicationEventPublisher publisher; @@ -50,6 +56,14 @@ class Osi2PostfachServiceITCase { sentEventTestListener.reset(); } + @DisplayName("should use stage profile properties") + @Test + void shouldUseStageProfileProperties() { + var url = osi2ApiConfiguration.getUrl(); + + assertThat(url).isNotEmpty(); + } + @DisplayName("should call osi2 postfach send") @Test @WithMockCustomUser diff --git a/nachrichten-manager-server/src/test/java/de/ozgcloud/nachrichten/postfach/OsiPostfachServiceITCase.java b/nachrichten-manager-server/src/test/java/de/ozgcloud/nachrichten/postfach/OsiPostfachServiceITCase.java index 55bf5fd61e145251a134e8596aa10a657c996bdc..d647dcc27083707838b9d3f2cf510bf2b7242873 100644 --- a/nachrichten-manager-server/src/test/java/de/ozgcloud/nachrichten/postfach/OsiPostfachServiceITCase.java +++ b/nachrichten-manager-server/src/test/java/de/ozgcloud/nachrichten/postfach/OsiPostfachServiceITCase.java @@ -11,26 +11,28 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.event.EventListener; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; -import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.ActiveProfiles; import org.springframework.web.client.RestTemplate; -import de.ozgcloud.common.test.ITCase; +import de.ozgcloud.nachrichten.NachrichtenManagerTestApplication; import de.ozgcloud.nachrichten.attributes.ClientAttributeService; import de.ozgcloud.nachrichten.email.EmailGrpcService; import de.ozgcloud.nachrichten.postfach.osi.MessageAttachmentService; import lombok.SneakyThrows; -@ITCase -@TestPropertySource(properties = { - "ozgcloud.osi.postfach.proxyapi.key=key", - "ozgcloud.osi.postfach.proxyapi.realm=realm", - "ozgcloud.osi.postfach.proxyapi.url=url", -}) +@SpringBootTest(classes = NachrichtenManagerTestApplication.class, + properties = { + "ozgcloud.osi.postfach.proxyapi.key=key", + "ozgcloud.osi.postfach.proxyapi.realm=realm", + "ozgcloud.osi.postfach.proxyapi.url=url", + }) +@ActiveProfiles({ "itcase" }) class OsiPostfachServiceITCase { @Autowired @@ -69,7 +71,6 @@ class OsiPostfachServiceITCase { var commandId = "aaaaa"; when(restTemplate.exchange(eq("url"), eq(HttpMethod.POST), any(), Mockito.<Class<String>>any())).thenReturn(ResponseEntity.ok("true")); - postfachService.sendMail(commandId, "userId", osiNachricht); assertThat(sentEventTestListener.events)