Package org.springframework.webflow.execution

Examples of org.springframework.webflow.execution.Event


  public void testMockActionExecuteCustomResultAttributes() {
    MockAction action = new MockAction("foo");
    LocalAttributeMap resultAttributes = new LocalAttributeMap();
    resultAttributes.put("bar", "baz");
    action.setResultAttributes(resultAttributes);
    Event e = action.execute(new MockRequestContext());
    assertEquals("foo", e.getId());
    assertFalse(e.getAttributes().isEmpty());
    assertEquals(e.getAttributes().get("bar"), "baz");
  }
View Full Code Here


   
    public void testNoService() throws Exception {
        final MockRequestContext context = new MockRequestContext();
        final MockHttpServletRequest request = new MockHttpServletRequest();
        context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, new MockHttpServletResponse()));
        Event event = this.action.execute(context);
       
        assertNotNull(event);
       
        assertEquals("error", this.action.execute(context).getId());
    }
View Full Code Here

        public boolean hasFlowEvent() {
            return this.context.getExternalContext().getRequestParameterMap().contains("_eventId");
        }

        public Event getFlowEvent() {
            return new Event(this, this.context.getExternalContext().getRequestParameterMap().get("_eventId"));
        }
View Full Code Here

    public void testOneFailure() throws Exception {
        final MockHttpServletRequest request = new MockHttpServletRequest();
        request.setMethod("POST");
        request.setRemoteAddr("111.111.111.111");
        MockRequestContext context = new MockRequestContext();
        context.setCurrentEvent(new Event("", "error"));
        request.setAttribute("flowRequestContext", context);
        this.adapter.postHandle(request, new MockHttpServletResponse(), new Object(), null);
       
        assert 1 == this.adapter.findCount(request, null, 60);
        assertTrue(this.adapter.preHandle(request, new MockHttpServletResponse(), new Object()));
View Full Code Here

    public void testSuccess() throws Exception {
        final MockHttpServletRequest request = new MockHttpServletRequest();
        request.setMethod("GET");
        request.setRemoteAddr("111.111.111.111");
        MockRequestContext context = new MockRequestContext();
        context.setCurrentEvent(new Event("", "success"));
        request.setAttribute("flowRequestContext", context);
       
        this.adapter.postHandle(request, new MockHttpServletResponse(), new Object(), null);
       
        assert 0 == this.adapter.findCount(request, null, 60);
View Full Code Here

    public void testEnoughFailuresToCauseProblem() throws Exception {
        final MockHttpServletRequest request = new MockHttpServletRequest();
        request.setMethod("POST");
        request.setRemoteAddr("111.111.111.111");
        MockRequestContext context = new MockRequestContext();
        context.setCurrentEvent(new Event("", "error"));
        request.setAttribute("flowRequestContext", context);
       for (int i = 0; i < CONST_FAILURE_THRESHHOLD+1; i++) {
           this.adapter.postHandle(request, new MockHttpServletResponse(), new Object(), null);
       }
View Full Code Here

    public void testFailuresThenSuccess() throws Exception {
        final MockHttpServletRequest request = new MockHttpServletRequest();
        request.setMethod("POST");
        request.setRemoteAddr("111.111.111.111");
        MockRequestContext context = new MockRequestContext();
        context.setCurrentEvent(new Event("", "error"));
        request.setAttribute("flowRequestContext", context);
       for (int i = 0; i < CONST_FAILURE_THRESHHOLD+1; i++) {
           this.adapter.postHandle(request, new MockHttpServletResponse(), new Object(), null);
       }
       
View Full Code Here

   
    public void testNoServiceFound() throws Exception {
        final MockRequestContext context = new MockRequestContext();
        context.setExternalContext(new ServletExternalContext(new MockServletContext(), new MockHttpServletRequest(), new MockHttpServletResponse()));
       
        final Event event = this.action.execute(context);

        assertNull(WebUtils.getService(context));
       
        assertEquals("success", event.getId());
    }
View Full Code Here

        final MockRequestContext context = new MockRequestContext();
        final MockHttpServletRequest request = new MockHttpServletRequest();
        request.setParameter("service", "test");
        context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, new MockHttpServletResponse()));
       
        final Event event = this.action.execute(context);

        assertEquals("test", WebUtils.getService(context).getId());
        assertEquals("success", event.getId());
    }
View Full Code Here

  public Event getFlowEvent() {
    if (!hasFlowEvent()) {
      return null;
    }
    return new Event(this, eventId, requestContext.getRequestParameters().asAttributeMap());
  }
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.