use of org.graylog.plugins.views.search.export.SimpleMessageChunk in project graylog2-server by Graylog2.
the class ElasticsearchExportBackendIT method assertResultMatches.
private void assertResultMatches(String resultFields, SimpleMessageChunk totalResult, String[] messageValues, boolean expectSorted) {
Object[][] values = Arrays.stream(messageValues).map(this::toObjectArray).toArray(Object[][]::new);
SimpleMessageChunk expected = TestData.simpleMessageChunkWithIndexNames(resultFields, values);
assertThat(totalResult).isEqualTo(expected);
if (expectSorted) {
assertThat(totalResult.messages()).containsExactlyElementsOf(expected.messages());
}
}
use of org.graylog.plugins.views.search.export.SimpleMessageChunk in project graylog2-server by Graylog2.
the class ElasticsearchExportBackendITBase 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");
}
use of org.graylog.plugins.views.search.export.SimpleMessageChunk in project graylog2-server by Graylog2.
the class ElasticsearchExportBackendITBase method assertResultMatches.
private void assertResultMatches(String resultFields, SimpleMessageChunk totalResult, String[] messageValues, boolean expectSorted) {
Object[][] values = Arrays.stream(messageValues).map(this::toObjectArray).toArray(Object[][]::new);
SimpleMessageChunk expected = TestData.simpleMessageChunkWithIndexNames(resultFields, values);
assertThat(totalResult).isEqualTo(expected);
if (expectSorted) {
assertThat(totalResult.messages()).containsExactlyElementsOf(expected.messages());
}
}
use of org.graylog.plugins.views.search.export.SimpleMessageChunk in project graylog2-server by Graylog2.
the class ElasticsearchExportBackendITBase method collectTotalResult.
private SimpleMessageChunk collectTotalResult(ExportMessagesCommand command) {
LinkedHashSet<SimpleMessageChunk> allChunks = collectChunksFor(command);
LinkedHashSet<SimpleMessage> allMessages = new LinkedHashSet<>();
for (SimpleMessageChunk chunk : allChunks) {
keepOnlyRelevantFields(chunk, command.fieldsInOrder());
allMessages.addAll(chunk.messages());
}
return SimpleMessageChunk.from(command.fieldsInOrder(), allMessages);
}
use of org.graylog.plugins.views.search.export.SimpleMessageChunk in project graylog2-server by Graylog2.
the class ElasticsearchExportBackendITBase method deliversCompleteLastChunkIfLimitIsReached.
@Test
public void deliversCompleteLastChunkIfLimitIsReached() {
importFixture("messages.json");
ExportMessagesCommand command = commandBuilderWithAllStreams().chunkSize(2).limit(3).build();
SimpleMessageChunk totalResult = collectTotalResult(command);
assertThat(totalResult.messages()).hasSize(4);
}
Aggregations