Clock.sleep(2000);
LogicalNode coll = setupColl(12345, "coll", "count");
LogicalNode coll2 = setupColl(12346, "coll2", "count2");
// wait until the counts add up properly
AccumulatorSink ctr = (AccumulatorSink) ReportManager.get().getReportable(
"count");
AccumulatorSink ctr2 = (AccumulatorSink) ReportManager.get().getReportable(
"count2");
loopUntilCount(count, coll, coll2);
// close off the collector
coll.close();
coll2.close();
// dump info for debugging
Map<String, ReportEvent> rpts = new HashMap<String, ReportEvent>();
agent.getReports(rpts);
for (Entry<String, ReportEvent> e : rpts.entrySet()) {
LOG.info(e.getKey() + " : " + e.getValue());
}
// check the end states
assertEquals(count, ctr.getCount() + ctr2.getCount());
assertTrue(ctr.getCount() > 0);
assertTrue(ctr2.getCount() > 0);
// the collector can be in ERROR or IDLE state because of the randomness.
NodeState stateColl = coll.getStatus().state;
LOG.info("coll exited in state: " + stateColl);
assertTrue(stateColl.equals(NodeState.IDLE)