WalEventConverter { public Record convert(final AbstractWalEvent event) { JdbcUri uri = new JdbcUri(((JDBCScalingDataSourceConfiguration) dumperConfig.getDataSourceConfiguration()).getJdbcUrl()); if (filter(uri.getDatabase(), event)) { return createPlaceholderRecord(event); } else if (event instanceof WriteRowEvent) { return handleWriteRowsEvent((WriteRowEvent) event); } else if (event instanceof UpdateRowEvent) { return handleUpdateRowsEvent((UpdateRowEvent) event); } else if (event instanceof DeleteRowEvent) { return handleDeleteRowsEvent((DeleteRowEvent) event); } else if (event instanceof PlaceholderEvent) { return createPlaceholderRecord(event); } throw new UnsupportedOperationException(""); } WalEventConverter(final DumperConfiguration dumperConfig); Record convert(final AbstractWalEvent event);  }
@Test public void assertConvertWriteRowEvent() { Record record = walEventConverter.convert(mockWriteRowEvent()); assertTrue(record instanceof DataRecord); assertThat(((DataRecord) record).getType(), is(ScalingConstant.INSERT)); }
@Test public void assertConvertUpdateRowEvent() { Record record = walEventConverter.convert(mockUpdateRowEvent()); assertTrue(record instanceof DataRecord); assertThat(((DataRecord) record).getType(), is(ScalingConstant.UPDATE)); }
@Test public void assertConvertDeleteRowEvent() { Record record = walEventConverter.convert(mockDeleteRowEvent()); assertTrue(record instanceof DataRecord); assertThat(((DataRecord) record).getType(), is(ScalingConstant.DELETE)); }
@Test public void assertConvertPlaceholderEvent() { Record record = walEventConverter.convert(new PlaceholderEvent()); assertTrue(record instanceof PlaceholderRecord); }
@Test public void assertUnknownTable() { Record record = walEventConverter.convert(mockUnknownTableEvent()); assertTrue(record instanceof PlaceholderRecord); }
@Test(expected = UnsupportedOperationException.class) public void assertConvertFailure() { walEventConverter.convert(new AbstractRowEvent()); }