Package org.springframework.webflow.test

Examples of org.springframework.webflow.test.MockExternalContext


    };
    MockFlowExecutionListener mockListener = new MockFlowExecutionListener();
    FlowExecutionListener[] listeners = new FlowExecutionListener[] { mockListener };
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
    execution.setListeners(listeners);
    MockExternalContext context = new MockExternalContext();
    execution.start(null, context);
    context = new MockExternalContext();
    try {
      execution.resume(context);
      assertEquals(1, mockListener.getResumingCount());
      fail("Should have failed");
    } catch (FlowExecutionException e) {
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 {
      execution.resume(context);
      fail("Should've failed");
    } catch (IllegalStateException e) {
View Full Code Here

    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());
View Full Code Here

    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());
View Full Code Here

    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);
    assertEquals(0, mockListener.getTransitionExecutingCount());
    execution.resume(context);
    assertTrue(execution.hasEnded());
    assertEquals(1, mockListener.getTransitionExecutingCount());
View Full Code Here

      }
    };
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
    execution.setKeyFactory(new MockFlowExecutionKeyFactory());

    MockExternalContext context = new MockExternalContext();
    execution.start(null, context);
    assertNull("RequestContext was not released", RequestContextHolder.getRequestContext());

    context = new MockExternalContext();
    execution.resume(context);
    assertNull("RequestContext was not released", RequestContextHolder.getRequestContext());

  }
View Full Code Here

    assertFalse(getErrors(context).hasErrors());
    assertFalse(getErrors(context, "otherTest").hasErrors());
    assertEquals("value", getFormObject(context).getProp());
    assertNull(getFormObject(context, "otherTest").getProp());

    context.setExternalContext(new MockExternalContext(blankParameters()));

    assertEquals(action.getEventFactorySupport().getErrorEventId(), otherAction.bindAndValidate(context).getId());

    assertEquals(3, context.getRequestScope().size());
    assertEquals(3, context.getFlowScope().size());
View Full Code Here

    assertEquals(action.getEventFactorySupport().getErrorEventId(), action.bindAndValidate(context).getId());

    assertSame(getFormObject(context), new FormObjectAccessor(context).getCurrentFormObject());
    assertSame(getErrors(context), new FormObjectAccessor(context).getCurrentFormErrors());

    context.setExternalContext(new MockExternalContext(parameters()));

    assertEquals(action.getEventFactorySupport().getSuccessEventId(), otherAction.bindAndValidate(context).getId());

    assertSame(getFormObject(context, "otherTest"), new FormObjectAccessor(context).getCurrentFormObject());
    assertSame(getErrors(context, "otherTest"), new FormObjectAccessor(context).getCurrentFormErrors());
View Full Code Here

    assertNotNull(test2);
    assertSame(test2, new FormObjectAccessor(context).getCurrentFormObject());

    MockParameterMap parameters = new MockParameterMap();
    parameters.put("prop", "12345");
    context.setExternalContext(new MockExternalContext(parameters));
    action1.bindAndValidate(context);
    TestBean test11 = (TestBean) context.getFlowScope().get("test1");
    assertSame(test1, test11);
    assertEquals("12345", test1.getProp());
    assertSame(test1, new FormObjectAccessor(context).getCurrentFormObject());

    parameters = new MockParameterMap();
    parameters.put("prop", "123456");
    context.setExternalContext(new MockExternalContext(parameters));
    action2.bindAndValidate(context);
    TestBean test22 = (TestBean) context.getFlowScope().get("test2");
    assertSame(test22, test2);
    assertEquals("123456", test2.getProp());
    assertSame(test2, new FormObjectAccessor(context).getCurrentFormObject());
View Full Code Here

    model.setStates(doubleList(end, notReached));

    Flow flow = getFlow(model);
    FlowExecutionImplFactory factory = new FlowExecutionImplFactory();
    FlowExecution execution = factory.createFlowExecution(flow);
    MockExternalContext context = new MockExternalContext();
    MutableAttributeMap map = new LocalAttributeMap();
    map.put("foo", "bar");
    map.put("number", "3");
    map.put("required", "9");
    execution.start(map, context);
View Full Code Here

TOP

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

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.