Class: TestService
testservice.v1.TestService
TestService API defines an interface supported only by the Temporal Test Server. It provides functionality needed or supported for testing purposes only.
This is an EXPERIMENTAL API.
Hierarchy
-
Service
↳
TestService
Constructors
constructor
• new TestService(rpcImpl
, requestDelimited?
, responseDelimited?
): TestService
Constructs a new TestService service.
Parameters
Name | Type | Description |
---|---|---|
rpcImpl | RPCImpl | RPC implementation |
requestDelimited? | boolean | Whether requests are length-delimited |
responseDelimited? | boolean | Whether responses are length-delimited |
Returns
Overrides
$protobuf.rpc.Service.constructor
Properties
requestDelimited
• requestDelimited: boolean
Whether requests are length-delimited.
Inherited from
$protobuf.rpc.Service.requestDelimited
responseDelimited
• responseDelimited: boolean
Whether responses are length-delimited.
Inherited from
$protobuf.rpc.Service.responseDelimited
rpcImpl
• rpcImpl: null
| RPCImpl
RPC implementation. Becomes null
once the service is ended.
Inherited from
$protobuf.rpc.Service.rpcImpl
Methods
emit
▸ emit(evt
, ...args
): this
Emits an event by calling its listeners with the specified arguments.
Parameters
Name | Type | Description |
---|---|---|
evt | string | Event name |
...args | any [] | Arguments |
Returns
this
this
Inherited from
$protobuf.rpc.Service.emit
end
▸ end(endedByRPC?
): Service
Ends this service and emits the end
event.
Parameters
Name | Type | Description |
---|---|---|
endedByRPC? | boolean | Whether the service has been ended by the RPC implementation. |
Returns
Service
this
Inherited from
$protobuf.rpc.Service.end
getCurrentTime
▸ getCurrentTime(request
, callback
): void
GetCurrentTime returns the current Temporal Test Server time
This time might not be equal to System#currentTimeMillis() due to time skipping.
Parameters
Name | Type | Description |
---|---|---|
request | IEmpty | Empty message or plain object |
callback | GetCurrentTimeCallback | Node-style callback called with the error, if any, and GetCurrentTimeResponse |
Returns
void
▸ getCurrentTime(request
): Promise
<GetCurrentTimeResponse
>
GetCurrentTime returns the current Temporal Test Server time
This time might not be equal to System#currentTimeMillis() due to time skipping.
Parameters
Name | Type | Description |
---|---|---|
request | IEmpty | Empty message or plain object |
Returns
Promise
<GetCurrentTimeResponse
>
Promise
lockTimeSkipping
▸ lockTimeSkipping(request
, callback
): void
LockTimeSkipping increments Time Locking Counter by one.
If Time Locking Counter is positive, time skipping is locked (disabled). When time skipping is disabled, the time in test server is moving normally, with a real time pace. Test Server is typically started with locked time skipping and Time Locking Counter = 1.
LockTimeSkipping and UnlockTimeSkipping calls are counted.
Parameters
Name | Type | Description |
---|---|---|
request | ILockTimeSkippingRequest | LockTimeSkippingRequest message or plain object |
callback | LockTimeSkippingCallback | Node-style callback called with the error, if any, and LockTimeSkippingResponse |
Returns
void
▸ lockTimeSkipping(request
): Promise
<LockTimeSkippingResponse
>
LockTimeSkipping increments Time Locking Counter by one.
If Time Locking Counter is positive, time skipping is locked (disabled). When time skipping is disabled, the time in test server is moving normally, with a real time pace. Test Server is typically started with locked time skipping and Time Locking Counter = 1.
LockTimeSkipping and UnlockTimeSkipping calls are counted.
Parameters
Name | Type | Description |
---|---|---|
request | ILockTimeSkippingRequest | LockTimeSkippingRequest message or plain object |
Returns
Promise
<LockTimeSkippingResponse
>
Promise
off
▸ off(evt?
, fn?
): this
Removes an event listener or any matching listeners if arguments are omitted.
Parameters
Name | Type | Description |
---|---|---|
evt? | string | Event name. Removes all listeners if omitted. |
fn? | EventEmitterListener | Listener to remove. Removes all listeners of evt if omitted. |
Returns
this
this
Inherited from
$protobuf.rpc.Service.off
on
▸ on(evt
, fn
, ctx?
): this
Registers an event listener.
Parameters
Name | Type | Description |
---|---|---|
evt | string | Event name |
fn | EventEmitterListener | Listener |
ctx? | any | Listener context |
Returns
this
this
Inherited from
$protobuf.rpc.Service.on
rpcCall
▸ rpcCall<TReq
, TRes
>(method
, requestCtor
, responseCtor
, request
, callback
): void
Calls a service method through rpcImpl.
Type parameters
Name | Type |
---|---|
TReq | extends Message <TReq > |
TRes | extends Message <TRes > |
Parameters
Name | Type | Description |
---|---|---|
method | Method | ServiceMethod <TReq , TRes > | Reflected or static method |
requestCtor | Constructor <TReq > | Request constructor |
responseCtor | Constructor <TRes > | Response constructor |
request | TReq | Properties <TReq > | Request message or plain object |
callback | ServiceMethodCallback <TRes > | Service callback |
Returns
void
Inherited from
$protobuf.rpc.Service.rpcCall
sleep
▸ sleep(request
, callback
): void
This call returns only when the Test Server Time advances by the specified duration. This is an EXPERIMENTAL API.
Parameters
Name | Type | Description |
---|---|---|
request | ISleepRequest | SleepRequest message or plain object |
callback | SleepCallback | Node-style callback called with the error, if any, and SleepResponse |
Returns
void
▸ sleep(request
): Promise
<SleepResponse
>
This call returns only when the Test Server Time advances by the specified duration. This is an EXPERIMENTAL API.
Parameters
Name | Type | Description |
---|---|---|
request | ISleepRequest | SleepRequest message or plain object |
Returns
Promise
<SleepResponse
>
Promise
sleepUntil
▸ sleepUntil(request
, callback
): void
This call returns only when the Test Server Time advances to the specified timestamp. If the current Test Server Time is beyond the specified timestamp, returns immediately. This is an EXPERIMENTAL API.
Parameters
Name | Type | Description |
---|---|---|
request | ISleepUntilRequest | SleepUntilRequest message or plain object |
callback | SleepUntilCallback | Node-style callback called with the error, if any, and SleepResponse |
Returns
void
▸ sleepUntil(request
): Promise
<SleepResponse
>
This call returns only when the Test Server Time advances to the specified timestamp. If the current Test Server Time is beyond the specified timestamp, returns immediately. This is an EXPERIMENTAL API.
Parameters
Name | Type | Description |
---|---|---|
request | ISleepUntilRequest | SleepUntilRequest message or plain object |
Returns
Promise
<SleepResponse
>
Promise
unlockTimeSkipping
▸ unlockTimeSkipping(request
, callback
): void
UnlockTimeSkipping decrements Time Locking Counter by one.
If the counter reaches 0, it unlocks time skipping and fast forwards time. LockTimeSkipping and UnlockTimeSkipping calls are counted. Calling UnlockTimeSkipping does not guarantee that time is going to be fast forwarded as another lock can be holding it.
Time Locking Counter can't be negative, unbalanced calls to UnlockTimeSkipping will lead to rpc call failure
Parameters
Name | Type | Description |
---|---|---|
request | IUnlockTimeSkippingRequest | UnlockTimeSkippingRequest message or plain object |
callback | UnlockTimeSkippingCallback | Node-style callback called with the error, if any, and UnlockTimeSkippingResponse |
Returns
void
▸ unlockTimeSkipping(request
): Promise
<UnlockTimeSkippingResponse
>
UnlockTimeSkipping decrements Time Locking Counter by one.
If the counter reaches 0, it unlocks time skipping and fast forwards time. LockTimeSkipping and UnlockTimeSkipping calls are counted. Calling UnlockTimeSkipping does not guarantee that time is going to be fast forwarded as another lock can be holding it.
Time Locking Counter can't be negative, unbalanced calls to UnlockTimeSkipping will lead to rpc call failure
Parameters
Name | Type | Description |
---|---|---|
request | IUnlockTimeSkippingRequest | UnlockTimeSkippingRequest message or plain object |
Returns
Promise
<UnlockTimeSkippingResponse
>
Promise
unlockTimeSkippingWithSleep
▸ unlockTimeSkippingWithSleep(request
, callback
): void
UnlockTimeSkippingWhileSleep decreases time locking counter by one and increases it back once the Test Server Time advances by the duration specified in the request.
This call returns only when the Test Server Time advances by the specified duration.
If it is called when Time Locking Counter is
- more than 1 and no other unlocks are coming in, rpc call will block for the specified duration, time will not be fast forwarded.
- 1, it will lead to fast forwarding of the time by the duration specified in the request and quick return of this rpc call.
- 0 will lead to rpc call failure same way as an unbalanced UnlockTimeSkipping.
Parameters
Name | Type | Description |
---|---|---|
request | ISleepRequest | SleepRequest message or plain object |
callback | UnlockTimeSkippingWithSleepCallback | Node-style callback called with the error, if any, and SleepResponse |
Returns
void
▸ unlockTimeSkippingWithSleep(request
): Promise
<SleepResponse
>
UnlockTimeSkippingWhileSleep decreases time locking counter by one and increases it back once the Test Server Time advances by the duration specified in the request.
This call returns only when the Test Server Time advances by the specified duration.
If it is called when Time Locking Counter is
- more than 1 and no other unlocks are coming in, rpc call will block for the specified duration, time will not be fast forwarded.
- 1, it will lead to fast forwarding of the time by the duration specified in the request and quick return of this rpc call.
- 0 will lead to rpc call failure same way as an unbalanced UnlockTimeSkipping.
Parameters
Name | Type | Description |
---|---|---|
request | ISleepRequest | SleepRequest message or plain object |
Returns
Promise
<SleepResponse
>
Promise
create
▸ create(rpcImpl
, requestDelimited?
, responseDelimited?
): TestService
Creates new TestService service using the specified rpc implementation.
Parameters
Name | Type | Description |
---|---|---|
rpcImpl | RPCImpl | RPC implementation |
requestDelimited? | boolean | Whether requests are length-delimited |
responseDelimited? | boolean | Whether responses are length-delimited |
Returns
RPC service. Useful where requests and/or responses are streamed.