XConfig { public Map<String, List<Double>> getClientRateLimitOverride() { return clientRateLimitOverride; } XConfig();  XConfig(Config configOverrides); Map<String, List<Double>> getClientRateLimitOverride();  }
@Test void getClientRateLimitOverride() { Config rawConfig = ConfigFactory.load("test.conf"); XConfig config = new XConfig(rawConfig.getConfig("xrpc")); Map<String, List<Double>> configTest = config.getClientRateLimitOverride(); double expected1 = Double.parseDouble("550"); double testVal1 = configTest.get("localhost").get(0); assertEquals(expected1, testVal1); double expected2 = Double.parseDouble("1"); double testVal2 = configTest.get("1.2.3.4").get(0); double expected3 = Double.parseDouble("2"); double testVal3 = configTest.get("1.2.3.4").get(1); assertEquals(expected2, testVal2); assertEquals(expected3, testVal3); }
@Test void deaultConfig_shouldUseCorrectXrpcConfigValues() { XConfig config = new XConfig(); assertEquals(TEN_MEGABYTES, config.maxPayloadBytes()); assertEquals(200 * SECONDS, config.readerIdleTimeout()); assertEquals(400 * SECONDS, config.writerIdleTimeout()); assertEquals(0, config.allIdleTimeout()); assertEquals("xrpc-worker-%d", config.workerNameFormat()); assertEquals(4, config.bossThreadCount()); assertEquals(40, config.workerThreadCount()); assertEquals(0, config.asyncHealthCheckThreadCount()); assertEquals(2000, config.maxConnections()); assertEquals(24, config.rateLimiterPoolSize()); assertEquals(500.0d, config.softReqPerSec()); assertEquals(550.0d, config.hardReqPerSec()); assertEquals(700.0d, config.globalSoftReqPerSec()); assertEquals(750.0d, config.globalHardReqPerSec()); assertEquals( ImmutableMap.of("127.0.0.1", Arrays.asList(500d, 550d)), config.getClientRateLimitOverride()); assertEquals(30 * SECONDS, config.slf4jReporterPollingRate()); assertEquals(30 * SECONDS, config.consoleReporterPollingRate()); assertEquals(NONE, config.ipBlackList()); assertEquals(NONE, config.ipWhiteList()); assertEquals("application/json", config.defaultContentType()); assertThat(config.port(), is(8080)); assertTrue(config.adminRoutesEnableInfo()); assertTrue(config.jmxReporter()); assertFalse(config.slf4jReporter()); assertFalse(config.adminRoutesEnableUnsafe()); assertFalse(config.consoleReporter()); }