Package org.springframework.webflow.execution

Examples of org.springframework.webflow.execution.FlowExecutionException


  public void testHandleException() {
    flow.getExceptionHandlerSet().add(
        new TransitionExecutingFlowExecutionExceptionHandler().add(TestException.class, "myState2"));
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.setCurrentState(flow.getStateInstance("myState1"));
    FlowExecutionException e = new FlowExecutionException(flow.getId(), flow.getStartState().getId(), "Oops!",
        new TestException());
    flow.handleException(e, context);
    assertFalse(context.getFlowExecutionContext().isActive());
  }
View Full Code Here


    assertFalse(context.getFlowExecutionContext().isActive());
  }

  public void testHandleExceptionNoMatch() {
    MockRequestControlContext context = new MockRequestControlContext(flow);
    FlowExecutionException e = new FlowExecutionException(flow.getId(), flow.getStartState().getId(), "Oops!",
        new TestException());
    try {
      flow.handleException(e, context);
    } catch (FlowExecutionException ex) {
      // expected
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;
      }
    };
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;
      }
    };
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;
      }
    };
View Full Code Here

    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");
      }
    };
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
    MockExternalContext context = new MockExternalContext();
    assertFalse(execution.hasStarted());
View Full Code Here

  public void testResumeFlowExecutionException() {
    Flow flow = new Flow("flow");
    ViewState state = new ViewState(flow, "view", new StubViewFactory()) {
      public void resume(RequestControlContext context) {
        throw new FlowExecutionException("flow", "view", "oops");
      }
    };
    MockFlowExecutionListener mockListener = new MockFlowExecutionListener();
    FlowExecutionListener[] listeners = new FlowExecutionListener[] { mockListener };
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
View Full Code Here

    FlowExecutionExceptionHandlerSet handlerSet = new FlowExecutionExceptionHandlerSet();
    handlerSet.add(new TestStateExceptionHandler(NullPointerException.class, "null"));
    handlerSet.add(new TestStateExceptionHandler(FlowExecutionException.class, "execution 1"));
    handlerSet.add(new TestStateExceptionHandler(FlowExecutionException.class, "execution 2"));
    assertEquals(3, handlerSet.size());
    FlowExecutionException e = new FlowExecutionException("flowId", "stateId", "Test");
    assertTrue(handlerSet.handleException(e, context));
    assertFalse(context.getFlowScope().contains("null"));
    assertTrue(context.getFlowScope().contains("execution 1"));
    assertFalse(context.getFlowScope().contains("execution 2"));
  }
View Full Code Here

    public void handle(FlowExecutionException exception, RequestControlContext context) {
      this.handleCount++;
      if (throwOnlyOnce && "nested exception".equals(exception.getMessage())) {
        // No more exceptions
      } else {
        throw new FlowExecutionException(exception.getFlowId(), exception.getStateId(), "nested exception");
      }
    }
View Full Code Here

    assertSessionBound();

    TestBean bean1 = new TestBean("Keith Donald");
    hibernateTemplate.save(bean1);
    assertEquals("Table should still only have one row", 1, jdbcTemplate.queryForInt("select count(*) from T_BEAN"));
    hibernateListener.exceptionThrown(context, new FlowExecutionException("bla", "bla", "bla"));
    assertEquals("Table should still only have one row", 1, jdbcTemplate.queryForInt("select count(*) from T_BEAN"));
    assertSessionNotBound();

  }
View Full Code Here

TOP

Related Classes of org.springframework.webflow.execution.FlowExecutionException

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.