Search in sources :

Example 16 with SearchVersion

use of org.graylog2.storage.SearchVersion in project graylog2-server by Graylog2.

the class NodeAdapterES6Test method retrievingVersionSucceedsIfElasticsearchVersionIsValid.

@Test
public void retrievingVersionSucceedsIfElasticsearchVersionIsValid() throws Exception {
    final JestResult jestResult = mock(JestResult.class);
    when(jestResult.isSucceeded()).thenReturn(true);
    when(jestResult.getJsonObject()).thenReturn(buildVersionJsonObject("5.4.0"));
    when(jestClient.execute(any(Ping.class))).thenReturn(jestResult);
    final Optional<SearchVersion> elasticsearchVersion = nodeAdapter.version();
    assertThat(elasticsearchVersion).contains(SearchVersion.elasticsearch("5.4.0"));
}
Also used : Ping(io.searchbox.core.Ping) SearchVersion(org.graylog2.storage.SearchVersion) JestResult(io.searchbox.client.JestResult) Test(org.junit.Test)

Aggregations

SearchVersion (org.graylog2.storage.SearchVersion)16 Optional (java.util.Optional)3 Inject (javax.inject.Inject)3 ElasticsearchProbeException (org.graylog2.storage.versionprobe.ElasticsearchProbeException)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 JestResult (io.searchbox.client.JestResult)2 Ping (io.searchbox.core.Ping)2 URI (java.net.URI)2 List (java.util.List)2 ExecutionException (java.util.concurrent.ExecutionException)2 Named (javax.inject.Named)2 MongodbServer (org.graylog.testing.containermatrix.MongodbServer)2 ContainerMatrixTestClassDescriptor (org.junit.jupiter.engine.descriptor.ContainerMatrixTestClassDescriptor)2 ContainerMatrixTestsDescriptor (org.junit.jupiter.engine.descriptor.ContainerMatrixTestsDescriptor)2 Logger (org.slf4j.Logger)2 LoggerFactory (org.slf4j.LoggerFactory)2 Duration (com.github.joschi.jadconfig.util.Duration)1 Attempt (com.github.rholder.retry.Attempt)1 RetryException (com.github.rholder.retry.RetryException)1