public void setEmbeddedMode() { getMockFlowExecutionContext().getMockActiveSession().setEmbeddedMode(); } }
public boolean getEmbeddedMode() { return getMockFlowExecutionContext().getMockActiveSession().isEmbeddedMode(); }
public void setCurrentState(State state) { getMockFlowExecutionContext().getMockActiveSession().setState(state); }
public void endActiveFlowSession(String outcome, MutableAttributeMap<Object> output) throws IllegalStateException { MockFlowSession endingSession = getMockFlowExecutionContext().getMockActiveSession(); endingSession.getDefinitionInternal().end(this, outcome, output); getMockFlowExecutionContext().setActiveSession(endingSession.getParent()); if (!getMockFlowExecutionContext().hasEnded()) { handleEvent(new Event(endingSession.getState(), outcome, output)); } }
public void setEmbeddedMode() { getMockFlowExecutionContext().getMockActiveSession().setEmbeddedMode(); } }
public boolean getEmbeddedMode() { return getMockFlowExecutionContext().getMockActiveSession().isEmbeddedMode(); }
public void setCurrentState(State state) { getMockFlowExecutionContext().getMockActiveSession().setState(state); }
public void setCurrentState(State state) { getMockFlowExecutionContext().getMockActiveSession().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; }
public void testCannotResolveMethod() throws Exception { try { context.getMockFlowExecutionContext().getMockActiveSession().setState(null); action.execute(context); fail("Should've failed with illegal state"); } catch (IllegalStateException e) { } }
public void endActiveFlowSession(String outcome, MutableAttributeMap<Object> output) throws IllegalStateException { MockFlowSession endingSession = getMockFlowExecutionContext().getMockActiveSession(); endingSession.getDefinitionInternal().end(this, outcome, output); getMockFlowExecutionContext().setActiveSession(endingSession.getParent()); if (!getMockFlowExecutionContext().hasEnded()) { handleEvent(new Event(endingSession.getState(), outcome, output)); } }
public void endActiveFlowSession(String outcome, MutableAttributeMap output) throws IllegalStateException { MockFlowSession endingSession = getMockFlowExecutionContext().getMockActiveSession(); endingSession.getDefinitionInternal().end(this, outcome, output); getMockFlowExecutionContext().setActiveSession(endingSession.getParent()); if (!getMockFlowExecutionContext().hasEnded()) { handleEvent(new Event(endingSession.getState(), outcome, output)); } }
public void testDispatchWithCurrentStateId() throws Exception { MockFlowSession session = context.getMockFlowExecutionContext().getMockActiveSession(); session.setState(new ViewState(session.getDefinitionInternal(), "increment", new StubViewFactory())); action.execute(context); assertEquals(1, action.counter); }
public void testExecuteActionInState() { context.getMockFlowExecutionContext().getMockActiveSession().setState(state); TestAction action = new TestAction(); Event result = ActionExecutor.execute(action, context); assertSame(state, context.getCurrentState()); assertEquals("success", result.getId()); }
public void testExecuteActionInStateWithException() { context.getMockFlowExecutionContext().getMockActiveSession().setState(state); TestAction action = new TestAction() { protected Event doExecute(RequestContext context) throws Exception { throw new IllegalStateException("Oops"); } }; try { ActionExecutor.execute(action, context); fail("Should've failed"); } catch (ActionExecutionException e) { assertSame(state, context.getCurrentState()); assertTrue(e.getCause() instanceof IllegalStateException); assertEquals(flow.getId(), e.getFlowId()); assertEquals(state.getId(), e.getStateId()); } } }