LdapSettingsManager { public Map<String, LdapUserMapping> getUserMappings() { if (userMappings == null) { userMappings = new LinkedHashMap<>(); String[] serverKeys = settings.getStringArray(LDAP_SERVERS_PROPERTY); if (serverKeys.length > 0) { for (String serverKey : serverKeys) { LdapUserMapping userMapping = new LdapUserMapping(settings, LDAP_PROPERTY_PREFIX + "." + serverKey); if (StringUtils.isNotBlank(userMapping.getBaseDn())) { LOG.info("User mapping for server {}: {}", serverKey, userMapping); userMappings.put(serverKey, userMapping); } else { LOG.info("Users will not be synchronized for server {}, because property 'ldap.{}.user.baseDn' is empty.", serverKey, serverKey); } } } else { LdapUserMapping userMapping = new LdapUserMapping(settings, LDAP_PROPERTY_PREFIX); if (StringUtils.isNotBlank(userMapping.getBaseDn())) { LOG.info("User mapping: {}", userMapping); userMappings.put(DEFAULT_LDAP_SERVER_KEY, userMapping); } else { LOG.info("Users will not be synchronized, because property 'ldap.user.baseDn' is empty."); } } } return userMappings; } LdapSettingsManager(Settings settings, LdapAutodiscovery ldapAutodiscovery); Map<String, LdapUserMapping> getUserMappings(); Map<String, LdapGroupMapping> getGroupMappings(); Map<String, LdapContextFactory> getContextFactories();  }
@Test public void testUserMappings() throws Exception { LdapSettingsManager settingsManager = new LdapSettingsManager( generateMultipleLdapSettingsWithUserAndGroupMapping(), new LdapAutodiscovery()); assertThat(settingsManager.getUserMappings().size()).isEqualTo(2); assertThat(settingsManager.getUserMappings().size()).isEqualTo(2); }