Configuration { public static Configuration getDefaultConfiguration() { return new Configuration() { { final ReporterConfiguration reporter = new ReporterConfiguration(); reporter.reporter = LogReporter.class.getName(); reporters.add(reporter); Map<String, Object> options = new HashMap<>(); options.put("period", 15); options.put("timeunit", TimeUnit.MINUTES.name()); final ModuleConfiguration module = new ModuleConfiguration(); module.measurement = "heartbeat"; module.module = HeartbeatModule.class.getName(); module.options = options; modules.add(module); connector = ConnectorConfiguration.getDefault(); global = GlobalConfiguration.getDefault(); } }; }  static Configuration getDefaultConfiguration(); @Override String toString(); public ConnectorConfiguration connector; public GlobalConfiguration global; public List<ReporterConfiguration> reporters; public List<ModuleConfiguration> modules; }
@Test public void default_connector_configuration() { Configuration conf = Configuration.getDefaultConfiguration(); assertThat(conf.connector.numWorkerThreads).isEqualTo(2); assertThat(conf.connector.queuedEventsOverflowThreshold).isEqualTo(1000); assertThat(conf.connector.queuedEventsRelaxThreshold).isEqualTo(700); assertThat(conf.connector.jmxHost).isEqualTo("127.0.0.1"); assertThat(conf.connector.jmxPort).isEqualTo(7199); assertThat(conf.connector.jmxAuthEnabled).isEqualTo(false); assertThat(conf.connector.jmxUsername).isEqualTo(null); assertThat(conf.connector.jmxPassword).isEqualTo(null); }
@Test public void default_configuration() { Configuration conf = Configuration.getDefaultConfiguration(); assertThat(conf.reporters.size()).isEqualTo(1); assertThat(conf.modules.size()).isEqualTo(1); assertThat(conf.global.httpApiEnabled).isTrue(); assertThat(conf.global.httpApiHost).isEqualTo("127.0.0.1"); assertThat(conf.global.httpApiPort).isEqualTo(8998); ReporterConfiguration reporterConfiguration = conf.reporters.get(0); assertThat(reporterConfiguration.reporter).isEqualTo(LogReporter.class.getName()); ModuleConfiguration moduleConfiguration = conf.modules.get(0); assertThat(moduleConfiguration.module).isEqualTo(HeartbeatModule.class.getName()); assertThat(moduleConfiguration.measurement).isEqualTo("heartbeat"); assertThat(moduleConfiguration.options.get("period")).isEqualTo(15); assertThat(moduleConfiguration.options.get("timeunit")).isEqualTo(TimeUnit.MINUTES.name()); }