Examples of DefaultConversionService


Examples of org.springframework.binding.convert.service.DefaultConversionService

  }

  public void testEvaluateExpressionResultExposerWithTypeConversion() throws Exception {
    StaticExpression resultExpression = new StaticExpression("");
    ActionResultExposer exposer = new ActionResultExposer(resultExpression, Integer.class,
        new DefaultConversionService());
    MockRequestContext context = new MockRequestContext();
    exposer.exposeResult("3", context);
    assertEquals(new Integer(3), resultExpression.getValue(null));
  }
View Full Code Here

Examples of org.springframework.binding.convert.service.DefaultConversionService

    assertEquals("bar", name.getValue(null));
  }

  public void testSetActionWithTypeConversion() throws Exception {
    StaticExpression name = new StaticExpression("");
    SetAction action = new SetAction(name, new StaticExpression("3"), Integer.class, new DefaultConversionService());
    MockRequestContext context = new MockRequestContext();
    Event result = action.execute(context);
    assertEquals("success", result.getId());
    assertEquals(new Integer(3), name.getValue(null));
  }
View Full Code Here

Examples of org.springframework.binding.convert.service.DefaultConversionService

    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(DefaultExpressionParserFactory.getExpressionParser());
    view.setConversionService(new DefaultConversionService());
    view.render();
    assertEquals(context.getFlowScope().get("bindBean"), model.get("bindBean"));
    BindingModel bm = (BindingModel) model.get(BindingResult.MODEL_KEY_PREFIX + "bindBean");
    assertNotNull(bm);
    assertEquals(null, bm.getFieldValue("stringProperty"));
View Full Code Here

Examples of org.springframework.binding.convert.service.DefaultConversionService

  /**
   * Creates a new expression parser that uses a {@link DefaultConversionService} to perform type conversion.
   */
  public BeanWrapperExpressionParser() {
    this.conversionService = new DefaultConversionService();
  }
View Full Code Here

Examples of org.springframework.binding.convert.service.DefaultConversionService

  // implementing InitializingBean

  public void afterPropertiesSet() throws Exception {
    Assert.notNull(flowDefinitionLocator, "The flow definition locator property is required");
    if (conversionService == null) {
      conversionService = new DefaultConversionService();
    }
    MutableAttributeMap executionAttributes = createFlowExecutionAttributes();
    FlowExecutionImplFactory executionFactory = createFlowExecutionFactory(executionAttributes);
    DefaultFlowExecutionRepository executionRepository = createFlowExecutionRepository(executionFactory);
    executionFactory.setExecutionKeyFactory(executionRepository);
View Full Code Here

Examples of org.springframework.binding.convert.service.DefaultConversionService

  }

  public static FlowBuilderServices getServices() {
    FlowBuilderServices services = new FlowBuilderServices();
    services.setViewFactoryCreator(new MockViewFactoryCreator());
    services.setConversionService(new DefaultConversionService());
    services.setExpressionParser(DefaultExpressionParserFactory.getExpressionParser());
    services.setApplicationContext(createTestApplicationContext());
    return services;
  }
View Full Code Here

Examples of org.springframework.binding.convert.service.DefaultConversionService

    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.setConversionService(new DefaultConversionService());
    view.render();
    assertEquals(context.getFlowScope().get("bindBean"), model.get("bindBean"));
    BindingModel bm = (BindingModel) model.get(BindingResult.MODEL_KEY_PREFIX + "bindBean");
    assertNotNull(bm);
    assertEquals(null, bm.getFieldValue("stringProperty"));
View Full Code Here

Examples of org.springframework.binding.convert.service.DefaultConversionService

    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());
    DefaultConversionService conversionService = new DefaultConversionService();
    StringToDate stringToDate = new StringToDate();
    stringToDate.setPattern("MM-dd-yyyy");
    conversionService.addConverter("customDateConverter", stringToDate);
    view.setConversionService(conversionService);
    BinderConfiguration binderConfiguration = new BinderConfiguration();
    binderConfiguration.addBinding(new Binding("dateProperty", "customDateConverter", true));
    view.setBinderConfiguration(binderConfiguration);
    view.processUserEvent();
View Full Code Here

Examples of org.springframework.binding.convert.service.DefaultConversionService

  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

Examples of org.springframework.binding.convert.service.DefaultConversionService

  private ConversionService conversionService;
  private ConverterRegistry converterRegistry;
  private WebFlowSpringELExpressionParser expressionParser;

  public void setUp() {
    conversionService = new DefaultConversionService();
    expressionParser = new WebFlowSpringELExpressionParser(new SpelExpressionParser(), conversionService);
    converterRegistry = (ConverterRegistry) conversionService.getDelegateConversionService();
  }
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.