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