@Test
public void testDFOFailchain() throws FlumeSpecException, JSONException {

  ReportManager.get().clear();
  String spec = AgentFailChainSink.genDfoChain("counter(\"foo1\")",
      "counter(\"foo2\")", "counter(\"foo3\")");
  LOG.info("disk failover failchain: " + spec);
  String node = NetUtils.localhost();
  EventSink snk = FlumeBuilder.buildSink(new LogicalNodeContext(node, node),
      spec);
  ReportEvent rpt = ReportUtil.getFlattenedReport(snk);
  LOG.info("testDFOFailchain report {}", ReportUtil.toJSONObject(rpt)
      .toString());
  // just check a sample of the values:
  assertEquals(
      "foo1",
      rpt.getStringMetric("backup.DiskFailover.LazyOpenDecorator."
          + "InsistentAppend.StubbornAppend.InsistentOpen."
          + "FailoverChainSink.primary.LazyOpenDecorator.StubbornAppend.foo1.name"));
  assertEquals(
      "foo2",
      rpt.getStringMetric("backup.DiskFailover.LazyOpenDecorator."
          + "InsistentAppend.StubbornAppend.InsistentOpen."
          + "FailoverChainSink.backup.BackoffFailover.primary.LazyOpenDecorator."
          + "StubbornAppend.foo2.name"));
  assertEquals(
      "foo3",
      rpt.getStringMetric("backup.DiskFailover.LazyOpenDecorator."
          + "InsistentAppend.StubbornAppend.InsistentOpen."
          + "FailoverChainSink.backup.BackoffFailover.backup.LazyOpenDecorator."
          + "StubbornAppend.foo3.name"));
}