Class OracleDefaultValueIT

java.lang.Object
io.debezium.embedded.AbstractConnectorTest
io.debezium.connector.oracle.OracleDefaultValueIT
All Implemented Interfaces:
Testing

public class OracleDefaultValueIT extends AbstractConnectorTest
Integration test that tests all supported data types and default value combinations during both snapshot and streaming phases in conjunction with schema changes to the table.
Author:
Chris Cranford
  • Field Details

  • Constructor Details

    • OracleDefaultValueIT

      public OracleDefaultValueIT()
  • Method Details

    • before

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

      public void after() throws Exception
      Throws:
      Exception
    • shouldHandleNumericDefaultTypes

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

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

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

      @FixFor("DBZ-3710") public void shouldHandleDateTimeDefaultTypes() throws Exception
      Throws:
      Exception
    • shouldHandleIntervalDefaultTypes

      @FixFor("DBZ-3710") public void shouldHandleIntervalDefaultTypes() throws Exception
      Throws:
      Exception
    • shouldHandleIntervalDefaultTypesAsString

      @FixFor("DBZ-1539") public void shouldHandleIntervalDefaultTypesAsString() throws Exception
      Throws:
      Exception
    • shouldHandleDefaultValueFromSequencesAsNoDefault

      @FixFor("DBZ-4208") public void shouldHandleDefaultValueFromSequencesAsNoDefault() throws Exception
      Throws:
      Exception
    • shouldHandleDefaultValuesWhereSqlMayContainsTrailingSpaces

      @FixFor("DBZ-4360") public void shouldHandleDefaultValuesWhereSqlMayContainsTrailingSpaces() throws Exception
      Throws:
      Exception
    • shouldHandleDefaultValueForNonOptionalColumnUsingUnparseableValues

      @FixFor("DBZ-4388") public void shouldHandleDefaultValueForNonOptionalColumnUsingUnparseableValues() throws Exception
      Throws:
      Exception
    • getOracleIntervalYearMonth

      private long getOracleIntervalYearMonth(int years, int month)
    • getOracleIntervalYearMonthString

      private String getOracleIntervalYearMonthString(int years, int month)
    • getOracleIntervalDaySecond

      private long getOracleIntervalDaySecond(int days, int hours, int minutes, int seconds, int micros)
    • getOracleIntervalDaySecondString

      private String getOracleIntervalDaySecondString(int days, int hours, int minutes, int seconds, int micros)
    • shouldHandleDefaultValuesCommon

      private void shouldHandleDefaultValuesCommon(List<OracleDefaultValueIT.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<OracleDefaultValueIT.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<OracleDefaultValueIT.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<OracleDefaultValueIT.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
    • assertSchemaFieldDefaultAndNonNullValue

      private static void assertSchemaFieldDefaultAndNonNullValue(org.apache.kafka.connect.source.SourceRecord record, String fieldName, Object defaultValue)
      Asserts that the schema field's default value is the supplied value and that the emitted events field value is at least a non-null value; expectation is that the emitted event value is dynamic, likely based on some database function call, like TO_DATE or TO_TIMESTAMP.
      Parameters:
      record - the change event record, never null
      fieldName - the field name, never null
      defaultValue - the expected schema field's default value
    • assertSchemaFieldWithDefaultSysdate

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

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