在Corda流测试框架中,如何获得到模拟节点的RPC连接? [英] In the Corda flow testing framework, how can I get an RPC connection to a mock node?
本文介绍了在Corda流测试框架中,如何获得到模拟节点的RPC连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Corda中创建用于测试流的模拟网络时,如何获得到其中一个模拟节点的RPC连接?
When creating a mock network for testing flows in Corda, how can I get an RPC connection to one of the mock nodes?
推荐答案
模拟节点未公开用于获取RPC连接的API。
The mock nodes do not expose an API for getting an RPC connection.
如果需要运行涉及节点RPC连接的测试,则应启动节点通过节点驱动程序:
If you need to run tests that involve a node's RPC connection, you should start the nodes via the node driver:
fun main(args: Array<String>) {
val user = User("user1", "test", permissions = setOf("ALL"))
driver(DriverParameters(startNodesInProcess = true, waitForAllNodesToFinish = true)) {
val partyA = startNode(providedName = CordaX500Name("PartyA", "London", "GB"), rpcUsers = listOf(user)).getOrThrow()
val cordaRPCOps = partyA.rpc
TODO("Tests using the RPC connection.")
}
}
这篇关于在Corda流测试框架中,如何获得到模拟节点的RPC连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文