Package com.cloudera.flume.handlers.thrift.PrioritizedThriftEventSource

Examples of com.cloudera.flume.handlers.thrift.PrioritizedThriftEventSource.EventQueue


  @SuppressWarnings("serial")
  @Test
  public void testEventQueuePriority() throws InterruptedException {

    EventQueue q = new EventQueue(10) {

      {
        add(e5);
        add(e6);
        add(e1);
      }
    };

    Assert.assertEquals(q.take(), e5); // WARN
    Assert.assertEquals(q.take(), e1); // INFO
    Assert.assertEquals(q.take(), e6); // DEBUG

  }
View Full Code Here


  @SuppressWarnings("serial")
  @Test
  public void testEventQueueNanos() throws InterruptedException {

    EventQueue q = new EventQueue(10) {
      {
        add(e4);
        System.out.println("insert " + e4.getTimestamp() + " " + e4.getNanos()
            + " " + e4);
        add(e2);
        System.out.println("insert " + e2.getTimestamp() + " " + e2.getNanos()
            + " " + e2);
        add(e1);
        System.out.println("insert " + e1.getTimestamp() + " " + e1.getNanos()
            + " " + e1);
        add(e3);
        System.out.println("insert " + e3.getTimestamp() + " " + e3.getNanos()
            + " " + e3);
      }
    };

    Event[] ordered = { e1, e2, e3, e4 };
    for (int i = 0; i < ordered.length; i++) {
      Event qe = q.take();
      System.out.println("take   " + qe.getTimestamp() + " " + qe.getNanos()
          + " " + qe);
      Assert.assertEquals(ordered[i], qe);
    }
View Full Code Here

  @Test
  public void testEventQueueMillis() throws InterruptedException {
    Thread.sleep(100);

    final Event e = new EventImpl("test".getBytes());
    EventQueue q = new EventQueue(10) {
      {
        add(e);
        System.out.println("insert " + e.getTimestamp() + " " + e.getNanos()
            + " " + e);
        add(e4);
        System.out.println("insert " + e4.getTimestamp() + " " + e4.getNanos()
            + " " + e4);
        add(e2);
        System.out.println("insert " + e2.getTimestamp() + " " + e2.getNanos()
            + " " + e2);
        add(e1);
        System.out.println("insert " + e1.getTimestamp() + " " + e1.getNanos()
            + " " + e1);
        add(e3);
        System.out.println("insert " + e3.getTimestamp() + " " + e3.getNanos()
            + " " + e3);
      }
    };

    Event[] ordered = { e1, e2, e3, e4, e };
    for (int i = 0; i < ordered.length; i++) {
      Event qe = q.take();
      System.out.println("take   " + qe.getTimestamp() + " " + qe.getNanos()
          + " " + qe);
      Assert.assertEquals(ordered[i], qe);
    }
View Full Code Here

TOP

Related Classes of com.cloudera.flume.handlers.thrift.PrioritizedThriftEventSource.EventQueue

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.