Esempio n. 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));
  }
Esempio n. 2
0
 /** Removes the table created from a previous test. */
 @Before
 public void initialize() {
   jdbcSink = sinks.jdbc();
   tableName = "acceptanceTEST12345";
   jdbcSink.tableName(tableName);
   cleanup();
 }
Esempio n. 3
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.
   }
 }