Skip to main content
Version: v1

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.

Signature​

export declare class MockContainerRuntimeFactory

Properties​

PropertyTypeDescription
messagesISequencedDocumentMessage[]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.
minSeqMap<string, number>
outstandingMessageCountnumber
quorumMockQuorumClients
runtimesMockContainerRuntime[]
sequenceNumbernumber

Methods​

MethodReturn TypeDescription
createContainerRuntime(dataStoreRuntime)MockContainerRuntime
getMinSeq()number
processAllMessages()voidProcess all remaining messages in the queue.
processOneMessage()voidProcess one of the queued messages. Throws if no messages are queued.
processSomeMessages(count)voidProcess a given number of queued messages. Throws if there are fewer messages queued than requested.
pushMessage(msg)void

Property Details​

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.

Signature​

protected messages: ISequencedDocumentMessage[];

Type: ISequencedDocumentMessage[]

minSeq​

Signature​

minSeq: Map<string, number>;

Type: Map<string, number>

outstandingMessageCount​

Signature​

get outstandingMessageCount(): number;

Type: number

quorum​

Signature​

readonly quorum: MockQuorumClients;

Type: MockQuorumClients

runtimes​

Signature​

protected readonly runtimes: MockContainerRuntime[];

Type: MockContainerRuntime[]

sequenceNumber​

Signature​

sequenceNumber: number;

Type: number

Method Details​

createContainerRuntime​

Signature​

createContainerRuntime(dataStoreRuntime: MockFluidDataStoreRuntime): MockContainerRuntime;

Parameters​

ParameterTypeDescription
dataStoreRuntimeMockFluidDataStoreRuntime

Returns​

Return type: MockContainerRuntime

getMinSeq​

Signature​

getMinSeq(): number;

Returns​

Return type: number

processAllMessages​

Process all remaining messages in the queue.

Signature​

processAllMessages(): void;

processOneMessage​

Process one of the queued messages. Throws if no messages are queued.

Signature​

processOneMessage(): void;

processSomeMessages​

Process a given number of queued messages. Throws if there are fewer messages queued than requested.

Signature​

processSomeMessages(count: number): void;

Parameters​

ParameterTypeDescription
countnumberthe number of messages to process

pushMessage​

Signature​

pushMessage(msg: Partial<ISequencedDocumentMessage>): void;

Parameters​

ParameterTypeDescription
msgPartial<ISequencedDocumentMessage>