Package org.springframework.webflow.engine

Examples of org.springframework.webflow.engine.Flow


      public Flow createFlow() throws FlowBuilderException {
        return Flow.create(getContext().getFlowId(), getContext().getFlowAttributes());
      }
    };
    Flow flow = new FlowAssembler(builder, new MockFlowBuilderContext("flow")).assembleFlow();
    FlowExecution execution = new FlowExecutionImplFactory().createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    assertTrue(execution.isActive());
  }
View Full Code Here


  private boolean removeSnapshotCalled;

  private boolean removeAllSnapshotsCalled;

  public void setUp() {
    flowDefinition = new Flow("flow");
    new EndState(flowDefinition, "end");
  }
View Full Code Here

* @author Jeremy Grelle
*/
public class FlowExecutionImplTests extends TestCase {

  public void testStartAndEnd() {
    Flow flow = new Flow("flow");
    new EndState(flow, "end");
    MockFlowExecutionListener mockListener = new MockFlowExecutionListener();
    FlowExecutionListener[] listeners = new FlowExecutionListener[] { mockListener };
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
    execution.setListeners(listeners);
View Full Code Here

    assertEquals(0, mockListener.getExceptionThrownCount());
    assertEquals(0, mockListener.getFlowNestingLevel());
  }

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

    assertTrue(execution.isActive());
    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
      }
    };
View Full Code Here

    assertTrue(execution.isActive());
    assertEquals(1, mockListener.getPausedCount());
  }

  public void testStartExceptionThrownBeforeFirstSessionCreated() {
    Flow flow = new Flow("flow");
    new EndState(flow, "end");
    FlowExecutionListener mockListener = new FlowExecutionListenerAdapter() {
      public void sessionStarting(RequestContext context, FlowSession session, MutableAttributeMap input) {
        throw new IllegalStateException("Oops");
      }
    };
    FlowExecutionListener[] listeners = new FlowExecutionListener[] { mockListener };
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
    execution.setListeners(listeners);
    MockExternalContext context = new MockExternalContext();
    assertFalse(execution.hasStarted());
    try {
      execution.start(null, context);
      fail("Should have failed");
    } catch (FlowExecutionException e) {
      assertEquals(flow.getId(), e.getFlowId());
      assertNull(e.getStateId());
    }
  }
View Full Code Here

      assertNull(e.getStateId());
    }
  }

  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

      assertEquals(state.getId(), e.getStateId());
    }
  }

  public void testStartFlowExecutionExceptionThrown() {
    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;
      }
View Full Code Here

      assertSame(e, ex);
    }
  }

  public void testStartCannotCallTwice() {
    Flow flow = new Flow("flow");
    new EndState(flow, "end");
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
    MockExternalContext context = new MockExternalContext();
    execution.start(null, context);
    try {
View Full Code Here

    }
  }

  public void testResume() {
    Flow flow = new Flow("flow");
    new ViewState(flow, "view", new StubViewFactory());
    MockFlowExecutionListener mockListener = new MockFlowExecutionListener();
    FlowExecutionListener[] listeners = new FlowExecutionListener[] { mockListener };
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
    execution.setListeners(listeners);
View Full Code Here

TOP

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

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.