Package org.springframework.xd.test.fixtures

Examples of org.springframework.xd.test.fixtures.JdbcSource


    assertEquals("good_bye", result.get("bar_baz"));
  }

  @Test
  public void testJdbcSourceNoUpdateStatement() 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", 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 + 3))));
  }
View Full Code Here


    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))));
  }
View Full Code Here

  protected JdbcSink newJdbcSink() {
    return new JdbcSink(createDataSource());
  }

  protected JdbcSource newJdbcSource() { return new JdbcSource(createDataSource());}
View Full Code Here

TOP

Related Classes of org.springframework.xd.test.fixtures.JdbcSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.