Skip to main content

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

NameTypeDescription
rpcImplRPCImplRPC implementation
requestDelimited?booleanWhether requests are length-delimited
responseDelimited?booleanWhether responses are length-delimited

Returns

TestService

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

NameTypeDescription
evtstringEvent name
...argsany[]Arguments

Returns

this

this

Inherited from

$protobuf.rpc.Service.emit


end

end(endedByRPC?): Service

Ends this service and emits the end event.

Parameters

NameTypeDescription
endedByRPC?booleanWhether 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

NameTypeDescription
requestIEmptyEmpty message or plain object
callbackGetCurrentTimeCallbackNode-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

NameTypeDescription
requestIEmptyEmpty 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

NameTypeDescription
requestILockTimeSkippingRequestLockTimeSkippingRequest message or plain object
callbackLockTimeSkippingCallbackNode-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

NameTypeDescription
requestILockTimeSkippingRequestLockTimeSkippingRequest 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

NameTypeDescription
evt?stringEvent name. Removes all listeners if omitted.
fn?EventEmitterListenerListener 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

NameTypeDescription
evtstringEvent name
fnEventEmitterListenerListener
ctx?anyListener 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

NameType
TReqextends Message<TReq>
TResextends Message<TRes>

Parameters

NameTypeDescription
methodMethod | ServiceMethod<TReq, TRes>Reflected or static method
requestCtorConstructor<TReq>Request constructor
responseCtorConstructor<TRes>Response constructor
requestTReq | Properties<TReq>Request message or plain object
callbackServiceMethodCallback<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

NameTypeDescription
requestISleepRequestSleepRequest message or plain object
callbackSleepCallbackNode-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

NameTypeDescription
requestISleepRequestSleepRequest 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

NameTypeDescription
requestISleepUntilRequestSleepUntilRequest message or plain object
callbackSleepUntilCallbackNode-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

NameTypeDescription
requestISleepUntilRequestSleepUntilRequest 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

NameTypeDescription
requestIUnlockTimeSkippingRequestUnlockTimeSkippingRequest message or plain object
callbackUnlockTimeSkippingCallbackNode-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

NameTypeDescription
requestIUnlockTimeSkippingRequestUnlockTimeSkippingRequest 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

NameTypeDescription
requestISleepRequestSleepRequest message or plain object
callbackUnlockTimeSkippingWithSleepCallbackNode-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

NameTypeDescription
requestISleepRequestSleepRequest message or plain object

Returns

Promise<SleepResponse>

Promise


create

create(rpcImpl, requestDelimited?, responseDelimited?): TestService

Creates new TestService service using the specified rpc implementation.

Parameters

NameTypeDescription
rpcImplRPCImplRPC implementation
requestDelimited?booleanWhether requests are length-delimited
responseDelimited?booleanWhether responses are length-delimited

Returns

TestService

RPC service. Useful where requests and/or responses are streamed.