use of com.datastax.oss.driver.api.core.config.DriverExecutionProfile in project spring-boot by spring-projects.
the class CassandraAutoConfigurationTests method driverConfigLoaderCustomizeConcurrencyLimitingRequestThrottler.
@Test
void driverConfigLoaderCustomizeConcurrencyLimitingRequestThrottler() {
this.contextRunner.withPropertyValues("spring.data.cassandra.request.throttler.type=concurrency-limiting", "spring.data.cassandra.request.throttler.max-concurrent-requests=62", "spring.data.cassandra.request.throttler.max-queue-size=72").run((context) -> {
DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig().getDefaultProfile();
assertThat(config.getString(DefaultDriverOption.REQUEST_THROTTLER_CLASS)).isEqualTo(ConcurrencyLimitingRequestThrottler.class.getSimpleName());
assertThat(config.getInt(DefaultDriverOption.REQUEST_THROTTLER_MAX_CONCURRENT_REQUESTS)).isEqualTo(62);
assertThat(config.getInt(DefaultDriverOption.REQUEST_THROTTLER_MAX_QUEUE_SIZE)).isEqualTo(72);
});
}
use of com.datastax.oss.driver.api.core.config.DriverExecutionProfile in project spring-boot by spring-projects.
the class CassandraAutoConfigurationTests method driverConfigLoaderWithContactPointAndNoPort.
@Test
void driverConfigLoaderWithContactPointAndNoPort() {
this.contextRunner.withPropertyValues("spring.data.cassandra.contact-points=cluster.example.com,another.example.com:9041", "spring.data.cassandra.local-datacenter=cassandra-eu1").run((context) -> {
assertThat(context).hasSingleBean(DriverConfigLoader.class);
DriverExecutionProfile configuration = context.getBean(DriverConfigLoader.class).getInitialConfig().getDefaultProfile();
assertThat(configuration.getStringList(DefaultDriverOption.CONTACT_POINTS)).containsOnly("cluster.example.com:9042", "another.example.com:9041");
assertThat(configuration.getString(DefaultDriverOption.LOAD_BALANCING_LOCAL_DATACENTER)).isEqualTo("cassandra-eu1");
});
}
use of com.datastax.oss.driver.api.core.config.DriverExecutionProfile in project spring-boot by spring-projects.
the class CassandraAutoConfigurationTests method driverConfigLoaderCustomizeConnectionOptions.
@Test
void driverConfigLoaderCustomizeConnectionOptions() {
this.contextRunner.withPropertyValues("spring.data.cassandra.connection.connect-timeout=200ms", "spring.data.cassandra.connection.init-query-timeout=10").run((context) -> {
DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig().getDefaultProfile();
assertThat(config.getInt(DefaultDriverOption.CONNECTION_CONNECT_TIMEOUT)).isEqualTo(200);
assertThat(config.getInt(DefaultDriverOption.CONNECTION_INIT_QUERY_TIMEOUT)).isEqualTo(10);
});
}
use of com.datastax.oss.driver.api.core.config.DriverExecutionProfile in project spring-boot by spring-projects.
the class CassandraAutoConfigurationTests method driverConfigLoaderWithContactPoints.
@Test
void driverConfigLoaderWithContactPoints() {
this.contextRunner.withPropertyValues("spring.data.cassandra.contact-points=cluster.example.com:9042", "spring.data.cassandra.local-datacenter=cassandra-eu1").run((context) -> {
assertThat(context).hasSingleBean(DriverConfigLoader.class);
DriverExecutionProfile configuration = context.getBean(DriverConfigLoader.class).getInitialConfig().getDefaultProfile();
assertThat(configuration.getStringList(DefaultDriverOption.CONTACT_POINTS)).containsOnly("cluster.example.com:9042");
assertThat(configuration.getString(DefaultDriverOption.LOAD_BALANCING_LOCAL_DATACENTER)).isEqualTo("cassandra-eu1");
});
}
use of com.datastax.oss.driver.api.core.config.DriverExecutionProfile in project spring-boot by spring-projects.
the class CassandraAutoConfigurationTests method driverConfigLoaderCustomizeRequestOptions.
@Test
void driverConfigLoaderCustomizeRequestOptions() {
this.contextRunner.withPropertyValues("spring.data.cassandra.request.timeout=5s", "spring.data.cassandra.request.consistency=two", "spring.data.cassandra.request.serial-consistency=quorum", "spring.data.cassandra.request.page-size=42").run((context) -> {
DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig().getDefaultProfile();
assertThat(config.getInt(DefaultDriverOption.REQUEST_TIMEOUT)).isEqualTo(5000);
assertThat(config.getString(DefaultDriverOption.REQUEST_CONSISTENCY)).isEqualTo("TWO");
assertThat(config.getString(DefaultDriverOption.REQUEST_SERIAL_CONSISTENCY)).isEqualTo("QUORUM");
assertThat(config.getInt(DefaultDriverOption.REQUEST_PAGE_SIZE)).isEqualTo(42);
});
}
Aggregations