Remove CashFlow

Remove the CashFlow flow, replacing it with CashFlowCommand which can be used for the use-cases
with instructions passed around as an object.
This commit is contained in:
Ross Nicoll
2017-02-03 14:07:45 +00:00
parent 288d709668
commit 98c30f6432
14 changed files with 147 additions and 152 deletions

View File

@ -10,7 +10,8 @@ import net.corda.core.node.services.ServiceInfo
import net.corda.core.node.services.Vault
import net.corda.core.serialization.OpaqueBytes
import net.corda.core.toFuture
import net.corda.flows.CashFlow
import net.corda.flows.CashIssueFlow
import net.corda.flows.CashPaymentFlow
import net.corda.node.driver.driver
import net.corda.node.services.User
import net.corda.node.services.startFlowPermission
@ -28,7 +29,10 @@ class IntegrationTestingTutorial {
fun `alice bob cash exchange example`() {
// START 1
driver {
val testUser = User("testUser", "testPassword", permissions = setOf(startFlowPermission<CashFlow>()))
val testUser = User("testUser", "testPassword", permissions = setOf(
startFlowPermission<CashIssueFlow>(),
startFlowPermission<CashPaymentFlow>()
))
val (alice, bob, notary) = Futures.allAsList(
startNode("Alice", rpcUsers = listOf(testUser)),
startNode("Bob", rpcUsers = listOf(testUser)),
@ -56,12 +60,12 @@ class IntegrationTestingTutorial {
val issueRef = OpaqueBytes.of(0)
for (i in 1 .. 10) {
thread {
aliceProxy.startFlow(::CashFlow, CashFlow.Command.IssueCash(
amount = i.DOLLARS,
issueRef = issueRef,
recipient = bob.nodeInfo.legalIdentity,
notary = notary.nodeInfo.notaryIdentity
))
aliceProxy.startFlow(::CashIssueFlow,
i.DOLLARS,
issueRef,
bob.nodeInfo.legalIdentity,
notary.nodeInfo.notaryIdentity
)
}
}
@ -82,10 +86,10 @@ class IntegrationTestingTutorial {
// START 5
for (i in 1 .. 10) {
val flowHandle = bobProxy.startFlow(::CashFlow, CashFlow.Command.PayCash(
amount = i.DOLLARS.issuedBy(alice.nodeInfo.legalIdentity.ref(issueRef)),
recipient = alice.nodeInfo.legalIdentity
))
val flowHandle = bobProxy.startFlow(::CashPaymentFlow,
i.DOLLARS.issuedBy(alice.nodeInfo.legalIdentity.ref(issueRef)),
alice.nodeInfo.legalIdentity
)
flowHandle.returnValue.getOrThrow()
}