|
30 | 30 |
|
31 | 31 | import static org.testng.Assert.assertEquals;
|
32 | 32 | import static org.testng.Assert.assertFalse;
|
| 33 | +import static org.testng.Assert.assertNotNull; |
33 | 34 | import static org.testng.Assert.assertNull;
|
34 | 35 | import static org.testng.Assert.assertTrue;
|
35 | 36 |
|
@@ -70,6 +71,36 @@ public void testChecksumCRC32WithCustomEventDataDeserializer() throws Exception
|
70 | 71 | readAll(reader, 303);
|
71 | 72 | }
|
72 | 73 |
|
| 74 | + @Test |
| 75 | + public void testUnsupportedEventType() throws Exception { |
| 76 | + EventDeserializer eventDeserializer = new EventDeserializer(); |
| 77 | + |
| 78 | + // mysql> SHOW BINLOG EVENTS IN 'mysql-bin.aurora-padding'; |
| 79 | + // +--------------------------+------+----------------+-------------+---------------------------------------+ |
| 80 | + // | Log_name | Pos | Event_type | End_log_pos | Info | |
| 81 | + // +--------------------------+------+----------------+-------------+---------------------------------------+ |
| 82 | + // | mysql-bin.aurora-padding | 4 | Format_desc | 185 | Server ver: 5.7.12-log, Binlog ver: 4 | |
| 83 | + // | mysql-bin.aurora-padding | 185 | Previous_gtids | 216 | | |
| 84 | + // | mysql-bin.aurora-padding | 216 | Anonymous_Gtid | 281 | SET @@SESSION.GTID_NEXT= 'ANONYMOUS' | |
| 85 | + // | mysql-bin.aurora-padding | 281 | Aurora_padding | 1209 | Ignorable | |
| 86 | + // | mysql-bin.aurora-padding | 1209 | Query | 1294 | BEGIN | |
| 87 | + BinaryLogFileReader reader = new BinaryLogFileReader( |
| 88 | + new FileInputStream("src/test/resources/mysql-bin.aurora-padding"), eventDeserializer); |
| 89 | + try { |
| 90 | + for (int i = 0; i < 3; i++) { |
| 91 | + assertNotNull(reader.readEvent()); |
| 92 | + } |
| 93 | + try { |
| 94 | + reader.readEvent(); |
| 95 | + } catch (IOException e) { |
| 96 | + // this simulates the Debezium's event.processing.failure.handling.mode = warn |
| 97 | + } |
| 98 | + assertEquals(reader.readEvent().getHeader().getEventType(), EventType.QUERY); |
| 99 | + } finally { |
| 100 | + reader.close(); |
| 101 | + } |
| 102 | + } |
| 103 | + |
73 | 104 | private void readAll(BinaryLogFileReader reader, int expect) throws IOException {
|
74 | 105 | try {
|
75 | 106 | int numberOfEvents = 0;
|
|
0 commit comments