Class AssertUtils
- java.lang.Object
-
- org.apache.flink.cdc.connectors.utils.AssertUtils
-
public class AssertUtils extends Object
Utilities for assertingSourceRecordandDebeziumSourceFunction.
-
-
Constructor Summary
Constructors Constructor Description AssertUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassertDelete(org.apache.kafka.connect.source.SourceRecord record)Verify that the givenSourceRecordis aDELETErecord without PK.static voidassertDelete(org.apache.kafka.connect.source.SourceRecord record, boolean keyExpected)Verify that the givenSourceRecordis aDELETErecord.static voidassertDelete(org.apache.kafka.connect.source.SourceRecord record, String pkField, int pk)Verify that the givenSourceRecordis aDELETErecord, and that the integer key matches the expected value.static voidassertInsert(org.apache.kafka.connect.source.SourceRecord record)Verify that the givenSourceRecordis aINSERT/CREATErecord without primary key.static voidassertInsert(org.apache.kafka.connect.source.SourceRecord record, boolean keyExpected)Verify that the givenSourceRecordis aINSERT/CREATErecord.static voidassertInsert(org.apache.kafka.connect.source.SourceRecord record, String pkField, int pk)Verify that the givenSourceRecordis aINSERT/CREATErecord, and that the integer key matches the expected value.static voidassertProducedTypeOfSourceFunction(DebeziumSourceFunction<org.apache.flink.table.data.RowData> debeziumSourceFunction, org.apache.flink.table.types.DataType expectedProducedType)Verify that the given produced data type ofDebeziumSourceFunction<RowData>matches the resolved schema data type.static voidassertRead(org.apache.kafka.connect.source.SourceRecord record)Verify that the givenSourceRecordis aREADrecord.static voidassertRead(org.apache.kafka.connect.source.SourceRecord record, String pkField, int pk)Verify that the givenSourceRecordis aREADrecord, and that the integer key matches the expected value.static voidassertTombstone(org.apache.kafka.connect.source.SourceRecord record)Verify that the givenSourceRecordis a valid tombstone, meaning it has a non-null key and key schema but null value and value schema.static voidassertUpdate(org.apache.kafka.connect.source.SourceRecord record)Verify that the givenSourceRecordis aUPDATErecord without PK.static voidassertUpdate(org.apache.kafka.connect.source.SourceRecord record, boolean keyExpected)Verify that the givenSourceRecordis aUPDATErecord.static voidassertUpdate(org.apache.kafka.connect.source.SourceRecord record, String pkField, int pk)Verify that the givenSourceRecordis aUPDATErecord, and that the integer key matches the expected value.static voidhasValidKey(org.apache.kafka.connect.source.SourceRecord record, String pkField, int pk)Verify that the givenSourceRecordhas a valid non-null integer key that matches the expected integer value.
-
-
-
Method Detail
-
assertInsert
public static void assertInsert(org.apache.kafka.connect.source.SourceRecord record, boolean keyExpected)Verify that the givenSourceRecordis aINSERT/CREATErecord.- Parameters:
record- the source record; may not be null
-
assertRead
public static void assertRead(org.apache.kafka.connect.source.SourceRecord record)
Verify that the givenSourceRecordis aREADrecord.- Parameters:
record- the source record; may not be null
-
assertUpdate
public static void assertUpdate(org.apache.kafka.connect.source.SourceRecord record, boolean keyExpected)Verify that the givenSourceRecordis aUPDATErecord.- Parameters:
record- the source record; may not be null
-
assertDelete
public static void assertDelete(org.apache.kafka.connect.source.SourceRecord record, boolean keyExpected)Verify that the givenSourceRecordis aDELETErecord.- Parameters:
record- the source record; may not be null
-
assertTombstone
public static void assertTombstone(org.apache.kafka.connect.source.SourceRecord record)
Verify that the givenSourceRecordis a valid tombstone, meaning it has a non-null key and key schema but null value and value schema.- Parameters:
record- the source record; may not be null
-
hasValidKey
public static void hasValidKey(org.apache.kafka.connect.source.SourceRecord record, String pkField, int pk)Verify that the givenSourceRecordhas a valid non-null integer key that matches the expected integer value.- Parameters:
record- the source record; may not be nullpkField- the single field defining the primary key of the struct; may not be nullpk- the expected integer value of the primary key in the struct
-
assertInsert
public static void assertInsert(org.apache.kafka.connect.source.SourceRecord record)
Verify that the givenSourceRecordis aINSERT/CREATErecord without primary key.- Parameters:
record- the source record; may not be null
-
assertInsert
public static void assertInsert(org.apache.kafka.connect.source.SourceRecord record, String pkField, int pk)Verify that the givenSourceRecordis aINSERT/CREATErecord, and that the integer key matches the expected value.- Parameters:
record- the source record; may not be nullpkField- the single field defining the primary key of the struct; may not be nullpk- the expected integer value of the primary key in the struct
-
assertRead
public static void assertRead(org.apache.kafka.connect.source.SourceRecord record, String pkField, int pk)Verify that the givenSourceRecordis aREADrecord, and that the integer key matches the expected value.- Parameters:
record- the source record; may not be nullpkField- the single field defining the primary key of the struct; may not be nullpk- the expected integer value of the primary key in the struct
-
assertUpdate
public static void assertUpdate(org.apache.kafka.connect.source.SourceRecord record)
Verify that the givenSourceRecordis aUPDATErecord without PK.- Parameters:
record- the source record; may not be null
-
assertUpdate
public static void assertUpdate(org.apache.kafka.connect.source.SourceRecord record, String pkField, int pk)Verify that the givenSourceRecordis aUPDATErecord, and that the integer key matches the expected value.- Parameters:
record- the source record; may not be nullpkField- the single field defining the primary key of the struct; may not be nullpk- the expected integer value of the primary key in the struct
-
assertDelete
public static void assertDelete(org.apache.kafka.connect.source.SourceRecord record)
Verify that the givenSourceRecordis aDELETErecord without PK. matches the expected value.- Parameters:
record- the source record; may not be null
-
assertDelete
public static void assertDelete(org.apache.kafka.connect.source.SourceRecord record, String pkField, int pk)Verify that the givenSourceRecordis aDELETErecord, and that the integer key matches the expected value.- Parameters:
record- the source record; may not be nullpkField- the single field defining the primary key of the struct; may not be nullpk- the expected integer value of the primary key in the struct
-
assertProducedTypeOfSourceFunction
public static void assertProducedTypeOfSourceFunction(DebeziumSourceFunction<org.apache.flink.table.data.RowData> debeziumSourceFunction, org.apache.flink.table.types.DataType expectedProducedType)
Verify that the given produced data type ofDebeziumSourceFunction<RowData>matches the resolved schema data type.- Parameters:
debeziumSourceFunction- the actual DebeziumSourceFunctionexpectedProducedType- expected DataType of resolved schema
-
-