private boolean reloadConfigIfRequested(HttpServletRequest req) { if (req.getParameter("reload") != null) { configuration.reloadDynamicConfigurationOptions(); return true; } return false; }
@Override public void run() { logger.debug("Beginning scheduled configuration reload (interval is {} sec)...", rate); reloadDynamicConfigurationOptions(); logger.debug("Finished scheduled configuration reload"); } }, rate, rate, timeUnit);
@Before public void setUp() throws Exception { abstractAlerterTest.configurationSource.add("stagemonitor.reporting.elasticsearch.url", elasticsearchUrl.toString()); abstractAlerterTest.configuration.reloadDynamicConfigurationOptions(); httpAlerter = new HttpAlerter(); this.alertSender = abstractAlerterTest.createAlertSender(httpAlerter); }
@Before public void setUp() throws Exception { abstractAlerterTest.configurationSource.add("stagemonitor.reporting.elasticsearch.url", elasticsearchUrl.toString()); abstractAlerterTest.configuration.reloadDynamicConfigurationOptions(); elasticsearchAlerter = new ElasticsearchAlerter(abstractAlerterTest.configuration, new HttpClient()); this.alertSender = abstractAlerterTest.createAlertSender(elasticsearchAlerter); }
@Test public void testProcessShortDescriptionTemplate() throws Exception { assertEquals("[OK -> CRITICAL] Test Timer has 2 failing checks", alertTemplateProcessor.processShortDescriptionTemplate(createIncidentWithVersion("1", 1))); // modify template configurationSource.add("stagemonitor.alerts.template.shortDescription", "foo"); configuration.reloadDynamicConfigurationOptions(); assertEquals("foo", alertTemplateProcessor.processShortDescriptionTemplate(testIncident)); }
@Test public void testCachingAndReload() { assertEquals("testCaching", testCaching.getValue()); configSource.add("testCaching", "testCaching2"); assertEquals("testCaching", testCaching.getValue()); configuration.reloadDynamicConfigurationOptions(); assertEquals("testCaching", testCaching.getValue()); configuration.reloadAllConfigurationOptions(); assertEquals("testCaching2", testCaching.getValue()); }