use of com.datastax.driver.core.Cluster in project zipkin by openzipkin.
the class Schema method getKeyspaceMetadata.
static KeyspaceMetadata getKeyspaceMetadata(Session session) {
String keyspace = session.getLoggedKeyspace();
Cluster cluster = session.getCluster();
KeyspaceMetadata keyspaceMetadata = cluster.getMetadata().getKeyspace(keyspace);
if (keyspaceMetadata == null) {
throw new IllegalStateException(String.format("Cannot read keyspace metadata for give keyspace: %s and cluster: %s", keyspace, cluster.getClusterName()));
}
return keyspaceMetadata;
}
use of com.datastax.driver.core.Cluster in project spring-boot by spring-projects.
the class CassandraAutoConfigurationTests method customizerOverridesAutoConfig.
@Test
public void customizerOverridesAutoConfig() {
load(SimpleCustomizerConfig.class, "spring.data.cassandra.cluster-name=testcluster");
assertThat(this.context.getBeanNamesForType(Cluster.class).length).isEqualTo(1);
Cluster cluster = this.context.getBean(Cluster.class);
assertThat(cluster.getClusterName()).isEqualTo("overridden-name");
}
use of com.datastax.driver.core.Cluster in project spring-boot by spring-projects.
the class CassandraTestServer method newCluster.
private Cluster newCluster() {
Cluster cluster = Cluster.builder().addContactPoint("localhost").build();
testCluster(cluster);
return cluster;
}
use of com.datastax.driver.core.Cluster in project presto by prestodb.
the class EmbeddedCassandra method start.
public static synchronized void start() throws Exception {
if (initialized) {
return;
}
log.info("Starting cassandra...");
System.setProperty("cassandra.config", "file:" + prepareCassandraYaml());
System.setProperty("cassandra-foreground", "true");
System.setProperty("cassandra.native.epoll.enabled", "false");
CassandraDaemon cassandraDaemon = new CassandraDaemon();
cassandraDaemon.activate();
Cluster cluster = Cluster.builder().withProtocolVersion(V3).withClusterName("TestCluster").addContactPointsWithPorts(ImmutableList.of(new InetSocketAddress(HOST, PORT))).build();
CassandraSession session = new NativeCassandraSession("EmbeddedCassandra", JsonCodec.listJsonCodec(ExtraColumnMetadata.class), cluster, new Duration(1, MINUTES));
try {
checkConnectivity(session);
} catch (RuntimeException e) {
cluster.close();
cassandraDaemon.deactivate();
throw e;
}
EmbeddedCassandra.session = session;
initialized = true;
}
use of com.datastax.driver.core.Cluster in project camel by apache.
the class CassandraComponentBeanRefTest method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry registry = super.createRegistry();
if (canTest()) {
Cluster cluster = Cluster.builder().addContactPoint("localhost").build();
registry.bind("cassandraCluster", cluster);
registry.bind("cassandraSession", cluster.connect("camel_ks"));
registry.bind("insertCql", CQL);
}
return registry;
}
Aggregations