Search in sources :

Example 26 with Configuration

use of io.debezium.config.Configuration in project debezium by debezium.

the class MySqlConnectorIT method shouldFailToValidateConflictingLockingModeExtendedConfiguration.

/**
 * Validates that if you use the deprecated snapshot.minimal.locking configuration value
 * AND set its replacement snapshot.locking.mode an error will be generated.
 */
@Test
@FixFor("DBZ-602")
public void shouldFailToValidateConflictingLockingModeExtendedConfiguration() {
    Configuration config = DATABASE.defaultJdbcConfigBuilder().with(MySqlConnectorConfig.SSL_MODE, SecureConnectionMode.DISABLED).with(MySqlConnectorConfig.SERVER_ID, 18765).with(MySqlConnectorConfig.SERVER_NAME, "myServer").with(KafkaDatabaseHistory.BOOTSTRAP_SERVERS, "some.host.com").with(KafkaDatabaseHistory.TOPIC, "my.db.history.topic").with(MySqlConnectorConfig.INCLUDE_SCHEMA_CHANGES, true).with(MySqlConnectorConfig.SNAPSHOT_MINIMAL_LOCKING, true).with(MySqlConnectorConfig.SNAPSHOT_LOCKING_MODE, "extended").build();
    MySqlConnector connector = new MySqlConnector();
    Config result = connector.validate(config.asMap());
    assertConfigurationErrors(result, MySqlConnectorConfig.SNAPSHOT_LOCKING_MODE);
}
Also used : Configuration(io.debezium.config.Configuration) Config(org.apache.kafka.common.config.Config) CommonConnectorConfig(io.debezium.config.CommonConnectorConfig) Test(org.junit.Test) AbstractConnectorTest(io.debezium.embedded.AbstractConnectorTest) FixFor(io.debezium.doc.FixFor)

Example 27 with Configuration

use of io.debezium.config.Configuration in project debezium by debezium.

the class MySqlConnectorIT method shouldFailToValidateConflictingLockingModeNoneConfiguration.

/**
 * Validates that if you use the deprecated snapshot.minimal.locking configuration value
 * AND set its replacement snapshot.locking.mode an error will be generated.
 */
@Test
@FixFor("DBZ-602")
public void shouldFailToValidateConflictingLockingModeNoneConfiguration() {
    Configuration config = DATABASE.defaultJdbcConfigBuilder().with(MySqlConnectorConfig.SSL_MODE, SecureConnectionMode.DISABLED).with(MySqlConnectorConfig.SERVER_ID, 18765).with(MySqlConnectorConfig.SERVER_NAME, "myServer").with(KafkaDatabaseHistory.BOOTSTRAP_SERVERS, "some.host.com").with(KafkaDatabaseHistory.TOPIC, "my.db.history.topic").with(MySqlConnectorConfig.INCLUDE_SCHEMA_CHANGES, true).with(MySqlConnectorConfig.SNAPSHOT_MINIMAL_LOCKING, true).with(MySqlConnectorConfig.SNAPSHOT_LOCKING_MODE, "none").build();
    MySqlConnector connector = new MySqlConnector();
    Config result = connector.validate(config.asMap());
    assertConfigurationErrors(result, MySqlConnectorConfig.SNAPSHOT_LOCKING_MODE);
}
Also used : Configuration(io.debezium.config.Configuration) Config(org.apache.kafka.common.config.Config) CommonConnectorConfig(io.debezium.config.CommonConnectorConfig) Test(org.junit.Test) AbstractConnectorTest(io.debezium.embedded.AbstractConnectorTest) FixFor(io.debezium.doc.FixFor)

Example 28 with Configuration

use of io.debezium.config.Configuration in project debezium by debezium.

the class MySqlConnectorIT method shouldValidateAcceptableConfiguration.

@Test
public void shouldValidateAcceptableConfiguration() {
    Configuration config = DATABASE.defaultJdbcConfigBuilder().with(MySqlConnectorConfig.SSL_MODE, SecureConnectionMode.DISABLED).with(MySqlConnectorConfig.SERVER_ID, 18765).with(MySqlConnectorConfig.SERVER_NAME, "myServer").with(KafkaDatabaseHistory.BOOTSTRAP_SERVERS, "some.host.com").with(KafkaDatabaseHistory.TOPIC, "my.db.history.topic").with(MySqlConnectorConfig.INCLUDE_SCHEMA_CHANGES, true).build();
    MySqlConnector connector = new MySqlConnector();
    Config result = connector.validate(config.asMap());
    assertNoConfigurationErrors(result, MySqlConnectorConfig.HOSTNAME);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.PORT);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.USER);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.PASSWORD);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.SERVER_NAME);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.SERVER_ID);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.TABLES_IGNORE_BUILTIN);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.DATABASE_WHITELIST);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.DATABASE_BLACKLIST);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.TABLE_WHITELIST);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.TABLE_BLACKLIST);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.COLUMN_BLACKLIST);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.CONNECTION_TIMEOUT_MS);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.KEEP_ALIVE);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.KEEP_ALIVE_INTERVAL_MS);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.MAX_QUEUE_SIZE);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.MAX_BATCH_SIZE);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.POLL_INTERVAL_MS);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.DATABASE_HISTORY);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.INCLUDE_SCHEMA_CHANGES);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.SNAPSHOT_MODE);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.SNAPSHOT_LOCKING_MODE);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.SSL_MODE);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.SSL_KEYSTORE);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.SSL_KEYSTORE_PASSWORD);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.SSL_TRUSTSTORE);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.SSL_TRUSTSTORE_PASSWORD);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.DECIMAL_HANDLING_MODE);
    assertNoConfigurationErrors(result, MySqlConnectorConfig.TIME_PRECISION_MODE);
    assertNoConfigurationErrors(result, KafkaDatabaseHistory.BOOTSTRAP_SERVERS);
    assertNoConfigurationErrors(result, KafkaDatabaseHistory.TOPIC);
    assertNoConfigurationErrors(result, KafkaDatabaseHistory.RECOVERY_POLL_ATTEMPTS);
    assertNoConfigurationErrors(result, KafkaDatabaseHistory.RECOVERY_POLL_INTERVAL_MS);
}
Also used : Configuration(io.debezium.config.Configuration) Config(org.apache.kafka.common.config.Config) CommonConnectorConfig(io.debezium.config.CommonConnectorConfig) Test(org.junit.Test) AbstractConnectorTest(io.debezium.embedded.AbstractConnectorTest)

Example 29 with Configuration

use of io.debezium.config.Configuration in project debezium by debezium.

the class MySqlConnectorIT method shouldFailToValidateConflictingLockingModeConfiguration.

/**
 * Validates that if you use the deprecated snapshot.minimal.locking configuration value
 * AND set its replacement snapshot.locking.mode an error will be generated.
 */
@Test
@FixFor("DBZ-602")
public void shouldFailToValidateConflictingLockingModeConfiguration() {
    Configuration config = DATABASE.defaultJdbcConfigBuilder().with(MySqlConnectorConfig.SSL_MODE, SecureConnectionMode.DISABLED).with(MySqlConnectorConfig.SERVER_ID, 18765).with(MySqlConnectorConfig.SERVER_NAME, "myServer").with(KafkaDatabaseHistory.BOOTSTRAP_SERVERS, "some.host.com").with(KafkaDatabaseHistory.TOPIC, "my.db.history.topic").with(MySqlConnectorConfig.INCLUDE_SCHEMA_CHANGES, true).with(MySqlConnectorConfig.SNAPSHOT_MINIMAL_LOCKING, false).with(MySqlConnectorConfig.SNAPSHOT_LOCKING_MODE, "none").build();
    MySqlConnector connector = new MySqlConnector();
    Config result = connector.validate(config.asMap());
    assertConfigurationErrors(result, MySqlConnectorConfig.SNAPSHOT_LOCKING_MODE);
}
Also used : Configuration(io.debezium.config.Configuration) Config(org.apache.kafka.common.config.Config) CommonConnectorConfig(io.debezium.config.CommonConnectorConfig) Test(org.junit.Test) AbstractConnectorTest(io.debezium.embedded.AbstractConnectorTest) FixFor(io.debezium.doc.FixFor)

Example 30 with Configuration

use of io.debezium.config.Configuration in project debezium by debezium.

the class MySqlConnectorIT method shouldValidateLockingModeNoneWithValidSnapshotModeConfiguration.

/**
 * Validates that SNAPSHOT_LOCKING_MODE 'none' is valid with all snapshot modes
 */
@Test
@FixFor("DBZ-639")
public void shouldValidateLockingModeNoneWithValidSnapshotModeConfiguration() {
    final List<String> acceptableValues = Arrays.stream(SnapshotMode.values()).map(SnapshotMode::getValue).collect(Collectors.toList());
    // Loop over all known valid values
    for (final String acceptableValue : acceptableValues) {
        Configuration config = DATABASE.defaultJdbcConfigBuilder().with(MySqlConnectorConfig.SSL_MODE, SecureConnectionMode.DISABLED).with(MySqlConnectorConfig.SERVER_ID, 18765).with(MySqlConnectorConfig.SERVER_NAME, "myServer").with(KafkaDatabaseHistory.BOOTSTRAP_SERVERS, "some.host.com").with(KafkaDatabaseHistory.TOPIC, "my.db.history.topic").with(MySqlConnectorConfig.INCLUDE_SCHEMA_CHANGES, true).with(MySqlConnectorConfig.SNAPSHOT_LOCKING_MODE, SnapshotLockingMode.NONE.getValue()).with(MySqlConnectorConfig.SNAPSHOT_MODE, acceptableValue).build();
        MySqlConnector connector = new MySqlConnector();
        Config result = connector.validate(config.asMap());
        assertNoConfigurationErrors(result, MySqlConnectorConfig.SNAPSHOT_LOCKING_MODE);
        assertThat(new MySqlConnectorConfig(config).getSnapshotLockingMode()).isEqualTo(SnapshotLockingMode.NONE);
    }
}
Also used : Configuration(io.debezium.config.Configuration) Config(org.apache.kafka.common.config.Config) CommonConnectorConfig(io.debezium.config.CommonConnectorConfig) Test(org.junit.Test) AbstractConnectorTest(io.debezium.embedded.AbstractConnectorTest) FixFor(io.debezium.doc.FixFor)

Aggregations

Configuration (io.debezium.config.Configuration)38 Test (org.junit.Test)21 AbstractConnectorTest (io.debezium.embedded.AbstractConnectorTest)16 Config (org.apache.kafka.common.config.Config)15 CommonConnectorConfig (io.debezium.config.CommonConnectorConfig)10 FixFor (io.debezium.doc.FixFor)6 ConnectException (org.apache.kafka.connect.errors.ConnectException)6 ConfigValue (org.apache.kafka.common.config.ConfigValue)5 HashMap (java.util.HashMap)4 JsonConverter (org.apache.kafka.connect.json.JsonConverter)4 SQLException (java.sql.SQLException)3 Map (java.util.Map)3 Field (io.debezium.config.Field)2 SchemaUtil (io.debezium.data.SchemaUtil)2 VerifyRecord (io.debezium.data.VerifyRecord)2 CompletionCallback (io.debezium.embedded.EmbeddedEngine.CompletionCallback)2 EmbeddedConfig (io.debezium.embedded.EmbeddedEngine.EmbeddedConfig)2 JdbcConnection (io.debezium.jdbc.JdbcConnection)2 KafkaProducer (org.apache.kafka.clients.producer.KafkaProducer)2 ProducerRecord (org.apache.kafka.clients.producer.ProducerRecord)2