Package org.springframework.webflow.engine

Examples of org.springframework.webflow.engine.Flow


    assertEquals(1, mockListener.getResumingCount());
    assertEquals(2, mockListener.getPausedCount());
  }

  public void testResumeNotAViewState() {
    Flow flow = new Flow("flow");
    new State(flow, "state") {
      protected void doEnter(RequestControlContext context) throws FlowExecutionException {
        // no-op
      }
    };
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 {
View Full Code Here

    }
  }

  public void testResumeException() {
    Flow flow = new Flow("flow");
    ViewState state = new ViewState(flow, "view", new StubViewFactory()) {
      public void resume(RequestControlContext context) {
        throw new IllegalStateException("Oops");
      }
    };
    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());
      assertEquals(1, mockListener.getResumingCount());
      assertEquals(2, mockListener.getPausedCount());
    }
  }
View Full Code Here

      assertEquals(2, mockListener.getPausedCount());
    }
  }

  public void testResumeFlowExecutionException() {
    Flow flow = new Flow("flow");
    ViewState state = new ViewState(flow, "view", new StubViewFactory()) {
      public void resume(RequestControlContext context) {
        throw new FlowExecutionException("flow", "view", "oops");
      }
    };
    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());
      assertEquals(1, mockListener.getResumingCount());
      assertEquals(2, mockListener.getPausedCount());
    }
  }
View Full Code Here

      assertEquals(2, mockListener.getPausedCount());
    }
  }

  public void testExecuteTransition() {
    Flow flow = new Flow("flow");
    ViewState state = new ViewState(flow, "view", new StubViewFactory()) {
      public void resume(RequestControlContext context) {
        context.execute(getRequiredTransition(context));
      }
    };
View Full Code Here

    assertTrue(execution.hasEnded());
    assertEquals(1, mockListener.getTransitionExecutingCount());
  }

  public void testRequestContextManagedOnStartAndResume() {
    Flow flow = new Flow("flow");
    new ViewState(flow, "view", new StubViewFactory()) {
      public void resume(RequestControlContext context) {
        assertSame(context, RequestContextHolder.getRequestContext());
      }
    };
View Full Code Here

    return new LinkedList<T>(Arrays.asList(a));
  }

  public void testBuildFlowWithEndState() {
    model.setStates(asList(AbstractStateModel.class, new EndStateModel("end")));
    Flow flow = getFlow(model);
    assertEquals("flow", flow.getId());
    assertEquals("end", flow.getStartState().getId());
  }
View Full Code Here

    assertEquals("end", flow.getStartState().getId());
  }

  public void testBuildFlowWithDefaultStartState() {
    model.setStates(asList(AbstractStateModel.class, new EndStateModel("end")));
    Flow flow = getFlow(model);
    assertEquals("flow", flow.getId());
    assertEquals("end", flow.getStartState().getId());
  }
View Full Code Here

  }

  public void testBuildFlowWithStartStateAttribute() {
    model.setStartStateId("end");
    model.setStates(asList(AbstractStateModel.class, new EndStateModel("foo"), new EndStateModel("end")));
    Flow flow = getFlow(model);
    assertEquals("flow", flow.getId());
    assertEquals("end", flow.getStartState().getId());
  }
View Full Code Here

    AttributeModel attribute2 = new AttributeModel("number", "1");
    attribute2.setType("integer");
    model.setAttributes(asList(AttributeModel.class, attribute1, attribute2));

    model.setStates(asList(AbstractStateModel.class, new EndStateModel("end")));
    Flow flow = getFlow(model);
    assertEquals("bar", flow.getAttributes().get("foo"));
    assertEquals(new Integer(1), flow.getAttributes().get("number"));
  }
View Full Code Here

TOP

Related Classes of org.springframework.webflow.engine.Flow

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.