From fca3d565acbdd0e4c036bc33cbd0c99eb491abda Mon Sep 17 00:00:00 2001 From: Andras Slemmer Date: Fri, 26 Jan 2018 14:28:24 +0000 Subject: [PATCH] Add 'Regulator' node for AutoOfferFlow, fixing IRS --- samples/irs-demo/cordapp/build.gradle | 8 ++++++++ .../src/main/kotlin/net/corda/irs/flows/AutoOfferFlow.kt | 4 ++-- .../cordapp/src/test/kotlin/net/corda/irs/Main.kt | 4 +++- .../integration-test/kotlin/net/corda/irs/IRSDemoTest.kt | 4 +++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/samples/irs-demo/cordapp/build.gradle b/samples/irs-demo/cordapp/build.gradle index 015f87342a..3a2dab78d5 100644 --- a/samples/irs-demo/cordapp/build.gradle +++ b/samples/irs-demo/cordapp/build.gradle @@ -94,6 +94,14 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { rpcUsers = ext.rpcUsers useTestClock true } + node { + name "O=Regulator,L=Moscow,C=RU" + p2pPort 10010 + rpcPort 10011 + cordapps = ["${project.group}:finance:$corda_release_version"] + rpcUsers = ext.rpcUsers + useTestClock true + } } task integrationTest(type: Test, dependsOn: []) { diff --git a/samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/flows/AutoOfferFlow.kt b/samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/flows/AutoOfferFlow.kt index 229daa9c5c..9da48655a9 100644 --- a/samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/flows/AutoOfferFlow.kt +++ b/samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/flows/AutoOfferFlow.kt @@ -71,8 +71,8 @@ object AutoOfferFlow { // and because in a real life app you'd probably have more complex logic here e.g. describing why the report // was filed, checking that the reportee is a regulated entity and not some random node from the wrong // country and so on. - // val regulator = serviceHub.identityService.partiesFromName("Regulator", true).single() - // subFlow(ReportToRegulatorFlow(regulator, finalTx)) + val regulator = serviceHub.identityService.partiesFromName("Regulator", true).single() + subFlow(ReportToRegulatorFlow(regulator, finalTx)) return finalTx } diff --git a/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/Main.kt b/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/Main.kt index 8614e26249..c6de65501f 100644 --- a/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/Main.kt +++ b/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/Main.kt @@ -1,5 +1,6 @@ package net.corda.irs +import net.corda.core.identity.CordaX500Name import net.corda.core.utilities.getOrThrow import net.corda.testing.core.DUMMY_BANK_A_NAME import net.corda.testing.core.DUMMY_BANK_B_NAME @@ -13,7 +14,8 @@ fun main(args: Array) { driver(useTestClock = true, isDebug = true, waitForAllNodesToFinish = true) { val (nodeA, nodeB) = listOf( startNode(providedName = DUMMY_BANK_A_NAME), - startNode(providedName = DUMMY_BANK_B_NAME) + startNode(providedName = DUMMY_BANK_B_NAME), + startNode(providedName = CordaX500Name("Regulator", "Moscow", "RU")) ).map { it.getOrThrow() } val controller = defaultNotaryNode.getOrThrow() diff --git a/samples/irs-demo/src/integration-test/kotlin/net/corda/irs/IRSDemoTest.kt b/samples/irs-demo/src/integration-test/kotlin/net/corda/irs/IRSDemoTest.kt index 26877ebf93..9a4c73a772 100644 --- a/samples/irs-demo/src/integration-test/kotlin/net/corda/irs/IRSDemoTest.kt +++ b/samples/irs-demo/src/integration-test/kotlin/net/corda/irs/IRSDemoTest.kt @@ -11,6 +11,7 @@ import com.fasterxml.jackson.module.kotlin.readValue import net.corda.client.jackson.JacksonSupport import net.corda.client.rpc.CordaRPCClient import net.corda.core.contracts.UniqueIdentifier +import net.corda.core.identity.CordaX500Name import net.corda.core.identity.Party import net.corda.core.messaging.vaultTrackBy import net.corda.core.toFuture @@ -56,7 +57,8 @@ class IRSDemoTest { ) { val (nodeA, nodeB) = listOf( startNode(providedName = DUMMY_BANK_A_NAME, rpcUsers = rpcUsers), - startNode(providedName = DUMMY_BANK_B_NAME, rpcUsers = rpcUsers) + startNode(providedName = DUMMY_BANK_B_NAME, rpcUsers = rpcUsers), + startNode(providedName = CordaX500Name("Regulator", "Moscow", "RU")) ).map { it.getOrThrow() } val controller = defaultNotaryNode.getOrThrow()