Package com.cloudera.flume.core

Examples of com.cloudera.flume.core.EventSink


   */
  @Test
  public void checkSynth() throws IOException, InterruptedException {
    EventSource src = new SynthSource(5, 10, 1337);
    Event e = null;
    EventSink snk = new ConsoleEventSink(new AvroJsonOutputFormat());
    MemorySinkSource mem = new MemorySinkSource();
    while ((e = src.next()) != null) {
      snk.append(e); // visual inspection
      mem.append(e); // testing
    }

    mem.open();
    int i = 0;
View Full Code Here


   */
  @Test
  public void checkAttrSynth() throws IOException, InterruptedException {
    EventSource src = new AttrSynthSource(5, 10, 20, 15, 1337);
    Event e = null;
    EventSink snk = new ConsoleEventSink(new AvroJsonOutputFormat());
    MemorySinkSource mem = new MemorySinkSource();
    while ((e = src.next()) != null) {
      snk.append(e); // visual inspection
      mem.append(e); // testing
    }

    mem.open();
    int i = 0;
View Full Code Here

      @Override
      public EventSink build(Context context, String... argv) {
        if (argv.length != 1) {
          throw new IllegalArgumentException("need only a name argument");
        }
        EventSink snk = new AccumulatorSink(argv[0]);

        if (context.getValue(ReportTestingContext.TESTING_REPORTS) != null) {
          ReportManager.get().add(snk);
        }
View Full Code Here

   */
  synchronized public EventSink newWritingSink(final Tagger tagger)
      throws IOException {
    File dir = getDir(State.WRITING);
    final String tag = tagger.newTag();
    EventSink curSink = new SeqfileEventSink(new File(dir, tag)
        .getAbsoluteFile());
    writingQ.add(tag);
    DFOData data = new DFOData(tag);
    table.put(tag, data);
    writingCount.incrementAndGet();
View Full Code Here

  @Test
  public void testSimpleMem() throws IOException, InterruptedException {

    EventSource src = new NoNlASCIISynthSource(25, 100, 1);
    EventSink snk = new ConsoleEventSink();
    EventSink snk2 = new BenchmarkReportDecorator<EventSink>("report", snk);
    EventSink snk3 = new BenchmarkInjectDecorator<EventSink>(snk2);
    EventSink snk4 = new InMemoryDecorator<EventSink>(snk3);

    DirectDriver connect = new DirectDriver(src, snk4);
    src.open();
    snk4.open();
    connect.start();
    connect.join(Long.MAX_VALUE);
    src.close();
    snk4.close();
    snk2.getMetrics().toText(new OutputStreamWriter(System.err));
  }
View Full Code Here

   * Test insistent append metrics
   */
  @Test
  public void testThriftMetrics() throws JSONException, FlumeSpecException,
      IOException, InterruptedException {
    EventSink snk = FlumeBuilder.buildSink(new ReportTestingContext(),
        "thriftSink");
    ReportEvent rpt = ReportUtil.getFlattenedReport(snk);
    LOG.info(ReportUtil.toJSONObject(rpt).toString());
    assertNotNull(rpt.getLongMetric(ThriftEventSink.A_SENTBYTES));
    assertNotNull(rpt.getStringMetric(ThriftEventSink.A_SERVERHOST));
View Full Code Here

  }

  @Test
  public void testSimple() throws IOException, InterruptedException {
    EventSource src = new NoNlASCIISynthSource(25, 100, 1);
    EventSink snk = new ConsoleEventSink();
    EventSink snk2 = new BenchmarkReportDecorator<EventSink>("report", snk);
    EventSink snk3 = new BenchmarkInjectDecorator<EventSink>(snk2);

    DirectDriver connect = new DirectDriver(src, snk3);
    src.open();
    snk3.open();
    connect.start();
    connect.join(Long.MAX_VALUE);
    src.close();
    snk3.close();
    snk2.getMetrics().toText(new OutputStreamWriter(System.err));
  }
View Full Code Here

   * @throws InterruptedException
   */
  @Test
  public void testReportSink() throws FlumeSpecException, IOException, InterruptedException {
    String spec = "{benchinject(\"foo\") => {benchreport(\"report\", \"[ console , counter(\\\"test\\\") ]\")  => null } }";
    EventSink snk = FlumeBuilder.buildSink(new ReportTestingContext(), spec);
    snk.open();
    snk.append(new EventImpl(new byte[0]));
    snk.append(new EventImpl(new byte[0]));
    snk.close();

    CounterSink ctr = (CounterSink) ReportManager.get().getReportable("test");
    Assert.assertEquals(1, ctr.getCount());

  }
View Full Code Here

          sz = Integer.parseInt(argv[0]);
        }
        if (argv.length >= 2) {
          hashes = Integer.parseInt(argv[1]);
        }
        EventSink rptSink = new NullSink();
        if (argv.length >= 3) {
          String rptSpec = argv[2];
          try {
            rptSink = new CompositeSink(ctx, rptSpec);
          } catch (FlumeSpecException e) {
View Full Code Here

      public EventSinkDecorator<EventSink> build(Context context,
          String... argv) {
        Preconditions.checkArgument(argv.length >= 1 && argv.length <= 2,
            "usage: benchreport(name[,rptSink])");
        String name = argv[0];
        EventSink rptSink = new NullSink();
        if (argv.length >= 2) {
          String rptSpec = argv[1];
          try {
            rptSink = new CompositeSink(context, rptSpec);
          } catch (FlumeSpecException e) {
View Full Code Here

TOP

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

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.