corda / net.corda.testing.node / MockNetworkParameters

MockNetworkParameters

data class MockNetworkParameters

Immutable builder for configuring a MockNetwork.

Constructors

<init>

MockNetworkParameters(networkSendManuallyPumped: Boolean, threadPerNode: Boolean, servicePeerAllocationStrategy: ServicePeerAllocationStrategy, notarySpecs: List<MockNetworkNotarySpec>, networkParameters: <ERROR CLASS>)
MockNetworkParameters(cordappsForAllNodes: Collection<TestCordapp>)MockNetworkParameters(networkSendManuallyPumped: Boolean = false, threadPerNode: Boolean = false, servicePeerAllocationStrategy: ServicePeerAllocationStrategy = InMemoryMessagingNetwork.ServicePeerAllocationStrategy.Random(), notarySpecs: List<MockNetworkNotarySpec> = listOf(MockNetworkNotarySpec(DUMMY_NOTARY_NAME)), networkParameters: <ERROR CLASS> = testNetworkParameters(), cordappsForAllNodes: Collection<TestCordapp> = emptyList())

Immutable builder for configuring a MockNetwork.

Properties

cordappsForAllNodes

val cordappsForAllNodes: Collection<TestCordapp>

TestCordapps added to all nodes.

networkParameters

val networkParameters: <ERROR CLASS>

The network parameters to be used by all the nodes. NetworkParameters.notaries must be empty as notaries are defined by notarySpecs.

networkSendManuallyPumped

val networkSendManuallyPumped: Boolean

If false then messages will not be routed from sender to receiver until you use the MockNetwork.runNetwork method. This is useful for writing single-threaded unit test code that can examine the state of the mock network before and after a message is sent, without races and without the receiving node immediately sending a response. The default is false, so you must call runNetwork.

notarySpecs

val notarySpecs: List<MockNetworkNotarySpec>

The notaries to use in the mock network. By default you get one mock notary and that is usually sufficient.

servicePeerAllocationStrategy

val servicePeerAllocationStrategy: ServicePeerAllocationStrategy

How messages are load balanced in the case where a single compound identity is used by multiple nodes. You rarely if ever need to change that, it's primarily of interest to people testing notary code.

threadPerNode

val threadPerNode: Boolean

If true then each node will be run in its own thread. This can result in race conditions in your code if not carefully written, but is more realistic and may help if you have flows in your app that do long blocking operations. The default is false.

Functions

copy

fun copy(networkSendManuallyPumped: Boolean, threadPerNode: Boolean, servicePeerAllocationStrategy: ServicePeerAllocationStrategy, notarySpecs: List<MockNetworkNotarySpec>, networkParameters: <ERROR CLASS>): MockNetworkParameters

withCordappsForAllNodes

fun withCordappsForAllNodes(cordappsForAllNodes: Collection<TestCordapp>): MockNetworkParameters

withNetworkParameters

fun withNetworkParameters(networkParameters: <ERROR CLASS>): MockNetworkParameters

withNetworkSendManuallyPumped

fun withNetworkSendManuallyPumped(networkSendManuallyPumped: Boolean): MockNetworkParameters

withNotarySpecs

fun withNotarySpecs(notarySpecs: List<MockNetworkNotarySpec>): MockNetworkParameters

withServicePeerAllocationStrategy

fun withServicePeerAllocationStrategy(servicePeerAllocationStrategy: ServicePeerAllocationStrategy): MockNetworkParameters

withThreadPerNode

fun withThreadPerNode(threadPerNode: Boolean): MockNetworkParameters