Search in sources :

Example 1 with SearchDomain

use of org.graylog.plugins.views.search.SearchDomain in project graylog2-server by Graylog2.

the class MessagesResourceTest method setUp.

@BeforeEach
void setUp() {
    GuiceInjectorHolder.createInjector(Collections.emptyList());
    currentUser = mock(User.class);
    when(currentUser.getName()).thenReturn("peterchen");
    MessagesExporter exporter = mock(MessagesExporter.class);
    commandFactory = mock(CommandFactory.class);
    when(commandFactory.buildFromRequest(any())).thenReturn(ExportMessagesCommand.withDefaults());
    when(commandFactory.buildWithSearchOnly(any(), any())).thenReturn(ExportMessagesCommand.withDefaults());
    when(commandFactory.buildWithMessageList(any(), any(), any())).thenReturn(ExportMessagesCommand.withDefaults());
    permittedStreams = mock(PermittedStreams.class);
    when(permittedStreams.load(any())).thenReturn(ImmutableSet.of("a-default-stream"));
    executionGuard = mock(SearchExecutionGuard.class);
    SearchDomain searchDomain = mock(SearchDomain.class);
    final QueryValidationServiceImpl validationService = new QueryValidationServiceImpl(new LuceneQueryParser(), (streamIds, timeRange) -> Collections.emptySet(), new QueryStringDecorators(Collections.emptySet()));
    sut = new MessagesTestResource(exporter, commandFactory, searchDomain, executionGuard, permittedStreams, mock(ObjectMapper.class), eventBus, validationService);
    sut.asyncRunner = c -> {
        c.accept(x -> {
        });
        return null;
    };
}
Also used : SearchUser(org.graylog.plugins.views.search.permissions.SearchUser) User(org.graylog2.plugin.database.users.User) QueryValidationServiceImpl(org.graylog.plugins.views.search.validation.QueryValidationServiceImpl) QueryStringDecorators(org.graylog.plugins.views.search.elasticsearch.QueryStringDecorators) SearchDomain(org.graylog.plugins.views.search.SearchDomain) MessagesExporter(org.graylog.plugins.views.search.export.MessagesExporter) CommandFactory(org.graylog.plugins.views.search.export.CommandFactory) SearchExecutionGuard(org.graylog.plugins.views.search.SearchExecutionGuard) LuceneQueryParser(org.graylog.plugins.views.search.validation.LuceneQueryParser) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

SearchDomain (org.graylog.plugins.views.search.SearchDomain)1 SearchExecutionGuard (org.graylog.plugins.views.search.SearchExecutionGuard)1 QueryStringDecorators (org.graylog.plugins.views.search.elasticsearch.QueryStringDecorators)1 CommandFactory (org.graylog.plugins.views.search.export.CommandFactory)1 MessagesExporter (org.graylog.plugins.views.search.export.MessagesExporter)1 SearchUser (org.graylog.plugins.views.search.permissions.SearchUser)1 LuceneQueryParser (org.graylog.plugins.views.search.validation.LuceneQueryParser)1 QueryValidationServiceImpl (org.graylog.plugins.views.search.validation.QueryValidationServiceImpl)1 User (org.graylog2.plugin.database.users.User)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1