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

Examples of org.apache.james.imap.api.message.response.StatusResponse


        taggedOk(responder, tag, command, metaData);
    }

    private void uidNext(final Responder responder, final MessageManager.MetaData metaData) throws MailboxException {
        final long uid = metaData.getUidNext();
        final StatusResponse untaggedOk = statusResponseFactory.untaggedOk(HumanReadableText.UIDNEXT, ResponseCode.uidNext(uid));
        responder.respond(untaggedOk);
    }


        if (writeable) {
            code = ResponseCode.readWrite();
        } else {
            code = ResponseCode.readOnly();
        }
        final StatusResponse taggedOk = statusResponseFactory.taggedOk(tag, command, HumanReadableText.SELECT, code);
        responder.respond(taggedOk);
    }

            int msn = selected.msn(unseenUid);

            if (msn == SelectedMailbox.NO_SUCH_MESSAGE)
                throw new MailboxException("No message found with uid " + unseenUid);

            final StatusResponse untaggedOk = statusResponseFactory.untaggedOk(HumanReadableText.unseen(msn), ResponseCode.unseen(msn));
            responder.respond(untaggedOk);
        }

    }

    }

    private void uidValidity(Responder responder, MessageManager.MetaData metaData) throws MailboxException {
        final long uidValidity = metaData.getUidValidity();
        final StatusResponse untaggedOk = statusResponseFactory.untaggedOk(HumanReadableText.UID_VALIDITY, ResponseCode.uidValidity(uidValidity));
        responder.respond(untaggedOk);
    }

        command = ImapCommand.anyStateCommand("Command");
    }

    @Test
    public void testTaggedOk() {
        StatusResponse response = factory.taggedOk(TAG, command, KEY);
        assertNotNull(response);
        assertEquals(StatusResponse.Type.OK, response.getServerResponseType());
        assertEquals(TAG, response.getTag());
        assertEquals(KEY, response.getTextKey());
        assertEquals(command, response.getCommand());
        assertNull(response.getResponseCode());
        response = factory.taggedOk(TAG, command, KEY, CODE);
        assertNotNull(response);
        assertEquals(StatusResponse.Type.OK, response.getServerResponseType());
        assertEquals(TAG, response.getTag());
        assertEquals(KEY, response.getTextKey());
        assertEquals(CODE, response.getResponseCode());
        assertEquals(command, response.getCommand());
    }

        assertEquals(command, response.getCommand());
    }

    @Test
    public void testTaggedNo() {
        StatusResponse response = factory.taggedNo(TAG, command, KEY);
        assertNotNull(response);
        assertEquals(StatusResponse.Type.NO, response.getServerResponseType());
        assertEquals(TAG, response.getTag());
        assertEquals(KEY, response.getTextKey());
        assertEquals(command, response.getCommand());
        assertNull(response.getResponseCode());
        response = factory.taggedNo(TAG, command, KEY, CODE);
        assertNotNull(response);
        assertEquals(StatusResponse.Type.NO, response.getServerResponseType());
        assertEquals(TAG, response.getTag());
        assertEquals(KEY, response.getTextKey());
        assertEquals(CODE, response.getResponseCode());
        assertEquals(command, response.getCommand());
    }

    }

    private ImapMessage unsupportedCharset(final String tag, final ImapCommand command) {
        final StatusResponseFactory factory = getStatusResponseFactory();
        final ResponseCode badCharset = StatusResponse.ResponseCode.badCharset(CharsetUtil.getAvailableCharsetNames());
        final StatusResponse result = factory.taggedNo(tag, command, HumanReadableText.BAD_CHARSET, badCharset);
        return result;
    }

        assertEquals(command, response.getCommand());
    }
   
    @Test
    public void testTaggedBad() {
        StatusResponse response = factory.taggedBad(TAG, command, KEY);
        assertNotNull(response);
        assertEquals(StatusResponse.Type.BAD, response.getServerResponseType());
        assertEquals(TAG, response.getTag());
        assertEquals(KEY, response.getTextKey());
        assertNull(response.getResponseCode());
        assertEquals(command, response.getCommand());
        response = factory.taggedBad(TAG, command, KEY, CODE);
        assertNotNull(response);
        assertEquals(StatusResponse.Type.BAD, response.getServerResponseType());
        assertEquals(TAG, response.getTag());
        assertEquals(KEY, response.getTextKey());
        assertEquals(CODE, response.getResponseCode());
        assertEquals(command, response.getCommand());
    }

        assertEquals(command, response.getCommand());
    }

    @Test
    public void testUntaggedOk() {
        StatusResponse response = factory.untaggedOk(KEY);
        assertNotNull(response);
        assertEquals(StatusResponse.Type.OK, response.getServerResponseType());
        assertEquals(null, response.getTag());
        assertEquals(KEY, response.getTextKey());
        assertNull(response.getResponseCode());
        assertNull(response.getCommand());
        response = factory.untaggedOk(KEY, CODE);
        assertNotNull(response);
        assertEquals(StatusResponse.Type.OK, response.getServerResponseType());
        assertEquals(null, response.getTag());
        assertEquals(KEY, response.getTextKey());
        assertEquals(CODE, response.getResponseCode());
        assertNull(response.getCommand());
    }

    }


    @Test
    public void testUntaggedNo() {
        StatusResponse response = factory.untaggedNo(KEY);
        assertNotNull(response);
        assertEquals(StatusResponse.Type.NO, response.getServerResponseType());
        assertEquals(null, response.getTag());
        assertEquals(KEY, response.getTextKey());
        assertNull(response.getResponseCode());
        assertNull(response.getCommand());
        response = factory.untaggedNo(KEY, CODE);
        assertNotNull(response);
        assertEquals(StatusResponse.Type.NO, response.getServerResponseType());
        assertEquals(null, response.getTag());
        assertEquals(KEY, response.getTextKey());
        assertEquals(CODE, response.getResponseCode());
        assertNull(response.getCommand());
    }

TOP

Related Classes of org.apache.james.imap.api.message.response.StatusResponse

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.