@Test(groups = INTEGRATION) public void testSetupCreatesDeleteTrigger() throws SQLException { MysqlConfigurator configurator = new MysqlConfigurator(provider, TEST_TABLE_NAME); insertToTestTable(1, "value"); configurator.setup(); int initialEventsCount = getEventsCount(); deleteTestValue(1); assertEquals(getEventsCount(), initialEventsCount + 1); }
public void setup() { try ( Connection connection = connectionProvider.getConnection(); Statement stmt = connection.createStatement() ) { List<String> tableColumnNames = tableMetadata.getColumnNames(tableName); ReactiveTrigger insertTrigger = ReactiveTriggerFactory.afterInsert(tableName, tableColumnNames); ReactiveTrigger updateTrigger = ReactiveTriggerFactory.afterUpdate(tableName, tableColumnNames); ReactiveTrigger deleteTrigger = ReactiveTriggerFactory.afterDelete(tableName, tableColumnNames); stmt.execute(insertTrigger.getCreateSql()); stmt.execute(updateTrigger.getCreateSql()); stmt.execute(deleteTrigger.getCreateSql()); } catch (SQLException sqle) { throw new ConfigurationException("Couldn't configure table " + tableName + " as a reactive source", sqle); } }
MysqlConfigurator { public void setup() { try ( Connection connection = connectionProvider.getConnection(); Statement stmt = connection.createStatement() ) { List<String> tableColumnNames = tableMetadata.getColumnNames(tableName); ReactiveTrigger insertTrigger = ReactiveTriggerFactory.afterInsert(tableName, tableColumnNames); ReactiveTrigger updateTrigger = ReactiveTriggerFactory.afterUpdate(tableName, tableColumnNames); ReactiveTrigger deleteTrigger = ReactiveTriggerFactory.afterDelete(tableName, tableColumnNames); stmt.execute(insertTrigger.getCreateSql()); stmt.execute(updateTrigger.getCreateSql()); stmt.execute(deleteTrigger.getCreateSql()); } catch (SQLException sqle) { throw new ConfigurationException("Couldn't configure table " + tableName + " as a reactive source", sqle); } } }
MysqlConfigurator { public void setup() { try ( Connection connection = connectionProvider.getConnection(); Statement stmt = connection.createStatement() ) { List<String> tableColumnNames = tableMetadata.getColumnNames(tableName); ReactiveTrigger insertTrigger = ReactiveTriggerFactory.afterInsert(tableName, tableColumnNames); ReactiveTrigger updateTrigger = ReactiveTriggerFactory.afterUpdate(tableName, tableColumnNames); ReactiveTrigger deleteTrigger = ReactiveTriggerFactory.afterDelete(tableName, tableColumnNames); stmt.execute(insertTrigger.getCreateSql()); stmt.execute(updateTrigger.getCreateSql()); stmt.execute(deleteTrigger.getCreateSql()); } catch (SQLException sqle) { throw new ConfigurationException("Couldn't configure table " + tableName + " as a reactive source", sqle); } } MysqlConfigurator(ConnectionProvider connectionProvider, String tableName); }
MysqlConfigurator { public void setup() { try ( Connection connection = connectionProvider.getConnection(); Statement stmt = connection.createStatement() ) { List<String> tableColumnNames = tableMetadata.getColumnNames(tableName); ReactiveTrigger insertTrigger = ReactiveTriggerFactory.afterInsert(tableName, tableColumnNames); ReactiveTrigger updateTrigger = ReactiveTriggerFactory.afterUpdate(tableName, tableColumnNames); ReactiveTrigger deleteTrigger = ReactiveTriggerFactory.afterDelete(tableName, tableColumnNames); stmt.execute(insertTrigger.getCreateSql()); stmt.execute(updateTrigger.getCreateSql()); stmt.execute(deleteTrigger.getCreateSql()); } catch (SQLException sqle) { throw new ConfigurationException("Couldn't configure table " + tableName + " as a reactive source", sqle); } } MysqlConfigurator(ConnectionProvider connectionProvider, String tableName); void setup(); void cleanup(); }
MysqlConfigurator { public void setup() { try ( Connection connection = connectionProvider.getConnection(); Statement stmt = connection.createStatement() ) { List<String> tableColumnNames = tableMetadata.getColumnNames(tableName); ReactiveTrigger insertTrigger = ReactiveTriggerFactory.afterInsert(tableName, tableColumnNames); ReactiveTrigger updateTrigger = ReactiveTriggerFactory.afterUpdate(tableName, tableColumnNames); ReactiveTrigger deleteTrigger = ReactiveTriggerFactory.afterDelete(tableName, tableColumnNames); stmt.execute(insertTrigger.getCreateSql()); stmt.execute(updateTrigger.getCreateSql()); stmt.execute(deleteTrigger.getCreateSql()); } catch (SQLException sqle) { throw new ConfigurationException("Couldn't configure table " + tableName + " as a reactive source", sqle); } } MysqlConfigurator(ConnectionProvider connectionProvider, String tableName); void setup(); void cleanup();  }