@Test public void testSetMetrics() throws Exception { IndicatorsModel model = new IndicatorsModel(); model.setTimingMetricsMap(timingMetricsMap); ChartManager.setMetrics(chart, model); List<Series> series = conf.getSeries(); assertEquals(2, series.size()); DataSeries dataSeries1 = (DataSeries) series.get(0); DataSeries dataSeries2 = (DataSeries) series.get(1); assertEquals(METRIC1.getDescription(), dataSeries1.getName()); assertEquals(METRIC2.getDescription(), dataSeries2.getName()); DataSeriesItem item1 = dataSeries1.get(1); assertEquals(metricItem.getT95(), item1.getY()); assertEquals(DATE_TIME2, new LocalDateTime(item1.getX(), DateTimeZone.UTC)); }
@Test public void testSetTimings() throws Exception { IndicatorsModel model = new IndicatorsModel(); model.setTimingMetricsMap(timingMetricsMap); ChartManager.setTimings(chart, model); List<Series> series = conf.getSeries(); assertEquals(6, series.size()); assertEquals(TimingsType.MIN.getName(), series.get(0).getName()); assertEquals(TimingsType.MAX.getName(), series.get(1).getName()); assertEquals(TimingsType.AVG.getName(), series.get(2).getName()); assertEquals(TimingsType.P90.getName(), series.get(3).getName()); assertEquals(TimingsType.P95.getName(), series.get(4).getName()); assertEquals(TimingsType.P99.getName(), series.get(5).getName()); assertEquals(metricItem.getMin(), ((DataSeries) series.get(0)).get(1).getY()); assertEquals(metricItem.getMax(), ((DataSeries) series.get(1)).get(1).getY()); assertEquals(metricItem.getAvg(), ((DataSeries) series.get(2)).get(1).getY()); assertEquals(metricItem.getT90(), ((DataSeries) series.get(3)).get(1).getY()); assertEquals(metricItem.getT95(), ((DataSeries) series.get(4)).get(1).getY()); assertEquals(metricItem.getT99(), ((DataSeries) series.get(5)).get(1).getY()); }