DiskFailoverDeco extends EventSinkDecorator<EventSink> { public static SinkDecoBuilder builder() { return new SinkDecoBuilder() { @Override public EventSinkDecorator<EventSink> build(Context context, String... argv) { Preconditions.checkArgument(argv.length <= 1, "usage: diskFailover[(maxMillis[, checkmillis])]"); FlumeConfiguration conf = FlumeConfiguration.get(); long delayMillis = conf.getAgentLogMaxAge(); if (argv.length >= 1) { delayMillis = Long.parseLong(argv[0]); } long checkmillis = 250; if (argv.length >= 2) { checkmillis = Long.parseLong(argv[1]); } FlumeNode node = FlumeNode.getInstance(); String dfonode = context.getValue(LogicalNodeContext.C_LOGICAL); Preconditions.checkArgument(dfonode != null, "Context does not have a logical node name"); DiskFailoverManager dfoman = node.getAddDFOManager(dfonode); return new DiskFailoverDeco(null, context, dfoman, new TimeTrigger( new ProcessTagger(), delayMillis), checkmillis); } }; } DiskFailoverDeco(EventSink s, Context ctx,
      final DiskFailoverManager dfoman, RollTrigger t, long checkmillis); void setSink(EventSink sink); @Override synchronized void append(Event e); @Override synchronized void close(); @Override synchronized void open(); static SinkDecoBuilder builder(); @Override String getName(); @Override ReportEvent getMetrics(); @Override Map<String, Reportable> getSubMetrics(); DiskFailoverManager getFailoverManager(); RollSink getDFOWriter();  }
@Test public void testBuilder() { DiskFailoverDeco.builder().build(LogicalNodeContext.testingContext()); DiskFailoverDeco.builder().build(LogicalNodeContext.testingContext(), "1000"); }
@Test(expected = IllegalArgumentException.class) public void testBuilderFail1() { DiskFailoverDeco.builder().build(LogicalNodeContext.testingContext(), "12341", "foo"); }
@Test(expected = IllegalArgumentException.class) public void testBuilderFail2() { DiskFailoverDeco.builder() .build(LogicalNodeContext.testingContext(), "foo"); }