MemberValidator { public Set<DistributedMember> findMembers(String id, String... groups) { if (StringUtils.isNotBlank(id)) { return getAllServersAndLocators().stream().filter(m -> m.getName().equals(id)) .collect(Collectors.toSet()); } return findMembers(true, groups); } MemberValidator(InternalCache cache, ConfigurationPersistenceService persistenceService); void validateCreate(AbstractConfiguration config, CacheConfigurationManager manager); String[] findGroupsWithThisElement(AbstractConfiguration config,
      CacheConfigurationManager manager); Map<String, AbstractConfiguration> findCacheElement(AbstractConfiguration config,
      CacheConfigurationManager manager); Set<String> findGroups(String regionName); Set<DistributedMember> findServers(String... groups); Set<DistributedMember> findServers(AbstractConfiguration configuration); Set<DistributedMember> findMembers(String id, String... groups); Set<DistributedMember> findMembers(boolean includeLocators, String... groups);  }
@Test public void findMembers() { assertThat(validator.findMembers(null)).flatExtracting(DistributedMember::getName) .containsExactlyInAnyOrder("member1", "member2", "member3", "member4", "member5"); assertThat(validator.findMembers(null)) .flatExtracting(DistributedMember::getName) .containsExactlyInAnyOrder("member1", "member2", "member3", "member4", "member5"); assertThat(validator.findMembers(null, new String[] {null})) .flatExtracting(DistributedMember::getName) .containsExactlyInAnyOrder("member1", "member2", "member3", "member4", "member5"); assertThat(validator.findMembers(null, "cluster")) .flatExtracting(DistributedMember::getName) .containsExactlyInAnyOrder("member1", "member2", "member3", "member4", "member5"); assertThat(validator.findMembers(null, "Cluster")) .flatExtracting(DistributedMember::getName) .containsExactlyInAnyOrder("member1", "member2", "member3", "member4", "member5"); assertThat(validator.findMembers(null, "CLUSTER")) .flatExtracting(DistributedMember::getName) .containsExactlyInAnyOrder("member1", "member2", "member3", "member4", "member5"); assertThat(validator.findMembers(null, "")) .flatExtracting(DistributedMember::getName) .containsExactlyInAnyOrder("member1", "member2", "member3", "member4", "member5"); assertThat(validator.findMembers("member1")).flatExtracting(DistributedMember::getName) .containsExactlyInAnyOrder("member1"); assertThat(validator.findMembers("member1", "group1")) .flatExtracting(DistributedMember::getName) .containsExactlyInAnyOrder("member1"); assertThat(validator.findMembers(null, "group1")).flatExtracting(DistributedMember::getName) .containsExactlyInAnyOrder("member2", "member4"); assertThat(validator.findMembers(null, "group1", "cluster")) .flatExtracting(DistributedMember::getName) .containsExactlyInAnyOrder("member1", "member2", "member3", "member4", "member5"); assertThat(validator.findMembers(null, "group1", "group2")) .flatExtracting(DistributedMember::getName) .containsExactlyInAnyOrder("member2", "member3", "member4"); }