0

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?

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Shivaganesh
  • 123
  • 8

2 Answers2

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")))

Shivaganesh
  • 123
  • 8
0

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

Dan Newton
  • 910
  • 6
  • 7