Package org.springframework.webflow.engine

Examples of org.springframework.webflow.engine.Flow


    assertTrue(execution.hasEnded());
    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
      }
    };
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");
    flow.getExceptionHandlerSet().add(new FlowExecutionExceptionHandler() {
      public boolean canHandle(FlowExecutionException exception) {
        return true;
      }

      public void handle(FlowExecutionException exception, RequestControlContext context) {
        throw new UnsupportedOperationException("Should not be called");
      }

    });
    new EndState(flow, "end");
    FlowExecutionListener mockListener = new FlowExecutionListenerAdapter() {
      public void sessionCreating(RequestContext context, FlowDefinition definition) {
        assertFalse(context.getFlowExecutionContext().isActive());
        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());
      assertTrue(e.getCause() instanceof IllegalStateException);
      e.printStackTrace();
      assertTrue(e.getCause().getMessage().equals("Oops"));
    }
View Full Code Here

      assertTrue(e.getCause().getMessage().equals("Oops"));
    }
  }

  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 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;
      }
View Full Code Here

      assertSame(e, ex);
    }
  }

  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;
      }
View Full Code Here

    execution.start(null, context);
    assertTrue(exceptionHandler.getHandled());
  }

  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;
      }
View Full Code Here

    execution.start(null, context);
    assertTrue(exceptionHandler.getHandled());
  }

  public void testExceptionHandledByNestedExceptionHandler() {
    Flow flow = new Flow("flow");
    ExceptionThrowingExceptionHandler exceptionHandler = new ExceptionThrowingExceptionHandler(true);
    flow.getExceptionHandlerSet().add(exceptionHandler);
    new State(flow, "state") {
      protected void doEnter(RequestControlContext context) throws FlowExecutionException {
        throw new FlowExecutionException("flow", "state", "Oops");
      }
    };
View Full Code Here

    execution.start(null, context);
    assertEquals(2, exceptionHandler.getHandleCount());
  }

  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.