use of com.datastax.oss.driver.internal.core.channel.ClusterNameMismatchException in project java-driver by datastax.
the class ChannelPoolInitTest method should_fire_force_down_event_when_cluster_name_does_not_match.
@Test
public void should_fire_force_down_event_when_cluster_name_does_not_match() throws Exception {
when(defaultProfile.getInt(DefaultDriverOption.CONNECTION_POOL_LOCAL_SIZE)).thenReturn(3);
ClusterNameMismatchException error = new ClusterNameMismatchException(node.getEndPoint(), "actual", "expected");
MockChannelFactoryHelper factoryHelper = MockChannelFactoryHelper.builder(channelFactory).failure(node, error).failure(node, error).failure(node, error).build();
ChannelPool.init(node, null, NodeDistance.LOCAL, context, "test");
factoryHelper.waitForCalls(node, 3);
verify(eventBus, VERIFY_TIMEOUT).fire(TopologyEvent.forceDown(node.getBroadcastRpcAddress().get()));
verify(eventBus, never()).fire(ChannelEvent.channelOpened(node));
verify(nodeMetricUpdater, VERIFY_TIMEOUT.times(3)).incrementCounter(DefaultNodeMetric.CONNECTION_INIT_ERRORS, null);
factoryHelper.verifyNoMoreCalls();
}
Aggregations