ScimExternalGroupsTypeResolvingFactoryBean { public Map<String, Map<String, List>> getExternalGroups() { return externalGroups; } ScimExternalGroupsTypeResolvingFactoryBean(Object o); Map<String, Map<String, List>> getExternalGroups(); void setExternalGroups(Map<String, Map<String, List>> groups);  }
@Test public void resultingExternalGroupsMap_withExternalGroupExtraSpaces() { List<String> internalToExternalGroups = Arrays.asList("acme| cn=Engineering,ou=groups,dc=example,dc=com cn=HR,ou=groups,dc=example,dc=com cn=mgmt,ou=groups,dc=example,dc=com ", "acme.dev|cn=Engineering,ou=groups,dc=example,dc=com "); ScimExternalGroupsTypeResolvingFactoryBean scimExternalGroupsTypeResolvingFactoryBean = new ScimExternalGroupsTypeResolvingFactoryBean(internalToExternalGroups); Map<String, Map<String, List>> externalGroups = scimExternalGroupsTypeResolvingFactoryBean.getExternalGroups(); assertThat(externalGroups.keySet(), containsInAnyOrder(OriginKeys.LDAP)); assertThat(externalGroups.get(OriginKeys.LDAP).keySet(), containsInAnyOrder("cn=Engineering,ou=groups,dc=example,dc=com", "cn=HR,ou=groups,dc=example,dc=com", "cn=mgmt,ou=groups,dc=example,dc=com")); }
@Test public void canAddExternalGroupsWithOrigin() { List<String> internalToExternalGroups = Arrays.asList("acme|cn=Engineering,ou=groups,dc=example,dc=com cn=HR,ou=groups,dc=example,dc=com cn=mgmt,ou=groups,dc=example,dc=com|uaa", "acme.dev|cn=Engineering,ou=groups,dc=example,dc=com|uaa"); ScimExternalGroupsTypeResolvingFactoryBean scimExternalGroupsTypeResolvingFactoryBean = new ScimExternalGroupsTypeResolvingFactoryBean(internalToExternalGroups); Map<String, Map<String, List>> externalGroups = scimExternalGroupsTypeResolvingFactoryBean.getExternalGroups(); assertThat(externalGroups.keySet(), containsInAnyOrder(OriginKeys.UAA)); }
@Test public void cannotAddInternalGroupsThatMapToNothing() { List<String> internalToExternalGroups = Arrays.asList("acme|", "acme.dev"); ScimExternalGroupsTypeResolvingFactoryBean scimExternalGroupsTypeResolvingFactoryBean = new ScimExternalGroupsTypeResolvingFactoryBean(internalToExternalGroups); Map<String, Map<String, List>> externalGroups = scimExternalGroupsTypeResolvingFactoryBean.getExternalGroups(); assertThat(externalGroups.size(), is(0)); }