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

Properties

getCurrentTime

getCurrentTime: GetCurrentTime

GetCurrentTime returns the current Temporal Test Server time

This time might not be equal to System#currentTimeMillis() due to time skipping.


lockTimeSkipping

lockTimeSkipping: LockTimeSkipping

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.


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


sleep

sleep: Sleep

This call returns only when the Test Server Time advances by the specified duration. This is an EXPERIMENTAL API.


sleepUntil

sleepUntil: SleepUntil

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.


unlockTimeSkipping

unlockTimeSkipping: UnlockTimeSkipping

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


unlockTimeSkippingWithSleep

unlockTimeSkippingWithSleep: UnlockTimeSkippingWithSleep

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.

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


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


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.