Package com.cloudera.flume.conf

Examples of com.cloudera.flume.conf.ReportTestingContext


   * @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

    final CountDownLatch start = new CountDownLatch(threads);
    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(ctx, cntsnk, wal,
        new TimeTrigger(new ProcessTagger(), 1000000), new AckListener.Empty(),
        1000000);
View Full Code Here

        @Override
        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(ctx, snk, wal, new TimeTrigger(
                new ProcessTagger(), 1000000), new AckListener.Empty(), 1000000);
View Full Code Here

        @Override
        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(ctx, snk, wal, new TimeTrigger(
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

  public void testAvailableSinkGen() throws IOException, FlumeSpecException,
      InterruptedException {

    List<String> names = Arrays.asList("first", "second", "third", "fourth",
        "fifth");
    FailoverChainSink snk = new FailoverChainSink(new ReportTestingContext(),
        "{ lazyOpen => { intervalFlakeyAppend(2) => accumulator(\"%s\")}}",
        names, new AlwaysRetryPolicy());

    // failover sink replaces each names
View Full Code Here

    List<String> names = Arrays.asList("first", "second", "third", "fourth",
        "fifth");
    String body = "{ lazyOpen => { intervalFlakeyAppend(2) => accumulator(\"%s\")}}";
    String spec = FailoverChainManager.genAvailableSinkSpec(body, names);
    System.out.println(spec);
    EventSink snk = new CompositeSink(new ReportTestingContext(), spec);

    LOG.info(snk.getMetrics().toText());

    snk.open();
    EventSource src = MemorySinkSource.cannedData("test is a test", 31);
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.