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

  ReportManager.get().clear();
  String spec = AgentFailChainSink.genBestEffortChain("counter(\"foo1\")",
      "counter(\"foo2\")", "counter(\"foo3\")");
  LOG.info("best effort failchain: " + spec);
  EventSink snk = FlumeBuilder.buildSink(new Context(), spec);
  ReportEvent rpt = ReportUtil.getFlattenedReport(snk);
  LOG.info(ReportUtil.toJSONObject(rpt).toString());
  // just check a sample of the values:
  assertEquals(
      "foo1",
      rpt.getStringMetric("primary.LazyOpenDecorator.StubbornAppend.foo1.name"));
  assertEquals("foo2",
      rpt.getStringMetric("backup.BackoffFailover.primary.LazyOpenDecorator."
          + "StubbornAppend.foo2.name"));
  assertEquals("foo3",
      rpt.getStringMetric("backup.BackoffFailover.backup.LazyOpenDecorator."
          + "StubbornAppend.foo3.name"));
}