Package com.cloudera.flume.core

Examples of com.cloudera.flume.core.CompositeSink


  }

  @Test(expected = IllegalArgumentException.class)
  public void testRollRollConflict() throws IOException, FlumeSpecException,
      InterruptedException {
    EventSink snk = new CompositeSink(new Context(),
        "{value(\"rolltag\",\"foofoo\") =>   roll(10000) {null} } ");
    Event e = new EventImpl("foo".getBytes());
    snk.open();
    snk.append(e); // should bork.
  }
View Full Code Here


    snk.append(e); // should bork.
  }

  @Test(expected = IllegalArgumentException.class)
  public void testRollRollBork() throws IOException, FlumeSpecException, InterruptedException {
    EventSink snk = new CompositeSink(new Context(),
        "roll(10000) { roll(10000) { null } } ");
    Event e = new EventImpl("foo".getBytes());
    snk.open();
    snk.append(e); // should bork.
  }
View Full Code Here

    snk.append(e); // should bork.
  }

  @Test
  public void testRollRollNoConflict() throws IOException, FlumeSpecException, InterruptedException {
    EventSink snk = new CompositeSink(new Context(),
        "{value(\"rolltag\",\"foofoo\") =>  "
            + "{ mask(\"rolltag\")=>  roll(10000) { null}}} ");

    Event e = new EventImpl("foo".getBytes());
    snk.open();
    snk.append(e); // should not bork.
  }
View Full Code Here

    snk.append(e); // should not bork.
  }

  @Test
  public void testRollRollNoBork() throws IOException, FlumeSpecException, InterruptedException {
    EventSink snk = new CompositeSink(new Context(),
        "roll(10000) {{ mask(\"rolltag\") => roll(10000) {null} }} ");
    Event e = new EventImpl("foo".getBytes());
    snk.open();
    snk.append(e); // should not bork.
  }
View Full Code Here

    FlumeTestHarness.setupLocalWriteDir();
    File path = FileUtil.createTempFile("collector", ".tmp");
    path.deleteOnExit();

    EventSink snk = new CompositeSink(LogicalNodeContext.testingContext(),
        "{ ackedWriteAhead => roll(1000) { dfs(\"file:///"
            + StringEscapeUtils.escapeJava(path.getAbsolutePath()) + "\") } }");
    Event e = new EventImpl("foo".getBytes());
    snk.open();
    snk.append(e); // should not bork.
    snk.close();
    FlumeTestHarness.cleanupLocalWriteDir();
  }
View Full Code Here

      InterruptedException {
    FlumeTestHarness.setupLocalWriteDir();
    File path = FileUtil.createTempFile("collector", ".tmp");
    path.deleteOnExit();

    EventSink snk = new CompositeSink(LogicalNodeContext.testingContext(),
        "{ ackedWriteAhead => { mask(\"rolltag\") => roll(1000) { dfs(\"file:///"
            + StringEscapeUtils.escapeJava(path.getAbsolutePath())
            + "\") } } }");
    Event e = new EventImpl("foo".getBytes());
    snk.open();
    snk.append(e); // should not bork.
    snk.close();
    FlumeTestHarness.cleanupLocalWriteDir();
  }
View Full Code Here

    final CountDownLatch done = new CountDownLatch(threads);
    final NaiveFileWALManager wal = new NaiveFileWALManager(dir);
    wal.open();

    Context ctx = new ReportTestingContext();
    EventSink cntsnk = new CompositeSink(ctx, "counter(\"total\")");
    // use the same wal, but different counter.
    final EventSink snk = new NaiveFileWALDeco<EventSink>(ctx, cntsnk, wal,
        new TimeTrigger(new ProcessTagger(), 1000000), new AckListener.Empty(),
        1000000);
    snk.open();
View Full Code Here

        public void run() {
          start.countDown();
          try {
            EventSource src = new NoNlASCIISynthSource(count, 100);
            Context ctx = new ReportTestingContext();
            EventSink snk = new CompositeSink(ctx, "counter(\"total." + idx
                + "\")");
            // use the same wal, but different counter.
            snk = new NaiveFileWALDeco<EventSink>(ctx, snk, wal,
                new TimeTrigger(new ProcessTagger(), 1000000),
                new AckListener.Empty(), 1000000);
            src.open();
            snk.open();

            start.await();

            EventUtil.dumpAll(src, snk);
            src.close();
            snk.close();
          } catch (Exception e) {
            LOG.error("failure", e);
            // fail("e");
          } finally {
            done.countDown();
View Full Code Here

        public void run() {
          start.countDown();
          try {
            EventSource src = new NoNlASCIISynthSource(count, 100);
            Context ctx = new ReportTestingContext();
            EventSink snk = new CompositeSink(ctx, "counter(\"total." + idx
                + "\")");
            // use the same wal, but different counter.

            snk = new NaiveFileWALDeco<EventSink>(ctx, snk, wal,
                new TimeTrigger(new ProcessTagger(), 1000000),
                new AckListener.Empty(), 1000000);

            start.await();

            // allow for contention on the open call.
            src.open();
            snk.open();

            EventUtil.dumpAll(src, snk);
            src.close();
            snk.close();
          } catch (Exception e) {
            LOG.error("failure", e);
            // fail("e");
          } finally {
            done.countDown();
View Full Code Here

  @Test
  public void testTailPermissionDenied() throws IOException,
      FlumeSpecException, InterruptedException {
    File f;
    final EventSource eventSource;
    final CompositeSink eventSink;
    final AtomicBoolean workerFailed;
    Thread workerThread;
    FileWriter writer;
    long sleepTime;
    long eventCount;

    f = File.createTempFile("temp", ".tmp");
    f.setReadable(false, false);

    f.deleteOnExit();

    eventSource = TailSource.builder().build(f.getAbsolutePath());
    eventSink = new CompositeSink(new ReportTestingContext(),
        "{ delay(50) => counter(\"count\") }");
    workerFailed = new AtomicBoolean(false);
    workerThread = new Thread() {

      @Override
      public void run() {
        try {
          eventSource.open();
          eventSink.open();

          EventUtil.dumpN(10, eventSource, eventSink);
          Clock.sleep(500);
          eventSource.close();
          eventSink.close();
        } catch (Exception e) {
          LOG.error("Unexpected exception", e);
        }
      }
View Full Code Here

TOP

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

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.