use of com.datastax.oss.driver.api.testinfra.DseRequirement in project java-driver by datastax.
the class NodeMetadataIT method should_expose_dse_node_properties.
@Test
@DseRequirement(min = "5.1")
public void should_expose_dse_node_properties() {
try (CqlSession session = SessionUtils.newSession(ccmRule)) {
Node node = getUniqueNode(session);
// Basic checks as we want something that will work with a large range of DSE versions:
assertThat(node.getExtras()).containsKeys(DseNodeProperties.DSE_VERSION, DseNodeProperties.DSE_WORKLOADS, DseNodeProperties.SERVER_ID);
assertThat(node.getExtras().get(DseNodeProperties.DSE_VERSION)).isEqualTo(ccmRule.getDseVersion().get());
assertThat(node.getExtras().get(DseNodeProperties.SERVER_ID)).isInstanceOf(String.class);
assertThat(node.getExtras().get(DseNodeProperties.DSE_WORKLOADS)).isInstanceOf(Set.class);
}
}
use of com.datastax.oss.driver.api.testinfra.DseRequirement in project java-driver by datastax.
the class CcmPaxExam method run.
@Override
public void run(RunNotifier notifier) {
Description description = getDescription();
CassandraRequirement cassandraRequirement = description.getAnnotation(CassandraRequirement.class);
if (cassandraRequirement != null) {
if (!cassandraRequirement.min().isEmpty()) {
Version minVersion = Objects.requireNonNull(Version.parse(cassandraRequirement.min()));
if (minVersion.compareTo(CCM_BRIDGE.getCassandraVersion()) > 0) {
fireRequirementsNotMet(notifier, description, cassandraRequirement.min(), false, false);
return;
}
}
if (!cassandraRequirement.max().isEmpty()) {
Version maxVersion = Objects.requireNonNull(Version.parse(cassandraRequirement.max()));
if (maxVersion.compareTo(CCM_BRIDGE.getCassandraVersion()) <= 0) {
fireRequirementsNotMet(notifier, description, cassandraRequirement.max(), true, false);
return;
}
}
}
DseRequirement dseRequirement = description.getAnnotation(DseRequirement.class);
if (dseRequirement != null) {
Optional<Version> dseVersionOption = CCM_BRIDGE.getDseVersion();
if (!dseVersionOption.isPresent()) {
notifier.fireTestAssumptionFailed(new Failure(description, new AssumptionViolatedException("Test Requires DSE but C* is configured.")));
return;
} else {
Version dseVersion = dseVersionOption.get();
if (!dseRequirement.min().isEmpty()) {
Version minVersion = Objects.requireNonNull(Version.parse(dseRequirement.min()));
if (minVersion.compareTo(dseVersion) > 0) {
fireRequirementsNotMet(notifier, description, dseRequirement.min(), false, true);
return;
}
}
if (!dseRequirement.max().isEmpty()) {
Version maxVersion = Objects.requireNonNull(Version.parse(dseRequirement.max()));
if (maxVersion.compareTo(dseVersion) <= 0) {
fireRequirementsNotMet(notifier, description, dseRequirement.min(), true, true);
return;
}
}
}
}
super.run(notifier);
}
use of com.datastax.oss.driver.api.testinfra.DseRequirement in project java-driver by datastax.
the class ProtocolVersionInitialNegotiationIT method should_use_explicitly_provided_v5_dse.
@DseRequirement(min = "7.0", description = "Only DSE in [7.0,*[ has V5 supported")
@Test
public void should_use_explicitly_provided_v5_dse() {
DriverConfigLoader loader = SessionUtils.configLoaderBuilder().withString(DefaultDriverOption.PROTOCOL_VERSION, "V5").build();
try (CqlSession session = SessionUtils.newSession(ccm, loader)) {
assertThat(session.getContext().getProtocolVersion().getCode()).isEqualTo(5);
session.execute("select * from system.local");
}
}
use of com.datastax.oss.driver.api.testinfra.DseRequirement in project java-driver by datastax.
the class ProtocolVersionInitialNegotiationIT method should_use_explicitly_provided_v4_dse.
@DseRequirement(min = "5.0", description = "Only DSE in [5.0,*[ has V4 supported")
@Test
public void should_use_explicitly_provided_v4_dse() {
DriverConfigLoader loader = SessionUtils.configLoaderBuilder().withString(DefaultDriverOption.PROTOCOL_VERSION, "V4").build();
try (CqlSession session = SessionUtils.newSession(ccm, loader)) {
assertThat(session.getContext().getProtocolVersion().getCode()).isEqualTo(4);
session.execute("select * from system.local");
}
}
use of com.datastax.oss.driver.api.testinfra.DseRequirement in project java-driver by datastax.
the class ProtocolVersionInitialNegotiationIT method should_use_explicitly_provided_v3_dse.
@DseRequirement(min = "4.8", description = "Only DSE in [4.8,*[ has V3 supported")
@Test
public void should_use_explicitly_provided_v3_dse() {
DriverConfigLoader loader = SessionUtils.configLoaderBuilder().withString(DefaultDriverOption.PROTOCOL_VERSION, "V3").build();
try (CqlSession session = SessionUtils.newSession(ccm, loader)) {
assertThat(session.getContext().getProtocolVersion().getCode()).isEqualTo(3);
session.execute("select * from system.local");
}
}
Aggregations