TextFileSink extends EventSink.Base { public OutputFormat getFormat() { return fmt; } TextFileSink(String fname);  TextFileSink(String fname, OutputFormat fmt); @Override synchronized void append(Event e); @Override synchronized void close(); @Override synchronized void open(); @Override synchronized ReportEvent getMetrics(); @Deprecated @Override synchronized ReportEvent getReport(); static SinkBuilder builder(); OutputFormat getFormat();  }
@Test public void testTextKWArgDeprecated() throws RecognitionException, FlumeSpecException { String s = "text(\"filename\", format=\"raw\")"; TextFileSink snk = (TextFileSink) FlumeBuilder.buildSink(new Context(), s); assertTrue(snk.getFormat() instanceof RawOutputFormat); s = "text(\"filename\", format=\"avrodata\")"; snk = (TextFileSink) FlumeBuilder.buildSink(new Context(), s); assertTrue(snk.getFormat() instanceof AvroDataFileOutputFormat); s = "text(\"filename\", format=\"avrojson\")"; snk = (TextFileSink) FlumeBuilder.buildSink(new Context(), s); assertTrue(snk.getFormat() instanceof AvroJsonOutputFormat); s = "text(\"filename\", format=\"seqfile\")"; snk = (TextFileSink) FlumeBuilder.buildSink(new Context(), s); assertTrue(snk.getFormat() instanceof SequenceFileOutputFormat); }
@Test public void testTextKWArg() throws RecognitionException, FlumeSpecException { String s = "text(\"filename\", format=raw)"; TextFileSink snk = (TextFileSink) FlumeBuilder.buildSink(new Context(), s); assertTrue(snk.getFormat() instanceof RawOutputFormat); s = "text(\"filename\", format=avrodata)"; snk = (TextFileSink) FlumeBuilder.buildSink(new Context(), s); assertTrue(snk.getFormat() instanceof AvroDataFileOutputFormat); s = "text(\"filename\", format=avrojson)"; snk = (TextFileSink) FlumeBuilder.buildSink(new Context(), s); assertTrue(snk.getFormat() instanceof AvroJsonOutputFormat); s = "text(\"filename\", format=seqfile)"; snk = (TextFileSink) FlumeBuilder.buildSink(new Context(), s); assertTrue(snk.getFormat() instanceof SequenceFileOutputFormat); s = "text(\"filename\", format=seqfile(\"bzip2\"))"; snk = (TextFileSink) FlumeBuilder.buildSink(new Context(), s); assertTrue(snk.getFormat() instanceof SequenceFileOutputFormat); }
@Test public void testTextFormatArg() throws RecognitionException, FlumeSpecException { String s = "text(\"filename\", raw)"; TextFileSink snk = (TextFileSink) FlumeBuilder.buildSink(new Context(), s); assertTrue(snk.getFormat() instanceof RawOutputFormat); s = "text(\"filename\", avrodata)"; snk = (TextFileSink) FlumeBuilder.buildSink(new Context(), s); assertTrue(snk.getFormat() instanceof AvroDataFileOutputFormat); s = "text(\"filename\", avrojson)"; snk = (TextFileSink) FlumeBuilder.buildSink(new Context(), s); assertTrue(snk.getFormat() instanceof AvroJsonOutputFormat); s = "text(\"filename\", seqfile)"; snk = (TextFileSink) FlumeBuilder.buildSink(new Context(), s); assertTrue(snk.getFormat() instanceof SequenceFileOutputFormat); }