StreamStatusMetricService { @CachedGauge(absolute = true, name = "streams.actions", timeout = 30, timeoutUnit = TimeUnit.SECONDS) public Map<String, String> getStreamActions() { Map<String, StreamStatusDTO> streams = streamStatusDao.getAll(); Map<String, String> result = new HashMap<>(); for (StreamStatusDTO stream : streams.values()) { result.put(stream.getStreamName(), stream.getActionsEnabled().toString()); } return result; } StreamStatusMetricService(StreamStatusDao streamStatusDao); @CachedGauge(absolute = true, name = "streams.count", timeout = 30, timeoutUnit = TimeUnit.SECONDS) int getTotalStreams(); @CachedGauge(absolute = true, name = "streams.names", timeout = 30, timeoutUnit = TimeUnit.SECONDS) List<String> getStreamNames(); @CachedGauge(absolute = true, name = "streams.actions", timeout = 30, timeoutUnit = TimeUnit.SECONDS) Map<String, String> getStreamActions();  }
@Test public void testGetStreamActions() throws Exception { Map<String, String> listActions= service.getStreamActions(); assertEquals("Expected value not found", 2, listActions.size()); assertTrue("Expected true not found", listActions.containsKey(StreamsHelper.STREAM_NAME)); assertTrue("Expected true not found", listActions.get(StreamsHelper.STREAM_NAME).equals(StreamsHelper.ACTION_LISTEN_TOKEN)); }