Search in sources :

Example 1 with SimpleMessageChunk

use of org.graylog.plugins.views.search.export.SimpleMessageChunk in project graylog2-server by Graylog2.

the class ElasticsearchExportBackendIT method runWithExpectedResultIgnoringSort.

protected void runWithExpectedResultIgnoringSort(ExportMessagesCommand command, String resultFields, String... messageValues) {
    SimpleMessageChunk totalResult = collectTotalResult(command);
    assertResultMatches(resultFields, totalResult, messageValues, false);
}
Also used : SimpleMessageChunk(org.graylog.plugins.views.search.export.SimpleMessageChunk)

Example 2 with SimpleMessageChunk

use of org.graylog.plugins.views.search.export.SimpleMessageChunk in project graylog2-server by Graylog2.

the class ElasticsearchExportBackendIT method marksFirstChunk.

@Test
public void marksFirstChunk() {
    importFixture("messages.json");
    ExportMessagesCommand command = commandBuilderWithAllStreams().build();
    SimpleMessageChunk[] chunks = collectChunksFor(command).toArray(new SimpleMessageChunk[0]);
    assertThat(chunks[0].isFirstChunk()).isTrue();
}
Also used : SimpleMessageChunk(org.graylog.plugins.views.search.export.SimpleMessageChunk) ExportMessagesCommand(org.graylog.plugins.views.search.export.ExportMessagesCommand) ElasticsearchBaseTest(org.graylog.testing.elasticsearch.ElasticsearchBaseTest) Test(org.junit.Test)

Example 3 with SimpleMessageChunk

use of org.graylog.plugins.views.search.export.SimpleMessageChunk in project graylog2-server by Graylog2.

the class ElasticsearchExportBackendIT method respectsResultLimitIfSet.

@Test
public void respectsResultLimitIfSet() {
    importFixture("messages.json");
    ExportMessagesCommand command = commandBuilderWithAllStreams().chunkSize(1).limit(3).build();
    SimpleMessageChunk totalResult = collectTotalResult(command);
    assertThat(totalResult.messages()).hasSize(3);
}
Also used : SimpleMessageChunk(org.graylog.plugins.views.search.export.SimpleMessageChunk) ExportMessagesCommand(org.graylog.plugins.views.search.export.ExportMessagesCommand) ElasticsearchBaseTest(org.graylog.testing.elasticsearch.ElasticsearchBaseTest) Test(org.junit.Test)

Example 4 with SimpleMessageChunk

use of org.graylog.plugins.views.search.export.SimpleMessageChunk in project graylog2-server by Graylog2.

the class ElasticsearchExportBackendIT method resultsHaveAllMessageFields.

@Test
public void resultsHaveAllMessageFields() {
    importFixture("messages.json");
    ExportMessagesCommand command = commandBuilderWithAllStreams().fieldsInOrder("timestamp", "message").build();
    LinkedHashSet<SimpleMessageChunk> allChunks = collectChunksFor(command);
    SimpleMessageChunk totalResult = allChunks.iterator().next();
    Set<String> allFieldsInResult = actualFieldNamesFrom(totalResult);
    assertThat(allFieldsInResult).containsExactlyInAnyOrder("gl2_message_id", "source", "message", "timestamp", "streams", "_id");
}
Also used : SimpleMessageChunk(org.graylog.plugins.views.search.export.SimpleMessageChunk) ExportMessagesCommand(org.graylog.plugins.views.search.export.ExportMessagesCommand) ElasticsearchQueryString(org.graylog.plugins.views.search.elasticsearch.ElasticsearchQueryString) ElasticsearchBaseTest(org.graylog.testing.elasticsearch.ElasticsearchBaseTest) Test(org.junit.Test)

Example 5 with SimpleMessageChunk

use of org.graylog.plugins.views.search.export.SimpleMessageChunk in project graylog2-server by Graylog2.

the class ElasticsearchExportBackendIT method runWithExpectedResult.

protected void runWithExpectedResult(ExportMessagesCommand command, @SuppressWarnings("SameParameterValue") String resultFields, String... messageValues) {
    SimpleMessageChunk totalResult = collectTotalResult(command);
    assertResultMatches(resultFields, totalResult, messageValues, true);
}
Also used : SimpleMessageChunk(org.graylog.plugins.views.search.export.SimpleMessageChunk)

Aggregations

SimpleMessageChunk (org.graylog.plugins.views.search.export.SimpleMessageChunk)17 ExportMessagesCommand (org.graylog.plugins.views.search.export.ExportMessagesCommand)9 ElasticsearchBaseTest (org.graylog.testing.elasticsearch.ElasticsearchBaseTest)9 Test (org.junit.Test)9 LinkedHashSet (java.util.LinkedHashSet)3 ElasticsearchQueryString (org.graylog.plugins.views.search.elasticsearch.ElasticsearchQueryString)3 SimpleMessage (org.graylog.plugins.views.search.export.SimpleMessage)3 ImmutableSet (com.google.common.collect.ImmutableSet)1 Sets (com.google.common.collect.Sets)1 Arrays (java.util.Arrays)1 Set (java.util.Set)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Assertions.assertThatExceptionOfType (org.assertj.core.api.Assertions.assertThatExceptionOfType)1 IndexLookup (org.graylog.plugins.views.search.elasticsearch.IndexLookup)1 ExportException (org.graylog.plugins.views.search.export.ExportException)1 TestData (org.graylog.plugins.views.search.export.TestData)1 ElasticsearchException (org.graylog2.indexer.ElasticsearchException)1 AbsoluteRange (org.graylog2.plugin.indexer.searches.timeranges.AbsoluteRange)1 InvalidRangeParametersException (org.graylog2.plugin.indexer.searches.timeranges.InvalidRangeParametersException)1 Before (org.junit.Before)1