Package io.debezium.connector.db2.util
Class TestHelper
- java.lang.Object
-
- io.debezium.connector.db2.util.TestHelper
-
public class TestHelper extends Object
- Author:
- Horia Chiorean (hchiorea@redhat.com), Luis Garcés-Erice
-
-
Field Summary
Fields Modifier and Type Field Description static PathDB_HISTORY_PATHprivate static StringDISABLE_DB_CDCprivate static StringDISABLE_TABLE_CDCprivate static StringENABLE_DB_CDCprivate static StringENABLE_TABLE_CDCprivate static StringRESTART_ASN_CDCprivate static StringSTATEMENTS_SCHEMA_PLACEHOLDERprivate static StringSTATEMENTS_TABLE_PLACEHOLDERprivate static StringSTATUS_DB_CDCstatic StringTEST_DATABASEstatic StringTYPE_LENGTH_PARAMETER_KEYKey for schema parameter used to store a source column's type length.static StringTYPE_NAME_PARAMETER_KEYKey for schema parameter used to store a source column's type name.static StringTYPE_SCALE_PARAMETER_KEYKey for schema parameter used to store a source column's type scale.static intWAIT_FOR_CDC
-
Constructor Summary
Constructors Constructor Description TestHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static io.debezium.connector.db2.Db2ConnectionadminConnection()static io.debezium.jdbc.JdbcConfigurationadminJdbcConfig()static io.debezium.config.Configuration.BuilderdefaultConfig()Returns a default configuration suitable for most test cases.static io.debezium.jdbc.JdbcConfigurationdefaultJdbcConfig()static 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 voidrefreshAndWait(io.debezium.connector.db2.Db2Connection connection)static io.debezium.connector.db2.Db2ConnectiontestConnection()static voidwaitForCDC()static voidwaitForSnapshotToBeCompleted()
-
-
-
Field Detail
-
DB_HISTORY_PATH
public static final Path DB_HISTORY_PATH
-
TEST_DATABASE
public static final String TEST_DATABASE
- See Also:
- Constant Field Values
-
WAIT_FOR_CDC
public static final int WAIT_FOR_CDC
- See Also:
- Constant Field Values
-
TYPE_NAME_PARAMETER_KEY
public static final String TYPE_NAME_PARAMETER_KEY
Key for schema parameter used to store a source column's type name.- See Also:
- Constant Field Values
-
TYPE_LENGTH_PARAMETER_KEY
public static final String TYPE_LENGTH_PARAMETER_KEY
Key for schema parameter used to store a source column's type length.- See Also:
- Constant Field Values
-
TYPE_SCALE_PARAMETER_KEY
public static final String TYPE_SCALE_PARAMETER_KEY
Key for schema parameter used to store a source column's type scale.- See Also:
- Constant Field Values
-
STATEMENTS_TABLE_PLACEHOLDER
private static final String STATEMENTS_TABLE_PLACEHOLDER
- See Also:
- Constant Field Values
-
STATEMENTS_SCHEMA_PLACEHOLDER
private static final String STATEMENTS_SCHEMA_PLACEHOLDER
- See Also:
- Constant Field Values
-
ENABLE_DB_CDC
private static final String ENABLE_DB_CDC
- See Also:
- Constant Field Values
-
DISABLE_DB_CDC
private static final String DISABLE_DB_CDC
- See Also:
- Constant Field Values
-
STATUS_DB_CDC
private static final String STATUS_DB_CDC
- See Also:
- Constant Field Values
-
ENABLE_TABLE_CDC
private static final String ENABLE_TABLE_CDC
- See Also:
- Constant Field Values
-
DISABLE_TABLE_CDC
private static final String DISABLE_TABLE_CDC
- See Also:
- Constant Field Values
-
RESTART_ASN_CDC
private static final String RESTART_ASN_CDC
- See Also:
- Constant Field Values
-
-
Method Detail
-
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 SQLExceptionEnables 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 SQLExceptionDisables 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 SQLExceptionEnables 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 SQLExceptionEnables 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 SQLExceptionDisables 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 SQLExceptionDisables 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
public static void waitForSnapshotToBeCompleted() throws InterruptedException- Throws:
InterruptedException
-
refreshAndWait
public static void refreshAndWait(io.debezium.connector.db2.Db2Connection connection) throws SQLException- Throws:
SQLException
-
waitForCDC
public static void waitForCDC()
-
-