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 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;
}
use of com.datastax.driver.core.Cluster in project camel by apache.
the class CassandraComponentProducerTest method testRequestUriCql.
@Test
public void testRequestUriCql() throws Exception {
if (!canTest()) {
return;
}
Object response = producerTemplate.requestBody(Arrays.asList("w_jiang", "Willem", "Jiang"));
Cluster cluster = CassandraUnitUtils.cassandraCluster();
Session session = cluster.connect(CassandraUnitUtils.KEYSPACE);
ResultSet resultSet = session.execute("select login, first_name, last_name from camel_user where login = ?", "w_jiang");
Row row = resultSet.one();
assertNotNull(row);
assertEquals("Willem", row.getString("first_name"));
assertEquals("Jiang", row.getString("last_name"));
session.close();
cluster.close();
}
Aggregations