@Test public void getSeeds_insufficientInstancesInDataCenter() { CassandraInstance instance1 = buildInstance(DATACENTER1, IP_ADDRESS_1); CassandraInstance instance2 = buildInstance(DATACENTER2, IP_ADDRESS_2); CassandraInstance instance3 = buildInstance(DATACENTER2, IP_ADDRESS_3); ImmutableSet<CassandraInstance> instances = ImmutableSet.of(instance1, instance2, instance3); expect(ring.getInstances()).andReturn(instances); replayAll(); assertEquals(ImmutableSet.of(IP_ADDRESS_1, IP_ADDRESS_2, IP_ADDRESS_3), seedProvider.getSeeds(ring)); }
@Override public ImmutableSet<String> getSeeds(CassandraRing ring) { ImmutableSet.Builder<String> seedBuilder = ImmutableSet.builder(); ImmutableSetMultimap<String, CassandraInstance> dataCenterToInstanceMap = buildDataCenterToInstanceMap(ring.getInstances()); for (String dc : dataCenterToInstanceMap.keySet()) { seedBuilder.addAll(getSeeds(dc, dataCenterToInstanceMap.get(dc))); } return seedBuilder.build(); }
PerDataCenterSeedService implements SeedService { @Override public ImmutableSet<String> getSeeds(CassandraRing ring) { ImmutableSet.Builder<String> seedBuilder = ImmutableSet.builder(); ImmutableSetMultimap<String, CassandraInstance> dataCenterToInstanceMap = buildDataCenterToInstanceMap(ring.getInstances()); for (String dc : dataCenterToInstanceMap.keySet()) { seedBuilder.addAll(getSeeds(dc, dataCenterToInstanceMap.get(dc))); } return seedBuilder.build(); } }
PerDataCenterSeedService implements SeedService { @Override public ImmutableSet<String> getSeeds(CassandraRing ring) { ImmutableSet.Builder<String> seedBuilder = ImmutableSet.builder(); ImmutableSetMultimap<String, CassandraInstance> dataCenterToInstanceMap = buildDataCenterToInstanceMap(ring.getInstances()); for (String dc : dataCenterToInstanceMap.keySet()) { seedBuilder.addAll(getSeeds(dc, dataCenterToInstanceMap.get(dc))); } return seedBuilder.build(); } @Inject  PerDataCenterSeedService(@Named(ServiceModule.SEEDS_PER_DATACENTER_PROPERTY) int numSeeds); }
PerDataCenterSeedService implements SeedService { @Override public ImmutableSet<String> getSeeds(CassandraRing ring) { ImmutableSet.Builder<String> seedBuilder = ImmutableSet.builder(); ImmutableSetMultimap<String, CassandraInstance> dataCenterToInstanceMap = buildDataCenterToInstanceMap(ring.getInstances()); for (String dc : dataCenterToInstanceMap.keySet()) { seedBuilder.addAll(getSeeds(dc, dataCenterToInstanceMap.get(dc))); } return seedBuilder.build(); } @Inject  PerDataCenterSeedService(@Named(ServiceModule.SEEDS_PER_DATACENTER_PROPERTY) int numSeeds); @Override ImmutableSet<String> getSeeds(CassandraRing ring); }
PerDataCenterSeedService implements SeedService { @Override public ImmutableSet<String> getSeeds(CassandraRing ring) { ImmutableSet.Builder<String> seedBuilder = ImmutableSet.builder(); ImmutableSetMultimap<String, CassandraInstance> dataCenterToInstanceMap = buildDataCenterToInstanceMap(ring.getInstances()); for (String dc : dataCenterToInstanceMap.keySet()) { seedBuilder.addAll(getSeeds(dc, dataCenterToInstanceMap.get(dc))); } return seedBuilder.build(); } @Inject  PerDataCenterSeedService(@Named(ServiceModule.SEEDS_PER_DATACENTER_PROPERTY) int numSeeds); @Override ImmutableSet<String> getSeeds(CassandraRing ring);  }