Package org.springframework.webflow.test

Examples of org.springframework.webflow.test.MockRequestControlContext


    StubViewFactory viewFactory = new StubViewFactory();
    ViewState state = new ViewState(flow, "viewState", viewFactory);
    state.setRedirect(false);
    Transition t = new Transition(on("submit"), null);
    state.getTransitionSet().add(t);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    state.enter(context);
    context.getMockExternalContext().setAjaxRequest(true);
    context.setEmbeddedMode();
    context.setAlwaysRedirectOnPause(true);
    context.setRedirectInSameState(true);
    assertFalse(context.getMockExternalContext().getFlowExecutionRedirectRequested());
  }
View Full Code Here


      public void restoreReferences(Object value, RequestContext context) {
      }
    }));
    state.getTransitionSet().add(new Transition(on("submit"), to("next")));
    new ViewState(flow, "next", viewFactory);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    state.enter(context);
    assertTrue(context.getViewScope().contains("foo"));
    context = new MockRequestControlContext(context.getFlowExecutionContext());
    context.putRequestParameter("_eventId", "submit");
    state.resume(context);
    assertTrue(context.getFlowExecutionContext().isActive());
    assertEquals("next", context.getCurrentState().getId());
    assertFalse(context.getViewScope().contains("foo"));
  }
View Full Code Here

  public void testEnterViewStateRenderResponse() {
    Flow flow = new Flow("myFlow");
    StubViewFactory viewFactory = new StubViewFactory();
    ViewState state = new ViewState(flow, "viewState", viewFactory);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.getFlashScope().put("foo", "bar");
    state.enter(context);
    assertTrue("Render not called", context.getFlowScope().contains("renderCalled"));
    assertTrue(context.getExternalContext().isResponseComplete());
    assertFalse(context.getMockExternalContext().getFlowExecutionRedirectRequested());
    assertFalse(context.getFlashScope().contains("foo"));
  }
View Full Code Here

  public void testEnterViewStateRenderNotAllowed() {
    Flow flow = new Flow("myFlow");
    StubViewFactory viewFactory = new StubViewFactory();
    ViewState state = new ViewState(flow, "viewState", viewFactory);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.getMockExternalContext().setResponseAllowed(false);
    context.getFlashScope().put("foo", "bar");
    state.enter(context);
    assertFalse("Render called", context.getFlowScope().contains("renderCalled"));
    assertTrue(context.getExternalContext().isResponseComplete());
    assertTrue(context.getMockExternalContext().getFlowExecutionRedirectRequested());
    assertTrue(context.getFlashScope().contains("foo"));
  }
View Full Code Here

  public void testEnterViewStateResponseAlreadyComplete() {
    Flow flow = new Flow("myFlow");
    StubViewFactory viewFactory = new StubViewFactory();
    ViewState state = new ViewState(flow, "viewState", viewFactory);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.getExternalContext().recordResponseComplete();
    context.getFlashScope().put("foo", "bar");
    state.enter(context);
    assertFalse("Render called", context.getFlowScope().contains("renderCalled"));
    assertFalse(context.getMockExternalContext().getFlowExecutionRedirectRequested());
    assertFalse(context.getFlashScope().contains("foo"));
  }
View Full Code Here

  public void testEnterViewStateRedirectResponseAlreadyComplete() {
    Flow flow = new Flow("myFlow");
    StubViewFactory viewFactory = new StubViewFactory();
    ViewState state = new ViewState(flow, "viewState", viewFactory);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.getExternalContext().requestFlowExecutionRedirect();
    context.getFlashScope().put("foo", "bar");
    state.enter(context);
    assertFalse("Render called", context.getFlowScope().contains("renderCalled"));
    assertTrue(context.getMockExternalContext().getFlowExecutionRedirectRequested());
    assertTrue(context.getFlashScope().contains("foo"));
  }
View Full Code Here

      }

      public void restoreReferences(Object value, RequestContext context) {
      }
    }));
    MockRequestControlContext context = new MockRequestControlContext(flow);
    state.enter(context);
    assertEquals("bar", context.getViewScope().getString("foo"));
    assertTrue("Render not called", context.getFlowScope().contains("renderCalled"));
    assertTrue(context.getExternalContext().isResponseComplete());
    assertFalse(context.getMockExternalContext().getFlowExecutionRedirectRequested());
  }
View Full Code Here

  public void testEnterViewStateWithLocalRedirect() {
    Flow flow = new Flow("myFlow");
    StubViewFactory viewFactory = new StubViewFactory();
    ViewState state = new ViewState(flow, "viewState", viewFactory);
    state.setRedirect(true);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.getFlashScope().put("foo", "bar");
    state.enter(context);
    assertFalse("Render called", context.getFlowScope().contains("renderCalled"));
    assertTrue(context.getMockExternalContext().getFlowExecutionRedirectRequested());
    assertTrue(context.getFlashScope().contains("foo"));
  }
View Full Code Here

  public void testEnterViewStateWithNoLocalRedirect() {
    Flow flow = new Flow("myFlow");
    StubViewFactory viewFactory = new StubViewFactory();
    ViewState state = new ViewState(flow, "viewState", viewFactory);
    state.setRedirect(false);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.getFlashScope().put("foo", "bar");
    state.enter(context);
    assertTrue("Render called", context.getFlowScope().contains("renderCalled"));
    assertFalse(context.getMockExternalContext().getFlowExecutionRedirectRequested());
    assertFalse(context.getFlashScope().contains("foo"));
  }
View Full Code Here

    Flow flow = new Flow("myFlow");
    StubViewFactory viewFactory = new StubViewFactory();
    ViewState state = new ViewState(flow, "viewState", viewFactory);
    state.setRedirect(true);
    state.setPopup(true);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.getFlashScope().put("foo", "bar");
    state.enter(context);
    assertFalse("Render called", context.getFlowScope().contains("renderCalled"));
    assertTrue(context.getMockExternalContext().getFlowExecutionRedirectRequested());
    assertTrue(context.getMockExternalContext().getRedirectInPopup());
    assertTrue(context.getFlashScope().contains("foo"));
  }
View Full Code Here

TOP

Related Classes of org.springframework.webflow.test.MockRequestControlContext

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.