Package com.cloudera.flume.conf

Examples of com.cloudera.flume.conf.ReportTestingContext


      fw.append("Line " + i + "\n");
      fw.flush();
    }
    fw.close();

    final CompositeSink snk = new CompositeSink(new ReportTestingContext(),
        "{ delay(50) => counter(\"count\") }");
    // Test start from end.
    final TailSource src = (TailSource) TailSource.builder().build(
        f.getAbsolutePath(), "true");
    final CountDownLatch done = new CountDownLatch(1);
View Full Code Here


    tmpFile = File.createTempFile("tmp-", ".tmp");
    tmpFile.deleteOnExit();

    source = TailSource.builder().build(tmpFile.getAbsolutePath(), "true");
    sink = CounterSink.builder().build(new ReportTestingContext(), "count");
    workerFailed = new AtomicBoolean(false);
    os = null;

    /*
     * A worker thread that blindly moves events until we send a poison pill
View Full Code Here

   * @throws InterruptedException
   */
  @Test
  public void testFailoverBuilder() throws IOException, InterruptedException {
    SinkBuilder bld = FailOverSink.builder();
    EventSink snk = bld.build(new ReportTestingContext(),
        "{intervalFlakeyAppend(2) => counter(\"pri\") } ", "counter(\"sec\")");
    snk.open();

    Event e = new EventImpl("foo".getBytes());
    snk.append(e);
View Full Code Here

   */
  @Test
  public void testBackoffFailoverBuilder() throws IOException,
      InterruptedException {
    SinkBuilder bld = BackOffFailOverSink.builder();
    EventSink snk = bld.build(new ReportTestingContext(),
        "{intervalFlakeyAppend(2) => counter(\"pri\") } ", "counter(\"sec\")");
    snk.open();

    Event e = new EventImpl("foo".getBytes());
    snk.append(e);
View Full Code Here

   */
  @Test
  public void testGetBackoffFailoverMetrics() throws JSONException {
    ReportTestUtils.setupSinkFactory();
    SinkBuilder bld = BackOffFailOverSink.builder();
    EventSink snk = bld.build(new ReportTestingContext(), "one", "two");
    ReportEvent rpt = snk.getMetrics();
    LOG.info(ReportUtil.toJSONObject(rpt).toString());
    assertNotNull(rpt.getLongMetric(BackOffFailOverSink.A_PRIMARY));
    assertNotNull(rpt.getLongMetric(BackOffFailOverSink.A_FAILS));
    assertNotNull(rpt.getLongMetric(BackOffFailOverSink.A_BACKUPS));
View Full Code Here

   */
  @Test
  public void testGetFailoverMetrics() throws JSONException {
    ReportTestUtils.setupSinkFactory();
    SinkBuilder bld = FailOverSink.builder();
    EventSink snk = bld.build(new ReportTestingContext(), "one", "two");
    ReportEvent rpt = snk.getMetrics();
    LOG.info(ReportUtil.toJSONObject(rpt).toString());
    assertNotNull(rpt.getLongMetric(FailOverSink.R_FAILS));
    assertNotNull(rpt.getLongMetric(FailOverSink.R_BACKUPS));
    assertNull(rpt.getStringMetric("primary.one.name"));
View Full Code Here

    // max 5s, backoff initially at 10ms
    BackoffPolicy bop = new CappedExponentialBackoff(10, 5000);
    final EventSink insistent = new InsistentAppendDecorator<EventSink>(
        fail4eva, bop);
    final EventSink sink = new LazyOpenDecorator<EventSink>(insistent);
    final EventSink roll = new RollSink(new ReportTestingContext(), "mock",
        10000, 100) {
      @Override
      public EventSink newSink(Context ctx) throws IOException {
        return sink;
      }
View Full Code Here

    f.deleteOnExit();

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

      @Override
View Full Code Here

  @Test
  public void testTailSource() throws IOException, FlumeSpecException,
      InterruptedException {
    File f = FileUtil.createTempFile("temp", ".tmp");
    f.deleteOnExit();
    final CompositeSink snk = new CompositeSink(new ReportTestingContext(),
        "{ delay(50) => counter(\"count\") }");
    final EventSource src = TailSource.builder().build(
        LogicalNodeContext.testingContext(), f.getAbsolutePath());
    final CountDownLatch done = new CountDownLatch(1);
    final int count = 30;
View Full Code Here

    File f = FileUtil.createTempFile("temp", ".tmp");
    f.deleteOnExit();
    File f2 = FileUtil.createTempFile("moved", ".tmp");
    f2.delete();
    f2.deleteOnExit();
    final CompositeSink snk = new CompositeSink(new ReportTestingContext(),
        "{ delay(50) => counter(\"count\") }");
    final EventSource src = TailSource.builder().build(
        LogicalNodeContext.testingContext(), f.getAbsolutePath());
    final CountDownLatch done = new CountDownLatch(1);
    final int count = 30;
View Full Code Here

TOP

Related Classes of com.cloudera.flume.conf.ReportTestingContext

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.