From a826d0e9d8b1ce316e18f65d3ac97dae235ea440 Mon Sep 17 00:00:00 2001 From: Maxim Grischenko Date: Sat, 18 May 2024 11:03:33 +0200 Subject: [PATCH 1/3] add codecov token --- .github/workflows/develop-push-merge.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/develop-push-merge.yml b/.github/workflows/develop-push-merge.yml index fcbb399d8b..2a1f9b45a9 100644 --- a/.github/workflows/develop-push-merge.yml +++ b/.github/workflows/develop-push-merge.yml @@ -62,26 +62,30 @@ jobs: OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }} # CODECOV Upload BEGIN - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v4 with: + token: ${{ secrets.CODECOV_TOKEN }} directory: ./last-module-codecoverage/ flags: backend verbose: true - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v4 with: + token: ${{ secrets.CODECOV_TOKEN }} directory: ./consent-ui/ flags: frontend verbose: true - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v4 with: + token: ${{ secrets.CODECOV_TOKEN }} directory: ./fintech-examples/fintech-last-module-codecoverage/ flags: fintech verbose: true - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v4 with: + token: ${{ secrets.CODECOV_TOKEN }} directory: ./fintech-examples/fintech-ui/ flags: fintech verbose: true From 3f427cf7d5faed042ecffbf0dcad1eb86ec417a1 Mon Sep 17 00:00:00 2001 From: Maxim Grischenko Date: Sat, 18 May 2024 21:25:54 +0200 Subject: [PATCH 2/3] fix test(mock xs2a-adapter call to https://xs2a.db.com/DE/SB-DB/aspsp-certificates) --- .../controller/TestBankSearchPerformance.java | 2 +- .../xs2a-bdd-wiremock/pom.xml | 1 + .../tests/e2e/wiremock/mocks/MockServers.java | 23 +++++++++++++++++++ .../mappings/get-certificate-pem.json | 19 +++++++++++++++ pom.xml | 2 +- 5 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/main/resources/mockedsandbox/restrecord/embedded/multi-sca/accounts/postbank/mappings/get-certificate-pem.json diff --git a/opba-banking-rest-impl/src/test/java/de/adorsys/opba/tppbankingapi/controller/TestBankSearchPerformance.java b/opba-banking-rest-impl/src/test/java/de/adorsys/opba/tppbankingapi/controller/TestBankSearchPerformance.java index 1b3047091d..380eff7c40 100644 --- a/opba-banking-rest-impl/src/test/java/de/adorsys/opba/tppbankingapi/controller/TestBankSearchPerformance.java +++ b/opba-banking-rest-impl/src/test/java/de/adorsys/opba/tppbankingapi/controller/TestBankSearchPerformance.java @@ -6,6 +6,7 @@ import de.adorsys.opba.tppbankingapi.dto.TestResult; import de.adorsys.opba.tppbankingapi.services.StatisticService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.RandomStringUtils; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -14,7 +15,6 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; -import org.testcontainers.shaded.org.apache.commons.lang.RandomStringUtils; import java.time.Instant; import java.util.ArrayList; diff --git a/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/pom.xml b/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/pom.xml index 8880b0d413..60578838f4 100644 --- a/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/pom.xml +++ b/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/pom.xml @@ -109,6 +109,7 @@ mockedsandbox/**/*.* **/*.yml + false diff --git a/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/main/java/de/adorsys/opba/protocol/xs2a/tests/e2e/wiremock/mocks/MockServers.java b/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/main/java/de/adorsys/opba/protocol/xs2a/tests/e2e/wiremock/mocks/MockServers.java index efaecc404d..8ad88d8941 100644 --- a/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/main/java/de/adorsys/opba/protocol/xs2a/tests/e2e/wiremock/mocks/MockServers.java +++ b/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/main/java/de/adorsys/opba/protocol/xs2a/tests/e2e/wiremock/mocks/MockServers.java @@ -26,9 +26,15 @@ import java.io.File; import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.net.URL; +import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; import java.util.Arrays; +import java.util.Properties; import java.util.UUID; import java.util.function.Consumer; @@ -336,9 +342,26 @@ public SELF embedded_mock_of_postbank_for_max_musterman_accounts_running() { WireMockConfiguration config = WireMockConfiguration.options().dynamicPort() .usingFilesUnderClasspath("mockedsandbox/restrecord/embedded/multi-sca/accounts/postbank/"); startWireMock(config, POSTBANK_BANK_ID, it -> it.setUrl("http://localhost:" + sandbox.port() + "/{Service Group}/DE/Postbank")); + setSandboxPortInAdapterConfig(sandbox.port()); return self(); } + @SneakyThrows + public void setSandboxPortInAdapterConfig(int port) { + Path resourcePath = Paths.get(MockServers.class.getClassLoader().getResource("adapter.config.properties").toURI()); + log.info(resourcePath.toString()); + Properties props = new Properties(); + try (InputStream input = Files.newInputStream(resourcePath)) { + props.load(input); + } + props.setProperty("deutsche-bank.aspsp.certificate.url", "http://localhost:" + port + "/pb/aspsp-certificates/tpp-pb-password_cert.pem"); + + Path tempFile = Files.createTempFile("temp", ".properties"); + try (OutputStream output = Files.newOutputStream(tempFile)) { + props.store(output, null); + } + Files.move(tempFile, resourcePath, StandardCopyOption.REPLACE_EXISTING); + } public SELF decoupled_embedded_approach_sca_decoupled_start_mock_of_sandbox_for_max_musterman_accounts_running() { diff --git a/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/main/resources/mockedsandbox/restrecord/embedded/multi-sca/accounts/postbank/mappings/get-certificate-pem.json b/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/main/resources/mockedsandbox/restrecord/embedded/multi-sca/accounts/postbank/mappings/get-certificate-pem.json new file mode 100644 index 0000000000..8f90c83d3c --- /dev/null +++ b/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/main/resources/mockedsandbox/restrecord/embedded/multi-sca/accounts/postbank/mappings/get-certificate-pem.json @@ -0,0 +1,19 @@ +{ + "scenarioName": "AccountsListUsingPostbankEmbedded", + "newScenarioState": "GetCertificatePem", + "request" : { + "urlPattern" : "/pb/aspsp-certificates/tpp-pb-password_cert.pem", + "method" : "GET", + "headers" : { + } + }, + "response" : { + "status" : 200, + "body" : "-----BEGIN CERTIFICATE-----\nMIICMzCCAZygAwIBAgIJALiPnVsvq8dsMA0GCSqGSIb3DQEBBQUAMFMxCzAJBgNV BAYTAlVTMQwwCgYDVQQIEwNmb28xDDAKBgNVBAcTA2ZvbzEMMAoGA1UEChMDZm9v MQwwCgYDVQQLEwNmb28xDDAKBgNVBAMTA2ZvbzAeFw0xMzAzMTkxNTQwMTlaFw0x ODAzMTgxNTQwMTlaMFMxCzAJBgNVBAYTAlVTMQwwCgYDVQQIEwNmb28xDDAKBgNV BAcTA2ZvbzEMMAoGA1UEChMDZm9vMQwwCgYDVQQLEwNmb28xDDAKBgNVBAMTA2Zv bzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAzdGfxi9CNbMf1UUcvDQh7MYB OveIHyc0E0KIbhjK5FkCBU4CiZrbfHagaW7ZEcN0tt3EvpbOMxxc/ZQU2WN/s/wP xph0pSfsfFsTKM4RhTWD2v4fgk+xZiKd1p0+L4hTtpwnEw0uXRVd0ki6muwV5y/P +5FHUeldq+pgTcgzuK8CAwEAAaMPMA0wCwYDVR0PBAQDAgLkMA0GCSqGSIb3DQEB BQUAA4GBAJiDAAtY0mQQeuxWdzLRzXmjvdSuL9GoyT3BF/jSnpxz5/58dba8pWen v3pj4P3w5DoOso0rzkZy2jEsEitlVM2mLSbQpMM+MUVQCQoiG6W9xuCFuxSrwPIS pAqEAuV4DNoxQKKWmhVv+J0ptMWD25Pnpxeq5sXzghfJnslJlQND\n-----END CERTIFICATE-----", + "headers" : { + "Content-Type" : "application/octet-stream" + } + }, + "uuid" : "96f5dbd8-0def-4ca0-9aa5-3ee061adc195", + "persistent" : true +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index b08b66b67c..544402620c 100644 --- a/pom.xml +++ b/pom.xml @@ -164,7 +164,7 @@ 3.12.2 1.1.0 2.25.1 - 1.16.3 + 1.19.8 5.10.0 1.3.17 3.4.0 From d46e2763b7a857373559584de6f26bfaa6391be9 Mon Sep 17 00:00:00 2001 From: Maxim Grischenko Date: Sun, 19 May 2024 19:52:59 +0200 Subject: [PATCH 3/3] change test order --- .../protocol/xs2a/tests/e2e/wiremock/mocks/MockServers.java | 2 ++ .../e2e/wiremock/WiremockConsentE2EXs2aProtocolTest.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/main/java/de/adorsys/opba/protocol/xs2a/tests/e2e/wiremock/mocks/MockServers.java b/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/main/java/de/adorsys/opba/protocol/xs2a/tests/e2e/wiremock/mocks/MockServers.java index 8ad88d8941..eb4d8a68ce 100644 --- a/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/main/java/de/adorsys/opba/protocol/xs2a/tests/e2e/wiremock/mocks/MockServers.java +++ b/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/main/java/de/adorsys/opba/protocol/xs2a/tests/e2e/wiremock/mocks/MockServers.java @@ -18,6 +18,7 @@ import de.adorsys.opba.protocol.xs2a.service.xs2a.authenticate.embedded.Xs2aAisAuthenticateUserConsentWithPin; import de.adorsys.opba.protocol.xs2a.service.xs2a.consent.CreateAisAccountListConsentService; import de.adorsys.opba.protocol.xs2a.tests.e2e.stages.CommonGivenStages; +import de.adorsys.xs2a.adapter.api.config.AdapterConfig; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.assertj.core.api.Assertions; @@ -361,6 +362,7 @@ public void setSandboxPortInAdapterConfig(int port) { props.store(output, null); } Files.move(tempFile, resourcePath, StandardCopyOption.REPLACE_EXISTING); + AdapterConfig.reload(); } diff --git a/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/test/java/de/adorsys/opba/protocol/xs2a/tests/e2e/wiremock/WiremockConsentE2EXs2aProtocolTest.java b/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/test/java/de/adorsys/opba/protocol/xs2a/tests/e2e/wiremock/WiremockConsentE2EXs2aProtocolTest.java index e61e725444..12f4be934a 100644 --- a/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/test/java/de/adorsys/opba/protocol/xs2a/tests/e2e/wiremock/WiremockConsentE2EXs2aProtocolTest.java +++ b/opba-protocols/xs2a-protocol-tests/xs2a-bdd-wiremock/src/test/java/de/adorsys/opba/protocol/xs2a/tests/e2e/wiremock/WiremockConsentE2EXs2aProtocolTest.java @@ -10,7 +10,10 @@ import de.adorsys.opba.protocol.xs2a.tests.e2e.wiremock.mocks.WiremockAccountInformationRequest; import de.adorsys.opba.protocol.xs2a.tests.e2e.wiremock.mocks.Xs2aProtocolApplication; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; @@ -59,6 +62,7 @@ @Transactional(propagation = Propagation.NOT_SUPPORTED) @SpringBootTest(classes = {Xs2aProtocolApplication.class, JGivenConfig.class}, webEnvironment = RANDOM_PORT) @ActiveProfiles(profiles = {ONE_TIME_POSTGRES_RAMFS, MOCKED_SANDBOX}) +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) class WiremockConsentE2EXs2aProtocolTest extends SpringScenarioTest>, AccountInformationResult> { private static final String OAUTH2_CODE = "2buKRxcMvi79w8xYLFaNsoyh"; @@ -132,6 +136,7 @@ void testIngAccountsListWithConsentUsingRedirect() { } @Test + @Order(1) // test should run before testDeutscheBank, because it's impossible to reinitialize static field URL_TO_CERTIFICATE of DeutscheBankPsuPasswordEncryptionService, which is needed to mock getCertificate call void testPostbankAccountsListWithConsentUsingEmbedded() { given() .embedded_mock_of_postbank_for_max_musterman_accounts_running()