MockNetworkParameters

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

Immutable builder for configuring a MockNetwork.

Constructors

Link copied to clipboard
constructor(networkSendManuallyPumped: Boolean, threadPerNode: Boolean, servicePeerAllocationStrategy: InMemoryMessagingNetwork.ServicePeerAllocationStrategy, notarySpecs: List<MockNetworkNotarySpec>, networkParameters: NetworkParameters)
constructor(cordappsForAllNodes: Collection<TestCordapp>)
constructor(networkSendManuallyPumped: Boolean = false, threadPerNode: Boolean = false, servicePeerAllocationStrategy: InMemoryMessagingNetwork.ServicePeerAllocationStrategy = InMemoryMessagingNetwork.ServicePeerAllocationStrategy.Random(), notarySpecs: List<MockNetworkNotarySpec> = listOf(MockNetworkNotarySpec(DUMMY_NOTARY_NAME)), networkParameters: NetworkParameters = testNetworkParameters(), cordappsForAllNodes: Collection<TestCordapp> = emptyList())

Properties

Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard

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.

Link copied to clipboard

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

Link copied to clipboard

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.

Link copied to clipboard
val threadPerNode: Boolean = false

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

Link copied to clipboard
fun copy(networkSendManuallyPumped: Boolean, threadPerNode: Boolean, servicePeerAllocationStrategy: InMemoryMessagingNetwork.ServicePeerAllocationStrategy, notarySpecs: List<MockNetworkNotarySpec>, networkParameters: NetworkParameters): MockNetworkParameters
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard