use of com.datastax.oss.driver.api.testinfra.CassandraRequirement in project java-driver by datastax.
the class PerRequestKeyspaceIT method should_reject_batch_statement_with_explicit_keyspace_in_protocol_v4.
@Test
@CassandraRequirement(min = "2.2")
public void should_reject_batch_statement_with_explicit_keyspace_in_protocol_v4() {
SimpleStatement statementWithoutKeyspace = SimpleStatement.newInstance("INSERT INTO foo (k, cc, v) VALUES (?, ?, ?)", nameRule.getMethodName(), 1, 1);
should_reject_statement_with_keyspace_in_protocol_v4(BatchStatement.builder(DefaultBatchType.LOGGED).setKeyspace(sessionRule.keyspace()).addStatement(statementWithoutKeyspace).build());
}
use of com.datastax.oss.driver.api.testinfra.CassandraRequirement in project java-driver by datastax.
the class PerRequestKeyspaceIT method should_reject_batch_statement_with_inferred_keyspace_in_protocol_v4.
@Test
@CassandraRequirement(min = "2.2")
public void should_reject_batch_statement_with_inferred_keyspace_in_protocol_v4() {
SimpleStatement statementWithKeyspace = SimpleStatement.newInstance("INSERT INTO foo (k, cc, v) VALUES (?, ?, ?)", nameRule.getMethodName(), 1, 1).setKeyspace(sessionRule.keyspace());
should_reject_statement_with_keyspace_in_protocol_v4(BatchStatement.builder(DefaultBatchType.LOGGED).addStatement(statementWithKeyspace).build());
}
use of com.datastax.oss.driver.api.testinfra.CassandraRequirement in project java-driver by datastax.
the class PerRequestKeyspaceIT method should_execute_batch_with_inferred_keyspace.
@Test
@CassandraRequirement(min = "4.0")
public void should_execute_batch_with_inferred_keyspace() {
CqlSession session = sessionRule.session();
session.execute(BatchStatement.builder(DefaultBatchType.LOGGED).setKeyspace(sessionRule.keyspace()).addStatements(SimpleStatement.newInstance("INSERT INTO foo (k, cc, v) VALUES (?, ?, ?)", nameRule.getMethodName(), 1, 1).setKeyspace(sessionRule.keyspace()), SimpleStatement.newInstance("INSERT INTO foo (k, cc, v) VALUES (?, ?, ?)", nameRule.getMethodName(), 2, 2).setKeyspace(sessionRule.keyspace())).build());
Row row = session.execute(SimpleStatement.newInstance("SELECT v FROM foo WHERE k = ? AND cc = 1", nameRule.getMethodName()).setKeyspace(sessionRule.keyspace())).one();
assertThat(row.getInt(0)).isEqualTo(1);
}
use of com.datastax.oss.driver.api.testinfra.CassandraRequirement in project java-driver by datastax.
the class ProtocolVersionInitialNegotiationIT method should_downgrade_to_v5_oss.
@CassandraRequirement(min = "4.0-rc1", description = "Only C* in [4.0-rc1,*[ has V5 as its highest version")
@Test
public void should_downgrade_to_v5_oss() {
Assume.assumeFalse("This test is only for OSS C*", ccm.getDseVersion().isPresent());
try (CqlSession session = SessionUtils.newSession(ccm)) {
assertThat(session.getContext().getProtocolVersion().getCode()).isEqualTo(5);
session.execute("select * from system.local");
}
}
use of com.datastax.oss.driver.api.testinfra.CassandraRequirement in project java-driver by datastax.
the class ProtocolVersionInitialNegotiationIT method should_not_downgrade_if_server_supports_latest_version_oss.
/**
* Note that this test will need to be updated as new protocol versions are introduced.
*/
@CassandraRequirement(min = "4.0", description = "Only C* in [4.0,*[ has V5 supported")
@Test
public void should_not_downgrade_if_server_supports_latest_version_oss() {
Assume.assumeFalse("This test is only for OSS C*", ccm.getDseVersion().isPresent());
try (CqlSession session = SessionUtils.newSession(ccm)) {
assertThat(session.getContext().getProtocolVersion()).isEqualTo(ProtocolVersion.V5);
session.execute("select * from system.local");
}
}
Aggregations