ElasticsearchConnectionManager implements ElasticsearchClientResolver, ElasticsearchConfigurationObserver { public ElasticsearchConnection getElasticsearchConnection() { return getElasticsearchConnection(null, false); }  void addElasticsearchConnection(
		ElasticsearchConnection elasticsearchConnection); @Override int compareTo(
		ElasticsearchConfigurationObserver elasticsearchConfigurationObserver); ElasticsearchConnection getElasticsearchConnection(); ElasticsearchConnection getElasticsearchConnection(
		boolean preferLocalCluster); ElasticsearchConnection getElasticsearchConnection(
		String connectionId); String getLocalClusterConnectionId(); @Override int getPriority(); @Override RestHighLevelClient getRestHighLevelClient(); @Override RestHighLevelClient getRestHighLevelClient(String connectionId); @Override RestHighLevelClient getRestHighLevelClient(
		String connectionId, boolean preferLocalCluster); boolean isCrossClusterReplicationEnabled(); @Override void onElasticsearchConfigurationUpdate(); void removeElasticsearchConnection(String connectionId);  }
@Test public void testGetElasticsearchConnectionWithRemoteModeDisabled() { Assert.assertEquals( _sidecarElasticsearchConnection, _elasticsearchConnectionManager.getElasticsearchConnection()); }
@Test public void testGetElasticsearchConnectionWithRemoteModeEnabled() { enableRemoteMode(); Assert.assertEquals( _defaultRemoteElasticsearchConnection, _elasticsearchConnectionManager.getElasticsearchConnection()); }
@Test public void testGetElasticsearchConnectionWithRemoteModeEnabledAndConnectionId() { enableRemoteMode(); setRemoteConnectionId(_REMOTE_1_CONNECTION_ID); Assert.assertEquals( _remoteElasticsearchConnection1, _elasticsearchConnectionManager.getElasticsearchConnection()); setRemoteConnectionId(_REMOTE_2_CONNECTION_ID); Assert.assertEquals( _remoteElasticsearchConnection2, _elasticsearchConnectionManager.getElasticsearchConnection()); }
@Test public void testGetExplicitElasticsearchConnectionWhenConnectionDoesNotExist() { Assert.assertEquals( null, _elasticsearchConnectionManager.getElasticsearchConnection("none")); }
@Test public void testGetExplicitElasticsearchConnectionWhenConnectionIdNull() { try { _elasticsearchConnectionManager.getElasticsearchConnection(null); Assert.fail(); } catch (NullPointerException nullPointerException) { } }
@Test public void testGetExplicitElasticsearchConnectionWithDifferentConnectionId() { setRemoteConnectionId(_REMOTE_1_CONNECTION_ID); Assert.assertEquals( _remoteElasticsearchConnection2, _elasticsearchConnectionManager.getElasticsearchConnection( _REMOTE_2_CONNECTION_ID)); }
@Test public void testGetExplicitElasticsearchConnectionWithRemoteModeDisabled() { Assert.assertEquals( _remoteElasticsearchConnection1, _elasticsearchConnectionManager.getElasticsearchConnection( _REMOTE_1_CONNECTION_ID)); Assert.assertEquals( _remoteElasticsearchConnection2, _elasticsearchConnectionManager.getElasticsearchConnection( _REMOTE_2_CONNECTION_ID)); }
@Test public void testGetExplicitElasticsearchConnectionWithRemoteModeEnabled() { enableRemoteMode(); Assert.assertEquals( _remoteElasticsearchConnection1, _elasticsearchConnectionManager.getElasticsearchConnection( _REMOTE_1_CONNECTION_ID)); Assert.assertEquals( _remoteElasticsearchConnection2, _elasticsearchConnectionManager.getElasticsearchConnection( _REMOTE_2_CONNECTION_ID)); }
@Test public void testGetExplicitElasticsearchConnectionWithRemoteModeEnabledAndDifferentConnectionId() { enableRemoteMode(); setRemoteConnectionId(_REMOTE_1_CONNECTION_ID); Assert.assertEquals( _remoteElasticsearchConnection2, _elasticsearchConnectionManager.getElasticsearchConnection( _REMOTE_2_CONNECTION_ID)); }