Package org.springframework.boot.bind

Examples of org.springframework.boot.bind.RelaxedDataBinder$MapHolder


    MutablePropertyValues values = new MutablePropertyValues();
    values.add("user", this.properties.getUsername());
    values.add("password", this.properties.getPassword());
    values.add("url", this.properties.getUrl());
    values.addPropertyValues(properties.getXa().getProperties());
    new RelaxedDataBinder(target).withAlias("user", "username").bind(values);
  }
View Full Code Here


    }
  }

  private void bind(DataSource result) {
    MutablePropertyValues properties = new MutablePropertyValues(this.properties);
    new RelaxedDataBinder(result).withAlias("url", "jdbcUrl").bind(properties);
  }
View Full Code Here

  private final ServerProperties properties = new ServerProperties();

  @Test
  public void testAddressBinding() throws Exception {
    RelaxedDataBinder binder = new RelaxedDataBinder(this.properties, "server");
    binder.bind(new MutablePropertyValues(Collections.singletonMap("server.address",
        "127.0.0.1")));
    assertFalse(binder.getBindingResult().hasErrors());
    assertEquals(InetAddress.getByName("127.0.0.1"), this.properties.getAddress());
  }
View Full Code Here

    assertEquals(InetAddress.getByName("127.0.0.1"), this.properties.getAddress());
  }

  @Test
  public void testPortBinding() throws Exception {
    new RelaxedDataBinder(this.properties, "server").bind(new MutablePropertyValues(
        Collections.singletonMap("server.port", "9000")));
    assertEquals(9000, this.properties.getPort().intValue());
  }
View Full Code Here

    assertEquals(9000, this.properties.getPort().intValue());
  }

  @Test
  public void testServletPathAsMapping() throws Exception {
    RelaxedDataBinder binder = new RelaxedDataBinder(this.properties, "server");
    binder.bind(new MutablePropertyValues(Collections.singletonMap(
        "server.servletPath", "/foo/*")));
    assertFalse(binder.getBindingResult().hasErrors());
    assertEquals("/foo/*", this.properties.getServletMapping());
    assertEquals("/foo", this.properties.getServletPrefix());
  }
View Full Code Here

    assertEquals("/foo", this.properties.getServletPrefix());
  }

  @Test
  public void testServletPathAsPrefix() throws Exception {
    RelaxedDataBinder binder = new RelaxedDataBinder(this.properties, "server");
    binder.bind(new MutablePropertyValues(Collections.singletonMap(
        "server.servletPath", "/foo")));
    assertFalse(binder.getBindingResult().hasErrors());
    assertEquals("/foo/*", this.properties.getServletMapping());
    assertEquals("/foo", this.properties.getServletPrefix());
  }
View Full Code Here

    assertEquals("x-my-forward-port", remoteIpValve.getPortHeader());
    assertEquals("192.168.0.1", remoteIpValve.getInternalProxies());
  }

  private void bindProperties(Map<String, String> map) {
    new RelaxedDataBinder(this.properties, "server").bind(new MutablePropertyValues(
        map));
  }
View Full Code Here

public class ShellPropertiesTests {

  @Test
  public void testBindingAuth() {
    ShellProperties props = new ShellProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
    binder.bind(new MutablePropertyValues(Collections.singletonMap("shell.auth",
        "spring")));
    assertFalse(binder.getBindingResult().hasErrors());
    assertEquals("spring", props.getAuth());
  }
View Full Code Here

  }

  @Test
  public void testBindingAuthIfEmpty() {
    ShellProperties props = new ShellProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
    binder.bind(new MutablePropertyValues(Collections.singletonMap("shell.auth", "")));
    assertTrue(binder.getBindingResult().hasErrors());
    assertEquals("simple", props.getAuth());
  }
View Full Code Here

  }

  @Test
  public void testBindingCommandRefreshInterval() {
    ShellProperties props = new ShellProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
    binder.setConversionService(new DefaultConversionService());
    binder.bind(new MutablePropertyValues(Collections.singletonMap(
        "shell.command_refresh_interval", "1")));
    assertFalse(binder.getBindingResult().hasErrors());
    assertEquals(1, props.getCommandRefreshInterval());
  }
View Full Code Here

TOP

Related Classes of org.springframework.boot.bind.RelaxedDataBinder$MapHolder

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.