From 20b307778e3a3441c71318800fb73cd37976b869 Mon Sep 17 00:00:00 2001 From: Lazar Iliev Date: Thu, 15 Sep 2022 17:42:30 +0300 Subject: [PATCH 1/2] fix: remove Page class and create new ones --- .../tech/bridge/data/CommercialBanks.kt | 24 +++++++++++++++++++ .../cbdc/industria/tech/bridge/data/Page.kt | 15 ------------ .../bridge/services/CommercialBankService.kt | 23 +++++++----------- .../tech/bridge/services/CurrencyService.kt | 2 -- .../tech/bridge/services/SandboxEnvService.kt | 2 -- 5 files changed, 33 insertions(+), 33 deletions(-) delete mode 100644 cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/data/Page.kt diff --git a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/data/CommercialBanks.kt b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/data/CommercialBanks.kt index 3f618b2..f2fceb5 100644 --- a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/data/CommercialBanks.kt +++ b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/data/CommercialBanks.kt @@ -51,3 +51,27 @@ data class GetPartyViewsPageResponseBody( val pageIndex: Int, val pageNumberOfElements: Int ) + +@CordaSerializable +data class GetCommercialBankDetailsPageResponseBody( + val data: List, + val first: Boolean, + val last: Boolean, + val totalPages: Int, + val totalElements: Int, + val pageSize: Int, + val pageIndex: Int, + val pageNumberOfElements: Int +) + +@CordaSerializable +data class GetBankingEntityAccountsPageResponseBody( + val data: List, + val first: Boolean, + val last: Boolean, + val totalPages: Int, + val totalElements: Int, + val pageSize: Int, + val pageIndex: Int, + val pageNumberOfElements: Int +) diff --git a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/data/Page.kt b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/data/Page.kt deleted file mode 100644 index fcaa71e..0000000 --- a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/data/Page.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.cbdc.industria.tech.bridge.data - -import net.corda.core.serialization.CordaSerializable - -@CordaSerializable -data class Page( - val data: List, - val first: Boolean, - val last: Boolean, - val totalPages: Int, - val totalElements: Int, - val pageSize: Int, - val pageIndex: Int, - val pageNumberOfElements: Int -) diff --git a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/CommercialBankService.kt b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/CommercialBankService.kt index c000ec8..a4e1fe1 100644 --- a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/CommercialBankService.kt +++ b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/CommercialBankService.kt @@ -1,21 +1,19 @@ package com.cbdc.industria.tech.bridge.services -import com.cbdc.industria.tech.bridge.data.Page -import com.cbdc.industria.tech.bridge.data.MakeDepositRequestBody -import com.cbdc.industria.tech.bridge.data.MakeWithdrawalRequestBody -import com.cbdc.industria.tech.bridge.data.OpenAccountResponseBody import com.cbdc.industria.tech.bridge.data.CreateCommercialBankRequestBody import com.cbdc.industria.tech.bridge.data.CreateCommercialBankResponseBody import com.cbdc.industria.tech.bridge.data.GetBankingEntityAccountResponseBody +import com.cbdc.industria.tech.bridge.data.GetBankingEntityAccountsPageResponseBody +import com.cbdc.industria.tech.bridge.data.GetCommercialBankDetailsPageResponseBody import com.cbdc.industria.tech.bridge.data.GetCommercialBankDetailsResponseBody import com.cbdc.industria.tech.bridge.data.GetPartyResponseBody import com.cbdc.industria.tech.bridge.data.GetPartyViewsPageResponseBody +import com.cbdc.industria.tech.bridge.data.MakeDepositRequestBody +import com.cbdc.industria.tech.bridge.data.MakeWithdrawalRequestBody import com.cbdc.industria.tech.bridge.data.OpenAccountRequestBody +import com.cbdc.industria.tech.bridge.data.OpenAccountResponseBody import com.cbdc.industria.tech.bridge.data.RegisterPartyRequestBody import com.cbdc.industria.tech.bridge.data.RegisterPartyResponseBody -import com.cbdc.industria.tech.bridge.views.BankingEntityAccountView -import com.cbdc.industria.tech.bridge.views.CommercialBankView -import com.cbdc.industria.tech.bridge.views.PartyView import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import java.util.concurrent.CompletableFuture import java.util.concurrent.ExecutorService @@ -25,9 +23,6 @@ import net.corda.core.node.AppServiceHub import net.corda.core.node.services.CordaService import net.corda.core.serialization.SingletonSerializeAsToken -typealias GetCommercialBankDetailsPageResponseBody = Page -typealias GetBankingEntityAccountsPageResponseBody = Page - @CordaService class CommercialBankCordaService(private val serviceHub: AppServiceHub) : CommercialBankService( executor = Executors.newFixedThreadPool(THREADS_COUNT), @@ -94,10 +89,10 @@ open class CommercialBankService( if (pageSize > MAX_PAGE_SIZE) throw IllegalArgumentException("pageSize must not be grater than $MAX_PAGE_SIZE.") - val future = CompletableFuture>() + val future = CompletableFuture() executor.execute { - val result = makeGetRequest>( + val result = makeGetRequest( url = "$host/$COMMERCIAL_BANKS", headers = mapOf( AUTH_HEADER_KEY to AUTH_TOKEN, @@ -287,10 +282,10 @@ open class CommercialBankService( if (pageSize > MAX_PAGE_SIZE) throw IllegalArgumentException("pageSize must not be grater than $MAX_PAGE_SIZE.") - val future = CompletableFuture>() + val future = CompletableFuture() executor.execute { - val result = makeGetRequest>( + val result = makeGetRequest( url = "$host/$COMMERCIAL_BANKS/$bankId/$COMMERCIAL_BANKS_ACCOUNTS", headers = mapOf( AUTH_HEADER_KEY to AUTH_TOKEN, diff --git a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/CurrencyService.kt b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/CurrencyService.kt index 5e5c7b7..c555d39 100644 --- a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/CurrencyService.kt +++ b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/CurrencyService.kt @@ -4,8 +4,6 @@ import com.cbdc.industria.tech.bridge.data.CreateCurrencyRequestBody import com.cbdc.industria.tech.bridge.data.CreateCurrencyResponseBody import com.cbdc.industria.tech.bridge.data.GetCurrencyDetailsPageResponseBody import com.cbdc.industria.tech.bridge.data.GetCurrencyDetailsResponseBody -import com.cbdc.industria.tech.bridge.data.Page -import com.cbdc.industria.tech.bridge.views.CurrencyView import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import java.util.concurrent.CompletableFuture import java.util.concurrent.ExecutorService diff --git a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/SandboxEnvService.kt b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/SandboxEnvService.kt index f489caf..0db481a 100644 --- a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/SandboxEnvService.kt +++ b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/SandboxEnvService.kt @@ -3,8 +3,6 @@ package com.cbdc.industria.tech.bridge.services import com.cbdc.industria.tech.bridge.data.CreateNewEnvironmentResponseBody import com.cbdc.industria.tech.bridge.data.GetEnvironmentDetailsPageResponseBody import com.cbdc.industria.tech.bridge.data.GetEnvironmentDetailsResponseBody -import com.cbdc.industria.tech.bridge.data.Page -import com.cbdc.industria.tech.bridge.views.EnvironmentView import java.util.concurrent.CompletableFuture import java.util.concurrent.ExecutorService import java.util.concurrent.Executors From 12c2627f483afc99e4480daa0f842821186f4e3b Mon Sep 17 00:00:00 2001 From: Lazar Iliev Date: Thu, 15 Sep 2022 17:44:51 +0300 Subject: [PATCH 2/2] fix: update tests for missing getOrThrow - minor update on CommercialBankChild change its field `id` type to Long. - remove unused imports. --- .../tech/bridge/models/CommercialBankChild.kt | 3 +- .../tech/bridge/services/PIPService.kt | 1 + .../tech/bridge/CommercialBankServiceTests.kt | 10 +- .../tech/bridge/CurrenciesServiceTests.kt | 4 +- ...penBankingAccountInformationServiceTest.kt | 5 +- .../industria/tech/bridge/PIPServiceTests.kt | 94 ++++++++++++++----- .../tech/bridge/SandboxEnvServiceTests.kt | 1 - .../tech/bridge/StartServiceTests.kt | 15 --- .../tech/bridge/services/MockStartService.kt | 35 ------- 9 files changed, 81 insertions(+), 87 deletions(-) delete mode 100644 cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/StartServiceTests.kt delete mode 100644 cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/services/MockStartService.kt diff --git a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/models/CommercialBankChild.kt b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/models/CommercialBankChild.kt index a7b75f9..3609eb4 100644 --- a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/models/CommercialBankChild.kt +++ b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/models/CommercialBankChild.kt @@ -4,4 +4,5 @@ import com.cbdc.industria.tech.bridge.enums.CurrencyStatus import net.corda.core.serialization.CordaSerializable @CordaSerializable -data class CommercialBankChild(val id: Int, val name: String, val status: CurrencyStatus) +data class CommercialBankChild(val id: Long, val name: String, val status: CurrencyStatus) + diff --git a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/PIPService.kt b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/PIPService.kt index ed9ad95..45feda3 100644 --- a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/PIPService.kt +++ b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/services/PIPService.kt @@ -3,6 +3,7 @@ package com.cbdc.industria.tech.bridge.services import com.cbdc.industria.tech.bridge.data.CreatePaymentInterfaceProviderRequestBody import com.cbdc.industria.tech.bridge.data.CreatePaymentInterfaceProviderResponseBody import com.cbdc.industria.tech.bridge.data.GetBankingEntityAccountResponseBody +import com.cbdc.industria.tech.bridge.data.GetBankingEntityAccountsPageResponseBody import com.cbdc.industria.tech.bridge.data.GetPIPDetailsPageResponseBody import com.cbdc.industria.tech.bridge.data.GetPIPDetailsResponseBody import com.cbdc.industria.tech.bridge.data.GetPartyResponseBody diff --git a/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/CommercialBankServiceTests.kt b/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/CommercialBankServiceTests.kt index f48b300..3e023c3 100644 --- a/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/CommercialBankServiceTests.kt +++ b/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/CommercialBankServiceTests.kt @@ -51,9 +51,9 @@ class CommercialBankServiceTests { @AfterEach fun tearDown() { - commercialBankService.deleteCommercialBank(xEnvId = environmentId, xCurrencyId = currencyId, bankId = commercialBankId) - currenciesService.deleteCurrency(xEnvId = environmentId, currencyId = currencyId) - sandboxEnvService.deleteEnv(environmentId) + commercialBankService.deleteCommercialBank(xEnvId = environmentId, xCurrencyId = currencyId, bankId = commercialBankId).getOrThrow() + currenciesService.deleteCurrency(xEnvId = environmentId, currencyId = currencyId).getOrThrow() + sandboxEnvService.deleteEnv(environmentId).getOrThrow() } @Test @@ -263,7 +263,7 @@ class CommercialBankServiceTests { bankId = commercialBankId, accountId = accountId, body = MakeDepositRequestBody(100) - ) + ).getOrThrow() assertThat( commercialBankService.getAccount( @@ -281,7 +281,7 @@ class CommercialBankServiceTests { bankId = commercialBankId, accountId = accountId, body = MakeWithdrawalRequestBody(100) - ) + ).getOrThrow() assertThat( commercialBankService.getAccount( diff --git a/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/CurrenciesServiceTests.kt b/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/CurrenciesServiceTests.kt index 9c7be46..905c237 100644 --- a/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/CurrenciesServiceTests.kt +++ b/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/CurrenciesServiceTests.kt @@ -34,8 +34,8 @@ class CurrenciesServiceTests { @AfterEach fun tearDown() { - currenciesService.deleteCurrency(xEnvId = environmentId, currencyId = currencyId) - sandboxEnvService.deleteEnv(environmentId) + currenciesService.deleteCurrency(xEnvId = environmentId, currencyId = currencyId).getOrThrow() + sandboxEnvService.deleteEnv(environmentId).getOrThrow() } @Test diff --git a/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/OpenBankingAccountInformationServiceTest.kt b/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/OpenBankingAccountInformationServiceTest.kt index ff97a51..519e47a 100644 --- a/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/OpenBankingAccountInformationServiceTest.kt +++ b/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/OpenBankingAccountInformationServiceTest.kt @@ -1,6 +1,5 @@ package com.cbdc.industria.tech.bridge -import com.cbdc.industria.tech.bridge.data.OpenBankingAccountAccessConsentCreationRequestBody import com.cbdc.industria.tech.bridge.enums.CurrencyCode import com.cbdc.industria.tech.bridge.services.CurrencyService import com.cbdc.industria.tech.bridge.services.HOST_URL @@ -40,8 +39,8 @@ class OpenBankingAccountInformationServiceTest { @AfterEach fun tearDown() { - currenciesService.deleteCurrency(xEnvId = environmentId, currencyId = currencyId) - sandboxEnvService.deleteEnv(environmentId) + currenciesService.deleteCurrency(xEnvId = environmentId, currencyId = currencyId).getOrThrow() + sandboxEnvService.deleteEnv(environmentId).getOrThrow() } diff --git a/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/PIPServiceTests.kt b/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/PIPServiceTests.kt index 860ee1f..c6c96d5 100644 --- a/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/PIPServiceTests.kt +++ b/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/PIPServiceTests.kt @@ -8,6 +8,7 @@ import com.cbdc.industria.tech.bridge.data.OpenAccountRequestBody import com.cbdc.industria.tech.bridge.data.RegisterPartyRequestBody import com.cbdc.industria.tech.bridge.enums.CurrencyCode import com.cbdc.industria.tech.bridge.enums.PartyType +import com.cbdc.industria.tech.bridge.services.CBDCLedgerService import com.cbdc.industria.tech.bridge.services.CommercialBankService import com.cbdc.industria.tech.bridge.services.CurrencyService import com.cbdc.industria.tech.bridge.services.HOST_URL @@ -30,7 +31,7 @@ class PIPServiceTests { executor = Executors.newFixedThreadPool(THREADS_COUNT), host = HOST_URL ) - private val mockCurrencyService = CurrencyService( + private val currencyService = CurrencyService( executor = Executors.newFixedThreadPool(THREADS_COUNT), host = HOST_URL ) @@ -51,12 +52,12 @@ class PIPServiceTests { fun createEnvAndCurrency() { envId = sandboxEnvService.postEnv().getOrThrow().data.id currencyId = - mockCurrencyService.postCurrency(envId, CreateCurrencyRequestBody(CurrencyCode.EUR)).getOrThrow().data.id + currencyService.postCurrency(envId, CreateCurrencyRequestBody(CurrencyCode.EUR)).getOrThrow().data.id } @AfterAll fun deleteEnvAndCurrency() { - mockCurrencyService.deleteCurrency(envId, currencyId).getOrThrow() + currencyService.deleteCurrency(envId, currencyId).getOrThrow() sandboxEnvService.deleteEnv(envId).getOrThrow() } @@ -155,42 +156,85 @@ class PIPServiceTests { val filteredEnv = envs.data.filter { it.status != "TERMINATED" } filteredEnv.forEach { env -> - val currenciesForEnv = mockCurrencyService.getCurrencies(env.id) + val currenciesForEnv = currencyService.getCurrencies(env.id) .getOrThrow().data.filter { currencyView -> currencyView.status.toString() != "TERMINATED" && env.currencies.map { it.currencyId }.contains(currencyView.id) } currenciesForEnv.forEach { currencyForEnv -> + try { + println(" env id: ${env.id} currency id: ${currencyForEnv.id}") + val pips = pipService.getPIPs(env.id, currencyForEnv.id) + .getOrThrow().data.filter { pip -> + pip.status != "TERMINATED" + && currenciesForEnv.flatMap { currencyView -> + currencyView.pips.map { it.id } + }.contains(pip.id) + } - val pips = pipService.getPIPs(env.id, currencyForEnv.id) - .getOrThrow().data.filter { pip -> - pip.status != "TERMINATED" - && currenciesForEnv.flatMap { currencyView -> - currencyView.pips.map { it.id } - }.contains(pip.id) - } + val comBanks = commercialBankService.getCommercialBanks(env.id, currencyForEnv.id) + .getOrThrow().data.filter { comBank -> + comBank.status.toString() != "TERMINATED" && currencyForEnv.commercialBanks.map { it.id } + .contains(comBank.id) + } + + comBanks.forEach { comBank -> + val comAccounts = + commercialBankService.getAccounts(env.id, currencyForEnv.id, comBank.id).getOrThrow() + .data.filter { account -> + account.status.toString() == "OPEN" + && comBank.accounts.map { it.accountId }.contains(account.id) + } + + val comParties = + commercialBankService.getParties(env.id, currencyForEnv.id, comBank.id).getOrThrow() + .data.filter { account -> + account.status.toString() == "ACTIVE" + && comBank.parties.map { it.partyId }.contains(account.id) + } - pips.forEach { pipView -> - pipView.accounts.forEach { account -> - if (account.status.toString() == "OPEN") - pipService.deletePIPAccount(env.id, currencyForEnv.id, pipView.id, account.accountId) - .getOrThrow() + comAccounts.forEach { + commercialBankService.deleteAccount( + env.id, + currencyForEnv.id, + comBank.id, + it.id + ) + } + comParties.forEach { + commercialBankService.deleteParty( + env.id, + currencyForEnv.id, + comBank.id, + it.id + ) + } + commercialBankService.deleteCommercialBank(env.id, currencyForEnv.id, comBank.id) } - pipView.parties.forEach { party -> - if (party.status.toString() == "ACTIVE") - pipService.deletePIPParty(env.id, currencyForEnv.id, pipView.id, party.partyId).getOrThrow() + + pips.forEach { pipView -> + pipView.accounts.forEach { account -> + if (account.status.toString() == "OPEN") + pipService.deletePIPAccount(env.id, currencyForEnv.id, pipView.id, account.accountId) + .getOrThrow() + } + pipView.parties.forEach { party -> + if (party.status.toString() == "ACTIVE") + pipService.deletePIPParty(env.id, currencyForEnv.id, pipView.id, party.partyId) + .getOrThrow() + } + + pipService.deletePIP(env.id, currencyForEnv.id, pipView.id).getOrThrow() } - pipService.deletePIP(env.id, currencyForEnv.id, pipView.id).getOrThrow() + currencyService.deleteCurrency(env.id, currencyForEnv.id).getOrThrow() + sandboxEnvService.deleteEnv(env.id).getOrThrow() + } catch (e: Exception) { + println(e.message) } } - - env.currencies.forEach { mockCurrencyService.deleteCurrency(env.id, it.currencyId).getOrThrow() } - sandboxEnvService.deleteEnv(env.id).getOrThrow() } - val envs2 = sandboxEnvService.getEnvs().getOrThrow().data.filter { it.status != "TERMINATED" } - assertThat(envs2.size).isEqualTo(0) } // @Test diff --git a/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/SandboxEnvServiceTests.kt b/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/SandboxEnvServiceTests.kt index f79a953..5cb62db 100644 --- a/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/SandboxEnvServiceTests.kt +++ b/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/SandboxEnvServiceTests.kt @@ -1,6 +1,5 @@ package com.cbdc.industria.tech.bridge -import com.cbdc.industria.tech.bridge.enums.CurrencyCode import com.cbdc.industria.tech.bridge.services.HOST_URL import com.cbdc.industria.tech.bridge.services.SandboxEnvService import com.cbdc.industria.tech.bridge.services.THREADS_COUNT diff --git a/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/StartServiceTests.kt b/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/StartServiceTests.kt deleted file mode 100644 index 76be9d0..0000000 --- a/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/StartServiceTests.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.cbdc.industria.tech.bridge - -import com.cbdc.industria.tech.bridge.services.MockStartService -import net.corda.core.utilities.getOrThrow -import org.junit.jupiter.api.Test - -class StartServiceTests { - - private val mockStartService = MockStartService() - - @Test - fun getPublicPing() { - mockStartService.getPublicPing().getOrThrow() - } -} \ No newline at end of file diff --git a/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/services/MockStartService.kt b/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/services/MockStartService.kt deleted file mode 100644 index 6691707..0000000 --- a/cbdc-bridge/src/test/kotlin/com/cbdc/industria/tech/bridge/services/MockStartService.kt +++ /dev/null @@ -1,35 +0,0 @@ -package com.cbdc.industria.tech.bridge.services - -import java.util.concurrent.CompletableFuture -import java.util.concurrent.Executors -import java.util.concurrent.Future - -class MockStartService: Start { - - private val executor = Executors.newFixedThreadPool(THREADS_COUNT) - - override fun getPublicPing(): Future { - val future = CompletableFuture() - - executor.execute { - val result = makeGetRequest(url = "$HOST_URL/start-here/public-ping") - result.toCompletableFuture(future) - } - - return future - } - - override fun getAuthPing(authToken: String): Future { - val future = CompletableFuture() - - executor.execute { - val result = makeGetRequest( - url = "$HOST_URL/start-here/public-ping", - headers = mapOf(AUTH_HEADER_KEY to authToken) - ) - result.toCompletableFuture(future) - } - - return future - } -} \ No newline at end of file