@Test public void testGetShardNameForModule() { String shardName = configuration.getShardNameForModule("cars"); assertEquals("getShardNameForModule", "cars-1", shardName); shardName = configuration.getShardNameForModule("people"); assertEquals("getShardNameForModule", "people-1", shardName); shardName = configuration.getShardNameForModule("non-existent"); assertNull("getShardNameForModule - expected null", shardName); }
@Override public String getShardNameForModule(final String moduleName) { ModuleConfig moduleConfig = getModuleConfig(moduleName); if (moduleConfig != null) { Collection<ShardConfig> shardConfigs = moduleConfig.getShardConfigs(); if (!shardConfigs.isEmpty()) { return shardConfigs.iterator().next().getName(); } } return null; }
ConfigurationImpl implements Configuration { @Override public String getShardNameForModule(final String moduleName) { ModuleConfig moduleConfig = getModuleConfig(moduleName); if (moduleConfig != null) { Collection<ShardConfig> shardConfigs = moduleConfig.getShardConfigs(); if (!shardConfigs.isEmpty()) { return shardConfigs.iterator().next().getName(); } } return null; } }
ConfigurationImpl implements Configuration { @Override public String getShardNameForModule(final String moduleName) { ModuleConfig moduleConfig = getModuleConfig(moduleName); if (moduleConfig != null) { Collection<ShardConfig> shardConfigs = moduleConfig.getShardConfigs(); if (!shardConfigs.isEmpty()) { return shardConfigs.iterator().next().getName(); } } return null; } ConfigurationImpl(final String moduleShardsConfigPath, final String modulesConfigPath);  ConfigurationImpl(final ModuleShardConfigProvider provider); }
ConfigurationImpl implements Configuration { @Override public String getShardNameForModule(final String moduleName) { ModuleConfig moduleConfig = getModuleConfig(moduleName); if (moduleConfig != null) { Collection<ShardConfig> shardConfigs = moduleConfig.getShardConfigs(); if (!shardConfigs.isEmpty()) { return shardConfigs.iterator().next().getName(); } } return null; } 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); }
ConfigurationImpl implements Configuration { @Override public String getShardNameForModule(final String moduleName) { ModuleConfig moduleConfig = getModuleConfig(moduleName); if (moduleConfig != null) { Collection<ShardConfig> shardConfigs = moduleConfig.getShardConfigs(); if (!shardConfigs.isEmpty()) { return shardConfigs.iterator().next().getName(); } } return null; } 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);  }