Package org.springframework.webflow

Examples of org.springframework.webflow.TestBean


    Flow flow = new Flow("myFlow");
    StubViewFactory viewFactory = new StubViewFactory();
    ViewState state = new ViewState(flow, "viewState", viewFactory);
    state.addVariable(new ViewVariable("foo", new VariableValueFactory() {
      public Object createInitialValue(RequestContext context) {
        return new TestBean();
      }

      public void restoreReferences(Object value, RequestContext context) {
        ((TestBean) value).datum1 = "Restored";
      }
View Full Code Here


  }

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

  }

  public void testResolveSpringBean() {
    MockRequestContext context = new MockRequestContext();
    StaticApplicationContext ac = new StaticApplicationContext();
    ac.getBeanFactory().registerSingleton("testBean", new TestBean());
    ac.getBeanFactory().registerSingleton("action", new TestAction());
    ac.getBeanFactory().registerSingleton("multiAction", new FormAction(TestBean.class));
    context.getRootFlow().setApplicationContext(ac);
    context.getConversationScope().put("foo", "bar");
    Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class));
View Full Code Here

  }

  public void testResolveAction() {
    MockRequestContext context = new MockRequestContext();
    StaticApplicationContext ac = new StaticApplicationContext();
    ac.getBeanFactory().registerSingleton("testBean", new TestBean());
    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

    Flow flow = new Flow("myFlow");
    StubViewFactory viewFactory = new StubViewFactory();
    ViewState state = new ViewState(flow, "viewState", viewFactory);
    state.addVariable(new ViewVariable("foo", new VariableValueFactory() {
      public Object createInitialValue(RequestContext context) {
        return new TestBean();
      }

      public void restoreReferences(Object value, RequestContext context) {
        ((TestBean) value).datum1 = "Restored";
      }
View Full Code Here

  }

  public void testRestoreValue() {
    factory = new BeanFactoryVariableValueFactory(TestBean.class, new DefaultListableBeanFactory());
    MockRequestContext context = new MockRequestContext();
    TestBean bean = new TestBean();
    factory.restoreReferences(bean, context);
  }
View Full Code Here

  }

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

  DefaultConversionService conversionService;
  TestBean testBean;
  ExpressionParser expressionParser;

  public void setUp() {
    testBean = new TestBean();
    messages = new DefaultMessageContext();
    conversionService = new DefaultConversionService();
    expressionParser = getExpressionParser();
    model = new BindingModel("testBean", testBean, expressionParser, conversionService, messages);
  }
View Full Code Here

  }

  public void testResolveSpringBean() {
    MockRequestContext context = new MockRequestContext();
    StaticApplicationContext ac = new StaticApplicationContext();
    ac.getBeanFactory().registerSingleton("testBean", new TestBean());
    ac.getBeanFactory().registerSingleton("action", new TestAction());
    ac.getBeanFactory().registerSingleton("multiAction", new FormAction(TestBean.class));
    context.getRootFlow().setApplicationContext(ac);
    context.getConversationScope().put("foo", "bar");
    Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(RequestContext.class));
View Full Code Here

  }

  public void testResolveAction() {
    MockRequestContext context = new MockRequestContext();
    StaticApplicationContext ac = new StaticApplicationContext();
    ac.getBeanFactory().registerSingleton("testBean", new TestBean());
    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

TOP

Related Classes of org.springframework.webflow.TestBean

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.