public class VerifyRecord extends Object
SourceRecord.| Modifier and Type | Class and Description |
|---|---|
static interface |
VerifyRecord.RecordValueComparator |
| Modifier and Type | Field and Description |
|---|---|
private static io.confluent.connect.avro.AvroConverter |
avroKeyConverter |
private static io.confluent.connect.avro.AvroConverter |
avroValueConverter |
private static org.apache.kafka.connect.json.JsonConverter |
keyJsonConverter |
private static org.apache.kafka.connect.json.JsonDeserializer |
keyJsonDeserializer |
private static io.confluent.kafka.schemaregistry.client.MockSchemaRegistryClient |
schemaRegistry |
private static org.apache.kafka.connect.json.JsonConverter |
valueJsonConverter |
private static org.apache.kafka.connect.json.JsonDeserializer |
valueJsonDeserializer |
| Constructor and Description |
|---|
VerifyRecord() |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
assertEquals(Object o1,
Object o2) |
protected static void |
assertEquals(org.apache.kafka.connect.data.Schema schema,
Object o1,
Object o2,
String keyOrValue,
String field,
Predicate<String> ignoreFields,
Map<String,VerifyRecord.RecordValueComparator> comparatorsByName,
Map<String,VerifyRecord.RecordValueComparator> comparatorsBySchemaName) |
static void |
assertEquals(org.apache.kafka.connect.source.SourceRecord actual,
org.apache.kafka.connect.source.SourceRecord expected,
Predicate<String> ignoreFields,
Map<String,VerifyRecord.RecordValueComparator> comparatorsByName,
Map<String,VerifyRecord.RecordValueComparator> comparatorsBySchemaName) |
static void |
debug(org.apache.kafka.connect.source.SourceRecord record)
Print a debug message with the JSON representation of the SourceRecord.
|
private static boolean |
deepEquals(Object[] a1,
Object[] a2) |
private static boolean |
deepEquals0(Object e1,
Object e2) |
protected static boolean |
equals(Object o1,
Object o2) |
private static String |
fieldName(String field,
String suffix) |
static void |
fieldsInSchema(org.apache.kafka.connect.data.Struct struct,
org.apache.kafka.connect.data.Schema schema)
Verify that the fields in the given
Struct reference the Field definitions in the given Schema. |
static void |
hasValidKey(org.apache.kafka.connect.source.SourceRecord record,
String pkField,
int pk)
Verify that the given
SourceRecord has a valid non-null integer key that matches the expected integer value. |
static void |
isValid(org.apache.kafka.connect.source.SourceRecord record)
Validate that a
SourceRecord's key and value can each be converted to a byte[] and then back to an equivalent
SourceRecord. |
static void |
isValidDelete(org.apache.kafka.connect.source.SourceRecord record)
Verify that the given
SourceRecord is a DELETE record. |
static void |
isValidDelete(org.apache.kafka.connect.source.SourceRecord record,
String pkField,
int pk)
Verify that the given
SourceRecord is a DELETE record, and that the integer key
matches the expected value. |
static void |
isValidInsert(org.apache.kafka.connect.source.SourceRecord record)
Verify that the given
SourceRecord is a INSERT/CREATE record. |
static void |
isValidInsert(org.apache.kafka.connect.source.SourceRecord record,
String pkField,
int pk)
Verify that the given
SourceRecord is a INSERT/CREATE record, and that the integer key
matches the expected value. |
static void |
isValidRead(org.apache.kafka.connect.source.SourceRecord record)
Verify that the given
SourceRecord is a READ record. |
static void |
isValidRead(org.apache.kafka.connect.source.SourceRecord record,
String pkField,
int pk)
Verify that the given
SourceRecord is a READ record, and that the integer key
matches the expected value. |
static void |
isValidTombstone(org.apache.kafka.connect.source.SourceRecord record)
Verify that the given
SourceRecord is a valid tombstone, meaning it has a non-null key and key schema but null
value and value schema. |
static void |
isValidTombstone(org.apache.kafka.connect.source.SourceRecord record,
String pkField,
int pk)
Verify that the given
SourceRecord is a valid tombstone, meaning it has a valid non-null key with key schema
but null value and value schema. |
static void |
isValidUpdate(org.apache.kafka.connect.source.SourceRecord record)
Verify that the given
SourceRecord is a UPDATE record. |
static void |
isValidUpdate(org.apache.kafka.connect.source.SourceRecord record,
String pkField,
int pk)
Verify that the given
SourceRecord is a UPDATE record, and that the integer key
matches the expected value. |
protected static String |
nameOf(String keyOrValue,
String field) |
protected static String |
prettyJson(com.fasterxml.jackson.databind.JsonNode json) |
static void |
print(org.apache.kafka.connect.source.SourceRecord record)
Print a message with the JSON representation of the SourceRecord.
|
protected static void |
printJson(org.apache.kafka.connect.source.SourceRecord record) |
static void |
schemaMatchesStruct(org.apache.kafka.connect.data.SchemaAndValue schemaAndValue)
Assert that the supplied
Struct is valid and its schema
matches that of the supplied schema. |
static void |
schemaMatchesStruct(org.apache.kafka.connect.data.Struct struct,
org.apache.kafka.connect.data.Schema schema)
Assert that the supplied
Struct is valid and its schema
matches that of the supplied schema. |
private static String |
schemaName(org.apache.kafka.connect.data.Schema schema) |
protected static void |
validateSchemaNames(org.apache.kafka.connect.data.Schema schema) |
protected static void |
validateSubSchemaNames(org.apache.kafka.connect.data.Schema parentSchema,
org.apache.kafka.connect.data.Field field) |
private static Object[] |
valuesFor(org.apache.kafka.connect.data.Struct struct) |
private static final org.apache.kafka.connect.json.JsonConverter keyJsonConverter
private static final org.apache.kafka.connect.json.JsonConverter valueJsonConverter
private static final org.apache.kafka.connect.json.JsonDeserializer keyJsonDeserializer
private static final org.apache.kafka.connect.json.JsonDeserializer valueJsonDeserializer
private static final io.confluent.kafka.schemaregistry.client.MockSchemaRegistryClient schemaRegistry
private static final io.confluent.connect.avro.AvroConverter avroKeyConverter
private static final io.confluent.connect.avro.AvroConverter avroValueConverter
public static void isValidInsert(org.apache.kafka.connect.source.SourceRecord record)
SourceRecord is a INSERT/CREATE record.record - the source record; may not be nullpublic static void isValidRead(org.apache.kafka.connect.source.SourceRecord record)
SourceRecord is a READ record.record - the source record; may not be nullpublic static void isValidUpdate(org.apache.kafka.connect.source.SourceRecord record)
SourceRecord is a UPDATE record.record - the source record; may not be nullpublic static void isValidDelete(org.apache.kafka.connect.source.SourceRecord record)
SourceRecord is a DELETE record.record - the source record; may not be nullpublic static void isValidTombstone(org.apache.kafka.connect.source.SourceRecord record)
SourceRecord is a valid tombstone, meaning it has a non-null key and key schema but null
value and value schema.record - the source record; may not be nullpublic static void hasValidKey(org.apache.kafka.connect.source.SourceRecord record,
String pkField,
int pk)
SourceRecord has a valid non-null integer key that matches the expected integer value.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 structpublic static void isValidInsert(org.apache.kafka.connect.source.SourceRecord record,
String pkField,
int pk)
SourceRecord is a INSERT/CREATE record, and that the integer key
matches the expected value.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 structpublic static void isValidRead(org.apache.kafka.connect.source.SourceRecord record,
String pkField,
int pk)
SourceRecord is a READ record, and that the integer key
matches the expected value.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 structpublic static void isValidUpdate(org.apache.kafka.connect.source.SourceRecord record,
String pkField,
int pk)
SourceRecord is a UPDATE record, and that the integer key
matches the expected value.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 structpublic static void isValidDelete(org.apache.kafka.connect.source.SourceRecord record,
String pkField,
int pk)
SourceRecord is a DELETE record, and that the integer key
matches the expected value.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 structpublic static void isValidTombstone(org.apache.kafka.connect.source.SourceRecord record,
String pkField,
int pk)
SourceRecord is a valid tombstone, meaning it has a valid non-null key with key schema
but null value and value schema.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 structpublic static void schemaMatchesStruct(org.apache.kafka.connect.data.SchemaAndValue schemaAndValue)
Struct is valid and its schema
matches that of the supplied schema.schemaAndValue - the value with a schema; may not be nullpublic static void schemaMatchesStruct(org.apache.kafka.connect.data.Struct struct,
org.apache.kafka.connect.data.Schema schema)
Struct is valid and its schema
matches that of the supplied schema.struct - the Struct to validate; may not be nullschema - the expected schema of the Struct; may not be nullpublic static void fieldsInSchema(org.apache.kafka.connect.data.Struct struct,
org.apache.kafka.connect.data.Schema schema)
Struct reference the Field definitions in the given Schema.struct - the Struct instance; may not be nullschema - the Schema defining the fields in the Struct; may not be nullpublic static void print(org.apache.kafka.connect.source.SourceRecord record)
record - the source record; may not be nullpublic static void debug(org.apache.kafka.connect.source.SourceRecord record)
record - the source record; may not be nullpublic static void assertEquals(org.apache.kafka.connect.source.SourceRecord actual,
org.apache.kafka.connect.source.SourceRecord expected,
Predicate<String> ignoreFields,
Map<String,VerifyRecord.RecordValueComparator> comparatorsByName,
Map<String,VerifyRecord.RecordValueComparator> comparatorsBySchemaName)
private static String schemaName(org.apache.kafka.connect.data.Schema schema)
protected static void assertEquals(org.apache.kafka.connect.data.Schema schema,
Object o1,
Object o2,
String keyOrValue,
String field,
Predicate<String> ignoreFields,
Map<String,VerifyRecord.RecordValueComparator> comparatorsByName,
Map<String,VerifyRecord.RecordValueComparator> comparatorsBySchemaName)
public static void isValid(org.apache.kafka.connect.source.SourceRecord record)
SourceRecord's key and value can each be converted to a byte[] and then back to an equivalent
SourceRecord.record - the record to validate; may not be nullprotected static void validateSchemaNames(org.apache.kafka.connect.data.Schema schema)
protected static void validateSubSchemaNames(org.apache.kafka.connect.data.Schema parentSchema,
org.apache.kafka.connect.data.Field field)
protected static void printJson(org.apache.kafka.connect.source.SourceRecord record)
protected static String prettyJson(com.fasterxml.jackson.databind.JsonNode json)
private static Object[] valuesFor(org.apache.kafka.connect.data.Struct struct)
Copyright © 2018 JBoss by Red Hat. All rights reserved.