Examples of AvroJsonOutputFormat


Examples of com.cloudera.flume.handlers.avro.AvroJsonOutputFormat

   */
  @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
    }
View Full Code Here

Examples of com.cloudera.flume.handlers.avro.AvroJsonOutputFormat

   */
  @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
    }
View Full Code Here

Examples of com.cloudera.flume.handlers.avro.AvroJsonOutputFormat

    snk.open();
    snk.append(e);
    snk.close();

    ByteArrayOutputStream exWriter = new ByteArrayOutputStream();
    AvroJsonOutputFormat ajof = new AvroJsonOutputFormat();
    ajof.format(exWriter, e);
    exWriter.close();
    String expected = new String(exWriter.toByteArray());

    // check the output to make sure it is what we expected.
    File fo = new File(f.getPath() + "/sub-foo");
View Full Code Here

Examples of com.cloudera.flume.handlers.avro.AvroJsonOutputFormat

      }
    };

    String path = "file://" + f + "/%Y-%m-%d/";
    EventSink snk = new HiveNotifyingDfsSink(path, "file-%{host}", "hivetable",
        new AvroJsonOutputFormat(), hfrh);

    snk.open();
    long day_millis = 1000 * 60 * 60 * 24;
    Event e1 = new EventImpl(new byte[0], Clock.unixTime(), Priority.INFO, 0,
        "localhost");
View Full Code Here

Examples of com.cloudera.flume.handlers.avro.AvroJsonOutputFormat

    Event e3 = new EventImpl(new byte[0], e1.getTimestamp() + 2 * day_millis,
        Priority.INFO, 0, "localhost");

    String path = "file://" + f + "/%Y-%m-%d/";
    EventSink snk = new HiveNotifyingDfsSink(path, "file-%{host}", "hivetable",
        new AvroJsonOutputFormat(), hfrh);

    snk.open();
    snk.append(e1);
    snk.append(e2);
    snk.append(e3);
    snk.close();

    // Simulate a roll by send the messages a second time sink using the same
    // HiveNewDirNotification handlers.

    // TODO (jon) fix this sink's open close has a problem. here just
    // instantiating a new one
    snk = new HiveNotifyingDfsSink(path, "file-%{host}", "hivetable",
        new AvroJsonOutputFormat(), hfrh);
    snk.open();
    snk.append(e1);
    snk.append(e2);
    snk.append(e3);
    snk.close();
View Full Code Here

Examples of com.cloudera.flume.handlers.avro.AvroJsonOutputFormat

    Assert.assertTrue(s.endsWith("hostname test\n"));
  }

  @Test
  public void testAvroJson() throws IOException {
    OutputFormat format = new AvroJsonOutputFormat();
    ByteArrayOutputStream sos = new ByteArrayOutputStream();
    format.format(sos, e);
    String s = new String(sos.toByteArray());
    System.out.print(s);
    // TODO (jon) not sure if this will pass on every machine the same (how does
    // avro order fields?)
    Assert.assertEquals(s, "{\"body\":\"test\",\"timestamp\":0,"
View Full Code Here

Examples of com.cloudera.flume.handlers.avro.AvroJsonOutputFormat

   */
  @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
    }
View Full Code Here

Examples of com.cloudera.flume.handlers.avro.AvroJsonOutputFormat

   */
  @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
    }
View Full Code Here

Examples of com.cloudera.flume.handlers.avro.AvroJsonOutputFormat

    assertTrue("temp folder successfully deleted", FileUtil.rmr(f));
  }

  @Test
  public void testAvroOutputFormat() throws IOException, InterruptedException {
    checkOutputFormat("avrojson", new AvroJsonOutputFormat());
  }
View Full Code Here

Examples of com.cloudera.flume.handlers.avro.AvroJsonOutputFormat

    snk.open();
    snk.append(e);
    snk.close();

    ByteArrayOutputStream exWriter = new ByteArrayOutputStream();
    AvroJsonOutputFormat ajof = new AvroJsonOutputFormat();
    ajof.format(exWriter, e);
    exWriter.close();
    String expected = new String(exWriter.toByteArray());

    // check the output to make sure it is what we expected.
    File fo = new File(f.getPath() + "/sub-foo");
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.