@Test public void testBootstrap() { String ipAddress = "140.211.11.105"; String hostName = "www.example.com"; Cluster cluster = Cluster.bootstrap(Arrays.asList( new InetSocketAddress(ipAddress, 9002), new InetSocketAddress(hostName, 9002) )); Set<String> expectedHosts = Utils.mkSet(ipAddress, hostName); Set<String> actualHosts = new HashSet<>(); for (Node node : cluster.nodes()) actualHosts.add(node.host()); assertEquals(expectedHosts, actualHosts); }
public static Cluster bootstrap(List<InetSocketAddress> addresses) { List<Node> nodes = new ArrayList<>(); int nodeId = -1; for (InetSocketAddress address : addresses) nodes.add(new Node(nodeId--, address.getHostString(), address.getPort())); return new Cluster(true, nodes, new ArrayList<PartitionInfo>(0), Collections.<String>emptySet()); }
Cluster { public static Cluster bootstrap(List<InetSocketAddress> addresses) { List<Node> nodes = new ArrayList<>(); int nodeId = -1; for (InetSocketAddress address : addresses) nodes.add(new Node(nodeId--, address.getHostString(), address.getPort())); return new Cluster(true, nodes, new ArrayList<PartitionInfo>(0), Collections.<String>emptySet()); } }
Cluster { public static Cluster bootstrap(List<InetSocketAddress> addresses) { List<Node> nodes = new ArrayList<>(); int nodeId = -1; for (InetSocketAddress address : addresses) nodes.add(new Node(nodeId--, address.getHostString(), address.getPort())); return new Cluster(true, nodes, new ArrayList<PartitionInfo>(0), Collections.<String>emptySet()); } Cluster(Collection<Node> nodes,
        Collection<PartitionInfo> partitions,
        Set<String> unauthorizedTopics); private  Cluster(boolean isBootstrapConfigured,
        Collection<Node> nodes,
        Collection<PartitionInfo> partitions,
        Set<String> unauthorizedTopics); }
Cluster { public static Cluster bootstrap(List<InetSocketAddress> addresses) { List<Node> nodes = new ArrayList<>(); int nodeId = -1; for (InetSocketAddress address : addresses) nodes.add(new Node(nodeId--, address.getHostString(), address.getPort())); return new Cluster(true, nodes, new ArrayList<PartitionInfo>(0), Collections.<String>emptySet()); } Cluster(Collection<Node> nodes,
        Collection<PartitionInfo> partitions,
        Set<String> unauthorizedTopics); private  Cluster(boolean isBootstrapConfigured,
        Collection<Node> nodes,
        Collection<PartitionInfo> partitions,
        Set<String> unauthorizedTopics); static Cluster empty(); static Cluster bootstrap(List<InetSocketAddress> addresses); Cluster withPartitions(Map<TopicPartition, PartitionInfo> partitions); List<Node> nodes(); Node nodeById(int id); Node leaderFor(TopicPartition topicPartition); PartitionInfo partition(TopicPartition topicPartition); List<PartitionInfo> partitionsForTopic(String topic); List<PartitionInfo> availablePartitionsForTopic(String topic); List<PartitionInfo> partitionsForNode(int nodeId); Integer partitionCountForTopic(String topic); Set<String> topics(); Set<String> unauthorizedTopics(); boolean isBootstrapConfigured(); @Override String toString(); }
Cluster { public static Cluster bootstrap(List<InetSocketAddress> addresses) { List<Node> nodes = new ArrayList<>(); int nodeId = -1; for (InetSocketAddress address : addresses) nodes.add(new Node(nodeId--, address.getHostString(), address.getPort())); return new Cluster(true, nodes, new ArrayList<PartitionInfo>(0), Collections.<String>emptySet()); } Cluster(Collection<Node> nodes,
        Collection<PartitionInfo> partitions,
        Set<String> unauthorizedTopics); private  Cluster(boolean isBootstrapConfigured,
        Collection<Node> nodes,
        Collection<PartitionInfo> partitions,
        Set<String> unauthorizedTopics); static Cluster empty(); static Cluster bootstrap(List<InetSocketAddress> addresses); Cluster withPartitions(Map<TopicPartition, PartitionInfo> partitions); List<Node> nodes(); Node nodeById(int id); Node leaderFor(TopicPartition topicPartition); PartitionInfo partition(TopicPartition topicPartition); List<PartitionInfo> partitionsForTopic(String topic); List<PartitionInfo> availablePartitionsForTopic(String topic); List<PartitionInfo> partitionsForNode(int nodeId); Integer partitionCountForTopic(String topic); Set<String> topics(); Set<String> unauthorizedTopics(); boolean isBootstrapConfigured(); @Override String toString();  }