コード例 #1
0
ファイル: JdbcTest.java プロジェクト: harunpehlivan/spring-xd
  /** * Verifies that Jdbc sink has written the test data to the table. */
  @Test
  public void testJDBCSink() {
    String data = UUID.randomUUID().toString();
    jdbcSink.getJdbcTemplate().getDataSource();
    stream("dataSender", "trigger --payload='" + data + "'" + XD_DELIMETER + jdbcSink, WAIT_TIME);

    waitForXD(2000);

    String query = String.format("SELECT payload FROM %s", tableName);
    assertEquals(data, jdbcSink.getJdbcTemplate().queryForObject(query, String.class));
  }
コード例 #2
0
ファイル: JdbcTest.java プロジェクト: harunpehlivan/spring-xd
 /** Being a good steward of the database remove the result table from the database. */
 @After
 public void cleanup() {
   if (jdbcSink == null) {
     return;
   }
   try {
     jdbcSink.getJdbcTemplate().execute("drop table " + tableName);
   } catch (DataAccessException daException) {
     // This exception is thrown if the table is not present. In this case that is ok.
   }
 }