Package com.uber.cadence.testing
Class WorkflowReplayer
- java.lang.Object
-
- com.uber.cadence.testing.WorkflowReplayer
-
public final class WorkflowReplayer extends java.lang.Object
Replays a workflow given its history. Useful for backwards compatibility testing.
-
-
Constructor Summary
Constructors Constructor Description WorkflowReplayer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
replayWorkflowExecution(WorkflowExecutionHistory history, java.lang.Class<?> workflowClass, java.lang.Class<?>... moreWorkflowClasses)
Replays workflow from aWorkflowExecutionHistory
.static void
replayWorkflowExecution(java.io.File historyFile, java.lang.Class<?> workflowClass, java.lang.Class<?>... moreWorkflowClasses)
Replays workflow from a filestatic void
replayWorkflowExecution(java.lang.String jsonSerializedHistory, java.lang.Class<?> workflowClass, java.lang.Class<?>... moreWorkflowClasses)
Replays workflow from a json serialized history.static void
replayWorkflowExecutionFromResource(java.lang.String resourceName, java.lang.Class<?> workflowClass, java.lang.Class<?>... moreWorkflowClasses)
Replays workflow from a resource that contains a json serialized history.
-
-
-
Method Detail
-
replayWorkflowExecutionFromResource
public static void replayWorkflowExecutionFromResource(java.lang.String resourceName, java.lang.Class<?> workflowClass, java.lang.Class<?>... moreWorkflowClasses) throws java.lang.Exception
Replays workflow from a resource that contains a json serialized history.- Parameters:
resourceName
- name of the resourceworkflowClass
- workflow implementation class to replaymoreWorkflowClasses
- optional additional workflow implementation classes- Throws:
java.lang.Exception
- if replay failed for any reason.
-
replayWorkflowExecution
public static void replayWorkflowExecution(java.io.File historyFile, java.lang.Class<?> workflowClass, java.lang.Class<?>... moreWorkflowClasses) throws java.lang.Exception
Replays workflow from a file- Parameters:
historyFile
- file that contains a json serialized history.workflowClass
- s workflow implementation class to replaymoreWorkflowClasses
- optional additional workflow implementation classes- Throws:
java.lang.Exception
- if replay failed for any reason.
-
replayWorkflowExecution
public static void replayWorkflowExecution(java.lang.String jsonSerializedHistory, java.lang.Class<?> workflowClass, java.lang.Class<?>... moreWorkflowClasses) throws java.lang.Exception
Replays workflow from a json serialized history. The json should be in the format:{ "workflowId": "...", "runId": "...", "events": [ ... ] }
RunId must match the one used to generate the serialized history.- Parameters:
jsonSerializedHistory
- string that contains the json serialized history.workflowClass
- s workflow implementation class to replaymoreWorkflowClasses
- optional additional workflow implementation classes- Throws:
java.lang.Exception
- if replay failed for any reason.
-
replayWorkflowExecution
public static void replayWorkflowExecution(WorkflowExecutionHistory history, java.lang.Class<?> workflowClass, java.lang.Class<?>... moreWorkflowClasses) throws java.lang.Exception
Replays workflow from aWorkflowExecutionHistory
. RunId must match the one used to generate the serialized history.- Parameters:
history
- object that contains the workflow ids and the events.workflowClass
- s workflow implementation class to replaymoreWorkflowClasses
- optional additional workflow implementation classes- Throws:
java.lang.Exception
- if replay failed for any reason.
-
-