private void check(SearchKey key, final SearchQuery query) throws Exception { when(session.getAttribute(SearchProcessor.SEARCH_MODSEQ)).thenReturn(null); when(session.getAttribute(ImapSessionUtils.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY)).thenReturn(mailboxSession); when(mailbox.search(query, mailboxSession)).thenReturn(new ArrayList<MessageUid>().iterator()); when(selectedMailbox.getApplicableFlags()).thenReturn(new Flags()); when(selectedMailbox.hasNewApplicableFlags()).thenReturn(false); SearchRequest message = new SearchRequest(command, new SearchOperation(key, new ArrayList<>()), false, TAG); processor.doProcess(message, session, TAG, command, responder); }
@Override protected Closeable addContextToMDC(SearchRequest message) { return MDCBuilder.create() .addContext(MDCBuilder.ACTION, "SEARCH") .addContext("useUid", message.isUseUids()) .addContext("searchOperation", message.getSearchOperation()) .build(); } }
@Override protected void doProcess(SearchRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) { final SearchOperation operation = request.getSearchOperation(); final SearchKey searchKey = operation.getSearchKey(); final boolean useUids = request.isUseUids(); List<SearchResultOption> resultOptions = operation.getResultOptions();
return new SearchRequest(command, new SearchOperation(finalKey, options), useUids, tag); } catch (IllegalCharsetNameException | UnsupportedCharsetException e) { LOGGER.debug("Unable to decode request", e);
final SearchOperation operation = request.getSearchOperation(); final SearchKey searchKey = operation.getSearchKey(); final boolean useUids = request.isUseUids(); List<SearchResultOption> resultOptions = operation.getResultOptions();
final ImapMessage result = new SearchRequest(command, new SearchOperation(finalKey, options), useUids, tag); return result; } catch (IllegalCharsetNameException e) {