@Test public void testGetIntegrationSummary() throws IOException, ParseException { String integrationId = "intId1"; Set<String> livePodIds = new HashSet<String>( Arrays.asList("pod1", "pod2", "pod3", "pod4", "pod5")); MetricsCollector collector = new MetricsCollector(null, jsondb, null); Map<String,RawMetrics> metrics = jsondbRM.getRawMetrics(integrationId); IntegrationMetricsSummary summary = intMH .compute(integrationId, metrics, livePodIds); assertThat(summary.getMessages()).isEqualTo(9); assertThat(summary.getErrors()).isEqualTo(3); assertThat(summary.getStart().get()).isEqualTo(ZonedDateTime.of(2018, 01, 31, 10, 20, 56, 0, ZoneId.of("Z")).toInstant()); jsondb.update(JsonDBRawMetrics.path("intId1","pod2"), JsonUtils.writer().writeValueAsString(raw("intId1","2","pod2",9L,"31-01-2018 10:22:56"))); Map<String,RawMetrics> updatedMetrics = jsondbRM.getRawMetrics(integrationId); IntegrationMetricsSummary updatedSummary = intMH .compute(integrationId, updatedMetrics, livePodIds); assertThat(updatedSummary.getMessages()).isEqualTo(15); assertThat(updatedSummary.getErrors()).isEqualTo(3); collector.close(); }
@Override public void close() throws IOException { LOGGER.info("Stopping metrics collector."); close(scheduler); close(executor); }
MetricsCollector implements Runnable, Closeable { @Override public void close() throws IOException { LOGGER.info("Stopping metrics collector."); close(scheduler); close(executor); } }
MetricsCollector implements Runnable, Closeable { @Override public void close() throws IOException { LOGGER.info("Stopping metrics collector."); close(scheduler); close(executor); } @Autowired  MetricsCollector(DataManager dataManager, JsonDB jsonDB, KubernetesClient kubernetes); }
MetricsCollector implements Runnable, Closeable { @Override public void close() throws IOException { LOGGER.info("Stopping metrics collector."); close(scheduler); close(executor); } @Autowired  MetricsCollector(DataManager dataManager, JsonDB jsonDB, KubernetesClient kubernetes); @PostConstruct @SuppressWarnings("FutureReturnValueIgnored") void open(); @Override void close(); @Override void run(); }
MetricsCollector implements Runnable, Closeable { @Override public void close() throws IOException { LOGGER.info("Stopping metrics collector."); close(scheduler); close(executor); } @Autowired  MetricsCollector(DataManager dataManager, JsonDB jsonDB, KubernetesClient kubernetes); @PostConstruct @SuppressWarnings("FutureReturnValueIgnored") void open(); @Override void close(); @Override void run();  }