/** * Creates a new mock flow session that sets a flow with id "mockFlow" as the 'active flow' in state "mockState". * This session marks itself active. */ public MockFlowSession() { setDefinition(new Flow("mockFlow")); State state = new ViewState(definition, "mockState"); setStatus(FlowSessionStatus.ACTIVE); setState(state); }
public void setCurrentState(State state) { State previousState = (State) getCurrentState(); getMockFlowExecutionContext().getMockActiveSession().setState(state); if (previousState == null) { getMockFlowExecutionContext().getMockActiveSession().setStatus(FlowSessionStatus.ACTIVE); } }
public ViewSelection start(Flow flow, MutableAttributeMap input) throws IllegalStateException { getMockFlowExecutionContext().setActiveSession(new MockFlowSession(flow, input)); getMockFlowExecutionContext().getMockActiveSession().setStatus(FlowSessionStatus.STARTING); ViewSelection selectedView = flow.start(this, input); return selectedView; }
public FlowSession endActiveFlowSession(MutableAttributeMap output) throws IllegalStateException { MockFlowSession endingSession = getMockFlowExecutionContext().getMockActiveSession(); endingSession.getDefinitionInternal().end(this, output); endingSession.setStatus(FlowSessionStatus.ENDED); getMockFlowExecutionContext().setActiveSession(null); return endingSession; }