Examples of JdbcSource


Examples of com.adgear.anoa.source.schemaless.JdbcSource

    }
    final AvroSource<List<String>> stringListSource;
    switch (inFormat) {
      case JDBC:
        try {
          stringListSource = new JdbcSource(fetchResultSet());
        } catch (SQLException e) {
          throw new IOException(e);
        }
        break;
      case CSV:
View Full Code Here

Examples of com.adgear.anoa.source.schemaless.JdbcSource

        return new StringListToAvro<>(new TsvWithHeaderSource(new InputStreamReader(in)), schema);
      case TSV_NO_HEADER:
        return new StringListToAvro<>(new TsvSource(new InputStreamReader(in)), schema);
      case JDBC:
        try {
          return new StringListToAvro<>(new JdbcSource(fetchResultSet()), schema);
        } catch (SQLException e) {
          throw new IOException(e);
        }
    }
    throw new UnsupportedOperationException("Unsupported input format " + inFormat);
View Full Code Here

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

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

    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

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

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

  protected JdbcSource newJdbcSource() { return new JdbcSource(createDataSource());}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.