Search in sources :

Example 11 with BoundNode

use of com.datastax.oss.simulacron.server.BoundNode in project java-driver by datastax.

the class ProtocolVersionMixedClusterIT method should_fail_if_peer_does_not_support_v3.

@Test
public void should_fail_if_peer_does_not_support_v3() {
    Throwable t = catchThrowable(() -> {
        try (BoundCluster simulacron = mixedVersions("3.0.0", "2.0.9", "3.11");
            BoundNode contactPoint = simulacron.node(0);
            CqlSession ignored = (CqlSession) SessionUtils.baseBuilder().addContactPoint(contactPoint.inetSocketAddress()).build()) {
            fail("Cluster init should have failed");
        }
    });
    assertThat(t).isInstanceOf(UnsupportedProtocolVersionException.class).hasMessageContaining("reports Cassandra version 2.0.9, but the driver only supports 2.1.0 and above");
}
Also used : Assertions.catchThrowable(org.assertj.core.api.Assertions.catchThrowable) BoundCluster(com.datastax.oss.simulacron.server.BoundCluster) BoundNode(com.datastax.oss.simulacron.server.BoundNode) UnsupportedProtocolVersionException(com.datastax.oss.driver.api.core.UnsupportedProtocolVersionException) CqlSession(com.datastax.oss.driver.api.core.CqlSession) Test(org.junit.Test)

Aggregations

BoundNode (com.datastax.oss.simulacron.server.BoundNode)11 CqlSession (com.datastax.oss.driver.api.core.CqlSession)7 Test (org.junit.Test)7 DriverConfigLoader (com.datastax.oss.driver.api.core.config.DriverConfigLoader)5 BoundCluster (com.datastax.oss.simulacron.server.BoundCluster)5 Node (com.datastax.oss.driver.api.core.metadata.Node)3 Metadata (com.datastax.oss.driver.api.core.metadata.Metadata)2 NodeStateListener (com.datastax.oss.driver.api.core.metadata.NodeStateListener)2 InternalDriverContext (com.datastax.oss.driver.internal.core.context.InternalDriverContext)2 DefaultNode (com.datastax.oss.driver.internal.core.metadata.DefaultNode)2 InetSocketAddress (java.net.InetSocketAddress)2 UnsupportedProtocolVersionException (com.datastax.oss.driver.api.core.UnsupportedProtocolVersionException)1 EndPoint (com.datastax.oss.driver.api.core.metadata.EndPoint)1 DefaultEndPoint (com.datastax.oss.driver.internal.core.metadata.DefaultEndPoint)1 DataProvider (com.tngtech.java.junit.dataprovider.DataProvider)1 SocketAddress (java.net.SocketAddress)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Assertions.catchThrowable (org.assertj.core.api.Assertions.catchThrowable)1 Before (org.junit.Before)1