Beispiel #1
0
  /** * 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));
  }
Beispiel #2
0
 /** 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.
   }
 }