ElasticsearchConfig extends MapConfig { public Optional<Integer> getTransportPort() { if (containsKey(CONFIG_KEY_CLIENT_TRANSPORT_PORT)) { return Optional.of(getInt(CONFIG_KEY_CLIENT_TRANSPORT_PORT)); } 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 testGetTransportPort() throws Exception { assertFalse(EMPTY_CONFIG.getTransportPort().isPresent()); ElasticsearchConfig config = configForProperty("systems.es.client.transport.port", "9300"); assertTrue(config.getTransportPort().isPresent()); assertEquals(Integer.valueOf(9300), config.getTransportPort().get()); }