Class AbstractInformixDefaultValueIT

java.lang.Object
io.debezium.embedded.AbstractConnectorTest
io.debezium.connector.informix.AbstractInformixDefaultValueIT
All Implemented Interfaces:
io.debezium.util.Testing
Direct Known Subclasses:
InformixOfflineDefaultValueIT

public abstract class AbstractInformixDefaultValueIT extends io.debezium.embedded.AbstractConnectorTest
Abstract default value integration test. This test is extended by two variants, online and offline schema evolution. All tests should be included in this class and therefore should pass both variants to make sure that the schema evolution process works regardless of mode used by the user.
Author:
Lars M Johansson, Chris Cranford
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static enum 
    Defines the different assertion types for a given column definition.
    private static class 
    Defines a column definition and its attributes that are used by tests.

    Nested classes/interfaces inherited from class io.debezium.embedded.AbstractConnectorTest

    io.debezium.embedded.AbstractConnectorTest.SourceRecords

    Nested classes/interfaces inherited from interface io.debezium.util.Testing

    io.debezium.util.Testing.Debug, io.debezium.util.Testing.Files, io.debezium.util.Testing.InterruptableFunction, io.debezium.util.Testing.Network, io.debezium.util.Testing.Print, io.debezium.util.Testing.Timer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    org.junit.rules.TestRule
     
    private io.debezium.config.Configuration
     
    private io.debezium.connector.informix.InformixConnection
     

    Fields inherited from class io.debezium.embedded.AbstractConnectorTest

    consumedLines, engine, isEngineRunning, logger, logTestName, OFFSET_STORE_PATH, pollTimeoutInMs, skipTestRule
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    private static void
    assertSchemaFieldDefaultAndNonNullValue(org.apache.kafka.connect.source.SourceRecord record, String fieldName, Object defaultValue)
     
    private static void
    assertSchemaFieldNoDefaultWithValue(org.apache.kafka.connect.source.SourceRecord record, String fieldName, Object fieldValue)
    Asserts that the schema field's default value is not set and that the emitted event value matches.
    private static void
    assertSchemaFieldValueWithDefault(org.apache.kafka.connect.source.SourceRecord record, String fieldName, Object expectedDefault, Consumer<Object> valueCheck)
     
    private static void
    assertSchemaFieldWithDefaultCurrentDateTime(org.apache.kafka.connect.source.SourceRecord record, String fieldName, Object expectedValue)
     
    private static void
    assertSchemaFieldWithSameDefaultAndValue(org.apache.kafka.connect.source.SourceRecord record, String fieldName, Object expectedValue)
    Asserts that the schema field's default value and after emitted event value are the same.
    void
     
    protected abstract void
    performSchemaChange(io.debezium.config.Configuration config, io.debezium.connector.informix.InformixConnection connection, String alterStatement)
     
    void
     
    void
     
    void
     
    private void
    Handles executing the full common set of default value tests for the supplied column definitions.
    void
     
    void
     
    private void
    Alters the underlying table changing adding a new column prefixed with A to each of the column definition with the initial default value definition.
    private void
    Alters the underlying table changing the default value to its second form.
    private void
    Restarts the connector and verifies when the database history topic is loaded that we can parse all the loaded history statements without failures.
    private void
    Creates the table and pre-inserts a record captured during the snapshot phase.

    Methods inherited from class io.debezium.embedded.AbstractConnectorTest

    assertBeginTransaction, assertConfigurationErrors, assertConfigurationErrors, assertConfigurationErrors, assertConnectorIsRunning, assertConnectorNotRunning, assertDelete, assertEndTransaction, assertEngineIsRunning, assertHasNoSourceQuery, assertInsert, assertKey, assertNoConfigurationErrors, assertNoRecordsToConsume, assertOffset, assertOffset, assertOnlyTransactionRecordsToConsume, assertRecordTransactionMetadata, assertSchemaMatchesStruct, assertSchemaMatchesStruct, assertSourceQuery, assertTombstone, assertTombstone, assertUpdate, assertValueField, configValue, consumeAvailableRecords, consumeAvailableRecordsByTopic, consumeDmlRecordsByTopic, consumeDmlRecordsByTopic, consumeDmlRecordsByTopic, consumeRecord, consumeRecords, consumeRecords, consumeRecords, consumeRecordsButSkipUntil, consumeRecordsByTopic, consumeRecordsByTopic, consumeRecordsByTopic, consumeRecordsByTopicUntil, consumeRecordsUntil, createEngine, createEngineBuilder, debug, getConsumer, getMaximumEnqueuedRecordCount, getSnapshotMetricsObjectName, getSnapshotMetricsObjectName, getSnapshotMetricsObjectName, getStreamingMetricsObjectName, getStreamingMetricsObjectName, getStreamingMetricsObjectName, getStreamingMetricsObjectName, getStreamingNamespace, initializeConnectorTestFramework, isStreamingRunning, isStreamingRunning, isStreamingRunning, isStreamingRunning, isTransactionRecord, loggingCompletion, print, readLastCommittedOffset, readLastCommittedOffsets, setConsumeTimeout, skipAvroValidation, start, start, start, start, start, start, start, startAndConsumeTillEnd, startAndConsumeTillEnd, stopConnector, stopConnector, storeOffsets, validate, waitForAvailableRecords, waitForConnectorShutdown, waitForEngineShutdown, waitForSnapshotToBeCompleted, waitForSnapshotToBeCompleted, waitForSnapshotWithCustomMetricsToBeCompleted, waitForStreamingRunning, waitForStreamingRunning, waitForStreamingRunning, waitForStreamingWithCustomMetricsToStart, waitTimeForEngine, waitTimeForRecords, waitTimeForRecordsAfterNulls

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.debezium.util.Testing

    once, once, resetBeforeEachTest, time, time
  • Field Details

    • conditionalFail

      public org.junit.rules.TestRule conditionalFail
    • connection

      private io.debezium.connector.informix.InformixConnection connection
    • config

      private io.debezium.config.Configuration config
  • Constructor Details

    • AbstractInformixDefaultValueIT

      public AbstractInformixDefaultValueIT()
  • Method Details

    • before

      public void before() throws SQLException
      Throws:
      SQLException
    • after

      public void after() throws SQLException
      Throws:
      SQLException
    • shouldHandleBooleanDefaultTypes

      @FixFor("DBZ-4990") public void shouldHandleBooleanDefaultTypes() throws Exception
      Throws:
      Exception
    • shouldHandleNumericDefaultTypes

      @FixFor("DBZ-4990") public void shouldHandleNumericDefaultTypes() throws Exception
      Throws:
      Exception
    • shouldHandleFloatPointDefaultTypes

      @FixFor("DBZ-4990") public void shouldHandleFloatPointDefaultTypes() throws Exception
      Throws:
      Exception
    • shouldHandleCharacterDefaultTypes

      @FixFor("DBZ-4990") public void shouldHandleCharacterDefaultTypes() throws Exception
      Throws:
      Exception
    • shouldHandleDateTimeDefaultTypes

      @FixFor("DBZ-4990") public void shouldHandleDateTimeDefaultTypes() throws Exception
      Throws:
      Exception
    • performSchemaChange

      protected abstract void performSchemaChange(io.debezium.config.Configuration config, io.debezium.connector.informix.InformixConnection connection, String alterStatement) throws Exception
      Throws:
      Exception
    • shouldHandleDefaultValuesCommon

      private void shouldHandleDefaultValuesCommon(List<AbstractInformixDefaultValueIT.ColumnDefinition> columnDefinitions) throws Exception
      Handles executing the full common set of default value tests for the supplied column definitions.
      Parameters:
      columnDefinitions - list of column definitions, should not be null
      Throws:
      Exception - if an exception occurred
    • testDefaultValuesByRestartAndLoadingHistoryTopic

      private void testDefaultValuesByRestartAndLoadingHistoryTopic() throws Exception
      Restarts the connector and verifies when the database history topic is loaded that we can parse all the loaded history statements without failures.
      Throws:
      Exception
    • testDefaultValuesCreateTableAndSnapshot

      private void testDefaultValuesCreateTableAndSnapshot(List<AbstractInformixDefaultValueIT.ColumnDefinition> columnDefinitions) throws Exception
      Creates the table and pre-inserts a record captured during the snapshot phase. The snapshot record will be validated against the supplied column definitions. The goal of this method is to test that when a table is snapshot which uses default values that both the in-memory schema representation and the snapshot pipeline change event have the right default value resolution.
      Parameters:
      columnDefinitions - list of column definitions, should not be null
      Throws:
      Exception - if an exception occurred
    • testDefaultValuesAlterTableModifyExisting

      private void testDefaultValuesAlterTableModifyExisting(List<AbstractInformixDefaultValueIT.ColumnDefinition> columnDefinitions) throws Exception
      Alters the underlying table changing the default value to its second form. This method then inserts a new record that is then validated against the supplied column definitions. The goal of this method is to test that when DDL modifies an existing column in an existing table that the right default value resolution occurs and that the in-memory schema representation is correct as well as the change event capture pipeline.
      Parameters:
      columnDefinitions - list of column definitions, should not be null
      Throws:
      Exception - if an exception occurred
    • testDefaultValuesAlterTableAdd

      private void testDefaultValuesAlterTableAdd(List<AbstractInformixDefaultValueIT.ColumnDefinition> columnDefinitions) throws Exception
      Alters the underlying table changing adding a new column prefixed with A to each of the column definition with the initial default value definition. The goal of this method is to test that when DDL adds a new column to an existing table that the right default value resolution occurs and that the in-memory schema representation is correct as well as the change event capture pipeline.
      Parameters:
      columnDefinitions - list of column definitions, should not be null
      Throws:
      Exception - if an exception occurred
    • assertSchemaFieldWithSameDefaultAndValue

      private static void assertSchemaFieldWithSameDefaultAndValue(org.apache.kafka.connect.source.SourceRecord record, String fieldName, Object expectedValue)
      Asserts that the schema field's default value and after emitted event value are the same.
      Parameters:
      record - the change event record, never null
      fieldName - the field name, never null
      expectedValue - the expected value in the field's default and "after" struct
    • assertSchemaFieldNoDefaultWithValue

      private static void assertSchemaFieldNoDefaultWithValue(org.apache.kafka.connect.source.SourceRecord record, String fieldName, Object fieldValue)
      Asserts that the schema field's default value is not set and that the emitted event value matches.
      Parameters:
      record - the change event record, never null
      fieldName - the field name, never null
      fieldValue - the expected value in the field's "after" struct
    • assertSchemaFieldValueWithDefault

      private static void assertSchemaFieldValueWithDefault(org.apache.kafka.connect.source.SourceRecord record, String fieldName, Object expectedDefault, Consumer<Object> valueCheck)
    • assertSchemaFieldWithDefaultCurrentDateTime

      private static void assertSchemaFieldWithDefaultCurrentDateTime(org.apache.kafka.connect.source.SourceRecord record, String fieldName, Object expectedValue)
    • assertSchemaFieldDefaultAndNonNullValue

      private static void assertSchemaFieldDefaultAndNonNullValue(org.apache.kafka.connect.source.SourceRecord record, String fieldName, Object defaultValue)