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 TypeMethodDescriptionvoid
activityBoundary
(String name, boolean isEnd) Do work at activity start or end.void
activityBoundary
(String name, Duration duration, boolean isEnd) Do work at activity start or end.<R> R
addSideEffect
(Class<?> resultClass, Functions.Func<R> func, Object activity) Executes the provided function once, records its result into the workflow history.void
Apply any recently received side effects (outside the normal thread of execution).static void
clear()
void
flush()
Flush any hanging side effect information at the end of replaystatic TestSideEffectHandler
get()
void
reset()
-
Constructor Details
-
TestSideEffectHandler
public TestSideEffectHandler()
-
-
Method Details
-
get
-
clear
public static void clear() -
addSideEffect
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 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:SideEffectHandler
Do work at activity start or end.- Specified by:
activityBoundary
in 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:SideEffectHandler
Do work at activity start or end. If a wait step (seeStep.isWait()
), include the duration of the wait.- Specified by:
activityBoundary
in 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:SideEffectHandler
Flush any hanging side effect information at the end of replay- Specified by:
flush
in interfaceSideEffectHandler
-
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 interfaceSideEffectHandler
-
reset
public void reset()
-