use of com.datastax.driver.core.Configuration in project spring-cloud-connectors by spring-cloud.
the class CassandraClusterCreatorTest method shouldCreateCluster.
@Test
public void shouldCreateCluster() throws Exception {
CassandraServiceInfo info = new CassandraServiceInfo("local", Collections.singletonList("127.0.0.1"), 9142);
Cluster cluster = creator.create(info, null);
Configuration configuration = cluster.getConfiguration();
assertThat(configuration.getProtocolOptions().getAuthProvider(), is(AuthProvider.NONE));
}
use of com.datastax.driver.core.Configuration in project spring-cloud-connectors by spring-cloud.
the class CassandraClusterCreatorTest method shouldCreateClusterWithAuthentication.
@Test
public void shouldCreateClusterWithAuthentication() throws Exception {
CassandraServiceInfo info = new CassandraServiceInfo("local", Collections.singletonList("127.0.0.1"), 9142, "walter", "white");
Cluster cluster = creator.create(info, null);
Configuration configuration = cluster.getConfiguration();
assertThat(configuration.getProtocolOptions().getAuthProvider(), is(instanceOf(PlainTextAuthProvider.class)));
}
use of com.datastax.driver.core.Configuration in project spring-cloud-connectors by spring-cloud.
the class CassandraClusterCreatorTest method shouldCreateClusterWithConfig.
@Test
public void shouldCreateClusterWithConfig() throws Exception {
CassandraServiceInfo info = new CassandraServiceInfo("local", Collections.singletonList("127.0.0.1"), 9142);
CassandraClusterConfig config = new CassandraClusterConfig();
config.setCompression(ProtocolOptions.Compression.NONE);
config.setPoolingOptions(new PoolingOptions().setPoolTimeoutMillis(1234));
config.setQueryOptions(new QueryOptions());
config.setProtocolVersion(ProtocolVersion.NEWEST_SUPPORTED);
config.setLoadBalancingPolicy(new RoundRobinPolicy());
config.setReconnectionPolicy(new ConstantReconnectionPolicy(1));
config.setRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE);
config.setSocketOptions(new SocketOptions());
Cluster cluster = creator.create(info, config);
Configuration configuration = cluster.getConfiguration();
assertThat(configuration.getProtocolOptions().getCompression(), is(config.getCompression()));
assertThat(configuration.getQueryOptions(), is(config.getQueryOptions()));
assertThat(configuration.getSocketOptions(), is(config.getSocketOptions()));
Policies policies = configuration.getPolicies();
assertThat(policies.getLoadBalancingPolicy(), is(config.getLoadBalancingPolicy()));
assertThat(policies.getReconnectionPolicy(), is(config.getReconnectionPolicy()));
assertThat(policies.getRetryPolicy(), is(config.getRetryPolicy()));
}
use of com.datastax.driver.core.Configuration in project apex-malhar by apache.
the class CassandraOperatorTest method testCassandraProtocolVersion.
@Test
public void testCassandraProtocolVersion() {
TestOutputOperator outputOperator = setupForOutputOperatorTest();
outputOperator.getStore().setProtocolVersion("v2");
outputOperator.setup(context);
Configuration config = outputOperator.getStore().getCluster().getConfiguration();
Assert.assertEquals("Procotol version was not set to V2.", ProtocolVersion.V2, config.getProtocolOptions().getProtocolVersion());
}
Aggregations