mirror of
https://github.com/corda/corda.git
synced 2024-12-21 22:07:55 +00:00
Adds constructors for creating mock nodes by passing params.
This commit is contained in:
parent
e5857b8e45
commit
c3455053ac
@ -152,9 +152,45 @@ open class MockNetwork(
|
||||
/** Create a started node with the given parameters. **/
|
||||
fun createNode(parameters: MockNodeParameters = MockNodeParameters()): StartedMockNode = StartedMockNode.create(internalMockNetwork.createNode(parameters))
|
||||
|
||||
/** Create a started node with the given parameters.
|
||||
* @param legalName the node's legal name.
|
||||
* @param forcedID a unique identifier for the node.
|
||||
* @param entropyRoot the initial entropy value to use when generating keys. Defaults to an (insecure) random value,
|
||||
* but can be overridden to cause nodes to have stable or colliding identity/service keys.
|
||||
* @param configOverrides add/override behaviour of the [NodeConfiguration] mock object.
|
||||
* @param version the mock node's platform, release, revision and vendor versions.
|
||||
*/
|
||||
@JvmOverloads
|
||||
fun createNode(legalName: CordaX500Name? = null,
|
||||
forcedID: Int? = null,
|
||||
entropyRoot: BigInteger = BigInteger.valueOf(random63BitValue()),
|
||||
configOverrides: (NodeConfiguration) -> Any? = {},
|
||||
version: VersionInfo = MockServices.MOCK_VERSION_INFO): StartedMockNode {
|
||||
val parameters = MockNodeParameters(forcedID, legalName, entropyRoot, configOverrides, version)
|
||||
return StartedMockNode.create(internalMockNetwork.createNode(parameters))
|
||||
}
|
||||
|
||||
/** Create an unstarted node with the given parameters. **/
|
||||
fun createUnstartedNode(parameters: MockNodeParameters = MockNodeParameters()): UnstartedMockNode = UnstartedMockNode.create(internalMockNetwork.createUnstartedNode(parameters))
|
||||
|
||||
/** Create an unstarted node with the given parameters.
|
||||
* @param legalName the node's legal name.
|
||||
* @param forcedID a unique identifier for the node.
|
||||
* @param entropyRoot the initial entropy value to use when generating keys. Defaults to an (insecure) random value,
|
||||
* but can be overridden to cause nodes to have stable or colliding identity/service keys.
|
||||
* @param configOverrides add/override behaviour of the [NodeConfiguration] mock object.
|
||||
* @param version the mock node's platform, release, revision and vendor versions.
|
||||
*/
|
||||
@JvmOverloads
|
||||
fun createUnstartedNode(legalName: CordaX500Name? = null,
|
||||
forcedID: Int? = null,
|
||||
entropyRoot: BigInteger = BigInteger.valueOf(random63BitValue()),
|
||||
configOverrides: (NodeConfiguration) -> Any? = {},
|
||||
version: VersionInfo = MockServices.MOCK_VERSION_INFO): UnstartedMockNode {
|
||||
val parameters = MockNodeParameters(forcedID, legalName, entropyRoot, configOverrides, version)
|
||||
return UnstartedMockNode.create(internalMockNetwork.createUnstartedNode(parameters))
|
||||
}
|
||||
|
||||
/** Start all nodes that aren't already started. **/
|
||||
fun startNodes() = internalMockNetwork.startNodes()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user