public class StartedMockNode
A class that represents a started mock node for testing.
Modifier and Type | Class and Description |
---|---|
static class |
StartedMockNode.Companion |
Modifier and Type | Field and Description |
---|---|
static StartedMockNode.Companion |
Companion |
Modifier and Type | Method and Description |
---|---|
<F extends FlowLogic<?>> |
findStateMachines(java.lang.Class<F> flowClass)
Returns the currently live flows of type flowClass, and their corresponding result future.
|
int |
getId()
An identifier for the node. By default this is allocated sequentially in a
class MockNetwork . |
NodeInfo |
getInfo()
The
class NodeInfo for the underlying node. |
ServiceHub |
getServices()
The
interface ServiceHub for the underlying node. |
InMemoryMessagingNetwork.MessageTransfer |
pumpReceive(boolean block)
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.
|
<F extends FlowLogic<?>> |
registerInitiatedFlow(java.lang.Class<F> initiatedFlowClass)
Manually register an initiating-responder flow pair based on the
class FlowLogic annotations. |
<F extends FlowLogic<?>> |
registerInitiatedFlow(java.lang.Class<? extends net.corda.core.flows.FlowLogic<?>> initiatingFlowClass,
java.lang.Class<F> initiatedFlowClass)
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.
|
<T> CordaFuture<T> |
startFlow(FlowLogic<? extends T> logic)
Starts an already constructed flow. Note that you must be on the server thread to call this method.
|
NonExistentClass |
stop()
Stop the node.
|
<T> T |
transaction(Function0<? extends T> statement)
Executes given statement in the scope of transaction.
|
public static StartedMockNode.Companion Companion
public ServiceHub getServices()
The interface ServiceHub
for the underlying node.
interface ServiceHub
public int getId()
An identifier for the node. By default this is allocated sequentially in a class MockNetwork
.
class MockNetwork
public NodeInfo getInfo()
The class NodeInfo
for the underlying node.
class NodeInfo
public <T> CordaFuture<T> startFlow(FlowLogic<? extends T> logic)
Starts an already constructed flow. Note that you must be on the server thread to call this method.
public <F extends FlowLogic<?>> NonExistentClass registerInitiatedFlow(java.lang.Class<F> initiatedFlowClass)
Manually register an initiating-responder flow pair based on the class FlowLogic
annotations.
NOTE: There is no need to call this method if the flow pair is defined in the CorDapp and the class TestCordapp
API is used.
initiatedFlowClass
- class FlowLogic
class which is annotated with interface InitiatedBy
.class FlowLogic
,
class TestCordapp
public <F extends FlowLogic<?>> NonExistentClass registerInitiatedFlow(java.lang.Class<? extends net.corda.core.flows.FlowLogic<?>> initiatingFlowClass, java.lang.Class<F> initiatedFlowClass)
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.
Note that this change affects only the node on which this method is called, and not the entire network.
initiatingFlowClass
- The class FlowLogic
-inheriting class to register a new responder for.initiatedFlowClass
- The class of the responder flow.public NonExistentClass stop()
Stop the node.
public InMemoryMessagingNetwork.MessageTransfer pumpReceive(boolean block)
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.
public <F extends FlowLogic<?>> java.util.List<NonExistentClass> findStateMachines(java.lang.Class<F> flowClass)
Returns the currently live flows of type flowClass, and their corresponding result future.
public <T> T transaction(Function0<? extends T> statement)
Executes given statement in the scope of transaction.
statement
- to be executed in the scope of this transaction.