Class MySqlAntlrDdlParserTest

java.lang.Object
io.debezium.connector.mysql.MySqlAntlrDdlParserTest

public class MySqlAntlrDdlParserTest extends Object
Author:
Roman Kuchár <kucharrom@gmail.com>.
  • Field Details

  • Constructor Details

    • MySqlAntlrDdlParserTest

      public MySqlAntlrDdlParserTest()
  • Method Details

    • beforeEach

      public void beforeEach()
    • shouldProcessCreateUniqueBeforePrimaryKeyDefinitions

      @FixFor("DBZ-6003") public void shouldProcessCreateUniqueBeforePrimaryKeyDefinitions()
    • shouldProcessAlterAddDefinitions

      @FixFor("DBZ-5623") public void shouldProcessAlterAddDefinitions()
    • shouldProcessNoPrimaryKeyForTable

      @FixFor("DBZ-5424") public void shouldProcessNoPrimaryKeyForTable()
    • shouldProcessLargeColumn

      @FixFor("DBZ-4583") public void shouldProcessLargeColumn()
    • shouldProcessMultipleSignedUnsignedForTable

      @FixFor("DBZ-4497") public void shouldProcessMultipleSignedUnsignedForTable()
    • shouldProcessDefaultCharsetForTable

      @FixFor("DBZ-3023") public void shouldProcessDefaultCharsetForTable()
    • shouldProcessCommentForTable

      @FixFor("DBZ-4000") public void shouldProcessCommentForTable()
    • shouldAllowAggregateWindowedFunction

      @FixFor("DBZ-4193") public void shouldAllowAggregateWindowedFunction()
    • shouldAllowIndexExpressionForTable

      @FixFor({"DBZ-4166","DBZ-4320"}) public void shouldAllowIndexExpressionForTable()
    • shouldProcessQueryWithoutFromStatement

      @FixFor("DBZ-4229") public void shouldProcessQueryWithoutFromStatement()
    • shouldProcessQueryWithIndexHintPrimary

      public void shouldProcessQueryWithIndexHintPrimary()
    • shouldProcessExpressionWithDefault

      @FixFor("DBZ-3020") public void shouldProcessExpressionWithDefault()
    • shouldAllowCharacterVarying

      @FixFor("DBZ-2821") public void shouldAllowCharacterVarying()
    • shouldAllowNonAsciiIdentifiers

      @FixFor("DBZ-2670") public void shouldAllowNonAsciiIdentifiers()
    • shouldProcessDimensionalBlob

      @FixFor("DBZ-2641") public void shouldProcessDimensionalBlob()
    • shouldUseDatabaseCharacterSet

      @FixFor({"DBZ-2604","DBZ-4246","DBZ-4261"}) public void shouldUseDatabaseCharacterSet()
    • shouldUseCharacterSetFromCollation

      @FixFor("DBZ-2922") public void shouldUseCharacterSetFromCollation()
    • shouldParseCharacterDatatype

      @FixFor("DBZ-2130") public void shouldParseCharacterDatatype()
    • shouldParseOtherDbDatatypes

      @FixFor("DBZ-2365") public void shouldParseOtherDbDatatypes()
    • shouldUpdateSchemaForRemovedDefaultValue

      @FixFor("DBZ-2140") public void shouldUpdateSchemaForRemovedDefaultValue()
    • shouldUpdateSchemaForChangedDefaultValue

      @FixFor("DBZ-2061") public void shouldUpdateSchemaForChangedDefaultValue()
    • shouldNotUpdateExistingTable

      @FixFor("DBZ-1833") public void shouldNotUpdateExistingTable()
    • shouldHandleQuotes

      @FixFor("DBZ-1834") public void shouldHandleQuotes()
    • shouldUpdateAndRenameTable

      @FixFor("DBZ-1645") public void shouldUpdateAndRenameTable()
    • shouldDropPrimaryKeyColumn

      @FixFor("DBZ-1560") public void shouldDropPrimaryKeyColumn()
    • shouldSupportBinaryCharset

      @FixFor("DBZ-1397") public void shouldSupportBinaryCharset()
    • shouldSupportCreateIndexBothAlgoAndLock

      @FixFor("DBZ-1376") public void shouldSupportCreateIndexBothAlgoAndLock()
    • shouldProcessMariadbCreateIndex

      @FixFor("DBZ-4841") public void shouldProcessMariadbCreateIndex()
    • shouldSupportCreateTableWithEcrytion

      @FixFor("DBZ-4661") public void shouldSupportCreateTableWithEcrytion()
    • shouldSupportCreateTableWithCompressed

      @FixFor("DBZ-4675") public void shouldSupportCreateTableWithCompressed()
    • shouldSupportUtfMb3Charset

      @FixFor("DBZ-1349") public void shouldSupportUtfMb3Charset()
    • shouldParseInternalColumnId

      @FixFor("DBZ-1348") public void shouldParseInternalColumnId()
    • shouldNotGetExceptionOnParseAlterStatementsWithoutCreate

      public void shouldNotGetExceptionOnParseAlterStatementsWithoutCreate()
    • shouldSupportInstantAlgoOnAlterStatements

      @FixFor("DBZ-2067") public void shouldSupportInstantAlgoOnAlterStatements()
    • shouldParseFloatVariants

      @FixFor("DBZ-1220") public void shouldParseFloatVariants()
    • shouldParseDecimalVariants

      @FixFor("DBZ-3984") public void shouldParseDecimalVariants()
    • shouldProcessSerialDatatype

      @FixFor("DBZ-1185") public void shouldProcessSerialDatatype()
    • shouldProcessSerialDefaultValue

      @FixFor("DBZ-1185") public void shouldProcessSerialDefaultValue()
    • shouldParseGeneratedColumn

      @FixFor("DBZ-1123") public void shouldParseGeneratedColumn()
    • shouldParseAlterTableMultiTableOptions

      @FixFor("DBZ-1186") public void shouldParseAlterTableMultiTableOptions()
    • shouldParseCheckTableKeywords

      @FixFor({"DBZ-1150","DBZ-4174","DBZ-4640"}) public void shouldParseCheckTableKeywords()
    • shouldParseCheckTableSomeOtherKeyword

      @FixFor({"DBZ-1233","DBZ-4833"}) public void shouldParseCheckTableSomeOtherKeyword()
    • shouldParseTimeWithNowDefault

      @FixFor("DBZ-169") public void shouldParseTimeWithNowDefault()
    • shouldParseCreateStatements

      public void shouldParseCreateStatements()
    • shouldParseTestStatements

      public void shouldParseTestStatements()
    • shouldParseSomeLinesFromCreateStatements

      public void shouldParseSomeLinesFromCreateStatements()
    • shouldParseMySql56InitializationStatements

      public void shouldParseMySql56InitializationStatements()
    • shouldParseMySql57InitializationStatements

      public void shouldParseMySql57InitializationStatements()
    • shouldParseButSkipAlterTableWhenTableIsNotKnown

      @FixFor("DBZ-198") public void shouldParseButSkipAlterTableWhenTableIsNotKnown()
    • shouldParseTruncateStatementsAfterCreate

      public void shouldParseTruncateStatementsAfterCreate()
    • shouldParseCreateViewStatementStartSelect

      public void shouldParseCreateViewStatementStartSelect()
    • shouldParseDropView

      public void shouldParseDropView()
    • shouldParseAlterTableRename

      @FixFor("DBZ-1059") public void shouldParseAlterTableRename()
    • shouldParseCreateViewStatementColumnAlias

      public void shouldParseCreateViewStatementColumnAlias()
    • shouldParseCreateViewStatementColumnAliasInnerSelect

      public void shouldParseCreateViewStatementColumnAliasInnerSelect()
    • shouldParseAlterViewStatementColumnAliasInnerSelect

      public void shouldParseAlterViewStatementColumnAliasInnerSelect()
    • shouldUseFiltersForAlterTable

      public void shouldUseFiltersForAlterTable()
    • shouldParseFunctionNamedDatabase

      @FixFor("DBZ-903") public void shouldParseFunctionNamedDatabase()
    • shouldParseConstraintCheck

      @FixFor("DBZ-910") public void shouldParseConstraintCheck()
    • shouldParseCommentWithEngineName

      @FixFor("DBZ-1028") public void shouldParseCommentWithEngineName()
    • shouldRenameColumnWithoutDefinition

      @FixFor("DBZ-780") public void shouldRenameColumnWithoutDefinition()
    • parseAddPartition

      @FixFor("DBZ-959") public void parseAddPartition()
    • parseGeomCollection

      @FixFor("DBZ-688") public void parseGeomCollection()
    • parseAlterEnumColumnWithNewCharacterSet

      @FixFor("DBZ-1203") public void parseAlterEnumColumnWithNewCharacterSet()
    • parseAlterEnumColumnWithEmbeddedOrEscapedCharacters

      @FixFor("DBZ-1226") public void parseAlterEnumColumnWithEmbeddedOrEscapedCharacters()
    • shouldParseEnumOptions

      @FixFor("DBZ-1226") public void shouldParseEnumOptions()
    • shouldParseEscapedEnumOptions

      @FixFor({"DBZ-476","DBZ-1226"}) public void shouldParseEscapedEnumOptions()
    • shouldParseSetOptions

      @FixFor("DBZ-1226") public void shouldParseSetOptions()
    • shouldParseMultipleStatements

      public void shouldParseMultipleStatements()
    • shouldParseAlterStatementsAfterCreate

      public void shouldParseAlterStatementsAfterCreate()
    • shouldParseCreateTableStatementWithSingleGeneratedAndPrimaryKeyColumn

      public void shouldParseCreateTableStatementWithSingleGeneratedAndPrimaryKeyColumn()
    • shouldParseCreateTableStatementWithSingleGeneratedColumnAsPrimaryKey

      public void shouldParseCreateTableStatementWithSingleGeneratedColumnAsPrimaryKey()
    • shouldParseCreateTableStatementWithMultipleColumnsForPrimaryKey

      public void shouldParseCreateTableStatementWithMultipleColumnsForPrimaryKey()
    • shouldParseCreateTableStatementWithCollate

      @FixFor("DBZ-474") public void shouldParseCreateTableStatementWithCollate()
    • shouldParseThirdPartyStorageEngine

      @FixFor("DBZ-646, DBZ-1398") public void shouldParseThirdPartyStorageEngine()
    • shouldParseEngineNameWithApostrophes

      @FixFor("DBZ-990") public void shouldParseEngineNameWithApostrophes()
    • shouldParseNonBinaryStringWithBinaryCollationAsString

      @FixFor("DBZ-3969") public void shouldParseNonBinaryStringWithBinaryCollationAsString()
    • shouldParseCreateUserTable

      public void shouldParseCreateUserTable()
    • shouldParseCreateTableStatementWithSignedTypes

      public void shouldParseCreateTableStatementWithSignedTypes()
    • shouldParseCreateTableStatementWithCharacterSetForTable

      public void shouldParseCreateTableStatementWithCharacterSetForTable()
    • shouldParseCreateTableStatementWithCharacterSetForColumns

      public void shouldParseCreateTableStatementWithCharacterSetForColumns()
    • shouldParseAlterTableStatementThatAddsCharacterSetForColumns

      public void shouldParseAlterTableStatementThatAddsCharacterSetForColumns()
    • shouldParseCreateDatabaseAndTableThatUsesDefaultCharacterSets

      public void shouldParseCreateDatabaseAndTableThatUsesDefaultCharacterSets()
    • shouldParseCreateDatabaseAndUseDatabaseStatementsAndHaveCharacterEncodingVariablesUpdated

      public void shouldParseCreateDatabaseAndUseDatabaseStatementsAndHaveCharacterEncodingVariablesUpdated()
    • shouldParseSetCharacterSetStatement

      public void shouldParseSetCharacterSetStatement()
    • shouldParseSetNamesStatement

      public void shouldParseSetNamesStatement()
    • shouldParseAlterTableStatementAddColumns

      public void shouldParseAlterTableStatementAddColumns()
    • shouldParseAlterTableStatementAddConstraintUniqueKey

      @FixFor("DBZ-660") public void shouldParseAlterTableStatementAddConstraintUniqueKey()
    • shouldParseCreateTableWithEnumAndSetColumns

      public void shouldParseCreateTableWithEnumAndSetColumns()
    • shouldParseDefiner

      public void shouldParseDefiner()
    • shouldParseCreateAndAlterWithOnUpdate

      @FixFor({"DBZ-169","DBZ-4503"}) public void shouldParseCreateAndAlterWithOnUpdate()
    • shouldParseCreateAndRemoveTwiceOrDoesNotExist

      @FixFor("DBZ-4786") public void shouldParseCreateAndRemoveTwiceOrDoesNotExist()
    • shouldParseGrantStatement

      @FixFor("DBZ-1411") public void shouldParseGrantStatement()
    • shouldParseGrantStatementWithoutSpecifiedHostName

      @FixFor("DBZ-1300") public void shouldParseGrantStatementWithoutSpecifiedHostName()
    • shouldParseSetOfOneVariableStatementWithoutTerminator

      public void shouldParseSetOfOneVariableStatementWithoutTerminator()
    • shouldParseSetOfOneVariableStatementWithTerminator

      public void shouldParseSetOfOneVariableStatementWithTerminator()
    • shouldParseSetOfSameVariableWithDifferentScope

      public void shouldParseSetOfSameVariableWithDifferentScope()
    • shouldParseSetOfMultipleVariablesWithInferredScope

      public void shouldParseSetOfMultipleVariablesWithInferredScope()
    • shouldParseSetOfGlobalVariable

      public void shouldParseSetOfGlobalVariable()
    • shouldParseSetOfLocalVariable

      public void shouldParseSetOfLocalVariable()
    • shouldParseSetOfSessionVariable

      public void shouldParseSetOfSessionVariable()
    • shouldParseButNotSetUserVariableWithUnderscoreDelimiter

      public void shouldParseButNotSetUserVariableWithUnderscoreDelimiter()
    • shouldParseVariableWithUnderscoreDelimiter

      public void shouldParseVariableWithUnderscoreDelimiter()
    • shouldParseAndIgnoreDeleteStatements

      public void shouldParseAndIgnoreDeleteStatements()
    • shouldParseAndIgnoreInsertStatements

      public void shouldParseAndIgnoreInsertStatements()
    • shouldParseStatementsWithQuotedIdentifiers

      public void shouldParseStatementsWithQuotedIdentifiers()
    • shouldParseIntegrationTestSchema

      public void shouldParseIntegrationTestSchema()
    • shouldParseStatementForDbz106

      public void shouldParseStatementForDbz106()
    • shouldParseStatementForDbz123

      public void shouldParseStatementForDbz123()
    • shouldParseAndIgnoreCreateFunction

      @FixFor("DBZ-162") public void shouldParseAndIgnoreCreateFunction()
    • shouldParseScientificNotationNumber

      @FixFor("DBZ-667") public void shouldParseScientificNotationNumber()
    • shouldParseAlterTableWithNewlineFeeds

      @FixFor("DBZ-162") public void shouldParseAlterTableWithNewlineFeeds()
    • shouldParseButIgnoreCreateTriggerWithDefiner

      @FixFor("DBZ-176") public void shouldParseButIgnoreCreateTriggerWithDefiner()
    • shouldParseFulltextKeyInCreateTable

      @FixFor("DBZ-193") public void shouldParseFulltextKeyInCreateTable()
    • shouldParseProcedureWithCase

      @FixFor("DBZ-198") public void shouldParseProcedureWithCase()
    • shouldParseProcedureEmbeddedIfs

      @FixFor("DBZ-415") public void shouldParseProcedureEmbeddedIfs()
    • shouldParseProcedureIfWithParenthesisStart

      @FixFor("DBZ-415") public void shouldParseProcedureIfWithParenthesisStart()
    • shouldParseButIgnoreCreateFunctionWithDefiner

      @FixFor("DBZ-198") public void shouldParseButIgnoreCreateFunctionWithDefiner()
    • shouldParseButIgnoreCreateFunctionC

      @FixFor("DBZ-198") public void shouldParseButIgnoreCreateFunctionC()
    • shouldParseButIgnoreCreateFunctionD

      @FixFor("DBZ-198") public void shouldParseButIgnoreCreateFunctionD()
    • shouldParseButIgnoreCreateFunctionE

      @FixFor("DBZ-198") public void shouldParseButIgnoreCreateFunctionE()
    • shouldParseButIgnoreCreateFunctionF

      @FixFor("DBZ-198") public void shouldParseButIgnoreCreateFunctionF()
    • shouldParseButIgnoreCreateFunctionG

      @FixFor("DBZ-198") public void shouldParseButIgnoreCreateFunctionG()
    • shouldParseButIgnoreCreateFunctionH

      @FixFor("DBZ-198") public void shouldParseButIgnoreCreateFunctionH()
    • shouldParseAlterTableWithDropIndex

      @FixFor("DBZ-198") public void shouldParseAlterTableWithDropIndex()
    • shouldParseAlterTableWithIndex

      @FixFor("DBZ-1329") public void shouldParseAlterTableWithIndex()
    • shouldParseIndex

      @FixFor("DBZ-3067") public void shouldParseIndex()
    • shouldParseStringSameAsKeyword

      @FixFor("DBZ-437") public void shouldParseStringSameAsKeyword()
    • shouldParseStatementForDbz200

      @FixFor("DBZ-200") public void shouldParseStatementForDbz200()
    • shouldParseAlterTableThatChangesMultipleColumns

      @FixFor("DBZ-204") public void shouldParseAlterTableThatChangesMultipleColumns()
    • shouldParseTicketMonsterLiquibaseStatements

      public void shouldParseTicketMonsterLiquibaseStatements()
    • shouldParseCreateTableWithEnumDefault

      @FixFor("DBZ-160") public void shouldParseCreateTableWithEnumDefault()
    • shouldParseCreateTableWithBitDefault

      @FixFor("DBZ-160") public void shouldParseCreateTableWithBitDefault()
    • shouldParseTableMaintenanceStatements

      @FixFor("DBZ-253") public void shouldParseTableMaintenanceStatements()
    • shouldParseCreateTableUnionStatement

      public void shouldParseCreateTableUnionStatement()
    • shouldParseAlterTableUnionStatement

      @FixFor("DBZ-346") public void shouldParseAlterTableUnionStatement()
    • shouldParseCreateTableWithUnnamedPrimaryKeyConstraint

      @FixFor("DBZ-419") public void shouldParseCreateTableWithUnnamedPrimaryKeyConstraint()
    • shouldParseStatementForDbz142

      public void shouldParseStatementForDbz142()
    • shouldParseCreateTableStatementWithColumnNamedColumn

      @FixFor("DBZ-408") public void shouldParseCreateTableStatementWithColumnNamedColumn()
    • shouldParseCreateTableWithTextType

      @FixFor("DBZ-428") public void shouldParseCreateTableWithTextType()
    • shouldParseCreateTableWithDoublePrecisionKeyword

      @FixFor("DBZ-439") public void shouldParseCreateTableWithDoublePrecisionKeyword()
    • shouldParseAlterTableStatementWithColumnNamedColumnWithoutColumnWord

      @FixFor({"DBZ-408","DBZ-412"}) public void shouldParseAlterTableStatementWithColumnNamedColumnWithoutColumnWord()
    • shouldParseAlterTableStatementWithColumnNamedColumnWithColumnWord

      @FixFor({"DBZ-408","DBZ-412","DBZ-524"}) public void shouldParseAlterTableStatementWithColumnNamedColumnWithColumnWord()
    • shouldParseAlterTableAlterDefaultColumnValue

      @FixFor("DBZ-425") public void shouldParseAlterTableAlterDefaultColumnValue()
    • parseDdlForDecAndFixed

      public void parseDdlForDecAndFixed()
    • parseDdlForUnscaledDecAndFixed

      @FixFor({"DBZ-615","DBZ-727"}) public void parseDdlForUnscaledDecAndFixed()
    • parseTableWithPageChecksum

      public void parseTableWithPageChecksum()
    • parseTableWithNegativeDefault

      @FixFor("DBZ-429") public void parseTableWithNegativeDefault()
    • parseUserDdlStatements

      @FixFor("DBZ-475") public void parseUserDdlStatements()
    • parseCreateUserDdlStatement

      @FixFor("DBZ-5836") public void parseCreateUserDdlStatement()
    • parsePartitionReorganize

      @FixFor("DBZ-530") public void parsePartitionReorganize()
    • parsePartitionWithEngine

      @FixFor("DBZ-641") public void parsePartitionWithEngine()
    • parseAddMultiplePartitions

      @FixFor("DBZ-1113") public void parseAddMultiplePartitions()
    • shouldParseChangeColumnAndKeepName

      @FixFor("DBZ-767") public void shouldParseChangeColumnAndKeepName()
    • parseDefaultValue

      public void parseDefaultValue()
    • shouldTreatPrimaryKeyColumnsImplicitlyAsNonNull

      @FixFor("DBZ-860") public void shouldTreatPrimaryKeyColumnsImplicitlyAsNonNull()
    • shouldNotNullPositionBeforeOrAfterDefaultValue

      @FixFor("DBZ-2330") public void shouldNotNullPositionBeforeOrAfterDefaultValue()
    • shouldParseTimestampDefaultValue

      @FixFor("DBZ-2726") public void shouldParseTimestampDefaultValue()
    • shouldSupportMariaDbCurrentTimestamp

      @FixFor("DBZ-5201") public void shouldSupportMariaDbCurrentTimestamp()
    • toIsoString

      private String toIsoString(String timestamp)
    • assertParseEnumAndSetOptions

      private void assertParseEnumAndSetOptions(String typeExpression, String... expectedValues)
      Assert whether the provided typeExpression string after being parsed results in a list of ENUM or SET options that match exactly to the provided list of expecetedValues.

      In this particular implementation, we construct a CREATE statement and invoke the antlr parser on the statement defining a column named options that represents the supplied ENUM or SET expression.

      Parameters:
      typeExpression - The ENUM or SET expression to be parsed
      expectedValues - An array of options expected to have been parsed from the expression.
    • assertVariable

      private void assertVariable(String name, String expectedValue)
    • assertVariable

      private void assertVariable(SystemVariables.Scope scope, String name, String expectedValue)
    • assertGlobalVariable

      private void assertGlobalVariable(String name, String expectedValue)
    • assertSessionVariable

      private void assertSessionVariable(String name, String expectedValue)
    • assertLocalVariable

      private void assertLocalVariable(String name, String expectedValue)
    • printEvent

      private void printEvent(DdlParserListener.Event event)
    • readFile

      private String readFile(String classpathResource)
    • readLines

      private String readLines(int startingLineNumber, String classpathResource)
      Reads the lines starting with a given line number from the specified file on the classpath. Any lines preceding the given line number will be included as empty lines, meaning the line numbers will match the input file.
      Parameters:
      startingLineNumber - the 1-based number designating the first line to be included
      classpathResource - the path to the file on the classpath
      Returns:
      the string containing the subset of the file contents; never null but possibly empty
    • assertColumn

      private void assertColumn(Table table, String name, String typeName, int jdbcType, int length, String charsetName, boolean optional)
    • assertColumn

      private void assertColumn(Table table, String name, String typeName, int jdbcType, int length, int scale, boolean optional, boolean generated, boolean autoIncremented)
    • assertColumn

      private void assertColumn(Table table, String name, String typeName, int jdbcType, int length, int scale, boolean optional, boolean generated, boolean autoIncremented, boolean hasDefaultValue, Object defaultValue)
    • getColumnSchema

      private org.apache.kafka.connect.data.Schema getColumnSchema(Table table, String column)