Package com.cloudera.flume.core

Examples of com.cloudera.flume.core.EventImpl


  public void testReorderDecorator() throws IOException, InterruptedException {
    ReorderDecorator<EventSink> reorder =
        new ReorderDecorator<EventSink>(new ConsoleEventSink(), .5, .5, 0);
    reorder.open();
    for (int i = 0; i < 10; i++) {
      Event e = new EventImpl(new byte[0]);
      e.set("order", ByteBuffer.allocate(4).putInt(i).array());
      reorder.append(e);
    }
    System.out.println("closing");
    reorder.close();
  }
View Full Code Here


    MemorySinkSource mss = new MemorySinkSource();
    ReorderDecorator<EventSink> reorder =
        new ReorderDecorator<EventSink>(mss, .5, .5, 0);
    reorder.open();
    for (int i = 0; i < 10; i++) {
      Event e = new EventImpl(new byte[0]);
      e.set("order", ByteBuffer.allocate(4).putInt(i).array());
      reorder.append(e);
    }
    System.out.println("closing");
    reorder.close();
    int[] order = { 0, 2, 1, 4, 3, 5, 7, 6, 8, 9 };
    for (int i = 0; i < order.length; i++) {
      Event e = mss.next();
      int j = ByteBuffer.wrap(e.get("order")).asIntBuffer().get();
      assertEquals(j, order[i]);
    }

  }
View Full Code Here

    mem.open();
    DatumReader<EventImpl> dtm = new ReflectDatumReader<EventImpl>(
        EventImpl.class);
    DataFileReader<EventImpl> dr = new DataFileReader<EventImpl>(f, dtm);

    EventImpl eout = null;
    for (Object o : dr) {
      eout = (EventImpl) o; // TODO (jon) fix AVRO -- this is gross
      Event expected = mem.next();
      Assert.assertTrue(Arrays.equals(eout.getBody(), expected.getBody()));
    }

  }
View Full Code Here

    AckChecksumInjector<EventSink> aci = new AckChecksumInjector<EventSink>(
        new FanOutSink<EventSink>(cnt, new ConsoleEventSink()));

    aci.open();
    for (int i = 0; i < msgs; i++) {
      Event e = new EventImpl(("this is a test " + i).getBytes());
      aci.append(e);
    }
    aci.close();
    assertEquals(5 + 2, cnt.getCount()); // should have gotten 5 messages + 1
    // start ack and 1 stop ack.
View Full Code Here

    AckChecksumChecker<EventSink> acc = new AckChecksumChecker<EventSink>(mss);
    AckChecksumInjector<EventSink> aci = new AckChecksumInjector<EventSink>(acc);

    aci.open();
    for (int i = 0; i < msgs; i++) {
      Event e = new EventImpl(("this is a test " + i).getBytes());
      aci.append(e);
    }
    aci.close(); // will throw exception if checksum doesn't match

    Event eo = null;
View Full Code Here

        .5, 0);
    AckChecksumInjector<EventSink> cp = new AckChecksumInjector<EventSink>(ro);

    cp.open();
    for (int i = 0; i < 100; i++) {
      Event e = new EventImpl(("this is a test " + i).getBytes());
      cp.append(e);
    }
    cp.close();

    Event eo = null;
View Full Code Here

    try {

      cp.open();
      for (int i = 0; i < msgs; i++) {
        Event e = new EventImpl(("this is a test " + i).getBytes());
        cp.append(e);
      }

      cp.close();
    } catch (IOException ioe) {
View Full Code Here

    AckChecksumInjector<EventSink> cp = new AckChecksumInjector<EventSink>(
        dropStop);

    cp.open();
    for (int i = 0; i < msgs; i++) {
      Event e = new EventImpl(("this is a test " + i).getBytes());
      cp.append(e);
    }
    cp.close();

    // We don't detect an error here..
View Full Code Here

        dupeMsg);

    try {
      cp.open();
      for (int i = 0; i < 100; i++) {
        Event e = new EventImpl(("this is a test " + i).getBytes());
        cp.append(e);
      }
      cp.close();
    } catch (IOException ioe) {
      return;
View Full Code Here

    StubbornAppendSink<EventSink> sink = new StubbornAppendSink<EventSink>(
        failAppend);
    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

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.