@Test public void testDelete() { Schema avroSchema = new Schema.Parser().parse(AVRO_SCHEMA_STRING); GenericRecord deleteRecord = new GenericData.Record(avroSchema); deleteRecord.put("field1", 2); deleteRecord.put("Op", "D"); GenericRecord oldRecord = new GenericData.Record(avroSchema); oldRecord.put("field1", 2); oldRecord.put("Op", "U"); AWSDmsAvroPayload payload = new AWSDmsAvroPayload(Option.of(deleteRecord)); try { Option<IndexedRecord> outputPayload = payload.combineAndGetUpdateValue(oldRecord, avroSchema); assertFalse(outputPayload.isPresent()); } catch (Exception e) { fail("Unexpected exception"); } }
@Override public Option<IndexedRecord> combineAndGetUpdateValue(IndexedRecord currentValue, Schema schema) throws IOException { IndexedRecord insertValue = super.getInsertValue(schema).get(); return handleDeleteOperation(insertValue); }
AWSDmsAvroPayload extends OverwriteWithLatestAvroPayload { @Override public Option<IndexedRecord> combineAndGetUpdateValue(IndexedRecord currentValue, Schema schema) throws IOException { IndexedRecord insertValue = super.getInsertValue(schema).get(); return handleDeleteOperation(insertValue); } }
AWSDmsAvroPayload extends OverwriteWithLatestAvroPayload { @Override public Option<IndexedRecord> combineAndGetUpdateValue(IndexedRecord currentValue, Schema schema) throws IOException { IndexedRecord insertValue = super.getInsertValue(schema).get(); return handleDeleteOperation(insertValue); } AWSDmsAvroPayload(GenericRecord record, Comparable orderingVal);  AWSDmsAvroPayload(Option<GenericRecord> record); }
AWSDmsAvroPayload extends OverwriteWithLatestAvroPayload { @Override public Option<IndexedRecord> combineAndGetUpdateValue(IndexedRecord currentValue, Schema schema) throws IOException { IndexedRecord insertValue = super.getInsertValue(schema).get(); return handleDeleteOperation(insertValue); } AWSDmsAvroPayload(GenericRecord record, Comparable orderingVal);  AWSDmsAvroPayload(Option<GenericRecord> record); @Override Option<IndexedRecord> getInsertValue(Schema schema); @Override Option<IndexedRecord> combineAndGetUpdateValue(IndexedRecord currentValue, Schema schema); }
AWSDmsAvroPayload extends OverwriteWithLatestAvroPayload { @Override public Option<IndexedRecord> combineAndGetUpdateValue(IndexedRecord currentValue, Schema schema) throws IOException { IndexedRecord insertValue = super.getInsertValue(schema).get(); return handleDeleteOperation(insertValue); } AWSDmsAvroPayload(GenericRecord record, Comparable orderingVal);  AWSDmsAvroPayload(Option<GenericRecord> record); @Override Option<IndexedRecord> getInsertValue(Schema schema); @Override Option<IndexedRecord> combineAndGetUpdateValue(IndexedRecord currentValue, Schema schema); static final String OP_FIELD; }