ElasticsearchConfig extends MapConfig { public Optional<Integer> getBulkFlushMaxSizeMB() { if (containsKey(CONFIG_KEY_BULK_FLUSH_MAX_SIZE_MB)) { return Optional.of(getInt(CONFIG_KEY_BULK_FLUSH_MAX_SIZE_MB)); } else { return Optional.empty(); } } ElasticsearchConfig(String name, Config config); String getClientFactoryClassName(); Config getElasticseachSettings(); Optional<String> getIndexRequestFactoryClassName(); Optional<String> getTransportHost(); Optional<Integer> getTransportPort(); Optional<Integer> getBulkFlushMaxActions(); Optional<Integer> getBulkFlushMaxSizeMB(); Optional<Integer> getBulkFlushIntervalMS(); static final String CONFIG_KEY_CLIENT_FACTORY; static final String PREFIX_ELASTICSEARCH_SETTINGS; static final String CONFIG_KEY_INDEX_REQUEST_FACTORY; static final String CONFIG_KEY_BULK_FLUSH_MAX_ACTIONS; static final String CONFIG_KEY_BULK_FLUSH_MAX_SIZE_MB; static final String CONFIG_KEY_BULK_FLUSH_INTERVALS_MS; static final String CONFIG_KEY_CLIENT_TRANSPORT_HOST; static final String CONFIG_KEY_CLIENT_TRANSPORT_PORT; }
@Test public void testGetBulkFlushMaxSizeMB() throws Exception { assertFalse(EMPTY_CONFIG.getBulkFlushMaxSizeMB().isPresent()); ElasticsearchConfig config = configForProperty("systems.es.bulk.flush.max.size.mb", "10"); assertTrue(config.getBulkFlushMaxSizeMB().isPresent()); assertEquals(Integer.valueOf(10), config.getBulkFlushMaxSizeMB().get()); }