mirror of
https://github.com/corda/corda.git
synced 2025-02-20 09:26:41 +00:00
Bank of Corda demo: Fix broken RPC client test.
This commit is contained in:
parent
259bdf4261
commit
d9a1e352cd
@ -10,7 +10,7 @@ import net.corda.node.driver.driver
|
||||
import net.corda.node.services.startFlowPermission
|
||||
import net.corda.node.services.transactions.SimpleNotaryService
|
||||
import net.corda.nodeapi.User
|
||||
import net.corda.testing.BOC_PARTY_REF
|
||||
import net.corda.testing.BIG_CORP_PARTY_REF
|
||||
import net.corda.testing.expect
|
||||
import net.corda.testing.expectEvents
|
||||
import net.corda.testing.sequence
|
||||
@ -20,20 +20,21 @@ class BankOfCordaRPCClientTest {
|
||||
@Test
|
||||
fun `issuer flow via RPC`() {
|
||||
driver(dsl = {
|
||||
val user = User("user1", "test", permissions = setOf(startFlowPermission<IssuanceRequester>()))
|
||||
val bocManager = User("bocManager", "password1", permissions = setOf(startFlowPermission<IssuanceRequester>()))
|
||||
val bigCorpCFO = User("bigCorpCFO", "password2", permissions = emptySet())
|
||||
val (nodeBankOfCorda, nodeBigCorporation) = Futures.allAsList(
|
||||
startNode("BankOfCorda", setOf(ServiceInfo(SimpleNotaryService.type)), listOf(user)),
|
||||
startNode("BigCorporation", rpcUsers = listOf(user))
|
||||
startNode("BankOfCorda", setOf(ServiceInfo(SimpleNotaryService.type)), listOf(bocManager)),
|
||||
startNode("BigCorporation", rpcUsers = listOf(bigCorpCFO))
|
||||
).getOrThrow()
|
||||
|
||||
// Bank of Corda RPC Client
|
||||
val bocClient = nodeBankOfCorda.rpcClientToNode()
|
||||
bocClient.start("user1", "test")
|
||||
bocClient.start("bocManager", "password1")
|
||||
val bocProxy = bocClient.proxy()
|
||||
|
||||
// Big Corporation RPC Client
|
||||
val bigCorpClient = nodeBankOfCorda.rpcClientToNode() // TODO This test is broken as this should be nodeBigCorporation
|
||||
bigCorpClient.start("user1", "test")
|
||||
val bigCorpClient = nodeBigCorporation.rpcClientToNode()
|
||||
bigCorpClient.start("bigCorpCFO", "password2")
|
||||
val bigCorpProxy = bigCorpClient.proxy()
|
||||
|
||||
// Register for Bank of Corda Vault updates
|
||||
@ -47,7 +48,7 @@ class BankOfCordaRPCClientTest {
|
||||
::IssuanceRequester,
|
||||
1000.DOLLARS,
|
||||
nodeBigCorporation.nodeInfo.legalIdentity,
|
||||
BOC_PARTY_REF,
|
||||
BIG_CORP_PARTY_REF,
|
||||
nodeBankOfCorda.nodeInfo.legalIdentity).returnValue.getOrThrow()
|
||||
|
||||
// Check Bank of Corda Vault Updates
|
||||
@ -69,15 +70,10 @@ class BankOfCordaRPCClientTest {
|
||||
// Check Big Corporation Vault Updates
|
||||
vaultUpdatesBigCorp.expectEvents {
|
||||
sequence(
|
||||
// ISSUE
|
||||
// MOVE
|
||||
expect { update ->
|
||||
require(update.consumed.isEmpty()) { update.consumed.size }
|
||||
require(update.produced.size == 1) { update.produced.size }
|
||||
},
|
||||
// MOVE
|
||||
expect { update ->
|
||||
require(update.consumed.size == 1) { update.consumed.size }
|
||||
require(update.produced.isEmpty()) { update.produced.size }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@ -85,6 +85,11 @@ val BOC_PUBKEY: CompositeKey get() = BOC_KEY.public.composite
|
||||
val BOC: Party get() = Party("BankOfCorda", BOC_PUBKEY)
|
||||
val BOC_PARTY_REF = BOC.ref(OpaqueBytes.of(1)).reference
|
||||
|
||||
val BIG_CORP_KEY: KeyPair by lazy { generateKeyPair() }
|
||||
val BIG_CORP_PUBKEY: CompositeKey get() = BIG_CORP_KEY.public.composite
|
||||
val BIG_CORP: Party get() = Party("BigCorporation", BIG_CORP_PUBKEY)
|
||||
val BIG_CORP_PARTY_REF = BIG_CORP.ref(OpaqueBytes.of(1)).reference
|
||||
|
||||
val ALL_TEST_KEYS: List<KeyPair> get() = listOf(MEGA_CORP_KEY, MINI_CORP_KEY, ALICE_KEY, BOB_KEY, DUMMY_NOTARY_KEY)
|
||||
|
||||
val MOCK_IDENTITY_SERVICE: MockIdentityService get() = MockIdentityService(listOf(MEGA_CORP, MINI_CORP, DUMMY_NOTARY))
|
||||
|
Loading…
x
Reference in New Issue
Block a user