use of com.datastax.oss.cdc.CassandraSourceConnectorConfig in project cdc-apache-cassandra by datastax.
the class CassandraSourceConnectorConfigTest method should_throw_when_secure_connect_bundle_and_local_dc_provided.
@Test
void should_throw_when_secure_connect_bundle_and_local_dc_provided() {
Map<String, String> props = ImmutableMap.<String, String>builder().putAll(requiredSettings()).put(SECURE_CONNECT_BUNDLE_OPT, "/location/to/bundle").put(DC_OPT, "dc1").build();
assertThatThrownBy(() -> new CassandraSourceConnectorConfig(props)).isInstanceOf(ConfigException.class).hasMessageContaining(String.format("When %s parameter is specified you should not provide %s.", SECURE_CONNECT_BUNDLE_OPT, DC_OPT));
}
use of com.datastax.oss.cdc.CassandraSourceConnectorConfig in project cdc-apache-cassandra by datastax.
the class CassandraSourceConnectorConfigTest method should_handle_maxConcurrentRequests.
@Test
void should_handle_maxConcurrentRequests() {
Map<String, String> props = ImmutableMap.<String, String>builder().putAll(requiredSettings()).put(CONCURRENT_REQUESTS_OPT, "129").build();
CassandraSourceConnectorConfig d = new CassandraSourceConnectorConfig(props);
assertThat(d.getMaxConcurrentRequests()).isEqualTo(129);
}
use of com.datastax.oss.cdc.CassandraSourceConnectorConfig in project cdc-apache-cassandra by datastax.
the class CassandraSourceConnectorConfigTest method should_handle_contact_points_provided_using_connector_and_driver_prefix.
@ParameterizedTest
@MethodSource("contactPointsProvider")
void should_handle_contact_points_provided_using_connector_and_driver_prefix(String connectorContactPoints, String javaDriverPrefixContactPoints, List<String> expected, Map<String, String> expectedDriverSettings) {
// given
Map<String, String> connectorSettings = new HashMap<>(requiredSettings());
if (connectorContactPoints != null) {
connectorSettings.put(CONTACT_POINTS_OPT, connectorContactPoints);
}
if (javaDriverPrefixContactPoints != null) {
connectorSettings.put(CONTACT_POINTS_DRIVER_SETTINGS, javaDriverPrefixContactPoints);
}
connectorSettings.put(LOCAL_DC_DRIVER_SETTING, "localDc");
// when
CassandraSourceConnectorConfig CassandraSourceConnectorConfig = new CassandraSourceConnectorConfig(connectorSettings);
// then
assertThat(CassandraSourceConnectorConfig.getContactPoints()).isEqualTo(expected);
for (Map.Entry<String, String> entry : expectedDriverSettings.entrySet()) {
assertThat(CassandraSourceConnectorConfig.getJavaDriverSettings()).contains(entry);
}
}
use of com.datastax.oss.cdc.CassandraSourceConnectorConfig in project cdc-apache-cassandra by datastax.
the class CassandraSourceConnectorConfigTest method should_error_invalid_maxConcurrentRequests.
@Test
void should_error_invalid_maxConcurrentRequests() {
Map<String, String> props = Maps.newHashMap(ImmutableMap.<String, String>builder().putAll(requiredSettings()).put(CONCURRENT_REQUESTS_OPT, "foo").build());
assertThatThrownBy(() -> new CassandraSourceConnectorConfig(props)).isInstanceOf(ConfigException.class).hasMessageContaining("Invalid value foo for configuration maxConcurrentRequests");
props.put(CONCURRENT_REQUESTS_OPT, "0");
assertThatThrownBy(() -> new CassandraSourceConnectorConfig(props)).isInstanceOf(ConfigException.class).hasMessageContaining("Value must be at least 1");
props.put(CONCURRENT_REQUESTS_OPT, "-1");
assertThatThrownBy(() -> new CassandraSourceConnectorConfig(props)).isInstanceOf(ConfigException.class).hasMessageContaining("Value must be at least 1");
}
use of com.datastax.oss.cdc.CassandraSourceConnectorConfig in project cdc-apache-cassandra by datastax.
the class CassandraSourceConnectorConfigTest method should_error_invalid_queryExecutionTimeout.
@Test
void should_error_invalid_queryExecutionTimeout() {
Map<String, String> props = Maps.newHashMap(ImmutableMap.<String, String>builder().putAll(requiredSettings()).put(QUERY_EXECUTION_TIMEOUT_OPT, "foo").build());
assertThatThrownBy(() -> new CassandraSourceConnectorConfig(props)).isInstanceOf(ConfigException.class).hasMessageContaining("Invalid value foo for configuration queryExecutionTimeout");
props.put(QUERY_EXECUTION_TIMEOUT_OPT, "0");
assertThatThrownBy(() -> new CassandraSourceConnectorConfig(props)).isInstanceOf(ConfigException.class).hasMessageContaining("Value must be at least 1");
props.put(QUERY_EXECUTION_TIMEOUT_OPT, "-1");
assertThatThrownBy(() -> new CassandraSourceConnectorConfig(props)).isInstanceOf(ConfigException.class).hasMessageContaining("Value must be at least 1");
}
Aggregations