ConfigurationImpl implements Configuration { @Override public Collection<MemberName> getMembersFromShardName(final String shardName) { checkNotNullShardName(shardName); for (ModuleConfig moduleConfig: moduleConfigMap.values()) { ShardConfig shardConfig = moduleConfig.getShardConfig(shardName); if (shardConfig != null) { return shardConfig.getReplicas(); } } for (final PrefixShardConfiguration prefixConfig : prefixConfigMap.values()) { if (shardName.equals(ClusterUtils.getCleanShardName(prefixConfig.getPrefix().getRootIdentifier()))) { return prefixConfig.getShardMemberNames(); } } return Collections.emptyList(); } ConfigurationImpl(final String moduleShardsConfigPath, final String modulesConfigPath);  ConfigurationImpl(final ModuleShardConfigProvider provider); @Override Collection<String> getMemberShardNames(final MemberName memberName); @Override String getModuleNameFromNameSpace(final String nameSpace); @Override ShardStrategy getStrategyForModule(final String moduleName); @Override String getShardNameForModule(final String moduleName); @Override String getShardNameForPrefix(final DOMDataTreeIdentifier prefix); @Override Collection<MemberName> getMembersFromShardName(final String shardName); @Override Set<String> getAllShardNames(); @Override Collection<MemberName> getUniqueMemberNamesForAllShards(); @Override synchronized void addModuleShardConfiguration(final ModuleShardConfiguration config); @Override void addPrefixShardConfiguration(final PrefixShardConfiguration config); @Override void removePrefixShardConfiguration(final DOMDataTreeIdentifier prefix); @Override Map<DOMDataTreeIdentifier, PrefixShardConfiguration> getAllPrefixShardConfigurations(); @Override boolean isShardConfigured(final String shardName); @Override void addMemberReplicaForShard(final String shardName, final MemberName newMemberName); @Override void removeMemberReplicaForShard(final String shardName, final MemberName newMemberName); @Override ShardStrategy getStrategyForPrefix(final DOMDataTreeIdentifier prefix);  }
@Test public void testGetMembersFromShardName() { Collection<MemberName> members = configuration.getMembersFromShardName("default"); assertEquals("getMembersFromShardName", ImmutableSortedSet.of(MEMBER_1, MEMBER_2, MEMBER_3), ImmutableSortedSet.copyOf(members)); members = configuration.getMembersFromShardName("cars-1"); assertEquals("getMembersFromShardName", ImmutableSortedSet.of(MEMBER_1), ImmutableSortedSet.copyOf(members)); members = configuration.getMembersFromShardName("foobar"); assertEquals("getMembersFromShardName size", 0, members.size()); }