Package com.cloudera.flume.core

Examples of com.cloudera.flume.core.EventImpl


   * @throws InterruptedException
   */
  @Test
  public void testStubbornNew() throws IOException, InterruptedException {
    EventSink failAppend = mock(EventSink.class);
    Event e = new EventImpl("test".getBytes());

    // for mocking void void returning calls, we use this mockito
    // syntax (it is kinda gross but still cleaner than the version above)
    // the first two calls "succeed", the third throws io exn, and then the
    // fourth
View Full Code Here


        cnt, 5);
    StubbornAppendSink<EventSink> sink = new StubbornAppendSink<EventSink>(
        flake);
    sink.open();
    for (int i = 0; i < 100; i++) {
      Event e = new EventImpl(("attempt " + i).getBytes());
      sink.append(e);
    }
    Assert.assertEquals(ok.get(), 100);

    ReportEvent rpt = sink.getMetrics();
View Full Code Here

    doNothing().doNothing().doThrow(new IOException()).doThrow(
        new IOException()).when(mock).append(Mockito.<Event> anyObject());
    doReturn(new ReportEvent("stub")).when(mock).getMetrics();

    StubbornAppendSink<EventSink> sink = new StubbornAppendSink<EventSink>(mock);
    Event e = new EventImpl("foo".getBytes());
    sink.open();
    sink.append(e);
    sink.append(e);
    try {
      sink.append(e);
View Full Code Here

        APACHE_REGEXES);

    Collection<RegexGroupHistogramSink> sinks = b.load();
    MultiReporter mr = new MultiReporter("apache_sinks", sinks);
    mr.open();
    mr.append(new EventImpl(sample.getBytes()));

    for (EventSink r : sinks) {
      System.out.println(r.getMetrics());
    }
  }
View Full Code Here

    EventSink es = FlumeBuilder.buildSink(new ReportTestingContext(
        LogicalNodeContext.testingContext()), snk);
    es.open();
    for (int i = 0; i < count; i++) {
      Event e = new EventImpl(("test message " + i).getBytes());
      es.append(e);
    }

    // last batch doesn't flush automatically unless time passes or closed-- one
    // pending
View Full Code Here

  public void testTestCountHistory() throws IOException, InterruptedException {
    // have a huge period and just force them in the test.
    CountHistoryReporter r = new CountHistoryReporter("test timeline", 5000000,
        t);
    r.open();
    Event e = new EventImpl("Test message".getBytes());

    // just a little forward to make things slighlty "out of sync"
    // 3
    r.append(e);
    r.append(e);
View Full Code Here

    byte[] tag = "my tag".getBytes();
    AckChecksumInjector<EventSink> ackinj = new AckChecksumInjector<EventSink>(
        mem, tag, pending);
    ackinj.open();
    for (int i = 0; i < 5; i++) {
      ackinj.append(new EventImpl(("Event " + i).getBytes()));
    }
    ackinj.close();

    // there now are now 7 events in the mem
    // consume data.
View Full Code Here

    MockClock m = new MockClock(0);
    Clock.setClock(m);

    CountHistoryReporter r = new CountHistoryReporter("test timeline", 500, t);
    r.open();
    Event e = new EventImpl("Test message".getBytes());

    // just a little forward to make things slighlty "out of sync"
    // 3
    r.append(e);
    r.append(e);
View Full Code Here

    EventSource src = new NoNlASCIISynthSource(25, 100, 1);
    src.open();

    EventUtil.dumpAll(src, snk);

    snk.append(new EventImpl(NPE.getBytes()));
    snk.append(new EventImpl(LOST.getBytes()));
    snk.append(new EventImpl(LOST.getBytes()));

    Histogram<String> h = snk.getHistogram();
    System.out.println(h);

    Assert.assertEquals(3, h.total());
View Full Code Here

    EventSource src = new NoNlASCIISynthSource(25, 100, 1);

    src.open();

    EventUtil.dumpAll(src, snk);
    snk.append(new EventImpl(NPE.getBytes()));
    snk.append(new EventImpl(LOST.getBytes()));
    snk.append(new EventImpl(LOST.getBytes()));

    Histogram<String> h = snk.getHistogram();
    System.out.println(h);

    Assert.assertEquals(3, h.total());
View Full Code Here

TOP

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

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.