@Test public void getTopicConfigTest() { clusterNameServiceStub.setRemoteResult(false); TopicConfig topicConfig = clusterNameServiceStub.getTopicConfig(TopicName.parse("test2")); Assert.assertEquals(1, (int) topicConfig.getPartitionGroups().get(0).getLeader()); Assert.assertEquals(2, (int) topicConfig.getPartitionGroups().get(1).getLeader()); Assert.assertEquals(3, (int) topicConfig.getPartitionGroups().get(2).getLeader()); Assert.assertEquals(Sets.newHashSet(1, 2, 3), clusterNameServiceStub.getLastRemote().get(0).keySet()); Assert.assertEquals(Sets.newHashSet(4, 6, 8, 9, 10, 5, 7, 11, 12, 13), clusterNameServiceStub.getLastRemote().get(1).keySet()); Assert.assertEquals(2, clusterNameServiceStub.getLastRemote().size()); clusterNameServiceStub.setRemoteResult(true); clusterNameServiceStub.getLastRemote().clear(); topicConfig = clusterNameServiceStub.getTopicConfig(TopicName.parse("test2")); Assert.assertEquals(1, (int) topicConfig.getPartitionGroups().get(0).getLeader()); Assert.assertEquals(2, (int) topicConfig.getPartitionGroups().get(1).getLeader()); Assert.assertEquals(3, (int) topicConfig.getPartitionGroups().get(2).getLeader()); Assert.assertEquals(Sets.newHashSet(1, 2, 3), clusterNameServiceStub.getLastRemote().get(0).keySet()); Assert.assertEquals(1, clusterNameServiceStub.getLastRemote().size()); }
public TopicConfig getTopicConfig(TopicName topicName) { TopicConfig topicConfig = nameService.getTopicConfig(topicName); if (topicConfig == null) { return null; } return doGetTopicConfig(topicConfig); }
ClusterNameService extends Service { public TopicConfig getTopicConfig(TopicName topicName) { TopicConfig topicConfig = nameService.getTopicConfig(topicName); if (topicConfig == null) { return null; } return doGetTopicConfig(topicConfig); } }
ClusterNameService extends Service { public TopicConfig getTopicConfig(TopicName topicName) { TopicConfig topicConfig = nameService.getTopicConfig(topicName); if (topicConfig == null) { return null; } return doGetTopicConfig(topicConfig); } ClusterNameService(NameService nameService, BrokerEventBus eventBus, PropertySupplier propertySupplier); }
ClusterNameService extends Service { public TopicConfig getTopicConfig(TopicName topicName) { TopicConfig topicConfig = nameService.getTopicConfig(topicName); if (topicConfig == null) { return null; } return doGetTopicConfig(topicConfig); } ClusterNameService(NameService nameService, BrokerEventBus eventBus, PropertySupplier propertySupplier); void setBroker(Broker broker); ClusterNode getTopicGroupNode(TopicName topicName, int group); ClusterNode getTopicGroupNode(String topic, int group); Map<TopicName, TopicConfig> getTopicConfigByApp(String subscribeApp, Subscription.Type subscribe); Map<String, TopicConfig> getTopicConfigs(List<String> topics); TopicConfig getTopicConfig(TopicName topicName); TopicConfig doGetTopicConfig(TopicConfig topicConfig); NameService getNameService(); }
ClusterNameService extends Service { public TopicConfig getTopicConfig(TopicName topicName) { TopicConfig topicConfig = nameService.getTopicConfig(topicName); if (topicConfig == null) { return null; } return doGetTopicConfig(topicConfig); } ClusterNameService(NameService nameService, BrokerEventBus eventBus, PropertySupplier propertySupplier); void setBroker(Broker broker); ClusterNode getTopicGroupNode(TopicName topicName, int group); ClusterNode getTopicGroupNode(String topic, int group); Map<TopicName, TopicConfig> getTopicConfigByApp(String subscribeApp, Subscription.Type subscribe); Map<String, TopicConfig> getTopicConfigs(List<String> topics); TopicConfig getTopicConfig(TopicName topicName); TopicConfig doGetTopicConfig(TopicConfig topicConfig); NameService getNameService();  }