executionFactory.setExecutionKeyFactory(executionKeyFactory);
factory = new SerializedFlowExecutionSnapshotFactory(executionFactory, locator);
}
public void testCreateSnapshot() {
FlowExecutionImpl flowExecution = (FlowExecutionImpl) executionFactory.createFlowExecution(flow);
flowExecution.start(null, new MockExternalContext());
flowExecution.getActiveSession().getScope().put("foo", "bar");
FlowExecutionSnapshot snapshot = factory.createSnapshot(flowExecution);
FlowExecutionImpl flowExecution2 = (FlowExecutionImpl) factory.restoreExecution(snapshot, "myFlow", null,
flowExecution.getConversationScope(), executionKeyFactory);
assertNotSame(flowExecution, flowExecution2);
assertEquals(flowExecution.getDefinition().getId(), flowExecution2.getDefinition().getId());
assertEquals(flowExecution.getActiveSession().getScope().get("foo"), flowExecution2.getActiveSession()
.getScope().get("foo"));
assertEquals(flowExecution.getActiveSession().getState().getId(), flowExecution2.getActiveSession().getState()
.getId());
assertNull(flowExecution2.getKey());
assertSame(flowExecution.getConversationScope(), flowExecution2.getConversationScope());
}