Caplin Trader 4.7.1

Class: module:caplin/watchlist/testing/WatchlistServiceStub

module:caplin/watchlist/testing/WatchlistServiceStub

Stub implementation of module:caplin/watchlist/Watchlist used for testing. This class not only provides implementations for the service's interface methods, but also provides several methods for setting its internal state.

This class uses module:caplin/services/testing/RequestStubs to simulate server requests.

Constructor

new module:caplin/watchlist/testing/WatchlistServiceStub()

Implements:
  • caplin/watchlist/WatchlistService

Methods

addWatchlist(properties) → {module:caplin/watchlist/Watchlist}

A stub method used for adding watchlists without having to respond to a request for creation. This can be used to simulate watchlists being created on a different device.
Parameters:
Name Type Description
properties map The properties of the watchlist being added.
Returns:
The added watchlist.
Type
module:caplin/watchlist/Watchlist

create(name, error, success)

Fires a CREATE_REQUESTED event (see module:caplin/watchlist/testing/WatchlistServiceStubEvents) if the service status is AVAILABLE, or fires the error callback otherwise.
Parameters:
Name Type Description
name String The name of the watchlist to be created.
error function A callback that will be invoked if the request fails.
success function A callback that will be invoked when the request succeeds.
See:

dispose(watchlists, error, success)

Fires a DISPOSE_REQUESTED event (see module:caplin/watchlist/testing/WatchlistServiceStubEvents) if the service status is AVAILABLE, or fires the error callback otherwise.
Parameters:
Name Type Description
watchlists Array.<module:caplin/watchlist/Watchlist> The watchlists to dispose of.
error function A callback that will be invoked if the request fails.
success function A callback that will be invoked when the request succeeds.
See:

getById()

getContentsManager()

See:

getId()

See:

getName()

See:

getSubject()

See:

getWatchlistCount()

getWatchlists()

propertyChanged(name, value)

Stub method to change the value of one of this watchlist's properties.
Parameters:
Name Type Description
name The name of the property to change.
value The new value for the changed property.

removeWatchlist(watchlist)

A stub method used for removing watchlists without having to respond to a request for disposal. This can be used to simulate watchlists being removed on a different device.
Parameters:
Name Type Description
watchlist module:caplin/watchlist/Watchlist The removed watchlist.

setName()

See:

setStatus(status)

A stub method used to set the status of the service, representing the availability of its data
Parameters:
Name Type Description
status module:caplin/services/ServiceStatus The new status of the service.
See:

subjectsAdded(subjects)

Stub method to add subjects to this watchlist.
Parameters:
Name Type Description
subjects array The subjects to add to this watchlist.

subjectsRemoved(subjects)

Stub method to remove subjects from this watchlist.
Parameters:
Name Type Description
subjects array The subjects to remove from this watchlist.

module:caplin/watchlist/testing/WatchlistServiceStub

Stub implementation of module:caplin/watchlist/WatchlistService used for testing.

This class not only provides implementations for the service's interface methods, but also provides several methods for setting its internal state.

This class uses module:caplin/services/testing/RequestStubs to simulate server requests.

Constructor

new module:caplin/watchlist/testing/WatchlistServiceStub()

Implements:

Methods

addWatchlist(properties) → {module:caplin/watchlist/Watchlist}

A stub method used for adding watchlists without having to respond to a request for creation. This can be used to simulate watchlists being created on a different device.
Parameters:
Name Type Description
properties map The properties of the watchlist being added.
Returns:
The added watchlist.
Type
module:caplin/watchlist/Watchlist

create(name, error, success)

Fires a CREATE_REQUESTED event (see module:caplin/watchlist/testing/WatchlistServiceStubEvents) if the service status is AVAILABLE, or fires the error callback otherwise.
Parameters:
Name Type Description
name String The name of the watchlist to be created.
error function A callback that will be invoked if the request fails.
success function A callback that will be invoked when the request succeeds.
See:

dispose(watchlists, error, success)

Fires a DISPOSE_REQUESTED event (see module:caplin/watchlist/testing/WatchlistServiceStubEvents) if the service status is AVAILABLE, or fires the error callback otherwise.
Parameters:
Name Type Description
watchlists Array.<module:caplin/watchlist/Watchlist> The watchlists to dispose of.
error function A callback that will be invoked if the request fails.
success function A callback that will be invoked when the request succeeds.
See:

getById()

getContentsManager()

See:

getId()

See:

getName()

See:

getSubject()

See:

getWatchlistCount()

getWatchlists()

propertyChanged(name, value)

Stub method to change the value of one of this watchlist's properties.
Parameters:
Name Type Description
name The name of the property to change.
value The new value for the changed property.

removeWatchlist(watchlist)

A stub method used for removing watchlists without having to respond to a request for disposal. This can be used to simulate watchlists being removed on a different device.
Parameters:
Name Type Description
watchlist module:caplin/watchlist/Watchlist The removed watchlist.

setName()

See:

setStatus(status)

A stub method used to set the status of the service, representing the availability of its data
Parameters:
Name Type Description
status module:caplin/services/ServiceStatus The new status of the service.
See:

subjectsAdded(subjects)

Stub method to add subjects to this watchlist.
Parameters:
Name Type Description
subjects array The subjects to add to this watchlist.

subjectsRemoved(subjects)

Stub method to remove subjects from this watchlist.
Parameters:
Name Type Description
subjects array The subjects to remove from this watchlist.