use of com.datastax.driver.core.policies.DCAwareRoundRobinPolicy in project zipkin by openzipkin.
the class SessionFactoryTest method loadBalancing_settingLocalDcIgnoresOtherDatacenters.
@Test
public void loadBalancing_settingLocalDcIgnoresOtherDatacenters() {
DCAwareRoundRobinPolicy policy = toDCAwareRoundRobinPolicy(CassandraStorage.builder().localDc("bar").build());
Host foo = mock(Host.class);
when(foo.getDatacenter()).thenReturn("foo");
Host bar = mock(Host.class);
when(bar.getDatacenter()).thenReturn("bar");
policy.init(mock(Cluster.class), asList(foo, bar));
assertThat(policy.distance(foo)).isEqualTo(HostDistance.IGNORED);
assertThat(policy.distance(bar)).isEqualTo(HostDistance.LOCAL);
}
use of com.datastax.driver.core.policies.DCAwareRoundRobinPolicy in project zipkin by openzipkin.
the class SessionFactoryTest method loadBalancing_settingLocalDcIgnoresOtherDatacenters.
@Test
public void loadBalancing_settingLocalDcIgnoresOtherDatacenters() {
DCAwareRoundRobinPolicy policy = toDCAwareRoundRobinPolicy(Cassandra3Storage.builder().localDc("bar").build());
Host foo = mock(Host.class);
when(foo.getDatacenter()).thenReturn("foo");
Host bar = mock(Host.class);
when(bar.getDatacenter()).thenReturn("bar");
policy.init(mock(Cluster.class), asList(foo, bar));
assertThat(policy.distance(foo)).isEqualTo(HostDistance.IGNORED);
assertThat(policy.distance(bar)).isEqualTo(HostDistance.LOCAL);
}
Aggregations