'In Corda flow tests, how to get the modularized cordapps assigned only to the respective parties?
As per the Corda coding guidelines, I have seperated out modules into contracts and workflows-common. There are workflows modules like workflows-party1, workflows-part2 etc. specific to a party. Now I want to give those workflows only to that particular node in my flow tests. How to achieve this?
Solution 1:[1]
The other answer is one way to achieve this, another is to use the DriverDSL (depends how you are writing your tests)
driver(DriverParameters(startNodesInProcess = false, inMemoryDB = false)) {
val charlie = startNode(
NodeParameters(
providedName = CHARLIE_NAME,
rpcUsers = listOf(rpcUser),
// important line
additionalCordapps = cordappsForPackages("package name")
)
).getOrThrow()
// stuff
}
Either solution works
Solution 2:[2]
In Corda v4, it can be achieved in this way
private val network = MockNetwork(MockNetworkParameters(cordappsForAllNodes = listOf(
TestCordapp.findCordapp("com.template.contracts"),
TestCordapp.findCordapp("com.template.common")),
networkParameters = testNetworkParameters(minimumPlatformVersion = 4),
notarySpecs = listOf(MockNetworkNotarySpec(CordaX500Name.parse("O=Notary,L=London,C=GB")))))
private val party1 = network.createNode(MockNodeParameters(
additionalCordapps = listOf(TestCordapp.findCordapp("com.template.workflows.party1")),
legalName = CordaX500Name.parse("O=Party,L=London,C=GB")))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Dan Newton |
Solution 2 | Shivaganesh |