@Test public void testUpdate() { Schema avroSchema = new Schema.Parser().parse(AVRO_SCHEMA_STRING); GenericRecord newRecord = new GenericData.Record(avroSchema); newRecord.put("field1", 1); newRecord.put("Op", "U"); GenericRecord oldRecord = new GenericData.Record(avroSchema); oldRecord.put("field1", 0); oldRecord.put("Op", "I"); AWSDmsAvroPayload payload = new AWSDmsAvroPayload(Option.of(newRecord)); try { Option<IndexedRecord> outputPayload = payload.combineAndGetUpdateValue(oldRecord, avroSchema); assertTrue((int) outputPayload.get().get(0) == 1); assertTrue(outputPayload.get().get(1).toString().equals("U")); } 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; }