Search code examples
unit-testingblockchainworkflowcordamodularization

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

  • 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