assertThat(counter, XDMatchers.eventually(XDMatchers.hasValue("" + (2 + 3))));
}
@Test
public void testJdbcSourceWithUpdateStatement() throws Exception {
JdbcSource jdbcSource = newJdbcSource().fixedDelay(1);
CounterSink counter = metrics().newCounterSink();
String streamname = generateStreamName().replace("-", "_");
jdbcSource.getJdbcTemplate().update(String.format("create table %s (seen INT, name VARCHAR(32))", streamname));
jdbcSource.getJdbcTemplate().update(String.format("insert into %s (seen, name) values (0, 'eric')", streamname));
jdbcSource.getJdbcTemplate().update(String.format("insert into %s (seen, name) values (0, 'eric')", streamname));
jdbcSource.query(String.format("select * from %s where seen = 0", streamname));
jdbcSource.update(String.format("update %s set seen = 1 where seen = 0", streamname));
stream().create(streamname, "%s | %s", jdbcSource, counter);
assertThat(counter, XDMatchers.eventually(XDMatchers.hasValue("2")));
jdbcSource.getJdbcTemplate().update(String.format("insert into %s (seen, name) values (0, 'eric')", streamname));
assertThat(counter, XDMatchers.eventually(XDMatchers.hasValue("" + (2 + 1))));
}