/** * Check that esper metrics are enabled (esper statement inserted). Check that listener will call * Spring Boot gauge service. * * @throws ConfigurationException * @throws EventTypeNotFoundException */ @Test public void checkMetrics() throws ConfigurationException, EventTypeNotFoundException { esperEventProcessor.setConfiguration(getBasicConf()); EventBean[] mockBeans = {mockMetricsBean}; // Check that metric statement is inserted ! for (EPStatement epStatement : esperEventProcessor.getEPStatements()) { if (epStatement.getName().equals("STATEMENT_METRIC")) { // Mock Esper metric event assertTrue(epStatement.getUpdateListeners().hasNext()); epStatement.getUpdateListeners().next().update(mockBeans, null); // Check Gauge service is notified one for each metric verify(gaugeService, times(4)).submit(anyString(), anyDouble()); return; } } fail("metric statement not found"); }