operation = Envelope.Operation.forCode(operationString);
Document afterDoc = Document.parse(after); foundNames.add(afterDoc.getString("name")); Operation op = Operation.forCode(value.getString("op")); assertThat(op == Operation.READ || op == Operation.CREATE).isTrue(); }); if (record.value() != null) { Struct value = (Struct) record.value(); Operation op = Operation.forCode(value.getString("op")); assertThat(op).isEqualTo(Operation.DELETE); Document afterDoc = Document.parse(after); foundNames.add(afterDoc.getString("name")); Operation op = Operation.forCode(value.getString("op")); assertThat(op).isEqualTo(Operation.READ); });
operation = Envelope.Operation.forCode(operationString);
/** * Obtain the operation for the given source record. * * @param record the source record; may not be null * @return the operation, or null if no valid operation was found in the record */ public static Operation operationFor(SourceRecord record) { Struct value = (Struct) record.value(); Field opField = value.schema().field(FieldName.OPERATION); if (opField != null) { return Operation.forCode(value.getString(opField.name())); } return null; } }
/** * Obtain the operation for the given source record. * * @param record the source record; may not be null * @return the operation, or null if no valid operation was found in the record */ public static Operation operationFor(SourceRecord record) { Struct value = (Struct) record.value(); Field opField = value.schema().field(FieldName.OPERATION); if (opField != null) { return Operation.forCode(value.getString(opField.name())); } return null; } }