Search in sources :

Example 16 with Configuration

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

the class PostgresConnectorIT method shouldNotProduceEventsWithInitialOnlySnapshot.

@Test
public void shouldNotProduceEventsWithInitialOnlySnapshot() throws InterruptedException {
    TestHelper.execute(SETUP_TABLES_STMT);
    Configuration config = TestHelper.defaultConfig().with(PostgresConnectorConfig.SNAPSHOT_MODE, INITIAL_ONLY.getValue()).with(PostgresConnectorConfig.DROP_SLOT_ON_STOP, Boolean.TRUE).build();
    start(PostgresConnector.class, config);
    assertConnectorIsRunning();
    // check the records from the snapshot
    assertRecordsFromSnapshot(2, 1, 1);
    // insert and verify that no events were received since the connector should not be streaming changes
    TestHelper.execute(INSERT_STMT);
    waitForAvailableRecords(100, TimeUnit.MILLISECONDS);
    // there shouldn't be any  records
    assertNoRecordsToConsume();
}
Also used : Configuration(io.debezium.config.Configuration) Test(org.junit.Test) AbstractConnectorTest(io.debezium.embedded.AbstractConnectorTest)

Example 17 with Configuration

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

the class PostgresConnectorIT method shouldNotStartWithInvalidConfiguration.

@Test
public void shouldNotStartWithInvalidConfiguration() throws Exception {
    // use an empty configuration which should be invalid because of the lack of DB connection details
    Configuration config = Configuration.create().build();
    // we expect the engine will log at least one error, so preface it ...
    logger.info("Attempting to start the connector with an INVALID configuration, so MULTIPLE error messages & one exceptions will appear in the log");
    start(PostgresConnector.class, config, (success, msg, error) -> {
        assertThat(success).isFalse();
        assertThat(error).isNotNull();
    });
    assertConnectorNotRunning();
}
Also used : Configuration(io.debezium.config.Configuration) Test(org.junit.Test) AbstractConnectorTest(io.debezium.embedded.AbstractConnectorTest)

Example 18 with Configuration

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

the class Configurator method createSchemas.

/**
 * For tests use only
 */
public MySqlSchema createSchemas() {
    Configuration config = configBuilder.build();
    String serverName = config.getString(MySqlConnectorConfig.SERVER_NAME);
    return new MySqlSchema(config, serverName, null, false, TopicSelector.defaultSelector(serverName, "__debezium-heartbeat"));
}
Also used : Configuration(io.debezium.config.Configuration)

Example 19 with Configuration

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

the class MySqlConnectorIT method shouldValidateLockingModeWithMinimalLocksEnabledConfiguration.

/**
 * Validates that if you use the deprecated snapshot.minimal.locking configuration value is set to true
 * and its replacement snapshot.locking.mode is not explicitly defined, configuration validates as acceptable.
 */
@Test
@FixFor("DBZ-602")
public void shouldValidateLockingModeWithMinimalLocksEnabledConfiguration() {
    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).build();
    MySqlConnector connector = new MySqlConnector();
    Config result = connector.validate(config.asMap());
    assertNoConfigurationErrors(result, MySqlConnectorConfig.SNAPSHOT_LOCKING_MODE);
    assertThat(new MySqlConnectorConfig(config).getSnapshotLockingMode()).isEqualTo(SnapshotLockingMode.MINIMAL);
}
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 20 with Configuration

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

the class MongoClientsIT method beforeAll.

@BeforeClass
public static void beforeAll() {
    Configuration config = TestHelper.getConfiguration();
    String host = config.getString(MongoDbConnectorConfig.HOSTS);
    addresses = MongoUtil.parseAddresses(host);
}
Also used : Configuration(io.debezium.config.Configuration) BeforeClass(org.junit.BeforeClass)

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