corda / net.corda.testing.node / StartedMockNode

StartedMockNode

class StartedMockNode

A class that represents a started mock node for testing.

Properties

id

An identifier for the node. By default this is allocated sequentially in a MockNetwork.

val id: Int

info

The NodeInfo for the underlying node.

val info: NodeInfo

services

The ServiceHub for the underlying node.

val services: ServiceHub

Functions

findStateMachines

Returns the currently live flows of type flowClass, and their corresponding result future.

fun <F : FlowLogic<*>> findStateMachines(flowClass: Class<F>): List<Pair<F, CordaFuture<*>>>

pumpReceive

Delivers a single message from the internal queue. If there are no messages waiting to be delivered and block is true, waits until one has been provided on a different thread via send. If block is false, the return result indicates whether a message was delivered or not.

fun pumpReceive(block: Boolean = false): MessageTransfer?

registerInitiatedFlow

Manually register an initiating-responder flow pair based on the FlowLogic annotations.

fun <F : FlowLogic<*>> registerInitiatedFlow(initiatedFlowClass: Class<F>): Observable<F>

Register a custom relationship between initiating and receiving flow on a node-by-node basis. This is used when we want to manually specify that a particular initiating flow class will have a particular responder.

fun <F : FlowLogic<*>> registerInitiatedFlow(initiatingFlowClass: Class<out FlowLogic<*>>, initiatedFlowClass: Class<F>): Observable<F>

startFlow

Starts an already constructed flow. Note that you must be on the server thread to call this method.

fun <T> startFlow(logic: FlowLogic<T>): CordaFuture<T>

stop

Stop the node.

fun stop(): Unit

transaction

Executes given statement in the scope of transaction.

fun <T> transaction(statement: () -> T): T