use of co.cask.cdap.api.metrics.MetricValue in project cdap by caskdata.
the class MessagingMetricsCollectionServiceTest method checkReceivedMetrics.
protected void checkReceivedMetrics(Table<String, String, Long> expected, Map<String, MetricValues> actual) {
for (String expectedContext : expected.rowKeySet()) {
MetricValues metricValues = actual.get(expectedContext);
Assert.assertNotNull("Missing expected value for " + expectedContext, metricValues);
for (Map.Entry<String, Long> entry : expected.row(expectedContext).entrySet()) {
boolean found = false;
for (MetricValue metricValue : metricValues.getMetrics()) {
if (entry.getKey().equals(metricValue.getName())) {
Assert.assertEquals(entry.getValue().longValue(), metricValue.getValue());
found = true;
break;
}
}
Assert.assertTrue(found);
}
}
}
Aggregations