Map<String, String> statFields = getStatFields("0", "0");
_statsHolder.applyStat(incomingStatName, statFields);
_statsHolder.persistStats();
// check persistent stats
HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
Builder keyBuilder = accessor.keyBuilder();
ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
System.out.println("rec: " + rec.toString());
String persistentStat = "window(3)(dbFoo.partition10.latency)";
AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0"));
AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0"));
// add 2nd stat
statFields = getStatFields("10", "1");
_statsHolder.applyStat(incomingStatName, statFields);
_statsHolder.persistStats();
rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
System.out.println("rec: " + rec.toString());
AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0,10.0"));
AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0,1.0"));
// add 3rd stat
statFields = getStatFields("20", "2");
_statsHolder.applyStat(incomingStatName, statFields);
_statsHolder.persistStats();
rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
System.out.println("rec: " + rec.toString());
AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0,10.0,20.0"));
AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0,1.0,2.0"));