diff --git a/README.md b/README.md index 792ee76..36196e1 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,17 @@ is the bridge used to easy access Barclays APIs. During the hackaton contracts and states can be created in `contracts` module and flows can be created in the `workflows` module. + +## Getting started + +In order to operate with provided bridge functionalities, you should use the provided auth token for your team and set it as a system environment variable. (edited) + +To be able to use the bridge with the configured token `val AUTH_TOKEN: String = System.getenv("BARCLAYS_AUTH_TOKEN")`. + +In Linux you can set it into you `.profile` file under the home directory like that: + +`export BARCLAYS_AUTH_TOKEN="the-actual-token"` + +In Windows you can go through the menu to Environment Variable and set it from there. + +https://docs.oracle.com/en/database/oracle/machine-learning/oml4r/1.5.1/oread/creating-and-modifying-environment-variables-on-windows.html#GUID-DD6F9982-60D5-48F6-8270-A27EC53807D0 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/Ecosystem.kt b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/data/Ecosystem.kt deleted file mode 100644 index eb585a0..0000000 --- a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/data/Ecosystem.kt +++ /dev/null @@ -1,35 +0,0 @@ -package com.cbdc.industria.tech.bridge.data - -import com.cbdc.industria.tech.bridge.enums.DomesticPaymentStatus -import net.corda.core.serialization.CordaSerializable - -@CordaSerializable -data class MakeDomesticPaymentRequestBody( - val sourceAccountId: Long, - val destinationAccountId: Long, - val paymentAmountInCurrencyUnits: Long -) - -@CordaSerializable -data class MakeDomesticPaymentResponseBody(val data: MakeDomesticPaymentResponseData) - -@CordaSerializable -data class MakeDomesticPaymentResponseData(val id: Long) - -@CordaSerializable -data class GetDomesticPaymentDetailsResponseBody(val data: DomesticPaymentView) - -@CordaSerializable -data class DomesticPaymentView( - val paymentId: Long, - val paymentInitiationDetails: PaymentInitiationDetails, - val status: DomesticPaymentStatus, - val failureReason: String - ) - -@CordaSerializable -data class PaymentInitiationDetails( - val sourceAccountId: Long, - val destinationAccountId: Long, - val paymentAmount: Long -) \ No newline at end of file diff --git a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/data/OpenBankingAccountInformation.kt b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/data/OpenBankingAccountInformation.kt index 227443f..dd55b5a 100644 --- a/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/data/OpenBankingAccountInformation.kt +++ b/cbdc-bridge/src/main/kotlin/com/cbdc/industria/tech/bridge/data/OpenBankingAccountInformation.kt @@ -1,6 +1,5 @@ package com.cbdc.industria.tech.bridge.data -import com.cbdc.industria.tech.bridge.enums.BankingEntityType import com.cbdc.industria.tech.bridge.views.AccountAccessConsentView import net.corda.core.serialization.CordaSerializable @@ -11,21 +10,6 @@ data class OpenBankingAccountAccessConsentCreationRequestBody( val requestingBankingEntityRef: RequestingBankingEntityRef ) -@CordaSerializable -data class RequestingPartyId(val partyId: Long) - -@CordaSerializable -data class BankingEntityWhereRequestingPartyIsRegisteredRef( - val bankingEntityType: BankingEntityType, - val bankingEntityId: Long -) - -@CordaSerializable -data class RequestingBankingEntityRef( - val bankingEntityType: BankingEntityType, - val bankingEntityId: Long -) - @CordaSerializable data class CreateAccountAccessConsentResponseBody( val data: CreateAccountAccessConsentResponseBodyData 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/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/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/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/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 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