Class TestSideEffectHandler

java.lang.Object
com.broadleafcommerce.orchestration.internal.TestSideEffectHandler
All Implemented Interfaces:
SideEffectHandler

public class TestSideEffectHandler extends Object implements SideEffectHandler
Non-prod (test) handler meant to simulate replay for unit test cases
  • Constructor Details

    • TestSideEffectHandler

      public TestSideEffectHandler()
  • Method Details

    • get

      public static TestSideEffectHandler get()
    • clear

      public static void clear()
    • addSideEffect

      public <R> R addSideEffect(Class<?> resultClass, Functions.Func<R> func, @Nullable Object activity)
      Description copied from interface: SideEffectHandler
      Executes the provided function once, records its result into the workflow history. The recorded result on history will be returned without executing the provided function during replay. This guarantees the deterministic requirement for workflow as the exact same result will be returned in replay.
      Specified by:
      addSideEffect in interface SideEffectHandler
      Parameters:
      resultClass - type of the side effect
      func - function that returns side effect value
      Returns:
      value of the side effect
    • activityBoundary

      public void activityBoundary(String name, boolean isEnd)
      Description copied from interface: SideEffectHandler
      Do work at activity start or end.
      Specified by:
      activityBoundary in interface SideEffectHandler
      Parameters:
      name - The name of the activity.
      isEnd - Whether this is the end of the activity (false if the start)
    • activityBoundary

      public void activityBoundary(String name, Duration duration, boolean isEnd)
      Description copied from interface: SideEffectHandler
      Do work at activity start or end. If a wait step (see Step.isWait()), include the duration of the wait.
      Specified by:
      activityBoundary in interface SideEffectHandler
      Parameters:
      name - The name of the activity.
      duration - The duration of the wait step
      isEnd - Whether this is the end of the activity (false if the start)
    • flush

      public void flush()
      Description copied from interface: SideEffectHandler
      Flush any hanging side effect information at the end of replay
      Specified by:
      flush in interface SideEffectHandler
    • applyRecent

      public void applyRecent()
      Description copied from interface: SideEffectHandler
      Apply any recently received side effects (outside the normal thread of execution). These types of side effects are almost always signals.
      Specified by:
      applyRecent in interface SideEffectHandler
    • reset

      public void reset()