The ConnectionServiceStub
serves to create a stub for a ConnectionService
to enable tests to simulate connection status changes.
Attributes | Name and Description |
---|---|
|
caplin.services.testing.ConnectionServiceStub(Object oStreamLink, String sInitialState)
Constructs a |
Attributes | Name and Description |
---|---|
|
void
addStatusChangedListener(Function fCallback)
Add a function as listener to connection status changes. |
|
void
getAvailableStates()
Returns the states the ConnectionServiceStub can be in. |
|
void
getCurrentState()
Returns the current ConnectionServiceStub connection state |
|
void
getStreamlink()
Return Streamlink instance. |
|
void
getValidTransitions(String The)
Returns the available states that can be transitioned from the state given. |
|
void
removeStatusChangedListener(Function fCallback)
Remove a function as listener to connection status changes. |
|
void
setState(String sNewState)
Sets a connection state from the available ones ('OK', 'ERROR', 'PARTIAL', 'DOWN') and notifies the listeners of a connection status change. |
|
void
updateStatus(String sCallback, Array pReasons)
Notify connection service listeners that the connection status has changed. |
►
caplin.services.testing.ConnectionServiceStub(Object oStreamLink, String sInitialState)
Constructs a caplin.services.testing.ConnectionServiceStub
.
Object | oStreamLink | Streamlink instance to be used, this parameter is optional. |
String | sInitialState | Initial state for the ConnectionServiceStub, this parameter is optional. |
►
void
addStatusChangedListener(Function fCallback)
Add a function as listener to connection status changes.
Function | fCallback | The callback that is used to notify of connection status changes. |
►
void
getAvailableStates()
Returns the states the ConnectionServiceStub can be in.
►
void
getCurrentState()
Returns the current ConnectionServiceStub connection state
►
void
getStreamlink()
Return Streamlink instance.
►
void
getValidTransitions(String The)
Returns the available states that can be transitioned from the state given. If no state is given it will return the available transitions from the current state.
String | The | state from which we want to know the transitions |
►
void
removeStatusChangedListener(Function fCallback)
Remove a function as listener to connection status changes.
Function | fCallback | The callback that is used to notify of connection status changes. |
►
void
setState(String sNewState)
Sets a connection state from the available ones ('OK', 'ERROR', 'PARTIAL', 'DOWN') and notifies the listeners of a connection status change.
String | sNewState | The new state to be set |
►
void
updateStatus(String sCallback, Array pReasons)
Notify connection service listeners that the connection status has changed.
String | sCallback | The name of the callback function to be triggered in the ConnectionServiceListeners (e.g. 'onConnectionAvailable' or 'onConnectionUnavailable'). |
Array | pReasons | The reason for the change in connection status. |