Class TestActivityEnvironmentInternal
java.lang.Object
io.temporal.testing.TestActivityEnvironmentInternal
- All Implemented Interfaces:
TestActivityEnvironment
public final class TestActivityEnvironmentInternal
extends Object
implements TestActivityEnvironment
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()<T> TnewActivityStub(Class<T> activityInterface) Creates client stub to activities that implement given interface.<T> TnewActivityStub(Class<T> activityInterface, io.temporal.activity.ActivityOptions options) Creates client stub to activities that implement given interface.<T> TnewLocalActivityStub(Class<T> activityInterface, io.temporal.activity.LocalActivityOptions options, Map<String, io.temporal.activity.LocalActivityOptions> activityMethodOptions) Creates client stub to activities that implement given interface.voidregisterActivitiesImplementations(Object... activityImplementations) Registers activity implementations to test.voidRequests activity cancellation.<T> voidsetActivityHeartbeatListener(Class<T> detailsClass, io.temporal.workflow.Functions.Proc1<T> listener) Sets a listener that is called every time an activity implementation heartbeats throughActivityExecutionContext.heartbeat(Object).<T> voidsetActivityHeartbeatListener(Class<T> detailsClass, Type detailsType, io.temporal.workflow.Functions.Proc1<T> listener) Sets a listener that is called every time an activity implementation heartbeats throughActivityExecutionContext.heartbeat(Object).<T> voidsetHeartbeatDetails(T details) Sets heartbeat details for the next activity execution.
-
Constructor Details
-
TestActivityEnvironmentInternal
-
-
Method Details
-
registerActivitiesImplementations
Description copied from interface:TestActivityEnvironmentRegisters activity implementations to test. UseTestActivityEnvironment.newActivityStub(Class)to create stubs that can be used to invoke them.Implementations that share a worker must implement different interfaces as an activity type is identified by the activity interface, not by the implementation.
- Specified by:
registerActivitiesImplementationsin interfaceTestActivityEnvironment
-
newActivityStub
Creates client stub to activities that implement given interface.- Specified by:
newActivityStubin interfaceTestActivityEnvironment- Type Parameters:
T- Type of the activity interface.- Parameters:
activityInterface- interface type implemented by activities- Returns:
- The stub that implements the activity interface.
-
newActivityStub
public <T> T newActivityStub(Class<T> activityInterface, io.temporal.activity.ActivityOptions options) Creates client stub to activities that implement given interface.- Specified by:
newActivityStubin interfaceTestActivityEnvironment- Type Parameters:
T- Type of the activity interface.- Parameters:
activityInterface- interface type implemented by activitiesoptions- options that specify the activity invocation parameters- Returns:
- The stub that implements the activity interface.
-
newLocalActivityStub
public <T> T newLocalActivityStub(Class<T> activityInterface, io.temporal.activity.LocalActivityOptions options, Map<String, io.temporal.activity.LocalActivityOptions> activityMethodOptions) Creates client stub to activities that implement given interface.- Specified by:
newLocalActivityStubin interfaceTestActivityEnvironment- Type Parameters:
T- Type of the activity interface.- Parameters:
activityInterface- interface type implemented by activitiesoptions- options that specify the activity invocation parametersactivityMethodOptions- activity method-specific invocation parameters- Returns:
- The stub that implements the activity interface.
-
requestCancelActivity
public void requestCancelActivity()Description copied from interface:TestActivityEnvironmentRequests activity cancellation. The cancellation is going to be delivered to the activity on the next heartbeat.- Specified by:
requestCancelActivityin interfaceTestActivityEnvironment
-
setActivityHeartbeatListener
public <T> void setActivityHeartbeatListener(Class<T> detailsClass, io.temporal.workflow.Functions.Proc1<T> listener) Description copied from interface:TestActivityEnvironmentSets a listener that is called every time an activity implementation heartbeats throughActivityExecutionContext.heartbeat(Object).- Specified by:
setActivityHeartbeatListenerin interfaceTestActivityEnvironment- Type Parameters:
T- Type of the heartbeat details.- Parameters:
detailsClass- class of the details passed to theActivityExecutionContext.heartbeat(Object).listener- listener to register.
-
setActivityHeartbeatListener
public <T> void setActivityHeartbeatListener(Class<T> detailsClass, Type detailsType, io.temporal.workflow.Functions.Proc1<T> listener) Description copied from interface:TestActivityEnvironmentSets a listener that is called every time an activity implementation heartbeats throughActivityExecutionContext.heartbeat(Object).- Specified by:
setActivityHeartbeatListenerin interfaceTestActivityEnvironment- Type Parameters:
T- Type of the heartbeat details.- Parameters:
detailsClass- class of the details passed to theActivityExecutionContext.heartbeat(Object).detailsType- type of the details. Differs for detailsClass for generic types.listener- listener to register.
-
setHeartbeatDetails
public <T> void setHeartbeatDetails(T details) Description copied from interface:TestActivityEnvironmentSets heartbeat details for the next activity execution. The next activity called from this TestActivityEnvironment will be able to access this value usingActivityExecutionContext.getHeartbeatDetails(Class). This value is cleared upon execution.- Specified by:
setHeartbeatDetailsin interfaceTestActivityEnvironment- Type Parameters:
T- Type of the heartbeat details.- Parameters:
details- The details object to make available to the next activity call.
-
close
public void close()- Specified by:
closein interfaceTestActivityEnvironment
-