Package org.springframework.webflow.execution

Examples of org.springframework.webflow.execution.Event


  }

  public void testOnEvent() {
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.setCurrentState(flow.getStateInstance("myState1"));
    Event event = new Event(this, "submit");
    context.setCurrentEvent(event);
    assertTrue(context.getFlowExecutionContext().isActive());
    context.setCurrentEvent(event);
    flow.handleEvent(context);
    assertTrue(!context.getFlowExecutionContext().isActive());
View Full Code Here


  }

  public void testOnEventGlobalTransition() {
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.setCurrentState(flow.getStateInstance("myState1"));
    Event event = new Event(this, "globalEvent");
    context.setCurrentEvent(event);
    assertTrue(context.getFlowExecutionContext().isActive());
    context.setCurrentEvent(event);
    flow.handleEvent(context);
    assertTrue(!context.getFlowExecutionContext().isActive());
View Full Code Here

  }

  public void testOnEventNoTransition() {
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.setCurrentState(flow.getStateInstance("myState1"));
    Event event = new Event(this, "bogus");
    context.setCurrentEvent(event);
    try {
      context.setCurrentEvent(event);
      flow.handleEvent(context);
    } catch (NoMatchingTransitionException e) {
View Full Code Here

  public void testRenderAction() throws Exception {
    StaticExpression name = new StaticExpression("frag1");
    StaticExpression name2 = new StaticExpression("frag2");
    RenderAction action = new RenderAction(new Expression[] { name, name2 });
    MockRequestContext context = new MockRequestContext();
    Event result = action.execute(context);
    assertEquals("success", result.getId());
    String[] fragments = (String[]) context.getFlashScope().getArray(View.RENDER_FRAGMENTS_ATTRIBUTE,
        String[].class);
    assertEquals("frag1", fragments[0]);
    assertEquals("frag2", fragments[1]);
  }
View Full Code Here

    action = new TestAbstractAction() {
      protected Event doExecute(RequestContext context) throws Exception {
        return success();
      }
    };
    Event result = action.execute(new MockRequestContext());
    assertEquals("success", result.getId());
    assertTrue(result.getAttributes().size() == 0);
  }
View Full Code Here

    action = new TestAbstractAction() {
      protected Event doPreExecute(RequestContext context) throws Exception {
        return success();
      }
    };
    Event result = action.execute(new MockRequestContext());
    assertEquals("success", result.getId());
  }
View Full Code Here

      postExecuteCalled = true;
    }
  }

  public void testSuccess() {
    Event event = action.success();
    assertEquals(action.getEventFactorySupport().getSuccessEventId(), event.getId());
  }
View Full Code Here

    assertEquals(action.getEventFactorySupport().getSuccessEventId(), event.getId());
  }

  public void testSuccessResult() {
    Object o = new Object();
    Event event = action.success(o);
    assertEquals(action.getEventFactorySupport().getSuccessEventId(), event.getId());
    assertSame(o, event.getAttributes().get(action.getEventFactorySupport().getResultAttributeName()));
  }
View Full Code Here

    assertEquals(action.getEventFactorySupport().getSuccessEventId(), event.getId());
    assertSame(o, event.getAttributes().get(action.getEventFactorySupport().getResultAttributeName()));
  }

  public void testError() {
    Event event = action.error();
    assertEquals(action.getEventFactorySupport().getErrorEventId(), event.getId());
  }
View Full Code Here

    assertEquals(action.getEventFactorySupport().getErrorEventId(), event.getId());
  }

  public void testErrorException() {
    IllegalArgumentException e = new IllegalArgumentException("woops");
    Event event = action.error(e);
    assertEquals(action.getEventFactorySupport().getErrorEventId(), event.getId());
    assertSame(e, event.getAttributes().get(action.getEventFactorySupport().getExceptionAttributeName()));
  }
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.