use of org.graylog.plugins.views.search.searchtypes.MessageList in project graylog2-server by Graylog2.
the class CommandFactoryTest method combinesQueryStringIfSpecifiedOnMessageListAndQuery.
@Test
void combinesQueryStringIfSpecifiedOnMessageListAndQuery() {
MessageList ml = MessageList.builder().id("ml-id").query(ElasticsearchQueryString.of("from-messagelist")).build();
Query q = validQueryBuilderWith(ml).query(ElasticsearchQueryString.of("from-query")).build();
Search s = searchWithQueries(q);
ExportMessagesCommand command = buildFrom(s, ml.id());
ElasticsearchQueryString combined = ElasticsearchQueryString.of("from-query AND from-messagelist");
assertThat(command.queryString()).isEqualTo(combined);
}
use of org.graylog.plugins.views.search.searchtypes.MessageList in project graylog2-server by Graylog2.
the class CommandFactoryTest method takesStreamsFromSearchTypeIfNotEmpty.
@Test
void takesStreamsFromSearchTypeIfNotEmpty() {
MessageList ml = MessageList.builder().id("ml-id").streams(ImmutableSet.of("stream-1", "stream-2")).build();
Query q = validQueryBuilderWith(ml).filter(streamFilter("stream-3")).build();
Search s = searchWithQueries(q);
ExportMessagesCommand command = buildFrom(s, ml.id());
assertThat(command.streams()).isEqualTo(ml.effectiveStreams());
}
use of org.graylog.plugins.views.search.searchtypes.MessageList in project graylog2-server by Graylog2.
the class CommandFactoryTest method takesTimeRangeFromQueryIfNotSpecifiedOnMessageList.
@Test
void takesTimeRangeFromQueryIfNotSpecifiedOnMessageList() {
MessageList ml = MessageList.builder().id("ml-id").build();
Query q = validQueryBuilderWith(ml).build();
Search s = searchWithQueries(q);
ExportMessagesCommand command = buildFrom(s, ml.id());
assertThat(command.timeRange()).isEqualTo(q.timerange());
}
use of org.graylog.plugins.views.search.searchtypes.MessageList in project graylog2-server by Graylog2.
the class CommandFactoryTest method takesQueryStringFromMessageListIfOnlySpecifiedThere.
@Test
void takesQueryStringFromMessageListIfOnlySpecifiedThere() {
MessageList ml = MessageList.builder().id("ml-id").query(ElasticsearchQueryString.of("nacken")).build();
Query q = validQueryBuilderWith(ml).build();
Search s = searchWithQueries(q);
ExportMessagesCommand command = buildFrom(s, ml.id());
// noinspection OptionalGetWithoutIsPresent
assertThat(command.queryString()).isEqualTo(ml.query().get());
}
use of org.graylog.plugins.views.search.searchtypes.MessageList in project graylog2-server by Graylog2.
the class CommandFactoryTest method takesFieldsFromResultFormatIfSpecified.
@Test
void takesFieldsFromResultFormatIfSpecified() {
MessageList ml = MessageList.builder().id("ml-id").build();
Query q = validQueryBuilderWith(ml).build();
Search s = searchWithQueries(q);
ResultFormat resultFormat = ResultFormat.builder().fieldsInOrder("field-1", "field-2").build();
ExportMessagesCommand command = buildFrom(s, ml.id(), resultFormat);
assertThat(command.fieldsInOrder()).isEqualTo(resultFormat.fieldsInOrder());
}
Aggregations