use of org.graylog.plugins.views.search.searchtypes.events.EventList in project graylog2-server by Graylog2.
the class ESEventListTest method testSortingOfStreamsInDoExtractResult.
@Test
public void testSortingOfStreamsInDoExtractResult() {
final ESEventList esEventList = new TestESEventList();
final SearchJob searchJob = mock(SearchJob.class);
final Query query = mock(Query.class);
final SearchResult searchResult = mock(SearchResult.class);
final MetricAggregation metricAggregation = mock(MetricAggregation.class);
final ESGeneratedQueryContext queryContext = mock(ESGeneratedQueryContext.class);
final EventList eventList = EventList.builder().id("search-type-id").streams(ImmutableSet.of("stream-id-1", "stream-id-2")).build();
final EventList.Result eventResult = (EventList.Result) esEventList.doExtractResult(searchJob, query, eventList, searchResult, metricAggregation, queryContext);
assertThat(eventResult.events()).containsExactly(eventSummary("find-1", ImmutableSet.of("stream-id-1")), eventSummary("find-2", ImmutableSet.of("stream-id-2")), eventSummary("find-3", ImmutableSet.of("stream-id-1", "stream-id-2")));
}
use of org.graylog.plugins.views.search.searchtypes.events.EventList in project graylog2-server by Graylog2.
the class ESEventListTest method testSortingOfStreamsInDoExtractResult.
@Test
public void testSortingOfStreamsInDoExtractResult() {
final ESEventList esEventList = new TestESEventList();
final SearchJob searchJob = mock(SearchJob.class);
final Query query = mock(Query.class);
final SearchResponse searchResult = mock(SearchResponse.class);
final Aggregations metricAggregation = mock(Aggregations.class);
final ESGeneratedQueryContext queryContext = mock(ESGeneratedQueryContext.class);
final EventList eventList = EventList.builder().id("search-type-id").streams(ImmutableSet.of("stream-id-1", "stream-id-2")).build();
final EventList.Result eventResult = (EventList.Result) esEventList.doExtractResult(searchJob, query, eventList, searchResult, metricAggregation, queryContext);
assertThat(eventResult.events()).containsExactly(eventSummary("find-1", ImmutableSet.of("stream-id-1")), eventSummary("find-2", ImmutableSet.of("stream-id-2")), eventSummary("find-3", ImmutableSet.of("stream-id-1", "stream-id-2")));
}
use of org.graylog.plugins.views.search.searchtypes.events.EventList in project graylog2-server by Graylog2.
the class EventListTest method testEffectiveStream.
@Test
public void testEffectiveStream() {
final EventList eventList = EventList.builder().streams(ImmutableSet.of("dead-beef", "1337-beef")).build();
assertThat(eventList.effectiveStreams()).isEqualTo(ImmutableSet.of(DEFAULT_EVENTS_STREAM_ID, DEFAULT_SYSTEM_EVENTS_STREAM_ID));
assertThat(eventList.streams()).isEqualTo(ImmutableSet.of("dead-beef", "1337-beef"));
}
Aggregations