mirror of
https://github.com/corda/corda.git
synced 2025-01-17 10:20:02 +00:00
Test transmission of an actual cash balance via RPC.
This commit is contained in:
parent
1a78ca240a
commit
6ad81ca1e7
@ -10,9 +10,6 @@ import net.corda.core.random63BitValue
|
|||||||
import net.corda.core.serialization.OpaqueBytes
|
import net.corda.core.serialization.OpaqueBytes
|
||||||
import net.corda.flows.CashIssueFlow
|
import net.corda.flows.CashIssueFlow
|
||||||
import net.corda.flows.CashPaymentFlow
|
import net.corda.flows.CashPaymentFlow
|
||||||
import net.corda.node.driver.DriverBasedTest
|
|
||||||
import net.corda.node.driver.NodeHandle
|
|
||||||
import net.corda.node.driver.driver
|
|
||||||
import net.corda.node.internal.Node
|
import net.corda.node.internal.Node
|
||||||
import net.corda.node.services.User
|
import net.corda.node.services.User
|
||||||
import net.corda.node.services.config.configureTestSSL
|
import net.corda.node.services.config.configureTestSSL
|
||||||
@ -22,8 +19,11 @@ import net.corda.node.services.transactions.ValidatingNotaryService
|
|||||||
import net.corda.testing.node.NodeBasedTest
|
import net.corda.testing.node.NodeBasedTest
|
||||||
import org.apache.activemq.artemis.api.core.ActiveMQSecurityException
|
import org.apache.activemq.artemis.api.core.ActiveMQSecurityException
|
||||||
import org.assertj.core.api.Assertions.assertThatExceptionOfType
|
import org.assertj.core.api.Assertions.assertThatExceptionOfType
|
||||||
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import java.util.*
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
class CordaRPCClientTest : NodeBasedTest() {
|
class CordaRPCClientTest : NodeBasedTest() {
|
||||||
private val rpcUser = User("user1", "test", permissions = setOf(
|
private val rpcUser = User("user1", "test", permissions = setOf(
|
||||||
@ -39,6 +39,11 @@ class CordaRPCClientTest : NodeBasedTest() {
|
|||||||
client = CordaRPCClient(node.configuration.artemisAddress, configureTestSSL())
|
client = CordaRPCClient(node.configuration.artemisAddress, configureTestSSL())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun done() {
|
||||||
|
client.close()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `log in with valid username and password`() {
|
fun `log in with valid username and password`() {
|
||||||
client.start(rpcUser.username, rpcUser.password)
|
client.start(rpcUser.username, rpcUser.password)
|
||||||
@ -95,7 +100,22 @@ class CordaRPCClientTest : NodeBasedTest() {
|
|||||||
client.start(rpcUser.username, rpcUser.password)
|
client.start(rpcUser.username, rpcUser.password)
|
||||||
println("Creating proxy")
|
println("Creating proxy")
|
||||||
val proxy = client.proxy()
|
val proxy = client.proxy()
|
||||||
val cash = proxy.getCashBalances()
|
|
||||||
println("Cash Balances: $cash")
|
val startCash = proxy.getCashBalances()
|
||||||
|
assert(startCash.isEmpty(), {"Should not start with any cash"})
|
||||||
|
|
||||||
|
val flowHandle = proxy.startFlow(::CashIssueFlow,
|
||||||
|
123.DOLLARS, OpaqueBytes.of(0),
|
||||||
|
node.info.legalIdentity, node.info.legalIdentity
|
||||||
|
)
|
||||||
|
println("Started issuing cash, waiting on result")
|
||||||
|
flowHandle.progress.subscribe {
|
||||||
|
println("CashIssue PROGRESS $it")
|
||||||
|
}
|
||||||
|
|
||||||
|
val finishCash = proxy.getCashBalances()
|
||||||
|
println("Cash Balances: $finishCash")
|
||||||
|
assertEquals(1, finishCash.size)
|
||||||
|
assertEquals(123.DOLLARS, finishCash.get(Currency.getInstance("USD")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user