@Test public void testGetMetricsFromCache() throws InterruptedException { TimelineMetricsHolder timelineMetricsHolder = TimelineMetricsHolder.getInstance(4,4, Collections.EMPTY_LIST); timelineMetricsHolder.extractMetricsForAggregationPublishing(); timelineMetricsHolder.extractMetricsForRawPublishing(); timelineMetricsHolder.putMetricsForRawPublishing(TimelineMetricsHolderTest.getTimelineMetricsWithAppID("raw1")); timelineMetricsHolder.putMetricsForAggregationPublishing(TimelineMetricsHolderTest.getTimelineMetricsWithAppID("aggr")); timelineMetricsHolder.putMetricsForRawPublishing(TimelineMetricsHolderTest.getTimelineMetricsWithAppID("raw2")); Configuration configuration = new Configuration(); RawMetricsPublisher rawMetricsPublisher = new RawMetricsPublisher(TimelineMetricsHolder.getInstance(), configuration, 1); Map<String, TimelineMetrics> metricsFromCache = rawMetricsPublisher.getMetricsFromCache(); Assert.assertNotNull(metricsFromCache); Collection<TimelineMetrics> actualTimelineMetrics = metricsFromCache.values(); Assert.assertNotNull(actualTimelineMetrics); Assert.assertEquals(2, actualTimelineMetrics.size()); for (TimelineMetrics timelineMetrics : actualTimelineMetrics) { List<TimelineMetric> metrics = timelineMetrics.getMetrics(); Assert.assertEquals(1, metrics.size()); Assert.assertTrue(metrics.get(0).getAppId().contains("raw")); } }
@Override protected Map<String, TimelineMetrics> getMetricsFromCache() { return timelineMetricsHolder.extractMetricsForRawPublishing(); }
RawMetricsPublisher extends AbstractMetricPublisher { @Override protected Map<String, TimelineMetrics> getMetricsFromCache() { return timelineMetricsHolder.extractMetricsForRawPublishing(); } }
RawMetricsPublisher extends AbstractMetricPublisher { @Override protected Map<String, TimelineMetrics> getMetricsFromCache() { return timelineMetricsHolder.extractMetricsForRawPublishing(); } RawMetricsPublisher(TimelineMetricsHolder timelineMetricsHolder, Configuration configuration, int interval); }
RawMetricsPublisher extends AbstractMetricPublisher { @Override protected Map<String, TimelineMetrics> getMetricsFromCache() { return timelineMetricsHolder.extractMetricsForRawPublishing(); } RawMetricsPublisher(TimelineMetricsHolder timelineMetricsHolder, Configuration configuration, int interval);  }
RawMetricsPublisher extends AbstractMetricPublisher { @Override protected Map<String, TimelineMetrics> getMetricsFromCache() { return timelineMetricsHolder.extractMetricsForRawPublishing(); } RawMetricsPublisher(TimelineMetricsHolder timelineMetricsHolder, Configuration configuration, int interval);   }