Package com.cloudera.flume.core

Examples of com.cloudera.flume.core.EventSource


      FlumeSpecException {
    Context ctx = LogicalNodeContext.testingContext();
    EventSink snk = FlumeBuilder.buildSink(new Context(), "console");
    snk.open();

    EventSource src = FlumeBuilder.buildSource(ctx, SOURCE);
    src.open();

    DirectDriver conn = new DirectDriver(src, snk);
    conn.start();

    conn.join(Long.MAX_VALUE);

    snk.close();
    src.close();
    assertNull(conn.getError());
  }
View Full Code Here


        fail4eva, bop);
    final EventSink sink = new LazyOpenDecorator<EventSink>(insistent);
    sink.open();

    // create an endless stream of data
    final EventSource source = new LazyOpenSource<EventSource>(
        new NoNlASCIISynthSource(0, 100));
    source.open();

    DirectDriver driver = new DirectDriver(source, sink);
    driver.start();
    Clock.sleep(1000); // let the insistent open try a few times.
    driver.stop();
View Full Code Here

        fail4eva, bop);
    final EventSink sink = new LazyOpenDecorator<EventSink>(insistent);
    sink.open();

    // create an endless stream of data
    final EventSource source = new EventSource.Base() {
      @Override
      public Event next() {
        return e;
      }
    };
View Full Code Here

  public void testMultiSink() throws IOException, FlumeSpecException,
      InterruptedException {
    Context ctx = LogicalNodeContext.testingContext();
    LOG.info("== multi test start");
    String multi = "[ console , accumulator(\"count\") ]";
    EventSource src = FlumeBuilder.buildSource(ctx, SOURCE);
    EventSink snk = FlumeBuilder.buildSink(new ReportTestingContext(), multi);
    src.open();
    snk.open();
    EventUtil.dumpAll(src, snk);
    src.close();
    snk.close();
    AccumulatorSink cnt = (AccumulatorSink) ReportManager.get().getReportable(
        "count");
    assertEquals(LINES, cnt.getCount());
    LOG.info("== multi test stop");
View Full Code Here

      }
    };
    roll.open();

    // create an endless stream of data
    final EventSource source = new EventSource.Base() {
      @Override
      public Event next() {
        return e;
      }
    };
View Full Code Here

        stubborn, new CappedExponentialBackoff(100, 100000));
    final EventSink sink = new LazyOpenDecorator<EventSink>(append);
    sink.open();

    // create an endless stream of data
    final EventSource source = new LazyOpenSource<EventSource>(
        new NoNlASCIISynthSource(0, 100));
    source.open();

    DirectDriver driver = new DirectDriver(source, sink);
    driver.start();
    Clock.sleep(1000); // let the insistent open try a few times.
    driver.stop();
View Full Code Here

    LOG.info("== Decorated start");
    String decorated = "{ intervalSampler(5) =>  accumulator(\"count\")}";
    // String decorated = "{ intervalSampler(5) =>  console }";

    EventSource src = FlumeBuilder.buildSource(ctx, SOURCE);
    EventSink snk = FlumeBuilder.buildSink(new ReportTestingContext(),
        decorated);
    src.open();
    snk.open();
    EventUtil.dumpAll(src, snk);
    src.close();
    snk.close();
    AccumulatorSink cnt = (AccumulatorSink) ReportManager.get().getReportable(
        "count");
    assertEquals(LINES / 5, cnt.getCount());
    LOG.info("== Decorated stop");
View Full Code Here

    Context ctx = LogicalNodeContext.testingContext();

    LOG.info("== failover start");
    // the primary is 90% flakey
    String multi = "< { flakeyAppend(.9,1337) => console } ? accumulator(\"count\") >";
    EventSource src = FlumeBuilder.buildSource(ctx, SOURCE);
    EventSink snk = FlumeBuilder.buildSink(new ReportTestingContext(), multi);
    src.open();
    snk.open();
    EventUtil.dumpAll(src, snk);
    src.close();
    snk.close();
    AccumulatorSink cnt = (AccumulatorSink) ReportManager.get().getReportable(
        "count");
    assertEquals(LINES, cnt.getCount());
    LOG.info("== failover stop");
View Full Code Here

    Map<String, Pair<EventSource, EventSink>> cfg = FlumeBuilder.build(
        new ReportTestingContext(), multi);
    for (Entry<String, Pair<EventSource, EventSink>> e : cfg.entrySet()) {
      // String name = e.getKey();
      EventSource src = e.getValue().getLeft();
      EventSink snk = e.getValue().getRight();
      src.open();
      snk.open();
      EventUtil.dumpAll(src, snk);
      src.close();
      snk.close();
    }
    AccumulatorSink cnt = (AccumulatorSink) ReportManager.get().getReportable(
        "count");
    assertEquals(LINES, cnt.getCount());
View Full Code Here

    // cannot write to the same instance.
    Event e1 = new EventImpl(new byte[0]);
    Event e2 = new EventImpl(new byte[0]);
    Event e3 = new EventImpl(new byte[0]);

    EventSource msrc = mock(EventSource.class);
    doNothing().when(msrc).open();
    doNothing().when(msrc).close();

    when(msrc.next()).thenReturn(e1).thenReturn(e2).thenReturn(e3).thenReturn(
        null);

    DiskFailoverDeco snk = new DiskFailoverDeco(msnk, LogicalNodeContext
        .testingContext(), FlumeNode.getInstance().getDFOManager(),
        new TimeTrigger(new ProcessTagger(), 60000), 300000);
View Full Code Here

TOP

Related Classes of com.cloudera.flume.core.EventSource

Copyright © 2018 www.massapicom. 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.