@Test public void shouldGetMetricsEnabled() { when(settingsFacade.getProperty(METRICS_ENABLED)).thenReturn("true"); assertTrue(metricsConfigFacade.isMetricsEnabled()); }
@Test public void shouldGetMetricsConfig() { when(settingsFacade.getProperty(METRICS_ENABLED)).thenReturn("true"); when(settingsFacade.getProperty(CONSOLE_REPORTER_ENABLED)).thenReturn("true"); when(settingsFacade.getProperty(CONSOLE_REPORTER_REPORTING_FREQUENCY_VALUE)).thenReturn("1"); when(settingsFacade.getProperty(CONSOLE_REPORTER_REPORTING_FREQUENCY_UNIT)) .thenReturn("SECONDS"); when(settingsFacade.getProperty(CONSOLE_REPORTER_CONVERT_RATES_UNIT)) .thenReturn("MILLISECONDS"); when(settingsFacade.getProperty(CONSOLE_REPORTER_CONVERT_DURATIONS_UNIT)).thenReturn("SECONDS"); when(settingsFacade.getProperty(GRAPHITE_REPORTER_ENABLED)).thenReturn("true"); when(settingsFacade.getProperty(GRAPHITE_REPORTER_GRAPHITE_SERVER_URI)) .thenReturn("http://foo.com/graphite"); when(settingsFacade.getProperty(GRAPHITE_REPORTER_GRAPHITE_SERVER_PORT)).thenReturn("2003"); when(settingsFacade.getProperty(GRAPHITE_REPORTER_REPORTING_FREQUENCY_VALUE)).thenReturn("1"); when(settingsFacade.getProperty(GRAPHITE_REPORTER_REPORTING_FREQUENCY_UNIT)) .thenReturn("SECONDS"); when(settingsFacade.getProperty(GRAPHITE_REPORTER_CONVERT_RATES_UNIT)) .thenReturn("MILLISECONDS"); when(settingsFacade.getProperty(GRAPHITE_REPORTER_CONVERT_DURATIONS_UNIT)) .thenReturn("SECONDS"); MetricsConfig config = metricsConfigFacade.getMetricsConfig(); assertNotNull(config); assertEquals(config.isMetricsEnabled(), true); ConsoleReporterConfig crConfig = config.getConsoleReporterConfig(); assertNotNull(crConfig); assertEquals(crConfig.isEnabled(), true); assertEquals(crConfig.getFrequency(), 1); assertEquals(crConfig.getFrequencyUnit(), TimeUnit.SECONDS); assertEquals(crConfig.getConvertRates(), TimeUnit.MILLISECONDS); assertEquals(crConfig.getConvertDurations(), TimeUnit.SECONDS); GraphiteReporterConfig grConfig = config.getGraphiteReporterConfig(); assertNotNull(grConfig); assertEquals(grConfig.isEnabled(), true); assertEquals(grConfig.getServerUri(), "http://foo.com/graphite"); assertEquals(grConfig.getServerPort(), 2003); assertEquals(grConfig.getFrequency(), 1); assertEquals(grConfig.getFrequencyUnit(), TimeUnit.SECONDS); assertEquals(grConfig.getConvertRates(), TimeUnit.MILLISECONDS); assertEquals(grConfig.getConvertDurations(), TimeUnit.SECONDS); }