Search in sources :

Example 11 with IndexingRequest

use of org.graylog2.indexer.messages.IndexingRequest in project graylog2-server by Graylog2.

the class MessagesAdapterES6Test method bulkIndexReturnsEmptyListIfSuccessful.

@Test
void bulkIndexReturnsEmptyListIfSuccessful() throws Exception {
    final BulkResult jestResult = mock(BulkResult.class);
    when(jestResult.isSucceeded()).thenReturn(true);
    when(jestClient.execute(any())).thenReturn(jestResult);
    final List<IndexingRequest> messageList = messageListWith(messageWithId("some-message"));
    final List<Messages.IndexingError> indexingErrors = messagesAdapter.bulkIndex(messageList);
    assertThat(indexingErrors).isEmpty();
}
Also used : IndexingRequest(org.graylog2.indexer.messages.IndexingRequest) BulkResult(io.searchbox.core.BulkResult) Test(org.junit.jupiter.api.Test)

Aggregations

IndexingRequest (org.graylog2.indexer.messages.IndexingRequest)9 BulkResult (io.searchbox.core.BulkResult)5 List (java.util.List)5 Message (org.graylog2.plugin.Message)5 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 IndexSet (org.graylog2.indexer.IndexSet)4 Messages (org.graylog2.indexer.messages.Messages)4 DateTime (org.joda.time.DateTime)4 Test (org.junit.jupiter.api.Test)4 MetricRegistry (com.codahale.metrics.MetricRegistry)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 Arrays (java.util.Arrays)3 Collections (java.util.Collections)3 Collectors (java.util.stream.Collectors)3 ChunkedBulkIndexer (org.graylog2.indexer.messages.ChunkedBulkIndexer)3 Indexable (org.graylog2.indexer.messages.Indexable)3 ImmutableList (com.google.common.collect.ImmutableList)2 JestClient (io.searchbox.client.JestClient)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2