Package org.springframework.webflow.execution

Examples of org.springframework.webflow.execution.TestAction


    assertEquals(state, context.getCurrentState());
    assertTrue(entered);
  }

  public void testStateEnterWithEntryAction() {
    TestAction action = new TestAction();
    state.getEntryActionList().add(action);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    state.enter(context);
    assertEquals(state, context.getCurrentState());
    assertTrue(action.isExecuted());
    assertTrue(entered);
    assertEquals(1, action.getExecutionCount());
  }
View Full Code Here


    }
  }

  public void testStartWithAction() {
    MockRequestControlContext context = new MockRequestControlContext(flow);
    TestAction action = new TestAction();
    flow.getStartActionList().add(action);
    flow.start(context, new LocalAttributeMap<Object>());
    assertEquals("Wrong start state", "myState1", context.getCurrentState().getId());
    assertEquals(1, action.getExecutionCount());
  }
View Full Code Here

    flow.resume(context);
    assertTrue(context.getFlowScope().getBoolean("renderCalled"));
  }

  public void testEnd() {
    TestAction action = new TestAction();
    flow.getEndActionList().add(action);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    LocalAttributeMap<Object> sessionOutput = new LocalAttributeMap<Object>();
    flow.end(context, "finish", sessionOutput);
    assertEquals(1, action.getExecutionCount());
  }
View Full Code Here

    new EndState(flow, "finish");
    context = new MockRequestControlContext(flow);
  }

  public void testExecuteSingleAction() {
    state.getActionList().add(new TestAction());
    state.getTransitionSet().add(new Transition(on("success"), to("finish")));
    state.enter(context);
    assertEquals(1, ((TestAction) state.getActionList().get(0)).getExecutionCount());
  }
View Full Code Here

      // expected
    }
  }

  public void testExecuteActionCannotHandleResultEvent() {
    state.getActionList().add(new TestAction());
    try {
      state.enter(context);
      fail("Should've failed");
    } catch (NoMatchingTransitionException e) {
      assertEquals(1, ((TestAction) state.getActionList().get(0)).getExecutionCount());
View Full Code Here

      assertEquals(1, ((TestAction) state.getActionList().get(0)).getExecutionCount());
    }
  }

  public void testExecuteActionChain() {
    state.getActionList().add(new TestAction("not mapped result"));
    state.getActionList().add(new TestAction(null));
    state.getActionList().add(new TestAction(""));
    state.getActionList().add(new TestAction("success"));
    state.getTransitionSet().add(new Transition(on("success"), to("finish")));
    state.enter(context);
    Action[] actions = state.getActionList().toArray();
    for (Action action2 : actions) {
      TestAction action = (TestAction) action2;
      assertEquals(1, action.getExecutionCount());
    }
  }
View Full Code Here

  }

  public void testResolveAction() {
    MockRequestContext context = new MockRequestContext();
    StaticApplicationContext ac = new StaticApplicationContext();
    ac.getBeanFactory().registerSingleton("action", new TestAction());
    context.getRootFlow().setApplicationContext(ac);
    Expression exp = parser.parseExpression("action", new FluentParserContext().evaluate(RequestContext.class));
    assertSame(ac.getBean("action"), exp.getValue(context));
  }
View Full Code Here

    state = new EndState(flow, "end");
    context = new MockRequestContext(flow);
  }

  public void testExecuteAction() {
    TestAction action = new TestAction();
    Event result = ActionExecutor.execute(action, context);
    assertNull(context.getCurrentState());
    assertEquals("success", result.getId());
  }
View Full Code Here

    assertEquals("success", result.getId());
  }

  public void testExecuteActionInState() {
    context.getMockFlowExecutionContext().getMockActiveSession().setState(state);
    TestAction action = new TestAction();
    Event result = ActionExecutor.execute(action, context);
    assertSame(state, context.getCurrentState());
    assertEquals("success", result.getId());
  }
View Full Code Here

    assertSame(state, context.getCurrentState());
    assertEquals("success", result.getId());
  }

  public void testExecuteActionWithException() {
    TestAction action = new TestAction() {
      protected Event doExecute(RequestContext context) throws Exception {
        throw new IllegalStateException("Oops");
      }
    };
    try {
View Full Code Here

TOP

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

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.