Search in sources :

Example 1 with EventList

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")));
}
Also used : Query(org.graylog.plugins.views.search.Query) MetricAggregation(io.searchbox.core.search.aggregation.MetricAggregation) ESEventList(org.graylog.storage.elasticsearch6.views.searchtypes.ESEventList) EventList(org.graylog.plugins.views.search.searchtypes.events.EventList) SearchJob(org.graylog.plugins.views.search.SearchJob) SearchResult(io.searchbox.core.SearchResult) ESEventList(org.graylog.storage.elasticsearch6.views.searchtypes.ESEventList) ESGeneratedQueryContext(org.graylog.storage.elasticsearch6.views.ESGeneratedQueryContext) SearchResult(io.searchbox.core.SearchResult) Test(org.junit.Test)

Example 2 with EventList

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")));
}
Also used : Query(org.graylog.plugins.views.search.Query) EventList(org.graylog.plugins.views.search.searchtypes.events.EventList) ESEventList(org.graylog.storage.elasticsearch7.views.searchtypes.ESEventList) Aggregations(org.graylog.shaded.elasticsearch7.org.elasticsearch.search.aggregations.Aggregations) SearchJob(org.graylog.plugins.views.search.SearchJob) ESEventList(org.graylog.storage.elasticsearch7.views.searchtypes.ESEventList) ESGeneratedQueryContext(org.graylog.storage.elasticsearch7.views.ESGeneratedQueryContext) SearchResponse(org.graylog.shaded.elasticsearch7.org.elasticsearch.action.search.SearchResponse) Test(org.junit.Test)

Example 3 with EventList

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"));
}
Also used : EventList(org.graylog.plugins.views.search.searchtypes.events.EventList) Test(org.junit.Test)

Aggregations

EventList (org.graylog.plugins.views.search.searchtypes.events.EventList)3 Test (org.junit.Test)3 Query (org.graylog.plugins.views.search.Query)2 SearchJob (org.graylog.plugins.views.search.SearchJob)2 SearchResult (io.searchbox.core.SearchResult)1 MetricAggregation (io.searchbox.core.search.aggregation.MetricAggregation)1 SearchResponse (org.graylog.shaded.elasticsearch7.org.elasticsearch.action.search.SearchResponse)1 Aggregations (org.graylog.shaded.elasticsearch7.org.elasticsearch.search.aggregations.Aggregations)1 ESGeneratedQueryContext (org.graylog.storage.elasticsearch6.views.ESGeneratedQueryContext)1 ESEventList (org.graylog.storage.elasticsearch6.views.searchtypes.ESEventList)1 ESGeneratedQueryContext (org.graylog.storage.elasticsearch7.views.ESGeneratedQueryContext)1 ESEventList (org.graylog.storage.elasticsearch7.views.searchtypes.ESEventList)1