MockNetworkParameters - corda

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: NetworkParameters)` `MockNetworkParameters(cordappsForAllNodes: Collection<TestCordapp>)` Immutable builder for configuring a MockNetwork. `MockNetworkParameters(networkSendManuallyPumped: Boolean = false, threadPerNode: Boolean = false, servicePeerAllocationStrategy: ServicePeerAllocationStrategy = InMemoryMessagingNetwork.ServicePeerAllocationStrategy.Random(), notarySpecs: List<MockNetworkNotarySpec> = listOf(MockNetworkNotarySpec(DUMMY_NOTARY_NAME)), networkParameters: NetworkParameters = testNetworkParameters(), cordappsForAllNodes: Collection<TestCordapp> = emptyList())`

### Properties

#### cordappsForAllNodes | TestCordapps added to all nodes. `val cordappsForAllNodes: Collection<TestCordapp>`
#### networkParameters | The network parameters to be used by all the nodes. NetworkParameters.notaries must be empty as notaries are defined by notarySpecs. `val networkParameters: NetworkParameters`
#### networkSendManuallyPumped | 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. `val networkSendManuallyPumped: Boolean`
#### notarySpecs | The notaries to use in the mock network. By default you get one mock notary and that is usually sufficient. `val notarySpecs: List<MockNetworkNotarySpec>`
#### 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. `val servicePeerAllocationStrategy: ServicePeerAllocationStrategy`
#### threadPerNode | 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. `val threadPerNode: Boolean`

### Functions

#### copy | `fun copy(networkSendManuallyPumped: Boolean, threadPerNode: Boolean, servicePeerAllocationStrategy: ServicePeerAllocationStrategy, notarySpecs: List<MockNetworkNotarySpec>, networkParameters: NetworkParameters): MockNetworkParameters`
#### withCordappsForAllNodes | `fun withCordappsForAllNodes(cordappsForAllNodes: Collection<TestCordapp>): MockNetworkParameters`
#### withNetworkParameters | `fun withNetworkParameters(networkParameters: NetworkParameters): 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`