Search in sources :

Example 1 with DseRequirement

use of com.datastax.oss.driver.api.testinfra.DseRequirement in project java-driver by datastax.

the class ProtocolVersionInitialNegotiationIT method should_use_explicitly_provided_dse_v1.

@DseRequirement(min = "5.1", description = "Only DSE in [5.1,*[ has DSE_V1 supported")
@Test
public void should_use_explicitly_provided_dse_v1() {
    DriverConfigLoader loader = SessionUtils.configLoaderBuilder().withString(DefaultDriverOption.PROTOCOL_VERSION, "DSE_V1").build();
    try (CqlSession session = SessionUtils.newSession(ccm, loader)) {
        assertThat(session.getContext().getProtocolVersion()).isEqualTo(DseProtocolVersion.DSE_V1);
        session.execute("select * from system.local");
    }
}
Also used : DriverConfigLoader(com.datastax.oss.driver.api.core.config.DriverConfigLoader) CqlSession(com.datastax.oss.driver.api.core.CqlSession) DseRequirement(com.datastax.oss.driver.api.testinfra.DseRequirement) Test(org.junit.Test)

Example 2 with DseRequirement

use of com.datastax.oss.driver.api.testinfra.DseRequirement in project java-driver by datastax.

the class ProtocolVersionInitialNegotiationIT method should_use_explicitly_provided_dse_v2.

@DseRequirement(min = "6.0", description = "Only DSE in [6.0,*[ has DSE_V2 supported")
@Test
public void should_use_explicitly_provided_dse_v2() {
    DriverConfigLoader loader = SessionUtils.configLoaderBuilder().withString(DefaultDriverOption.PROTOCOL_VERSION, "DSE_V2").build();
    try (CqlSession session = SessionUtils.newSession(ccm, loader)) {
        assertThat(session.getContext().getProtocolVersion()).isEqualTo(DseProtocolVersion.DSE_V2);
        session.execute("select * from system.local");
    }
}
Also used : DriverConfigLoader(com.datastax.oss.driver.api.core.config.DriverConfigLoader) CqlSession(com.datastax.oss.driver.api.core.CqlSession) DseRequirement(com.datastax.oss.driver.api.testinfra.DseRequirement) Test(org.junit.Test)

Example 3 with DseRequirement

use of com.datastax.oss.driver.api.testinfra.DseRequirement in project java-driver by datastax.

the class ProtocolVersionInitialNegotiationIT method should_downgrade_to_v3_dse.

@DseRequirement(max = "5.0", description = "Only DSE in [*,5.0[ has V3 as its highest version")
@Test
public void should_downgrade_to_v3_dse() {
    try (CqlSession session = SessionUtils.newSession(ccm)) {
        assertThat(session.getContext().getProtocolVersion().getCode()).isEqualTo(3);
        session.execute("select * from system.local");
    }
}
Also used : CqlSession(com.datastax.oss.driver.api.core.CqlSession) DseRequirement(com.datastax.oss.driver.api.testinfra.DseRequirement) Test(org.junit.Test)

Example 4 with DseRequirement

use of com.datastax.oss.driver.api.testinfra.DseRequirement in project java-driver by datastax.

the class ProtocolVersionInitialNegotiationIT method should_not_downgrade_if_server_supports_latest_version_dse.

/**
 * Note that this test will need to be updated as new protocol versions are introduced.
 */
@DseRequirement(min = "6.0", description = "Only DSE in [6.0,*[ has DSE_V2 supported")
@Test
public void should_not_downgrade_if_server_supports_latest_version_dse() {
    try (CqlSession session = SessionUtils.newSession(ccm)) {
        assertThat(session.getContext().getProtocolVersion()).isEqualTo(ProtocolVersion.DSE_V2);
        session.execute("select * from system.local");
    }
}
Also used : CqlSession(com.datastax.oss.driver.api.core.CqlSession) DseRequirement(com.datastax.oss.driver.api.testinfra.DseRequirement) Test(org.junit.Test)

Example 5 with DseRequirement

use of com.datastax.oss.driver.api.testinfra.DseRequirement in project java-driver by datastax.

the class ProtocolVersionInitialNegotiationIT method should_downgrade_to_dse_v1.

@DseRequirement(min = "5.1", max = "6.0", description = "Only DSE in [5.1,6.0[ has DSE_V1 as its highest version")
@Test
public void should_downgrade_to_dse_v1() {
    try (CqlSession session = SessionUtils.newSession(ccm)) {
        assertThat(session.getContext().getProtocolVersion()).isEqualTo(DseProtocolVersion.DSE_V1);
        session.execute("select * from system.local");
    }
}
Also used : CqlSession(com.datastax.oss.driver.api.core.CqlSession) DseRequirement(com.datastax.oss.driver.api.testinfra.DseRequirement) Test(org.junit.Test)

Aggregations

DseRequirement (com.datastax.oss.driver.api.testinfra.DseRequirement)12 CqlSession (com.datastax.oss.driver.api.core.CqlSession)10 Test (org.junit.Test)10 DriverConfigLoader (com.datastax.oss.driver.api.core.config.DriverConfigLoader)5 Version (com.datastax.oss.driver.api.core.Version)2 CassandraRequirement (com.datastax.oss.driver.api.testinfra.CassandraRequirement)2 AssumptionViolatedException (org.junit.AssumptionViolatedException)2 DefaultProtocolVersion (com.datastax.oss.driver.api.core.DefaultProtocolVersion)1 ProtocolVersion (com.datastax.oss.driver.api.core.ProtocolVersion)1 Node (com.datastax.oss.driver.api.core.metadata.Node)1 Description (org.junit.runner.Description)1 Failure (org.junit.runner.notification.Failure)1 Statement (org.junit.runners.model.Statement)1