@Override protected ImapMessage createMessage(ImapCommand command, String referenceName, String mailboxPattern, String tag) { return new LsubRequest(command, referenceName, mailboxPattern, tag); } }
/** * @see * org.apache.james.imap.decode.parser.ListCommandParser#createMessage(org.apache.james.imap.api.ImapCommand, * java.lang.String, java.lang.String, java.lang.String) */ protected ImapMessage createMessage(ImapCommand command, String referenceName, String mailboxPattern, String tag) { final ImapMessage result = new LsubRequest(command, referenceName, mailboxPattern, tag); return result; } }
@Test public void testShouldRespondNoSelectToRegexWithParentsOfSubscribedMailboxes() throws Exception { subscriptions.add(MAILBOX_A); subscriptions.add(MAILBOX_B); subscriptions.add(MAILBOX_C); subscriptions.add(CHILD_ONE); subscriptions.add(CHILD_TWO); when(mailboxSession.getUser()).thenReturn(USER); expectSubscriptions(); when(serverResponseFactory.taggedOk(eq(TAG), same(command), eq(HumanReadableText.COMPLETED))) .thenReturn(statusResponse); LsubRequest request = new LsubRequest(command, "", ROOT + HIERARCHY_DELIMITER + "%", TAG); processor.doProcessRequest(request, session, TAG, command, responderImpl); verify(responder).respond(new LSubResponse(PARENT, true, HIERARCHY_DELIMITER)); verify(responder).respond(statusResponse); }
@Test public void testShouldRespondSelectToRegexWithParentOfSubscribedMailboxesWhenParentSubscribed() throws Exception { subscriptions.add(MAILBOX_A); subscriptions.add(MAILBOX_B); subscriptions.add(MAILBOX_C); subscriptions.add(PARENT); subscriptions.add(CHILD_ONE); subscriptions.add(CHILD_TWO); when(mailboxSession.getUser()).thenReturn(USER); expectSubscriptions(); when(serverResponseFactory.taggedOk(eq(TAG), same(command), eq(HumanReadableText.COMPLETED))) .thenReturn(statusResponse); LsubRequest request = new LsubRequest(command, "", ROOT + HIERARCHY_DELIMITER + "%", TAG); processor.doProcessRequest(request, session, TAG, command, responderImpl); verify(responder).respond(new LSubResponse(PARENT, false, HIERARCHY_DELIMITER)); verify(responder).respond(statusResponse); }
@Test public void testShouldRespondToRegexWithSubscribedMailboxes() throws Exception { subscriptions.add(MAILBOX_A); subscriptions.add(MAILBOX_B); subscriptions.add(MAILBOX_C); subscriptions.add(CHILD_ONE); subscriptions.add(CHILD_TWO); when(mailboxSession.getUser()).thenReturn(USER); expectSubscriptions(); when(serverResponseFactory.taggedOk(eq(TAG), same(command), eq(HumanReadableText.COMPLETED))) .thenReturn(statusResponse); LsubRequest request = new LsubRequest(command, "", PARENT + HIERARCHY_DELIMITER + "%", TAG); processor.doProcessRequest(request, session, TAG, command, responderImpl); verify(responder).respond(new LSubResponse(CHILD_ONE, false, HIERARCHY_DELIMITER)); verify(responder).respond(new LSubResponse(CHILD_TWO, false, HIERARCHY_DELIMITER)); verify(responder).respond(statusResponse); }
@Test public void testSelectAll() throws Exception { subscriptions.add(MAILBOX_A); subscriptions.add(MAILBOX_B); subscriptions.add(MAILBOX_C); when(mailboxSession.getUser()).thenReturn(USER); expectSubscriptions(); when(serverResponseFactory.taggedOk(eq(TAG), same(command), eq(HumanReadableText.COMPLETED))) .thenReturn(statusResponse); LsubRequest request = new LsubRequest(command, "", "*", TAG); processor.doProcessRequest(request, session, TAG, command, responderImpl); verify(responder).respond(new LSubResponse(MAILBOX_A, false, HIERARCHY_DELIMITER)); verify(responder).respond(new LSubResponse(MAILBOX_B, false, HIERARCHY_DELIMITER)); verify(responder).respond(new LSubResponse(MAILBOX_C, false, HIERARCHY_DELIMITER)); verify(responder).respond(statusResponse); }