Class TestActivityEnvironmentInternal

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      <T> T newActivityStub​(java.lang.Class<T> activityInterface)
      Creates client stub to activities that implement given interface.
      <T> T newActivityStub​(java.lang.Class<T> activityInterface, io.temporal.activity.ActivityOptions options)
      Creates client stub to activities that implement given interface.
      <T> T newLocalActivityStub​(java.lang.Class<T> activityInterface, io.temporal.activity.LocalActivityOptions options, java.util.Map<java.lang.String,​io.temporal.activity.LocalActivityOptions> activityMethodOptions)
      Creates client stub to activities that implement given interface.
      void registerActivitiesImplementations​(java.lang.Object... activityImplementations)
      Register activity implementation objects with a worker.
      void requestCancelActivity()
      Requests activity cancellation.
      <T> void setActivityHeartbeatListener​(java.lang.Class<T> detailsClass, io.temporal.workflow.Functions.Proc1<T> listener)
      Sets a listener that is called every time an activity implementation heartbeats through ActivityExecutionContext.heartbeat(Object).
      <T> void setActivityHeartbeatListener​(java.lang.Class<T> detailsClass, java.lang.reflect.Type detailsType, io.temporal.workflow.Functions.Proc1<T> listener)
      Sets a listener that is called every time an activity implementation heartbeats through ActivityExecutionContext.heartbeat(Object).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • registerActivitiesImplementations

        public void registerActivitiesImplementations​(java.lang.Object... activityImplementations)
        Register activity implementation objects with a worker. Overwrites previously registered objects. As activities are reentrant and stateless only one instance per activity type is registered.

        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:
        registerActivitiesImplementations in interface TestActivityEnvironment
      • newActivityStub

        public <T> T newActivityStub​(java.lang.Class<T> activityInterface)
        Creates client stub to activities that implement given interface.
        Specified by:
        newActivityStub in interface TestActivityEnvironment
        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​(java.lang.Class<T> activityInterface,
                                     io.temporal.activity.ActivityOptions options)
        Creates client stub to activities that implement given interface.
        Specified by:
        newActivityStub in interface TestActivityEnvironment
        Type Parameters:
        T - Type of the activity interface.
        Parameters:
        activityInterface - interface type implemented by activities
        options - options that specify the activity invocation parameters
        Returns:
        The stub that implements the activity interface.
      • newLocalActivityStub

        public <T> T newLocalActivityStub​(java.lang.Class<T> activityInterface,
                                          io.temporal.activity.LocalActivityOptions options,
                                          java.util.Map<java.lang.String,​io.temporal.activity.LocalActivityOptions> activityMethodOptions)
        Creates client stub to activities that implement given interface.
        Specified by:
        newLocalActivityStub in interface TestActivityEnvironment
        Type Parameters:
        T - Type of the activity interface.
        Parameters:
        activityInterface - interface type implemented by activities
        options - options that specify the activity invocation parameters
        activityMethodOptions - activity method-specific invocation parameters
        Returns:
        The stub that implements the activity interface.
      • setActivityHeartbeatListener

        public <T> void setActivityHeartbeatListener​(java.lang.Class<T> detailsClass,
                                                     io.temporal.workflow.Functions.Proc1<T> listener)
        Description copied from interface: TestActivityEnvironment
        Sets a listener that is called every time an activity implementation heartbeats through ActivityExecutionContext.heartbeat(Object).
        Specified by:
        setActivityHeartbeatListener in interface TestActivityEnvironment
        Type Parameters:
        T - Type of the heartbeat details.
        Parameters:
        detailsClass - class of the details passed to the ActivityExecutionContext.heartbeat(Object).
        listener - listener to register.
      • setActivityHeartbeatListener

        public <T> void setActivityHeartbeatListener​(java.lang.Class<T> detailsClass,
                                                     java.lang.reflect.Type detailsType,
                                                     io.temporal.workflow.Functions.Proc1<T> listener)
        Description copied from interface: TestActivityEnvironment
        Sets a listener that is called every time an activity implementation heartbeats through ActivityExecutionContext.heartbeat(Object).
        Specified by:
        setActivityHeartbeatListener in interface TestActivityEnvironment
        Type Parameters:
        T - Type of the heartbeat details.
        Parameters:
        detailsClass - class of the details passed to the ActivityExecutionContext.heartbeat(Object).
        detailsType - type of the details. Differs for detailsClass for generic types.
        listener - listener to register.