use of org.graylog.plugins.views.search.export.ExportMessagesCommand in project graylog2-server by Graylog2.
the class ElasticsearchExportBackendITBase method usesTimeRangeTestLtEqualToTimestampofLastEntry.
// This method tests, that with LT (the upper interval excluded) instead of LTE the message with a TS same as the upper interval is excluded
@Test
public void usesTimeRangeTestLtEqualToTimestampofLastEntry() {
importFixture("messages.json");
ExportMessagesCommand command = commandBuilderWithAllStreams().timeRange(timerange("2015-01-01T00:00:00.000Z", "2015-01-01T01:59:59.999Z")).build();
SimpleMessageChunk totalResult = collectTotalResult(command);
assertThat(totalResult.messages().stream().map(msg -> msg.fields().get("timestamp")).anyMatch("2015-01-01T01:00:00.000Z"::equals)).isTrue();
assertThat(totalResult.messages().stream().map(msg -> msg.fields().get("timestamp")).anyMatch("2015-01-01T01:59:59.999Z"::equals)).isFalse();
}
use of org.graylog.plugins.views.search.export.ExportMessagesCommand in project graylog2-server by Graylog2.
the class ElasticsearchExportBackendITBase method usesFieldsInOrder.
@Test
public void usesFieldsInOrder() {
importFixture("messages.json");
ExportMessagesCommand command = commandBuilderWithAllStreams().fieldsInOrder("timestamp", "message").build();
runWithExpectedResultIgnoringSort(command, "timestamp,message", "graylog_0, 2015-01-01T04:00:00.000Z, Ho", "graylog_0, 2015-01-01T03:00:00.000Z, Hi", "graylog_1, 2015-01-01T01:59:59.999Z, He", "graylog_0, 2015-01-01T01:00:00.000Z, Ha");
}
use of org.graylog.plugins.views.search.export.ExportMessagesCommand in project graylog2-server by Graylog2.
the class ElasticsearchExportBackendTest method appliesRequestStrategyStreamFilter.
@Test
void appliesRequestStrategyStreamFilter() {
ExportMessagesCommand command = ExportMessagesCommand.withDefaults().toBuilder().streams("stream-1", "stream-2").build();
when(requestStrategy.removeUnsupportedStreams(command.streams())).thenReturn(ImmutableSet.of("stream-1"));
sut.run(command, chunk -> {
});
String searchPayload = captureSearchPayload(command);
assertThat(searchPayload).doesNotContain("stream-2");
}
use of org.graylog.plugins.views.search.export.ExportMessagesCommand in project graylog2-server by Graylog2.
the class ElasticsearchExportBackendIT 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);
}
use of org.graylog.plugins.views.search.export.ExportMessagesCommand in project graylog2-server by Graylog2.
the class ElasticsearchExportBackendIT method usesFieldsInOrder.
@Test
public void usesFieldsInOrder() {
importFixture("messages.json");
ExportMessagesCommand command = commandBuilderWithAllStreams().fieldsInOrder("timestamp", "message").build();
runWithExpectedResultIgnoringSort(command, "timestamp,message", "graylog_0, 2015-01-01T04:00:00.000Z, Ho", "graylog_0, 2015-01-01T03:00:00.000Z, Hi", "graylog_1, 2015-01-01T01:59:59.999Z, He", "graylog_0, 2015-01-01T01:00:00.000Z, Ha");
}
Aggregations