Package org.springframework.webflow.execution

Examples of org.springframework.webflow.execution.FlowExecutionException


    }
  }

  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


  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

  private FlowExecutionException wrap(Exception e) {
    if (isActive()) {
      FlowSession session = getActiveSession();
      String flowId = session.getDefinition().getId();
      String stateId = session.getState() != null ? session.getState().getId() : null;
      return new FlowExecutionException(flowId, stateId, "Exception thrown in state '" + stateId + "' of flow '"
          + flowId + "'", e);
    } else {
      return new FlowExecutionException(flow.getId(), null, "Exception thrown within inactive flow '"
          + flow.getId() + "'", e);
    }
  }
View Full Code Here

    TestBean bean = new TestBean(1, "Keith Donald");
    EntityManager em = EntityManagerFactoryUtils.getTransactionalEntityManager(entityManagerFactory);
    em.persist(bean);
    assertEquals("Table should still only have one row", 1, jdbcTemplate.queryForInt("select count(*) from T_BEAN"));
    jpaListener.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

    assertEquals("Table should only have one row", 1, jdbcTemplate.queryForInt("select count(*) from T_BEAN"));
    MockRequestContext context = new MockRequestContext();
    MockFlowSession flowSession = new MockFlowSession();
    flowSession.getDefinition().getAttributes().put("persistenceContext", "true");
    assertSessionNotBound();
    jpaListener.exceptionThrown(context, new FlowExecutionException("foo", "bar", "test"));
    assertSessionNotBound();
  }
View Full Code Here

  protected void setUp() {
    flow = new Flow("myFlow");
    state = new TransitionableState(flow, "state1") {
      protected void doEnter(RequestControlContext context) {
        throw new FlowExecutionException(getFlow().getId(), getId(), "Oops!", new TestException());
      }
    };
    state.getTransitionSet().add(new Transition(toState("end")));
  }
View Full Code Here

  }

  public void testTransitionExecutorHandlesExceptionExactMatch() {
    TransitionExecutingFlowExecutionExceptionHandler handler = new TransitionExecutingFlowExecutionExceptionHandler();
    handler.add(TestException.class, "state");
    FlowExecutionException e = new FlowExecutionException(state.getOwner().getId(), state.getId(), "Oops",
        new TestException());
    assertTrue("Doesn't handle state exception", handler.canHandle(e));

    e = new FlowExecutionException(state.getOwner().getId(), state.getId(), "Oops", new Exception());
    assertFalse("Shouldn't handle exception", handler.canHandle(e));
  }
View Full Code Here

  }

  public void testTransitionExecutorHandlesExceptionSuperclassMatch() {
    TransitionExecutingFlowExecutionExceptionHandler handler = new TransitionExecutingFlowExecutionExceptionHandler();
    handler.add(Exception.class, "state");
    FlowExecutionException e = new FlowExecutionException(state.getOwner().getId(), state.getId(), "Oops",
        new TestException());
    assertTrue("Doesn't handle state exception", handler.canHandle(e));
    e = new FlowExecutionException(state.getOwner().getId(), state.getId(), "Oops", new RuntimeException());
    assertTrue("Doesn't handle state exception", handler.canHandle(e));
  }
View Full Code Here

      public void handle(FlowExecutionException exception, RequestControlContext context) {
        handled = true;
      }

    });
    FlowExecutionException e = new FlowExecutionException(flow.getId(), state.getId(), "Whatev");
    MockRequestControlContext context = new MockRequestControlContext(flow);
    assertTrue(state.handleException(e, context));
    assertTrue(handled);
  }
View Full Code Here

    assertTrue(state.handleException(e, context));
    assertTrue(handled);
  }

  public void testCouldNotHandleException() {
    FlowExecutionException e = new FlowExecutionException(flow.getId(), state.getId(), "Whatev");
    MockRequestControlContext context = new MockRequestControlContext(flow);
    assertFalse(state.handleException(e, context));
  }
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.