com.github.manosbatsis.corda.testacles.mocknetwork / MockNetworkHelper
MockNetworkHelper¶
open class MockNetworkHelper
Used to create and start/stop a Corda MockNetwork
.
Note that according to Corda’s InternalMockNetwork
,
“Using more than one mock network simultaneously is not supported”.
It is recommended to annotate your test suite
classes or methods with ResourceLock
as shown bellow.
That said, you shouldn’t need to do that when using MockNetworkExtension
.
@ResourceLock(MockNetworkHelper.RESOURCE_LOCK)
Constructors¶
Name | Summary |
---|---|
<init> | MockNetworkHelper(mockNetworkConfig: MockNetworkConfig ) Used to create and start/stop a Corda MockNetwork . |
Properties¶
Name | Summary |
---|---|
mockNetwork | lateinit var mockNetwork: MockNetwork |
mockNetworkConfig | val mockNetworkConfig: MockNetworkConfig |
nodeHandles | val nodeHandles: NodeHandles Obtain the mock network nodes as a NodeHandles instance |
nodesMap | lateinit var nodesMap: NodeHandles |
Functions¶
Name | Summary |
---|---|
buildMockNetwork | open fun buildMockNetwork(): MockNetwork Initialize, but not start, the network |
buildNodes | open fun buildNodes(): NodeHandles Initialize, but not start, the nodes |
maybeWithConfig | open fun TestCordapp.maybeWithConfig(packageName: String ): TestCordapp Apply any custom config if one was given for it’s package |
onStarted | open fun onStarted(): Unit Override to add post-startup initialization logic, e.g. assign individual started nodes to variables for ease of use. |
start | fun start(): Unit Start the network |
stop | fun stop(): Unit Stop the network |
Companion Object Properties¶
Name | Summary |
---|---|
RESOURCE_LOCK | const val RESOURCE_LOCK: String |