@Test() public void testGetSeeds() throws UnknownHostException { Instance one = getInstance("1"); Instance two = getInstance("2"); Set<Instance> instances = Sets.newLinkedHashSet(); instances.add(one); CassandraClusterActionHandler handler = new CassandraClusterActionHandler(); List<Instance> seeds1 = handler.getSeeds(instances); assertEquals(1, seeds1.size()); assertEquals(one, seeds1.get(0)); instances.add(two); for (int i = 3; i < 10; i++) { instances.add(getInstance(Integer.toString(i))); } List<Instance> seeds2 = handler.getSeeds(instances); assertEquals(2, seeds2.size()); assertEquals(one, seeds2.get(0)); assertEquals(two, seeds2.get(1)); }
protected List<Instance> getSeeds(Set<Instance> instances) { List<Instance> nodes = Lists.newArrayList(instances); int seeds = (int) Math.ceil(Math.max(1, instances.size() * 0.2)); List<Instance> rv = Lists.newArrayList(); for (int i = 0; i < seeds; i++) { rv.add(nodes.get(i)); } return rv; }
CassandraClusterActionHandler extends ClusterActionHandlerSupport { protected List<Instance> getSeeds(Set<Instance> instances) { List<Instance> nodes = Lists.newArrayList(instances); int seeds = (int) Math.ceil(Math.max(1, instances.size() * 0.2)); List<Instance> rv = Lists.newArrayList(); for (int i = 0; i < seeds; i++) { rv.add(nodes.get(i)); } return rv; } }
CassandraClusterActionHandler extends ClusterActionHandlerSupport { protected List<Instance> getSeeds(Set<Instance> instances) { List<Instance> nodes = Lists.newArrayList(instances); int seeds = (int) Math.ceil(Math.max(1, instances.size() * 0.2)); List<Instance> rv = Lists.newArrayList(); for (int i = 0; i < seeds; i++) { rv.add(nodes.get(i)); } return rv; }  }
CassandraClusterActionHandler extends ClusterActionHandlerSupport { protected List<Instance> getSeeds(Set<Instance> instances) { List<Instance> nodes = Lists.newArrayList(instances); int seeds = (int) Math.ceil(Math.max(1, instances.size() * 0.2)); List<Instance> rv = Lists.newArrayList(); for (int i = 0; i < seeds; i++) { rv.add(nodes.get(i)); } return rv; }  @Override String getRole(); }
CassandraClusterActionHandler extends ClusterActionHandlerSupport { protected List<Instance> getSeeds(Set<Instance> instances) { List<Instance> nodes = Lists.newArrayList(instances); int seeds = (int) Math.ceil(Math.max(1, instances.size() * 0.2)); List<Instance> rv = Lists.newArrayList(); for (int i = 0; i < seeds; i++) { rv.add(nodes.get(i)); } return rv; }  @Override String getRole(); static final String CASSANDRA_ROLE; static final int CLIENT_PORT; static final int JMX_PORT; static final String BIN_TARBALL; static final String MAJOR_VERSION; }