Source:
public void testAggregationTask() throws Exception { int port = 10000; int numNode = 3; for (StatsReportType type : StatsReportType.values()) { initializeNodeReports(type, numNode, port); String healthReportName = type == StatsReportType.ACCOUNT_REPORT ? HEALTH_REPORT_NAME_ACCOUNT : HEALTH_REPORT_NAME_PARTITION; String statsFieldName = type == StatsReportType.ACCOUNT_REPORT ? STATS_FIELD_NAME_ACCOUNT : STATS_FIELD_NAME_PARTITION; clusterMapConfig = makeClusterMapConfig(); task = new HelixHealthReportAggregatorTask(mockHelixManager, RELEVANT_PERIOD_IN_MINUTES, healthReportName, statsFieldName, type, null, clusterMapConfig, mockTime); task.run(); Stat stat = new Stat(); ZNRecord record = mockHelixManager.getHelixPropertyStore() .get(String.format("/%s%s", HelixHealthReportAggregatorTask.AGGREGATED_REPORT_PREFIX, healthReportName), stat, AccessOption.PERSISTENT); Assert.assertNotNull(record); Assert.assertNotNull(record.getSimpleField(HelixHealthReportAggregatorTask.VALID_SIZE_FIELD_NAME)); Assert.assertNotNull(record.getSimpleField(HelixHealthReportAggregatorTask.RAW_VALID_SIZE_FIELD_NAME)); if (type == StatsReportType.ACCOUNT_REPORT && this.enableAggregatedMonthlyAccountReport) { record = mockHelixManager.getHelixPropertyStore() .get(String.format("/%s%s%s", HelixHealthReportAggregatorTask.AGGREGATED_REPORT_PREFIX, healthReportName, HelixHealthReportAggregatorTask.AGGREGATED_MONTHLY_REPORT_SUFFIX), stat, AccessOption.PERSISTENT); Assert.assertNotNull(record); Assert.assertNotNull(record.getSimpleField(HelixHealthReportAggregatorTask.VALID_SIZE_FIELD_NAME)); Assert.assertNotNull(record.getSimpleField(HelixHealthReportAggregatorTask.RAW_VALID_SIZE_FIELD_NAME)); Assert.assertNotNull(record.getSimpleField(HelixHealthReportAggregatorTask.MONTH_NAME)); } } }

Target:
public void testAggregationTask() throws Exception { int port = 10000; int numNode = 3; for (StatsReportType type : StatsReportType.values()) { initializeNodeReports(type, numNode, port); String healthReportName = type == StatsReportType.ACCOUNT_REPORT ? HEALTH_REPORT_NAME_ACCOUNT : HEALTH_REPORT_NAME_PARTITION; String statsFieldName = type == StatsReportType.ACCOUNT_REPORT ? STATS_FIELD_NAME_ACCOUNT : STATS_FIELD_NAME_PARTITION; task = new HelixHealthReportAggregatorTask(mockHelixManager, RELEVANT_PERIOD_IN_MINUTES, healthReportName, statsFieldName, type, null, clusterMapConfig, mockTime); task.run(); Stat stat = new Stat(); ZNRecord record = mockHelixManager.getHelixPropertyStore() .get(String.format("/%s%s", HelixHealthReportAggregatorTask.AGGREGATED_REPORT_PREFIX, healthReportName), stat, AccessOption.PERSISTENT); Assert.assertNotNull(record); Assert.assertNotNull(record.getSimpleField(HelixHealthReportAggregatorTask.VALID_SIZE_FIELD_NAME)); Assert.assertNotNull(record.getSimpleField(HelixHealthReportAggregatorTask.RAW_VALID_SIZE_FIELD_NAME)); if (type == StatsReportType.ACCOUNT_REPORT && this.enableAggregatedMonthlyAccountReport) { record = mockHelixManager.getHelixPropertyStore() .get(String.format("/%s%s%s", HelixHealthReportAggregatorTask.AGGREGATED_REPORT_PREFIX, healthReportName, HelixHealthReportAggregatorTask.AGGREGATED_MONTHLY_REPORT_SUFFIX), stat, AccessOption.PERSISTENT); Assert.assertNotNull(record); Assert.assertNotNull(record.getSimpleField(HelixHealthReportAggregatorTask.VALID_SIZE_FIELD_NAME)); Assert.assertNotNull(record.getSimpleField(HelixHealthReportAggregatorTask.RAW_VALID_SIZE_FIELD_NAME)); Assert.assertNotNull(record.getSimpleField(HelixHealthReportAggregatorTask.MONTH_NAME)); } } }