@Test
public void testGetLdapServerProperties() throws Exception {

  final Properties ambariProperties = new Properties();
  final Configuration configuration = new Configuration(ambariProperties);
  final File passwordFile = temp.newFile("ldap-password.dat");
  final FileOutputStream fos = new FileOutputStream(passwordFile);
  fos.write("ambaritest\r\n".getBytes());
  fos.close();
  final String passwordFilePath = temp.getRoot().getAbsolutePath() + File.separator + "ldap-password.dat";
  ambariProperties.setProperty(Configuration.LDAP_PRIMARY_URL.getKey(), "1");
  ambariProperties.setProperty(Configuration.LDAP_SECONDARY_URL.getKey(), "2");
  ambariProperties.setProperty(Configuration.LDAP_USE_SSL.getKey(), "true");
  ambariProperties.setProperty(Configuration.LDAP_BIND_ANONYMOUSLY.getKey(), "true");
  ambariProperties.setProperty(Configuration.LDAP_MANAGER_DN.getKey(), "5");
  ambariProperties.setProperty(Configuration.LDAP_MANAGER_PASSWORD.getKey(), passwordFilePath);
  ambariProperties.setProperty(Configuration.LDAP_BASE_DN.getKey(), "7");
  ambariProperties.setProperty(Configuration.LDAP_USERNAME_ATTRIBUTE.getKey(), "8");
  ambariProperties.setProperty(Configuration.LDAP_USER_BASE.getKey(), "9");
  ambariProperties.setProperty(Configuration.LDAP_USER_OBJECT_CLASS.getKey(), "10");
  ambariProperties.setProperty(Configuration.LDAP_GROUP_BASE.getKey(), "11");
  ambariProperties.setProperty(Configuration.LDAP_GROUP_OBJECT_CLASS.getKey(), "12");
  ambariProperties.setProperty(Configuration.LDAP_GROUP_MEMBERSHIP_ATTR.getKey(), "13");
  ambariProperties.setProperty(Configuration.LDAP_GROUP_NAMING_ATTR.getKey(), "14");
  ambariProperties.setProperty(Configuration.LDAP_ADMIN_GROUP_MAPPING_RULES.getKey(), "15");
  ambariProperties.setProperty(Configuration.LDAP_GROUP_SEARCH_FILTER.getKey(), "16");
  final LdapServerProperties ldapProperties = configuration.getLdapServerProperties();
  Assert.assertEquals("1", ldapProperties.getPrimaryUrl());
  Assert.assertEquals("2", ldapProperties.getSecondaryUrl());
  Assert.assertEquals(true, ldapProperties.isUseSsl());
  Assert.assertEquals(true, ldapProperties.isAnonymousBind());
  Assert.assertEquals("5", ldapProperties.getManagerDn());
  Assert.assertEquals("ambaritest", ldapProperties.getManagerPassword());
  Assert.assertEquals("7", ldapProperties.getBaseDN());
  Assert.assertEquals("8", ldapProperties.getUsernameAttribute());
  Assert.assertEquals("9", ldapProperties.getUserBase());
  Assert.assertEquals("10", ldapProperties.getUserObjectClass());
  Assert.assertEquals("11", ldapProperties.getGroupBase());
  Assert.assertEquals("12", ldapProperties.getGroupObjectClass());
  Assert.assertEquals("13", ldapProperties.getGroupMembershipAttr());
  Assert.assertEquals("14", ldapProperties.getGroupNamingAttr());
  Assert.assertEquals("15", ldapProperties.getAdminGroupMappingRules());
  Assert.assertEquals("16", ldapProperties.getGroupSearchFilter());
}