Package org.springframework.webflow.execution

Examples of org.springframework.webflow.execution.Event


    result = factory.createResultEvent(this, Boolean.FALSE, context);
    assertEquals("no", result.getId());
  }

  public void testLabeledEnumResult() {
    Event result = factory.createResultEvent(this, MyEnum.FOO, context);
    assertEquals("foo", result.getId());
  }
View Full Code Here


    Event result = factory.createResultEvent(this, MyEnum.FOO, context);
    assertEquals("foo", result.getId());
  }

  public void testOtherResult() {
    Event result = factory.createResultEvent(this, "hello", context);
    assertEquals("hello", result.getId());
  }
View Full Code Here

public class SetActionTests extends TestCase {
  public void testSetAction() throws Exception {
    StaticExpression name = new StaticExpression("");
    SetAction action = new SetAction(name, new StaticExpression("bar"), null, null);
    MockRequestContext context = new MockRequestContext();
    Event result = action.execute(context);
    assertEquals("success", result.getId());
    assertEquals("bar", name.getValue(null));
  }
View Full Code Here

  public void testSetActionWithTypeConversion() throws Exception {
    StaticExpression name = new StaticExpression("");
    SetAction action = new SetAction(name, new StaticExpression("3"), Integer.class, new DefaultConversionService());
    MockRequestContext context = new MockRequestContext();
    Event result = action.execute(context);
    assertEquals("success", result.getId());
    assertEquals(new Integer(3), name.getValue(null));
  }
View Full Code Here

  public void testDoExecute() throws Exception {
    MockRequestContext mockRequestContext = new MockRequestContext();
    LocalAttributeMap attributes = new LocalAttributeMap();
    attributes.put("some key", "some value");
    EasyMock.expect(actionMock.execute(mockRequestContext)).andReturn(new Event(this, "some event", attributes));
    EasyMock.replay(new Object[] { actionMock });
    Event result = tested.doExecute(mockRequestContext);
    EasyMock.verify(new Object[] { actionMock });
    assertEquals("some event", result.getId());
    assertEquals(1, result.getAttributes().size());
  }
View Full Code Here

  }

  public void testDoExecuteWithError() throws Exception {
    tested.setStopOnError(true);
    MockRequestContext mockRequestContext = new MockRequestContext();
    EasyMock.expect(actionMock.execute(mockRequestContext)).andReturn(new Event(this, "error"));
    EasyMock.replay(new Object[] { actionMock });
    Event result = tested.doExecute(mockRequestContext);
    EasyMock.verify(new Object[] { actionMock });
    assertEquals("error", result.getId());
  }
View Full Code Here

  public void testDoExecuteWithNullResult() throws Exception {
    tested.setStopOnError(true);
    MockRequestContext mockRequestContext = new MockRequestContext();
    EasyMock.expect(actionMock.execute(mockRequestContext)).andReturn(null);
    EasyMock.replay(new Object[] { actionMock });
    Event result = tested.doExecute(mockRequestContext);
    EasyMock.verify(new Object[] { actionMock });
    assertEquals("Expecting success since no check is performed if null result,", "success", result.getId());
  }
View Full Code Here

  }

  public void testMultipleActions() throws Exception {
    CompositeAction ca = new CompositeAction(new Action[] { new Action() {
      public Event execute(RequestContext context) throws Exception {
        return new Event(this, "foo");
      }
    }, new Action() {
      public Event execute(RequestContext context) throws Exception {
        return new Event(this, "bar");
      }
    } });
    assertEquals("Result of last executed action should be returned", "bar", ca.execute(new MockRequestContext())
        .getId());
  }
View Full Code Here

    assertNull(context.getFlowScope().get("attr"));
  }

  public void testOnEventNullCurrentState() {
    MockRequestControlContext context = new MockRequestControlContext(flow);
    Event event = new Event(this, "foo");
    try {
      context.setCurrentEvent(event);
      flow.handleEvent(context);
    } catch (IllegalStateException e) {
View Full Code Here

  }

  public void testOnEventInvalidCurrentState() {
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.setCurrentState(flow.getStateInstance("myState2"));
    Event event = new Event(this, "submit");
    context.setCurrentEvent(event);
    try {
      context.setCurrentEvent(event);
      flow.handleEvent(context);
    } catch (IllegalStateException e) {
View Full Code Here

TOP

Related Classes of org.springframework.webflow.execution.Event

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.