Examples of CounterSink


Examples of com.cloudera.flume.reporter.aggregator.CounterSink

    final ThriftEventSource tes = new ThriftEventSource(
        conf.getCollectorPort() + 1); // this is a slight
    // tweak to avoid port conflicts
    tes.open();

    final CounterSink cnt = new CounterSink("count");
    cnt.open();
    Thread t = new Thread("drain") {
      public void run() {
        try {
          EventUtil.dumpAll(tes, cnt);
        } catch (IOException e) {
        } catch (InterruptedException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
    };
    t.start(); // drain the sink.

    // mem -> ThriftEventSink
    ThriftEventSink snk = new ThriftEventSink("0.0.0.0", conf
        .getCollectorPort() + 1);
    snk.open();
    EventUtil.dumpAll(mem, snk);
    mem.close();
    snk.close();

    // a little delay to drain events at ThriftEventSource queue
    try {
      Thread.sleep(1000);
      t.interrupt();
    } catch (InterruptedException e) {
    }
    tes.close();
    assertEquals(25, cnt.getCount());
    ReportEvent rpt = tes.getMetrics();
    assertEquals(4475, rpt.getLongMetric(ThriftEventSource.A_BYTES_IN)
        .longValue());
    assertEquals(25, rpt.getLongMetric(ThriftEventSource.A_DEQUEUED)
        .longValue());
View Full Code Here

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

  }

  @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));
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.