@Test(groups = "unit") public void should_ignore_DCs_in_black_list() { when(host1.getDatacenter()).thenReturn("dc1"); when(host2.getDatacenter()).thenReturn("dc2"); when(host3.getDatacenter()).thenReturn(null); HostFilterPolicy policy = HostFilterPolicy.fromDCBlackList(wrappedPolicy, Lists.newArrayList("dc2")); assertThat(policy.distance(host1)).isSameAs(HostDistance.LOCAL); assertThat(policy.distance(host2)).isSameAs(HostDistance.IGNORED); assertThat(policy.distance(host3)).isSameAs(HostDistance.LOCAL); }
HostFilterPolicy.fromDCBlackList( DCAwareRoundRobinPolicy.builder().withUsedHostsPerRemoteDc(2).build(), Lists.newArrayList(datacenter(2)));
@Test(groups = "unit") public void should_ignore_DCs_in_black_list() { when(host1.getDatacenter()).thenReturn("dc1"); when(host2.getDatacenter()).thenReturn("dc2"); when(host3.getDatacenter()).thenReturn(null); HostFilterPolicy policy = HostFilterPolicy.fromDCBlackList(wrappedPolicy, Lists.newArrayList("dc2")); assertThat(policy.distance(host1)).isSameAs(HostDistance.LOCAL); assertThat(policy.distance(host2)).isSameAs(HostDistance.IGNORED); assertThat(policy.distance(host3)).isSameAs(HostDistance.LOCAL); }
HostFilterPolicy.fromDCBlackList( DCAwareRoundRobinPolicy.builder().withUsedHostsPerRemoteDc(2).build(), Lists.newArrayList(datacenter(2)));