2525import org .apache .hudi .common .util .Option ;
2626import org .junit .jupiter .api .Test ;
2727
28+ import java .util .Properties ;
29+
2830import static org .junit .jupiter .api .Assertions .assertFalse ;
2931import static org .junit .jupiter .api .Assertions .assertTrue ;
3032import static org .junit .jupiter .api .Assertions .fail ;
@@ -42,13 +44,14 @@ public void testInsert() {
4244
4345 Schema avroSchema = new Schema .Parser ().parse (AVRO_SCHEMA_STRING );
4446 GenericRecord record = new GenericData .Record (avroSchema );
47+ Properties properties = new Properties ();
4548 record .put ("field1" , 0 );
4649 record .put ("Op" , "I" );
4750
4851 AWSDmsAvroPayload payload = new AWSDmsAvroPayload (Option .of (record ));
4952
5053 try {
51- Option <IndexedRecord > outputPayload = payload .getInsertValue (avroSchema );
54+ Option <IndexedRecord > outputPayload = payload .getInsertValue (avroSchema , properties );
5255 assertTrue ((int ) outputPayload .get ().get (0 ) == 0 );
5356 assertTrue (outputPayload .get ().get (1 ).toString ().equals ("I" ));
5457 } catch (Exception e ) {
@@ -61,6 +64,7 @@ public void testInsert() {
6164 public void testUpdate () {
6265 Schema avroSchema = new Schema .Parser ().parse (AVRO_SCHEMA_STRING );
6366 GenericRecord newRecord = new GenericData .Record (avroSchema );
67+ Properties properties = new Properties ();
6468 newRecord .put ("field1" , 1 );
6569 newRecord .put ("Op" , "U" );
6670
@@ -71,7 +75,7 @@ public void testUpdate() {
7175 AWSDmsAvroPayload payload = new AWSDmsAvroPayload (Option .of (newRecord ));
7276
7377 try {
74- Option <IndexedRecord > outputPayload = payload .combineAndGetUpdateValue (oldRecord , avroSchema );
78+ Option <IndexedRecord > outputPayload = payload .combineAndGetUpdateValue (oldRecord , avroSchema , properties );
7579 assertTrue ((int ) outputPayload .get ().get (0 ) == 1 );
7680 assertTrue (outputPayload .get ().get (1 ).toString ().equals ("U" ));
7781 } catch (Exception e ) {
@@ -84,6 +88,7 @@ public void testUpdate() {
8488 public void testDelete () {
8589 Schema avroSchema = new Schema .Parser ().parse (AVRO_SCHEMA_STRING );
8690 GenericRecord deleteRecord = new GenericData .Record (avroSchema );
91+ Properties properties = new Properties ();
8792 deleteRecord .put ("field1" , 2 );
8893 deleteRecord .put ("Op" , "D" );
8994
@@ -94,7 +99,7 @@ public void testDelete() {
9499 AWSDmsAvroPayload payload = new AWSDmsAvroPayload (Option .of (deleteRecord ));
95100
96101 try {
97- Option <IndexedRecord > outputPayload = payload .combineAndGetUpdateValue (oldRecord , avroSchema );
102+ Option <IndexedRecord > outputPayload = payload .combineAndGetUpdateValue (oldRecord , avroSchema , properties );
98103 // expect nothing to be committed to table
99104 assertFalse (outputPayload .isPresent ());
100105 } catch (Exception e ) {
@@ -107,6 +112,7 @@ public void testDelete() {
107112 public void testPreCombineWithDelete () {
108113 Schema avroSchema = new Schema .Parser ().parse (AVRO_SCHEMA_STRING );
109114 GenericRecord deleteRecord = new GenericData .Record (avroSchema );
115+ Properties properties = new Properties ();
110116 deleteRecord .put ("field1" , 4 );
111117 deleteRecord .put ("Op" , "D" );
112118
@@ -119,7 +125,7 @@ public void testPreCombineWithDelete() {
119125
120126 try {
121127 OverwriteWithLatestAvroPayload output = payload .preCombine (insertPayload );
122- Option <IndexedRecord > outputPayload = output .getInsertValue (avroSchema );
128+ Option <IndexedRecord > outputPayload = output .getInsertValue (avroSchema , properties );
123129 // expect nothing to be committed to table
124130 assertFalse (outputPayload .isPresent ());
125131 } catch (Exception e ) {
0 commit comments