Package org.springframework.webflow.test

Examples of org.springframework.webflow.test.MockRequestControlContext


    Expression x = parser.parseExpression("flowScope.attr", new FluentParserContext()
        .evaluate(RequestContext.class));
    Expression y = parser.parseExpression("attr", new FluentParserContext().evaluate(MutableAttributeMap.class));
    attributeMapper.addMapping(new DefaultMapping(x, y));
    flow.setOutputMapper(attributeMapper);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.getFlowScope().put("attr", "foo");
    LocalAttributeMap sessionOutput = new LocalAttributeMap();
    flow.end(context, "finish", sessionOutput);
    assertEquals("foo", sessionOutput.get("attr"));
  }
View Full Code Here


  }

  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

    flow.handleException(e, context);
    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) {
View Full Code Here

  public void setUp() {
    flow = new Flow("myFlow");
    state = new ActionState(flow, "actionState");
    new EndState(flow, "finish");
    context = new MockRequestControlContext(flow);
  }
View Full Code Here

public class EndStateTests extends TestCase {

  public void testEnterEndStateTerminateFlowExecution() {
    Flow flow = new Flow("myFlow");
    EndState state = new EndState(flow, "end");
    MockRequestControlContext context = new MockRequestControlContext(flow);
    state.enter(context);
    assertFalse("Active", context.getFlowExecutionContext().isActive());
  }
View Full Code Here

  public void testEnterEndStateWithFinalResponseRenderer() {
    Flow flow = new Flow("myFlow");
    EndState state = new EndState(flow, "end");
    StubFinalResponseAction action = new StubFinalResponseAction();
    state.setFinalResponseAction(action);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    state.enter(context);
    assertTrue(action.executeCalled);
  }
View Full Code Here

    ExpressionParser parser = DefaultExpressionParserFactory.getExpressionParser();
    Expression x = parser.parseExpression("flowScope.x", new FluentParserContext().evaluate(RequestContext.class));
    Expression y = parser.parseExpression("y", new FluentParserContext().evaluate(MutableAttributeMap.class));
    mapper.addMapping(new DefaultMapping(x, y));
    state.setOutputMapper(mapper);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.getFlowScope().put("x", "foo");
    state.enter(context);
  }
View Full Code Here

    MockFlowSession parentSession = new MockFlowSession(parent);
    parentSession.setState(subflowState);

    session.setParent(parentSession);
    MockRequestControlContext context = new MockRequestControlContext(new MockFlowExecutionContext(session));
    state.enter(context);

    assertFalse("Active", context.getFlowExecutionContext().isActive());
  }
View Full Code Here

  private String eventId;

  private String modelName;

  protected void setUp() throws Exception {
    requestContext = new MockRequestControlContext();
    eventId = "userEvent";
    modelName = "model";
  }
View Full Code Here

    exp.setValue(context, "baz");
    assertEquals("baz", exp.getValue(context));
  }

  public void testResolveViewScope() {
    MockRequestControlContext context = new MockRequestControlContext();
    ViewState state = new ViewState(context.getRootFlow(), "view", new StubViewFactory());
    context.setCurrentState(state);
    context.getViewScope().put("foo", "bar");
    Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class));
    assertEquals("bar", exp.getValue(context));
  }
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.