Package org.springframework.boot.bind

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


  }

  @Test
  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);

    assertNull(p.get("crash.auth.key.path"));
View Full Code Here


  }

  @Test
  public void testBindingSimple() {
    SimpleAuthenticationProperties props = new SimpleAuthenticationProperties();
    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);

    assertEquals("username123", p.get("crash.auth.simple.username"));
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

  }

  @Test
  public void testBindingSpring() {
    SpringAuthenticationProperties props = new SpringAuthenticationProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.spring");
    binder.bind(new MutablePropertyValues(Collections.singletonMap(
        "shell.auth.spring.roles", "role1, role2")));
    assertFalse(binder.getBindingResult().hasErrors());

    Properties p = new Properties();
    props.applyToCrshShellConfig(p);

    assertEquals("role1, role2", p.get("crash.auth.spring.roles"));
View Full Code Here

TOP

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

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.