Package org.springframework.webflow.engine

Examples of org.springframework.webflow.engine.Flow


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

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


    }
  }

  public void testResumeAfterEnding() {
    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 testResumeException() {
    Flow flow = new Flow("flow");
    ViewState state = new ViewState(flow, "view", new StubViewFactory()) {
      public void resume(RequestControlContext context) {
        throw new IllegalStateException("Oops");
      }
    };
    MockFlowExecutionListener mockListener = new MockFlowExecutionListener();
    FlowExecutionListener[] listeners = new FlowExecutionListener[] { mockListener };
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
    execution.setListeners(listeners);
    execution.setKeyFactory(new MockFlowExecutionKeyFactory());
    MockExternalContext context = new MockExternalContext();
    execution.start(null, context);
    context = new MockExternalContext();
    try {
      execution.resume(context);
    } catch (FlowExecutionException e) {
      assertEquals(flow.getId(), e.getFlowId());
      assertEquals(state.getId(), e.getStateId());
      assertEquals(1, mockListener.getResumingCount());
      assertEquals(2, mockListener.getPausedCount());
    }
  }
View Full Code Here

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

  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);
    execution.setListeners(listeners);
    execution.setKeyFactory(new MockFlowExecutionKeyFactory());
    MockExternalContext context = new MockExternalContext();
    execution.start(null, context);
    context = new MockExternalContext();
    try {
      execution.resume(context);
    } catch (FlowExecutionException e) {
      assertEquals(flow.getId(), e.getFlowId());
      assertEquals(state.getId(), e.getStateId());
      assertEquals(1, mockListener.getResumingCount());
      assertEquals(2, mockListener.getPausedCount());
    }
  }
View Full Code Here

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

  public void testExecuteTransition() {
    Flow flow = new Flow("flow");
    ViewState state = new ViewState(flow, "view", new StubViewFactory()) {
      public void resume(RequestControlContext context) {
        context.execute(getRequiredTransition(context));
      }
    };
View Full Code Here

    assertTrue(execution.hasEnded());
    assertEquals(1, mockListener.getTransitionExecutingCount());
  }

  public void testRequestContextManagedOnStartAndResume() {
    Flow flow = new Flow("flow");
    new ViewState(flow, "view", new StubViewFactory()) {
      public void resume(RequestControlContext context) {
        assertSame(context, RequestContextHolder.getRequestContext());
      }
    };
View Full Code Here

    builder.buildStates();
    builder.buildGlobalTransitions();
    builder.buildEndActions();
    builder.buildOutputMapper();
    builder.buildExceptionHandlers();
    EasyMock.expect(builder.getFlow()).andReturn(new Flow("search"));
    EasyMock.replay(new Object[] { builder });
    Flow flow = assembler.assembleFlow();
    assertEquals("search", flow.getId());
    EasyMock.verify(new Object[] { builder });
  }
View Full Code Here

  public void testViewStatePopup() {
    ViewStateModel view = new ViewStateModel("view");
    view.setPopup("true");
    model.setStates(singleList(view));
    Flow flow = getFlow(model);
    assertTrue(((ViewState) flow.getStateInstance("view")).getPopup());
  }
View Full Code Here

  public void testViewStateFlowRedirect() {
    ViewStateModel state = new ViewStateModel("view");
    state.setView("flowRedirect:myFlow?input=#{flowScope.foo}");
    model.setStates(singleList(state));
    Flow flow = getFlow(model);
    ViewFactory vf = ((ViewState) flow.getStateInstance("view")).getViewFactory();
    assertTrue(vf instanceof ActionExecutingViewFactory);
    ActionExecutingViewFactory avf = (ActionExecutingViewFactory) vf;
    assertTrue(avf.getAction() instanceof FlowDefinitionRedirectAction);
  }
View Full Code Here

  public void testViewStateExternalRedirect() {
    ViewStateModel state = new ViewStateModel("view");
    state.setView("externalRedirect:http://www.paypal.com?_callbackUrl=#{flowExecutionUri}");
    model.setStates(singleList(state));
    Flow flow = getFlow(model);
    ViewFactory vf = ((ViewState) flow.getStateInstance("view")).getViewFactory();
    assertTrue(vf instanceof ActionExecutingViewFactory);
    ActionExecutingViewFactory avf = (ActionExecutingViewFactory) vf;
    assertTrue(avf.getAction() instanceof ExternalRedirectAction);
  }
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.