Class TestSideEffectHandler
java.lang.Object
com.broadleafcommerce.orchestration.internal.TestSideEffectHandler
- All Implemented Interfaces:
SideEffectHandler
Non-prod (test) handler meant to simulate replay for unit test cases
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivityBoundary(String name, boolean isEnd) Do work at activity start or end.voidactivityBoundary(String name, Duration duration, boolean isEnd) Do work at activity start or end.<R> RaddSideEffect(Class<?> resultClass, Functions.Func<R> func, Object activity) Executes the provided function once, records its result into the workflow history.voidApply any recently received side effects (outside the normal thread of execution).static voidclear()voidflush()Flush any hanging side effect information at the end of replaystatic TestSideEffectHandlerget()voidreset()
-
Constructor Details
-
TestSideEffectHandler
public TestSideEffectHandler()
-
-
Method Details
-
get
-
clear
public static void clear() -
addSideEffect
Description copied from interface:SideEffectHandlerExecutes 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:
addSideEffectin interfaceSideEffectHandler- Parameters:
resultClass- type of the side effectfunc- function that returns side effect value- Returns:
- value of the side effect
-
activityBoundary
Description copied from interface:SideEffectHandlerDo work at activity start or end.- Specified by:
activityBoundaryin interfaceSideEffectHandler- Parameters:
name- The name of the activity.isEnd- Whether this is the end of the activity (false if the start)
-
activityBoundary
Description copied from interface:SideEffectHandlerDo work at activity start or end. If a wait step (seeStep.isWait()), include the duration of the wait.- Specified by:
activityBoundaryin interfaceSideEffectHandler- Parameters:
name- The name of the activity.duration- The duration of the wait stepisEnd- Whether this is the end of the activity (false if the start)
-
flush
public void flush()Description copied from interface:SideEffectHandlerFlush any hanging side effect information at the end of replay- Specified by:
flushin interfaceSideEffectHandler
-
applyRecent
public void applyRecent()Description copied from interface:SideEffectHandlerApply any recently received side effects (outside the normal thread of execution). These types of side effects are almost always signals.- Specified by:
applyRecentin interfaceSideEffectHandler
-
reset
public void reset()
-