Package org.springframework.boot.bind

Examples of org.springframework.boot.bind.RelaxedDataBinder.bind()


    binder.setConversionService(new DefaultConversionService());
    Map<String, String> map = new HashMap<String, String>();
    map.put("shell.ssh.enabled", "true");
    map.put("shell.ssh.port", "2222");
    map.put("shell.ssh.key_path", "~/.ssh/test.pem");
    binder.bind(new MutablePropertyValues(map));
    assertFalse(binder.getBindingResult().hasErrors());

    Properties p = props.asCrshShellConfig();

    assertEquals("2222", p.get("crash.ssh.port"));
View Full Code Here


    binder.setConversionService(new DefaultConversionService());
    Map<String, String> map = new HashMap<String, String>();
    map.put("shell.ssh.enabled", "false");
    map.put("shell.ssh.port", "2222");
    map.put("shell.ssh.key_path", "~/.ssh/test.pem");
    binder.bind(new MutablePropertyValues(map));
    assertFalse(binder.getBindingResult().hasErrors());

    Properties p = props.asCrshShellConfig();

    assertNull(p.get("crash.ssh.port"));
View Full Code Here

    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
    binder.setConversionService(new DefaultConversionService());
    Map<String, String> map = new HashMap<String, String>();
    map.put("shell.telnet.enabled", "true");
    map.put("shell.telnet.port", "2222");
    binder.bind(new MutablePropertyValues(map));
    assertFalse(binder.getBindingResult().hasErrors());

    Properties p = props.asCrshShellConfig();

    assertEquals("2222", p.get("crash.telnet.port"));
View Full Code Here

    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell");
    binder.setConversionService(new DefaultConversionService());
    Map<String, String> map = new HashMap<String, String>();
    map.put("shell.telnet.enabled", "false");
    map.put("shell.telnet.port", "2222");
    binder.bind(new MutablePropertyValues(map));
    assertFalse(binder.getBindingResult().hasErrors());

    Properties p = props.asCrshShellConfig();

    assertNull(p.get("crash.telnet.port"));
View Full Code Here

    JaasAuthenticationProperties props = new JaasAuthenticationProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.jaas");
    binder.setConversionService(new DefaultConversionService());
    Map<String, String> map = new HashMap<String, String>();
    map.put("shell.auth.jaas.domain", "my-test-domain");
    binder.bind(new MutablePropertyValues(map));
    assertFalse(binder.getBindingResult().hasErrors());

    Properties p = new Properties();
    props.applyToCrshShellConfig(p);
View Full Code Here

    KeyAuthenticationProperties props = new KeyAuthenticationProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.key");
    binder.setConversionService(new DefaultConversionService());
    Map<String, String> map = new HashMap<String, String>();
    map.put("shell.auth.key.path", "~/.ssh/test.pem");
    binder.bind(new MutablePropertyValues(map));
    assertFalse(binder.getBindingResult().hasErrors());

    Properties p = new Properties();
    props.applyToCrshShellConfig(p);
View Full Code Here

  public void testBindingKeyIgnored() {
    KeyAuthenticationProperties props = new KeyAuthenticationProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.key");
    binder.setConversionService(new DefaultConversionService());
    Map<String, String> map = new HashMap<String, String>();
    binder.bind(new MutablePropertyValues(map));
    assertFalse(binder.getBindingResult().hasErrors());

    Properties p = new Properties();
    props.applyToCrshShellConfig(p);
View Full Code Here

    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.simple");
    binder.setConversionService(new DefaultConversionService());
    Map<String, String> map = new HashMap<String, String>();
    map.put("shell.auth.simple.user.name", "username123");
    map.put("shell.auth.simple.user.password", "password123");
    binder.bind(new MutablePropertyValues(map));
    assertFalse(binder.getBindingResult().hasErrors());

    Properties p = new Properties();
    props.applyToCrshShellConfig(p);
View Full Code Here

  @Test
  public void testDefaultPasswordAutogeneratedIfUnresolovedPlaceholder() {
    SimpleAuthenticationProperties security = new SimpleAuthenticationProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(security, "security");
    binder.bind(new MutablePropertyValues(Collections.singletonMap(
        "shell.auth.simple.user.password", "${ADMIN_PASSWORD}")));
    assertFalse(binder.getBindingResult().hasErrors());
    assertTrue(security.getUser().isDefaultPassword());
  }
View Full Code Here

  @Test
  public void testDefaultPasswordAutogeneratedIfEmpty() {
    SimpleAuthenticationProperties security = new SimpleAuthenticationProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(security, "security");
    binder.bind(new MutablePropertyValues(Collections.singletonMap(
        "shell.auth.simple.user.password", "")));
    assertFalse(binder.getBindingResult().hasErrors());
    assertTrue(security.getUser().isDefaultPassword());
  }
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.