Class
caplin.services.testing

MessageServiceStub

A stub implementation of caplin.services.messaging.MessageService for use in tests and workbenches.

This class uses emitr.

Constructor Summary

Attributes Name and Description
caplin.services.testing.MessageServiceStub()

Constructs a caplin.services.testing.MessageServiceStub.

Field Summary

Attributes Name and Description
<static> caplin.services.testing.MessageServiceStub.EVENTS

A map of events that this class may trigger.

Method Summary

Attributes Name and Description
void addDataGenerator(caplin.workbench.model.DataGenerator generator)

Adds a data generator that will be used to generate field data for all records.

void addSubjectPrefixData(String prefix, Object data)

Sets initial data for all records that have a subject starting with the given prefix.

void clearDataSubscribers()

caplin.services.testing.RecordStub getRecordStub(String subject)

Gets the caplin.services.testing.RecordStub for the given subject.

Map getRecordStubs()

Gets a map of all caplin.services.testing.RecordStubs.

void invokeSendDataToListenerOnDataSubscribers( subject, data)

void publish( subject, updateData, listener, hints)

This stub does not handle contribs

void publishSessionMessage( subject, updateData, listener, hints)

This stub does not handle session messages

void reset()

Resets the stub, clearing all records, data generators and subject prefix mappings.

caplin.services.testing.SubscriptionStub subscribe( subject, listener)

void updateSubjectData(String subject, Object data)

Updates field data for a record, which then notifies all of its subscriptions of the change.

Constructor Detail

caplin.services.testing.MessageServiceStub()

Constructs a caplin.services.testing.MessageServiceStub.

Field Detail

<static> caplin.services.testing.MessageServiceStub.EVENTS

A map of events that this class may trigger.

Contains the following events:

RECORD_CREATED
Triggered when some of the record's field data has changed.
PARAMETERS
caplin.services.testing.RecordStub record The newly created record.

Method Detail

void addDataGenerator(caplin.workbench.model.DataGenerator generator)

Adds a data generator that will be used to generate field data for all records. Each record's initial values will be used as seeds for the generated values.

Parameters
caplin.workbench.model.DataGenerator generator The data generator.

void addSubjectPrefixData(String prefix, Object data)

Sets initial data for all records that have a subject starting with the given prefix. This does not affect already existing records.

Parameters
String prefix The subject prefix of records that should be initialised with the data.
Object data The initial data for matching records.

void clearDataSubscribers()

Deprecated
Use caplin.services.testing.MessageServiceStub#reset instead.

caplin.services.testing.RecordStub getRecordStub(String subject)

Gets the caplin.services.testing.RecordStub for the given subject.

Parameters
String subject The subject of the RecordStub to get.
Returns
{caplin.services.testing.RecordStub}

Map getRecordStubs()

Gets a map of all caplin.services.testing.RecordStubs.

Returns
{Map}

void invokeSendDataToListenerOnDataSubscribers( subject, data)

Parameters
subject
data
Deprecated
Use caplin.services.testing.MessageServiceStub#updateSubjectData instead.

void publish( subject, updateData, listener, hints)

This stub does not handle contribs

Parameters
subject
updateData
listener
hints

void publishSessionMessage( subject, updateData, listener, hints)

This stub does not handle session messages

Parameters
subject
updateData
listener
hints

void reset()

Resets the stub, clearing all records, data generators and subject prefix mappings.

caplin.services.testing.SubscriptionStub subscribe( subject, listener)

Parameters
subject
listener
Returns
{caplin.services.testing.SubscriptionStub}

void updateSubjectData(String subject, Object data)

Updates field data for a record, which then notifies all of its subscriptions of the change.

Parameters
String subject The subject of the record to be updated.
Object data The new field data for the record.