MockContainerRuntimeFactory Class
Factory to create MockContainerRuntime for testing basic submitting and processing of messages. This also acts as a very basic server that stores the messages from all the MockContainerRuntimes and processes them when asked. If test specific logic is required, extend this class and add the logic there. For an example, take a look at MockContainerRuntimeFactoryForReconnection. \
To use, import via @fluidframework/test-runtime-utils/legacy
.
For more information about our API support guarantees, see here.
Signature
export declare class MockContainerRuntimeFactory
Constructors
Constructor | Alerts | Description |
---|---|---|
(constructor)(mockContainerRuntimeOptions) | Beta |
Constructs a new instance of the MockContainerRuntimeFactory class |
Properties
Property | Alerts | Modifiers | Type | Description |
---|---|---|---|---|
lastProcessedMessage | Beta |
ISequencedDocumentMessage | undefined | ||
messages | Beta |
ISequencedDocumentMessage[] | The MockContainerRuntimes we produce will push messages into this queue as they are submitted. This is playing the role of the orderer, establishing a single universal order for the messages generated. They are held in this queue until we explicitly choose to process them, at which time they are "broadcast" to each of the runtimes. | |
minSeq | Beta |
Map<string, number> | ||
outstandingMessageCount | Beta |
readonly |
number | |
quorum | Beta |
readonly |
MockQuorumClients | |
runtimeOptions | Beta |
readonly |
Required<IMockContainerRuntimeOptions> |
The container runtime options which will be provided to the all runtimes created by this factory and also drive the way the ops are processed. |
runtimes | Beta |
readonly |
Set<MockContainerRuntime> | |
sequenceNumber | Beta |
number |
Methods
Method | Alerts | Return Type | Description |
---|---|---|---|
createContainerRuntime(dataStoreRuntime) | Beta |
MockContainerRuntime | |
getFirstMessageToProcess() | Beta |
ISequencedDocumentMessage | |
getMinSeq() | Beta |
number | |
processAllMessages() | Beta |
void | Process all remaining messages in the queue. |
processOneMessage() | Beta |
void | Process one of the queued messages. Throws if no messages are queued. |
processSomeMessages(count) | Beta |
void | Process a given number of queued messages. Throws if there are fewer messages queued than requested. |
pushMessage(msg) | Beta |
void | |
removeContainerRuntime(containerRuntime) | Beta |
void |
Constructor Details
(constructor)
Constructs a new instance of the MockContainerRuntimeFactory
class
For more information about our API support guarantees, see here.
Signature
constructor(mockContainerRuntimeOptions?: IMockContainerRuntimeOptions);
Parameters
Parameter | Modifiers | Type | Description |
---|---|---|---|
mockContainerRuntimeOptions | optional | IMockContainerRuntimeOptions |
Property Details
lastProcessedMessage
For more information about our API support guarantees, see here.
Signature
protected lastProcessedMessage: ISequencedDocumentMessage | undefined;
Type: ISequencedDocumentMessage | undefined
messages
The MockContainerRuntimes we produce will push messages into this queue as they are submitted. This is playing the role of the orderer, establishing a single universal order for the messages generated. They are held in this queue until we explicitly choose to process them, at which time they are "broadcast" to each of the runtimes.
For more information about our API support guarantees, see here.
Signature
protected messages: ISequencedDocumentMessage[];
Type: ISequencedDocumentMessage[]
minSeq
For more information about our API support guarantees, see here.
Signature
minSeq: Map<string, number>;
Type: Map<string, number>
outstandingMessageCount
For more information about our API support guarantees, see here.
Signature
get outstandingMessageCount(): number;
Type: number
quorum
For more information about our API support guarantees, see here.
Signature
readonly quorum: MockQuorumClients;
Type: MockQuorumClients
runtimeOptions
The container runtime options which will be provided to the all runtimes created by this factory and also drive the way the ops are processed.
See IMockContainerRuntimeOptions
For more information about our API support guarantees, see here.
Signature
protected readonly runtimeOptions: Required<IMockContainerRuntimeOptions>;
Type: Required<IMockContainerRuntimeOptions>
runtimes
For more information about our API support guarantees, see here.
Signature
protected readonly runtimes: Set<MockContainerRuntime>;
Type: Set<MockContainerRuntime>
sequenceNumber
For more information about our API support guarantees, see here.
Signature
sequenceNumber: number;
Type: number
Method Details
createContainerRuntime
For more information about our API support guarantees, see here.
Signature
createContainerRuntime(dataStoreRuntime: MockFluidDataStoreRuntime): MockContainerRuntime;
Parameters
Parameter | Type | Description |
---|---|---|
dataStoreRuntime | MockFluidDataStoreRuntime |
Returns
Return type: MockContainerRuntime
getFirstMessageToProcess
For more information about our API support guarantees, see here.
Signature
protected getFirstMessageToProcess(): ISequencedDocumentMessage;
Returns
Return type: ISequencedDocumentMessage
getMinSeq
For more information about our API support guarantees, see here.
Signature
getMinSeq(): number;
Returns
a minimum sequence number for all connected clients.
Return type: number
processAllMessages
Process all remaining messages in the queue.
For more information about our API support guarantees, see here.
Signature
processAllMessages(): void;
processOneMessage
Process one of the queued messages. Throws if no messages are queued.
For more information about our API support guarantees, see here.
Signature
processOneMessage(): void;
processSomeMessages
Process a given number of queued messages. Throws if there are fewer messages queued than requested.
For more information about our API support guarantees, see here.
Signature
processSomeMessages(count: number): void;
Parameters
Parameter | Type | Description |
---|---|---|
count | number | the number of messages to process |
pushMessage
For more information about our API support guarantees, see here.
Signature
pushMessage(msg: Partial<ISequencedDocumentMessage>): void;
Parameters
Parameter | Type | Description |
---|---|---|
msg | Partial<ISequencedDocumentMessage> |
removeContainerRuntime
For more information about our API support guarantees, see here.
Signature
removeContainerRuntime(containerRuntime: MockContainerRuntime): void;
Parameters
Parameter | Type | Description |
---|---|---|
containerRuntime | MockContainerRuntime |