Package com.cloudera.flume.conf.SinkFactory

Examples of com.cloudera.flume.conf.SinkFactory.SinkBuilder.build()


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


        // TODO replace with Generator Sink lookup
        Preconditions.checkArgument("collector".equals(sourceType));
        SinkBuilder builder = CollectorSink.builder();

        return builder.build(ctx, args.toArray(new String[0]));

      } catch (IllegalArgumentException iae) {
        throw new FlumeSpecException(iae.getMessage());
      }
View Full Code Here

   * No exception expected
   */
  @Test
  public void testBadArgsParseOK() {
    SinkBuilder sb = DFSEventSink.builder();
    sb.build(new Context(), "/foo/msgs");
  }

  /**
   * wrong # args, exception expected
   */
 
View Full Code Here

   * wrong # args, exception expected
   */
  @Test(expected = IllegalArgumentException.class)
  public void testBadArgsParseOkInstanceFail() {
    SinkBuilder sb = DFSEventSink.builder();
    sb.build(new Context());
  }

  /**
   * Failure occurs when opened due to permissions.
   *
 
View Full Code Here

  @Test
  public void testBadArgsOpenFail() throws IOException, InterruptedException {
    assumeTrue(!OSUtils.isWindowsOS());

    SinkBuilder sb = DFSEventSink.builder();
    EventSink snk = sb.build(new Context(), "/foo/msgs");
    try {
      snk.open();
    } catch (IOException e) {
      return;
    }
View Full Code Here

   * Expect no failures
   */
  @Test
  public void testBuilder() {
    SinkBuilder esb = HBaseSink.builder();
    HBaseSink snk = (HBaseSink) esb.build(LogicalNodeContext.testingContext(),
        "table", "%{rowkey}", "cf1", "col1", "%{attr1}", "cf2", "col2",
        "%{attr2}");
    assertEquals(snk.tableName, "table");
    assertEquals(snk.rowkey, "%{rowkey}");

View Full Code Here

  }

  @Test(expected = IllegalArgumentException.class)
  public void testFailNotTriples() {
    SinkBuilder esb = HBaseSink.builder();
    HBaseSink snk = (HBaseSink) esb.build(LogicalNodeContext.testingContext(),
        "table", "%{rowkey}", "cf1", "col1", "%{attr1}", "cf2", "col2");
  }

  @Test(expected = IllegalArgumentException.class)
  public void testFailNotEnough() {
View Full Code Here

  }

  @Test(expected = IllegalArgumentException.class)
  public void testFailNotEnough() {
    SinkBuilder esb = HBaseSink.builder();
    HBaseSink snk = (HBaseSink) esb.build(LogicalNodeContext.testingContext(),
        "table");
  }

  @Test
  public void testKwArgs() throws FlumeSpecException {
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

TOP
Copyright © 2018 www.massapi.com. 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.