Caplin Trader 4.2.0

Class: module:caplin/trading/testing/TOBOUserServiceStub

module:caplin/trading/testing/TOBOUserServiceStub

The TOBOUserServiceStub class provides a stub implementation of the module:caplin/trading/service/TOBOUserService to provide the TOBO user list and accounts for a system-under-test. This class also provides additional methods to set such properties where external sub-systems (such as permissioning) are missing in the testing environment.

The initial state of the TOBOUserServiceStub is as follows:

  • User cannot trade on behalf of other users
  • The TOBOUserService is unlocked and TOBOUserService state values can be modified
  • There are no TOBO Users/Accounts or selected TOBO user/account which the user can trade on behalf of

Constructor

new module:caplin/trading/testing/TOBOUserServiceStub()

Constructs an instance of caplin.trading.testing.TOBOUserServiceStub.
Extends:
Implements:

Extends

Methods

setAccountList(pAccounts)

This method is called by a mock permission service to set the list of the selected TOBO user's accounts that the user of the system-user-test is allowed to trade upon.
Parameters:
Name Type Description
pAccounts Array List of account names.

setTOBOLocked(bLocked)

This method is called to lock the TOBO User Service; i.e. to trigger a signal to all listeners that the TOBO user/account cannot be changed.
Parameters:
Name Type Description
bLocked boolean if TRUE the user/account cannot be changed.

setTOBOUserList(pTOBOUsers)

This method is called by a mock permission service to set the list of TOBO users that the user of the system-user-test is allowed to trade on behalf of.
Parameters:
Name Type Description
pTOBOUsers Array List of TOBO users' names.

setUserCanTradeOnBehalfOf(bCanTradeOnBehalfOf)

This method is called by a mock permission service to adjust whether or not the current user of the system-under-test can trade on behalf of other users, or not.
Parameters:
Name Type Description
bCanTradeOnBehalfOf Boolean True if the user is allowed to trade on behalf of other users; false otherwise.

setUserType(sUserType)

This method is called by a mock permission service to set the user type of the user of the system-under-test.
Parameters:
Name Type Description
sUserType String User type.