Package org.springframework.webflow.engine

Examples of org.springframework.webflow.engine.State


    }
  }

  private State getCurrentState() {
    FlowSessionImpl session = getActiveSessionInternal();
    State currentState = (State) session.getState();
    return currentState;
  }
View Full Code Here


  /**
   * Creates a new mock flow session that sets a flow with id "mockFlow" as the 'active flow' in state "mockState".
   */
  public MockFlowSession() {
    setDefinition(new Flow("mockFlow"));
    State state = new TransitionableState(definition, "mockState") {
      protected void doEnter(RequestControlContext context) throws FlowExecutionException {
        // nothing to do
      }
    };
    setState(state);
View Full Code Here

  }

  public void testStateExceptionHandlingExceptionInEndState() {
    FlowBuilder builder = new AbstractFlowBuilder() {
      public void buildStates() throws FlowBuilderException {
        State state = new EndState(getFlow(), "end");
        state.getEntryActionList().add(new AbstractAction() {
          protected Event doExecute(RequestContext context) throws Exception {
            throw new NullPointerException("failing");
          }
        });
        new TransitionableState(getFlow(), "showError") {
View Full Code Here

    execution.start(null, new MockExternalContext());
    assertTrue(starting);
  }

  public void testCreateWithExecutionKeyFactory() {
    State state = new State(flowDefinition, "state") {
      protected void doEnter(RequestControlContext context) throws FlowExecutionException {
        context.assignFlowExecutionKey();
        context.updateCurrentFlowExecutionSnapshot();
        context.removeCurrentFlowExecutionSnapshot();
        context.removeAllFlowExecutionSnapshots();
View Full Code Here

    assertNotNull(execution.getFlashScope().get("messagesMemento"));
  }

  public void testStartAndPause() {
    Flow flow = new Flow("flow");
    new State(flow, "state") {
      protected void doEnter(RequestControlContext context) throws FlowExecutionException {
        // no op
      }
    };
    MockFlowExecutionListener mockListener = new MockFlowExecutionListener();
View Full Code Here

    assertEquals(1, mockListener.getPausedCount());
  }

  public void testStartWithNullInputMap() {
    Flow flow = new Flow("flow");
    new State(flow, "state") {
      protected void doEnter(RequestControlContext context) throws FlowExecutionException {
        // no op
      }
    };
    MockFlowExecutionListener mockListener = new MockFlowExecutionListener() {
View Full Code Here

    }
  }

  public void testStartExceptionThrownByState() {
    Flow flow = new Flow("flow");
    State state = new State(flow, "state") {
      protected void doEnter(RequestControlContext context) throws FlowExecutionException {
        throw new IllegalStateException("Oops");
      }
    };
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
    MockExternalContext context = new MockExternalContext();
    assertFalse(execution.hasStarted());
    try {
      execution.start(null, context);
      fail("Should have failed");
    } catch (FlowExecutionException e) {
      assertEquals(flow.getId(), e.getFlowId());
      assertEquals(state.getId(), e.getStateId());
    }
  }
View Full Code Here

  }

  public void testStartFlowExecutionExceptionThrownByState() {
    Flow flow = new Flow("flow");
    final FlowExecutionException e = new FlowExecutionException("flow", "state", "Oops");
    new State(flow, "state") {
      protected void doEnter(RequestControlContext context) throws FlowExecutionException {
        throw e;
      }
    };
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
View Full Code Here

  public void testStartExceptionThrownByStateHandledByFlowExceptionHandler() {
    Flow flow = new Flow("flow");
    StubFlowExecutionExceptionHandler exceptionHandler = new StubFlowExecutionExceptionHandler();
    flow.getExceptionHandlerSet().add(exceptionHandler);
    final FlowExecutionException e = new FlowExecutionException("flow", "state", "Oops");
    new State(flow, "state") {
      protected void doEnter(RequestControlContext context) throws FlowExecutionException {
        throw e;
      }
    };
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
View Full Code Here

  public void testStartExceptionThrownByStateHandledByStateExceptionHandler() {
    Flow flow = new Flow("flow");
    flow.getExceptionHandlerSet().add(new StubFlowExecutionExceptionHandler());
    final FlowExecutionException e = new FlowExecutionException("flow", "state", "Oops");
    State s = new State(flow, "state") {
      protected void doEnter(RequestControlContext context) throws FlowExecutionException {
        throw e;
      }
    };
    StubFlowExecutionExceptionHandler exceptionHandler = new StubFlowExecutionExceptionHandler();
    s.getExceptionHandlerSet().add(exceptionHandler);
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
    MockExternalContext context = new MockExternalContext();
    assertFalse(execution.hasStarted());
    execution.start(null, context);
    assertTrue(exceptionHandler.getHandled());
View Full Code Here

TOP

Related Classes of org.springframework.webflow.engine.State

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.