Package org.apache.james.imap.message.response

Examples of org.apache.james.imap.message.response.LSubResponse


        subscriptions.add(CHILD_ONE);
        subscriptions.add(CHILD_TWO);

        mockery.checking(new Expectations() {{
            oneOf(responder).respond(with(
                    equal(new LSubResponse(PARENT, false, HIERARCHY_DELIMITER))));
        }});

        expectSubscriptions();
        expectOk();
View Full Code Here


    @Test
    public void testSelectAll() throws Exception {
        mockery.checking(new Expectations() {{
            oneOf(responder).respond(with(equal(
                    new LSubResponse(MAILBOX_A, false, HIERARCHY_DELIMITER))));
            oneOf(responder).respond(with(equal(
                    new LSubResponse(MAILBOX_B, false, HIERARCHY_DELIMITER))));
            oneOf(responder).respond(with(equal(
                    new LSubResponse(MAILBOX_C, false, HIERARCHY_DELIMITER))));
        }});
        subscriptions.add(MAILBOX_A);
        subscriptions.add(MAILBOX_B);
        subscriptions.add(MAILBOX_C);
View Full Code Here

    }

    private void respond(Responder responder, final MailboxQuery expression, final String mailboxName, final boolean originalSubscription, final Collection<String> mailboxes, final Collection<String> mailboxResponses, final char delimiter) {
        if (expression.isExpressionMatch(mailboxName)) {
            if (!mailboxResponses.contains(mailboxName)) {
                final LSubResponse response = new LSubResponse(mailboxName, !originalSubscription, delimiter);
                responder.respond(response);
                mailboxResponses.add(mailboxName);
            }
        } else {
            final int lastDelimiter = mailboxName.lastIndexOf(delimiter);
View Full Code Here

     *
     * @param referenceName
     *            IMAP reference name, possibly null
     */
    private void respondWithHierarchyDelimiter(final Responder responder, final char delimiter) {
        final LSubResponse response = new LSubResponse("", true, delimiter);
        responder.respond(response);
    }
View Full Code Here

    @Test
    public void testIsAcceptable() {
        assertTrue(encoder.isAcceptable(new ListResponse(true, true, true,
                true, false, false, "name", '.')));
        assertFalse(encoder.isAcceptable(new LSubResponse("name", true, '.')));
        assertFalse(encoder.isAcceptable(context.mock(ImapMessage.class)));
        assertFalse(encoder.isAcceptable(null));
    }
View Full Code Here

    @Test
    public void testIsAcceptable() {
        assertFalse(encoder.isAcceptable(new ListResponse(true, true, true,
                true, false, false, "name", '.')));
        assertTrue(encoder.isAcceptable(new LSubResponse("name", true, '.')));
        assertFalse(encoder.isAcceptable(context.mock(ImapMessage.class)));
        assertFalse(encoder.isAcceptable(null));
    }
View Full Code Here

    @SuppressWarnings("unchecked")
  public void testName() throws Exception {
        context.checking(new Expectations() {{
            oneOf(composer).listResponse(with(equal("LSUB")),with(aNull(List.class)), with(equal('.')), with(equal("INBOX.name")));
        }});
        encoder.encode(new LSubResponse("INBOX.name", false, '.'), composer, new FakeImapSession());
    }
View Full Code Here

    @SuppressWarnings("unchecked")
  public void testDelimiter() throws Exception {
        context.checking(new Expectations() {{
            oneOf(composer).listResponse(with(equal("LSUB")),with(aNull(List.class)), with(equal('.')), with(equal("INBOX.name")));
        }});
        encoder.encode(new LSubResponse("INBOX.name", false, '.'), composer, new FakeImapSession());
    }
View Full Code Here

    public void testNoSelect() throws Exception {
        final String[] values = { ImapConstants.NAME_ATTRIBUTE_NOSELECT };
        context.checking(new Expectations() {{
            oneOf(composer).listResponse(with(equal("LSUB")),with(equal(Arrays.asList(values))), with(equal('.')), with(equal("INBOX.name")));
        }});
        encoder.encode(new LSubResponse("INBOX.name", true, '.'), composer, new FakeImapSession());
    }
View Full Code Here

        mockery.checking(new Expectations() {{
            allowing(session).getAttribute(ImapSessionUtils.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY); will(returnValue(mailboxSession));
            allowing(mailboxSession).getPathDelimiter(); will(returnValue(HIERARCHY_DELIMITER));
            oneOf(responder).respond(with(
                    equal(new LSubResponse("", true, HIERARCHY_DELIMITER))));
        }});

        expectOk();

        LsubRequest request = new LsubRequest(command, "", "", TAG);
View Full Code Here

TOP

Related Classes of org.apache.james.imap.message.response.LSubResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.