Package io.debezium.connector.db2.util
Class TestHelper
java.lang.Object
io.debezium.connector.db2.util.TestHelper
- Author:
- Horia Chiorean (hchiorea@redhat.com), Luis Garcés-Erice
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Pathprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static org.slf4j.Loggerprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringstatic final Stringstatic final StringKey for schema parameter used to store a source column's type length.static final StringKey for schema parameter used to store a source column's type name.static final StringKey for schema parameter used to store a source column's type scale.static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidactiveTable(io.debezium.connector.db2.Db2Connection connection, String tableName) static io.debezium.connector.db2.Db2Connectionstatic io.debezium.jdbc.JdbcConfigurationstatic voiddeactivateTable(io.debezium.connector.db2.Db2Connection connection, String tableName) static io.debezium.config.Configuration.BuilderReturns a default configuration suitable for most test cases.static io.debezium.jdbc.JdbcConfigurationstatic voiddisableDbCdc(io.debezium.connector.db2.Db2Connection connection) Disables CDC for a given database, if not already disabled.static voiddisableTableCdc(io.debezium.connector.db2.Db2Connection connection, String name) Disables CDC for a table for which it was enabled before.static voiddisableTableCdc(io.debezium.connector.db2.Db2Connection connection, String schemaName, String tableName) Disables CDC for a table for which it was enabled before.static voidenableDbCdc(io.debezium.connector.db2.Db2Connection connection) Enables CDC for a given database, if not already enabled.static voidenableTableCdc(io.debezium.connector.db2.Db2Connection connection, String name) Enables CDC for a table if not already enabled and generates the wrapper functions for that table.static voidenableTableCdc(io.debezium.connector.db2.Db2Connection connection, String schemaName, String tableName) Enables CDC for a table if not already enabled and generates the wrapper functions for that table.static StringgetCdcTableName(io.debezium.connector.db2.Db2Connection connection, String sourceTable) static voidrefreshAndWait(io.debezium.connector.db2.Db2Connection connection) static io.debezium.connector.db2.Db2Connectionstatic voidstatic void
-
Field Details
-
DB_HISTORY_PATH
-
TEST_DATABASE
- See Also:
-
WAIT_FOR_CDC
public static final int WAIT_FOR_CDC- See Also:
-
TYPE_NAME_PARAMETER_KEY
Key for schema parameter used to store a source column's type name.- See Also:
-
TYPE_LENGTH_PARAMETER_KEY
Key for schema parameter used to store a source column's type length.- See Also:
-
TYPE_SCALE_PARAMETER_KEY
Key for schema parameter used to store a source column's type scale.- See Also:
-
STATEMENTS_TABLE_PLACEHOLDER
- See Also:
-
STATEMENTS_SCHEMA_PLACEHOLDER
- See Also:
-
ENABLE_DB_CDC
- See Also:
-
DISABLE_DB_CDC
- See Also:
-
STATUS_DB_CDC
- See Also:
-
ENABLE_TABLE_CDC
- See Also:
-
DISABLE_TABLE_CDC
- See Also:
-
RESTART_ASN_CDC
- See Also:
-
LOGGER
private static org.slf4j.Logger LOGGER
-
-
Constructor Details
-
TestHelper
public TestHelper()
-
-
Method Details
-
adminJdbcConfig
public static io.debezium.jdbc.JdbcConfiguration adminJdbcConfig() -
defaultJdbcConfig
public static io.debezium.jdbc.JdbcConfiguration defaultJdbcConfig() -
defaultConfig
public static io.debezium.config.Configuration.Builder defaultConfig()Returns a default configuration suitable for most test cases. Can be amended/overridden in individual tests as needed. -
adminConnection
public static io.debezium.connector.db2.Db2Connection adminConnection() -
testConnection
public static io.debezium.connector.db2.Db2Connection testConnection() -
enableDbCdc
public static void enableDbCdc(io.debezium.connector.db2.Db2Connection connection) throws SQLException Enables CDC for a given database, if not already enabled.- Throws:
SQLException- if anything unexpected fails
-
disableDbCdc
public static void disableDbCdc(io.debezium.connector.db2.Db2Connection connection) throws SQLException Disables CDC for a given database, if not already disabled.- Throws:
SQLException- if anything unexpected fails
-
enableTableCdc
public static void enableTableCdc(io.debezium.connector.db2.Db2Connection connection, String name) throws SQLException Enables CDC for a table if not already enabled and generates the wrapper functions for that table.- Parameters:
name- the name of the table, may not benull- Throws:
SQLException- if anything unexpected fails
-
enableTableCdc
public static void enableTableCdc(io.debezium.connector.db2.Db2Connection connection, String schemaName, String tableName) throws SQLException Enables CDC for a table if not already enabled and generates the wrapper functions for that table.- Parameters:
schemaName- the name of the schema, may not benulltableName- the name of the table, may not benull- Throws:
SQLException- if anything unexpected fails
-
disableTableCdc
public static void disableTableCdc(io.debezium.connector.db2.Db2Connection connection, String name) throws SQLException Disables CDC for a table for which it was enabled before.- Parameters:
name- the name of the table, may not benull- Throws:
SQLException- if anything unexpected fails
-
disableTableCdc
public static void disableTableCdc(io.debezium.connector.db2.Db2Connection connection, String schemaName, String tableName) throws SQLException Disables CDC for a table for which it was enabled before.- Parameters:
schemaName- the name of the schema, may not benulltableName- the name of the table, may not benull- Throws:
SQLException- if anything unexpected fails
-
waitForSnapshotToBeCompleted
- Throws:
InterruptedException
-
refreshAndWait
public static void refreshAndWait(io.debezium.connector.db2.Db2Connection connection) throws SQLException - Throws:
SQLException
-
getCdcTableName
public static String getCdcTableName(io.debezium.connector.db2.Db2Connection connection, String sourceTable) throws SQLException - Throws:
SQLException
-
activeTable
public static void activeTable(io.debezium.connector.db2.Db2Connection connection, String tableName) throws SQLException - Throws:
SQLException
-
deactivateTable
public static void deactivateTable(io.debezium.connector.db2.Db2Connection connection, String tableName) throws SQLException - Throws:
SQLException
-
waitForCDC
public static void waitForCDC()
-