@Test public void should_report_zero_unreachable_nodes_when_started() throws ConfigurationException, InterruptedException { InfoProvider infoProvider = mock(InfoProvider.class); List<String> unreachableNodes = new ArrayList<>(); when(infoProvider.getUnreachableNodes()).thenReturn(unreachableNodes); PowerMockito.mockStatic(DiagnosticsAgent.class); PowerMockito.when(DiagnosticsAgent.getInfoProvider()).thenReturn(infoProvider); final CountDownLatch latch = new CountDownLatch(1); final LatchTestReporter testReporter = new LatchTestReporter(null, GlobalConfiguration.getDefault(), latch); final List<Reporter> reporters = new ArrayList<Reporter>() { { add(testReporter); } }; int periodInMinutes = 1; boolean numberOfUnreachableNodesEnabled = true; final ClusterHealthModule module = new ClusterHealthModule( testConfiguration(periodInMinutes, numberOfUnreachableNodesEnabled), reporters, GlobalConfiguration.getDefault()); boolean wait = latch.await(1100, TimeUnit.MILLISECONDS); module.stop(); assertThat(wait).isTrue(); assertThat(testReporter.getReported().get(0).getValue()).isEqualTo(0.0); }
@Override public void stop() { logger.trace("Stopping status module."); timer.cancel(); }
ClusterHealthModule extends Module { @Override public void stop() { logger.trace("Stopping status module."); timer.cancel(); } }
ClusterHealthModule extends Module { @Override public void stop() { logger.trace("Stopping status module."); timer.cancel(); } ClusterHealthModule(ModuleConfiguration configuration, List<Reporter> reporters,
            final GlobalConfiguration globalConfiguration); }
ClusterHealthModule extends Module { @Override public void stop() { logger.trace("Stopping status module."); timer.cancel(); } ClusterHealthModule(ModuleConfiguration configuration, List<Reporter> reporters,
            final GlobalConfiguration globalConfiguration); @Override void stop(); }
ClusterHealthModule extends Module { @Override public void stop() { logger.trace("Stopping status module."); timer.cancel(); } ClusterHealthModule(ModuleConfiguration configuration, List<Reporter> reporters,
            final GlobalConfiguration globalConfiguration); @Override void stop();  }