Examples of StaticExpression


Examples of org.springframework.binding.expression.support.StaticExpression

    Event result = action.execute(context);
    assertEquals("null", result.getId());
  }

  public void testEvaluateExpressionNullResult() throws Exception {
    EvaluateAction action = new EvaluateAction(new StaticExpression(null), null);
    MockRequestContext context = new MockRequestContext();
    Event result = action.execute(context);
    assertEquals("success", result.getId());
  }
View Full Code Here

Examples of org.springframework.binding.expression.support.StaticExpression

    Event result = action.execute(context);
    assertEquals("success", result.getId());
  }

  public void testEvaluateExpressionResultExposer() throws Exception {
    StaticExpression resultExpression = new StaticExpression("");
    EvaluateAction action = new EvaluateAction(new StaticExpression("bar"), resultExpression);
    MockRequestContext context = new MockRequestContext();
    Event result = action.execute(context);
    assertEquals("bar", result.getId());
    assertEquals("bar", resultExpression.getValue(null));
  }
View Full Code Here

Examples of org.springframework.binding.expression.support.StaticExpression

public class ExternalRedirectActionTests extends TestCase {
  private ExternalRedirectAction action;

  public void testExecute() throws Exception {
    action = new ExternalRedirectAction(new StaticExpression("/wherever"));
    MockRequestContext context = new MockRequestContext();
    action.execute(context);
    assertEquals("/wherever", context.getMockExternalContext().getExternalRedirectUrl());
  }
View Full Code Here

Examples of org.springframework.binding.expression.support.StaticExpression

    assertTrue(validator.fallbackInvoked);
  }

  public void testSmartValidatorWithClassHint() {
    ViewState state = new ViewState(requestContext.getRootFlow(), "state2", new StubViewFactory());
    state.getAttributes().put("validationHints", new StaticExpression(new Object[] { Model.State1.class }));
    requestContext.setCurrentState(state);

    LegacyModelValidator validator = new LegacyModelValidator();
    ExtendedModel model = new ExtendedModel();
    ValidationHelper helper = new ValidationHelper(model, requestContext, eventId, modelName, null, codesResolver, null);
View Full Code Here

Examples of org.springframework.binding.expression.support.StaticExpression

    assertEquals(Model.State1.class, validator.hints[0]);
  }

  public void testSmartValidatorWithHintResolution() {
    ViewState state = new ViewState(requestContext.getRootFlow(), "state2", new StubViewFactory());
    state.getAttributes().put("validationHints", new StaticExpression("State1"));
    requestContext.setCurrentState(state);

    LegacyModelValidator validator = new LegacyModelValidator();
    ExtendedModel model = new ExtendedModel();
    ValidationHelper helper = new ValidationHelper(model, requestContext, eventId, modelName, null, codesResolver, null);
View Full Code Here

Examples of org.springframework.binding.expression.support.StaticExpression

    assertEquals(Model.State1.class, validator.hints[0]);
  }

  public void testSmartValidatorWithHintOnTransition() {
    Transition transition = new Transition();
    transition.setMatchingCriteria(new DefaultTransitionCriteria(new StaticExpression(eventId)));
    transition.getAttributes().put("validationHints", new StaticExpression("State1"));

    ViewState state = new ViewState(requestContext.getRootFlow(), "state2", new StubViewFactory());
    state.getTransitionSet().add(transition);
    requestContext.setCurrentState(state);
View Full Code Here

Examples of org.springframework.binding.expression.support.StaticExpression

    MockRequestControlContext context = new MockRequestControlContext();
    context.putRequestParameter("_eventId", "submit");
    context.putRequestParameter("integerProperty", "bogus 1");
    context.putRequestParameter("dateProperty", "bogus 2");
    BindBean bindBean = new BindBean();
    StaticExpression modelObject = new StaticExpression(bindBean);
    modelObject.setExpressionString("bindBean");
    context.getCurrentState().getAttributes().put("model", modelObject);
    context.getFlowScope().put("bindBean", bindBean);
    context.getMockExternalContext().setNativeContext(new MockServletContext());
    context.getMockExternalContext().setNativeRequest(new MockHttpServletRequest());
    context.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
    context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
    org.springframework.web.servlet.View mvcView = new MockView();
    AbstractMvcView view = new MockMvcView(mvcView, context);
    view.setExpressionParser(createExpressionParser());
    view.setMessageCodesResolver(new WebFlowMessageCodesResolver());
    context.setAlwaysRedirectOnPause(true);
    assertTrue(view.userEventQueued());
    view.processUserEvent();
    assertFalse(view.userEventQueued());
    assertFalse(view.hasFlowEvent());
    Object viewActionState = view.getUserEventState();
    assertNotNull(viewActionState);

    viewActionState = saveAndRestoreViewActionState(viewActionState);

    MockRequestControlContext context2 = new MockRequestControlContext();
    context2.getFlashScope().put(org.springframework.webflow.execution.View.USER_EVENT_STATE_ATTRIBUTE,
        viewActionState);
    BindBean bindBean2 = new BindBean();
    StaticExpression modelObject2 = new StaticExpression(bindBean2);
    modelObject2.setExpressionString("bindBean");
    context2.getCurrentState().getAttributes().put("model", modelObject);
    context2.getFlowScope().put("bindBean", bindBean);
    context2.getMockExternalContext().setNativeContext(new MockServletContext());
    context2.getMockExternalContext().setNativeRequest(new MockHttpServletRequest());
    context2.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
View Full Code Here

Examples of org.springframework.binding.expression.support.StaticExpression

    context.putRequestParameter("stringProperty", "foo");
    context.putRequestParameter("integerProperty", "5");
    context.putRequestParameter("dateProperty", "2007-01-01");
    context.putRequestParameter("beanProperty.name", "foo");
    BindBean bindBean = new BindBean();
    StaticExpression modelObject = new StaticExpression(bindBean);
    modelObject.setExpressionString("bindBean");
    context.getCurrentState().getAttributes().put("model", modelObject);
    context.getFlowScope().put("bindBean", bindBean);
    context.getMockExternalContext().setNativeContext(new MockServletContext());
    context.getMockExternalContext().setNativeRequest(new MockHttpServletRequest());
    context.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
View Full Code Here

Examples of org.springframework.binding.expression.support.StaticExpression

  public void testResumeEventModelBindingCustomConverter() throws Exception {
    MockRequestContext context = new MockRequestContext();
    context.putRequestParameter("_eventId", "submit");
    context.putRequestParameter("dateProperty", "01-01-2007");
    BindBean bindBean = new BindBean();
    StaticExpression modelObject = new StaticExpression(bindBean);
    modelObject.setExpressionString("bindBean");
    context.getCurrentState().getAttributes().put("model", modelObject);
    context.getFlowScope().put("bindBean", bindBean);
    context.getMockExternalContext().setNativeContext(new MockServletContext());
    context.getMockExternalContext().setNativeRequest(new MockHttpServletRequest());
    context.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
View Full Code Here

Examples of org.springframework.binding.expression.support.StaticExpression

    MockRequestContext context = new MockRequestContext();
    context.putRequestParameter("_eventId", "submit");
    context.putRequestParameter("_booleanProperty", "whatever");
    BindBean bindBean = new BindBean();
    bindBean.setBooleanProperty(true);
    StaticExpression modelObject = new StaticExpression(bindBean);
    modelObject.setExpressionString("bindBean");
    context.getCurrentState().getAttributes().put("model", modelObject);
    context.getFlowScope().put("bindBean", bindBean);
    context.getMockExternalContext().setNativeContext(new MockServletContext());
    context.getMockExternalContext().setNativeRequest(new MockHttpServletRequest());
    context.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.