use of com.datastax.driver.core.utils.CassandraVersion in project java-driver by datastax.
the class IndexMetadataTest method should_create_metadata_for_index_on_map_values.
@Test(groups = "short")
@CassandraVersion("2.1.0")
public void should_create_metadata_for_index_on_map_values() {
// 3.0 assumes the 'values' keyword if index on a collection
String createValuesIndex = ccm().getCassandraVersion().getMajor() > 2 ? String.format("CREATE INDEX map_values_index ON %s.indexing (values(map_values));", keyspace) : String.format("CREATE INDEX map_values_index ON %s.indexing (map_values);", keyspace);
session().execute(createValuesIndex);
ColumnMetadata column = getColumn("map_values");
IndexMetadata index = getIndex("map_values_index");
assertThat(index).hasName("map_values_index").hasParent((TableMetadata) column.getParent()).isNotCustomIndex().hasTarget(ccm().getCassandraVersion().getMajor() > 2 ? "values(map_values)" : "map_values").hasKind(COMPOSITES).asCqlQuery(createValuesIndex);
assertThat((TableMetadata) column.getParent()).hasIndex(index);
}
use of com.datastax.driver.core.utils.CassandraVersion in project java-driver by datastax.
the class IndexMetadataTest method should_create_metadata_for_full_index_on_list.
@Test(groups = "short")
@CassandraVersion("2.1.3")
public void should_create_metadata_for_full_index_on_list() {
String createFullIndex = String.format("CREATE INDEX list_full_index ON %s.indexing (full(list_full));", keyspace);
session().execute(createFullIndex);
ColumnMetadata column = getColumn("list_full");
IndexMetadata index = getIndex("list_full_index");
assertThat(index).hasName("list_full_index").hasParent((TableMetadata) column.getParent()).isNotCustomIndex().hasTarget("full(list_full)").hasKind(COMPOSITES).asCqlQuery(createFullIndex);
assertThat((TableMetadata) column.getParent()).hasIndex(index);
}
use of com.datastax.driver.core.utils.CassandraVersion in project java-driver by datastax.
the class IndexMetadataTest method should_create_metadata_for_full_index_on_set.
@Test(groups = "short")
@CassandraVersion("2.1.3")
public void should_create_metadata_for_full_index_on_set() {
String createFullIndex = String.format("CREATE INDEX set_full_index ON %s.indexing (full(set_full));", keyspace);
session().execute(createFullIndex);
ColumnMetadata column = getColumn("set_full");
IndexMetadata index = getIndex("set_full_index");
assertThat(index).hasName("set_full_index").hasParent((TableMetadata) column.getParent()).isNotCustomIndex().hasTarget("full(set_full)").hasKind(COMPOSITES).asCqlQuery(createFullIndex);
assertThat((TableMetadata) column.getParent()).hasIndex(index);
}
use of com.datastax.driver.core.utils.CassandraVersion in project java-driver by datastax.
the class QueryLoggerTest method should_log_wrapped_bound_statement.
@CassandraVersion("2.0.0")
@Test(groups = "short")
public void should_log_wrapped_bound_statement() throws Exception {
// given
normal.setLevel(TRACE);
queryLogger = QueryLogger.builder().withConstantThreshold(Long.MAX_VALUE).withMaxQueryStringLength(Integer.MAX_VALUE).build();
cluster().register(queryLogger);
// when
String query = "UPDATE test SET c_text = :param1 WHERE pk = :param2";
PreparedStatement ps = session().prepare(query);
BoundStatement bs = ps.bind();
bs.setString("param1", "foo");
bs.setInt("param2", 42);
session().execute(new CustomStatement(bs));
// then
String line = normalAppender.waitAndGet(10000);
assertThat(line).contains("Query completed normally").contains(ipOfNode(1)).contains(query).contains("param2:42").contains("param1:'foo'");
}
use of com.datastax.driver.core.utils.CassandraVersion in project java-driver by datastax.
the class ProtocolVersionRenegotiationTest method should_fail_when_version_provided_and_too_low_3_8_plus.
/**
* @jira_ticket JAVA-1367
*/
@Test(groups = "short")
@CassandraVersion("3.8")
public void should_fail_when_version_provided_and_too_low_3_8_plus() throws Exception {
UnsupportedProtocolVersionException e = connectWithUnsupportedVersion(V1);
assertThat(e.getUnsupportedVersion()).isEqualTo(V1);
// post-CASSANDRA-11464: server replies with client's version
assertThat(e.getServerVersion()).isEqualTo(V1);
}
Aggregations