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

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


    }

    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

        assertFalse(encoder.isAcceptable(null));
    }

    @Test
  public void testName() throws Exception {
        encoder.encode(new LSubResponse("INBOX.name", false, '.'), composer, new FakeImapSession());
        assertEquals("* LSUB () \".\" \"INBOX.name\"\r\n", writer.getString());

    }
View Full Code Here

    }

    @Test
  public void testDelimiter() throws Exception {
        encoder.encode(new LSubResponse("INBOX.name", false, '.'), composer, new FakeImapSession());
        assertEquals("* LSUB () \".\" \"INBOX.name\"\r\n", writer.getString());

    }
View Full Code Here

    }

    @Test
    public void testNoSelect() throws Exception {
        encoder.encode(new LSubResponse("INBOX.name", true, '.'), composer, new FakeImapSession());
        assertEquals("* LSUB (\\Noselect) \".\" \"INBOX.name\"\r\n", writer.getString());


    }
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

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

        mockery.checking(new Expectations() {{
            oneOf(responder).respond(with(
                    equal(new LSubResponse(CHILD_ONE, false, HIERARCHY_DELIMITER))));
            oneOf(responder).respond(with(
                    equal(new LSubResponse(CHILD_TWO, false, HIERARCHY_DELIMITER))));
        }});
       
        expectSubscriptions();
        expectOk();
View Full Code Here

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

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

        expectSubscriptions();
        expectOk();
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.