Package org.apache.james.imap.decode

Examples of org.apache.james.imap.decode.ImapRequestStreamLineReader


        checkInvalid("header field \r\n", key);
    }

  
    private void checkValid(String input, final SearchKey key) throws Exception {
        ImapRequestLineReader reader = new ImapRequestStreamLineReader(
                new ByteArrayInputStream(input.getBytes("US-ASCII")),
                new ByteArrayOutputStream());

        assertEquals(key, parser.searchKey(null, reader, null, false));
    }
View Full Code Here


        checkValid(number + "\r\n", key);
    }

    private void checkInvalid(String input, final SearchKey key)
            throws Exception {
        ImapRequestLineReader reader = new ImapRequestStreamLineReader(
                new ByteArrayInputStream(input.getBytes("US-ASCII")),
                new ByteArrayOutputStream());

        try {
            parser.searchKey(null, reader, null, false);
View Full Code Here

    }
   
    private void check(String input, final IdRange[] idSet,final boolean silent,
            final Boolean sign, final Flags flags, final boolean useUids, final String tag)
            throws Exception {
        ImapRequestLineReader reader = new ImapRequestStreamLineReader(
                new ByteArrayInputStream(input.getBytes("US-ASCII")),
                new ByteArrayOutputStream());

        parser.decode(command, reader, tag, useUids, session);
    }
View Full Code Here

                    with(same(command)),
                    with(equal(HumanReadableText.BAD_CHARSET)),
                    with(equal(StatusResponse.ResponseCode.badCharset(CharsetUtil.getAvailableCharsetNames()))));
            oneOf (session).getLog(); returnValue(new MockLogger());
        }});
        ImapRequestLineReader reader = new ImapRequestStreamLineReader(
                new ByteArrayInputStream("CHARSET BOGUS ".getBytes("US-ASCII")),
                new ByteArrayOutputStream());
        parser.decode(command, reader, TAG, false, session);
    }
View Full Code Here

                true, "US-ASCII");
    }

    private void checkUTF8Valid(byte[] term, final SearchKey key)
            throws Exception {
        ImapRequestLineReader reader = new ImapRequestStreamLineReader(
                new ByteArrayInputStream(NioUtils.add(NioUtils.add(CHARSET,
                        term), BYTES_UTF8_NON_ASCII_SEARCH_TERM)),
                new ByteArrayOutputStream());
        final SearchKey searchKey = parser.searchKey(null, reader, null, true);
        assertEquals(key, searchKey);
View Full Code Here

        assertEquals(key, searchKey);
    }

    private void checkValid(String input, final SearchKey key, boolean isFirst,
            String charset) throws Exception {
        ImapRequestLineReader reader = new ImapRequestStreamLineReader(
                new ByteArrayInputStream(input.getBytes(charset)),
                new ByteArrayOutputStream());

        final SearchKey searchKey = parser.searchKey(null, reader, null, isFirst);
        assertEquals(key, searchKey);
View Full Code Here

        checkValid("not new\r\n", key);
    }
   
    @Test
    public void testUserFlagsParsing() throws Exception {
        ImapRequestLineReader reader = new ImapRequestStreamLineReader(
                new ByteArrayInputStream("NOT (KEYWORD bar KEYWORD foo)".getBytes("US-ASCII")),
                new ByteArrayOutputStream());
        SearchKey key = parser.searchKey(null, reader, null, false);
        List<SearchKey> keys = key.getKeys().get(0).getKeys();
        assertEquals(2, keys.size());
View Full Code Here

        assertEquals("bar", keys.get(0).getValue());
        assertEquals("foo", keys.get(1).getValue());
    }

    private void checkValid(String input, final SearchKey key) throws Exception {
        ImapRequestLineReader reader = new ImapRequestStreamLineReader(
                new ByteArrayInputStream(input.getBytes("US-ASCII")),
                new ByteArrayOutputStream());

        assertEquals(key, parser.searchKey(null, reader, null, false));
    }
View Full Code Here

    }

    @Test
    public void testShouldNotParseZeroLength() throws Exception {
        try {
            ImapRequestLineReader reader = new ImapRequestStreamLineReader(
                    new ByteArrayInputStream("1 (BODY[]<20.0>)\r\n"
                            .getBytes("US-ASCII")), new ByteArrayOutputStream());
            parser.decode(command, reader, "A01", false, session);               
            throw new Exception("Number of octets must be non-zero");
View Full Code Here

        }
    }

    private void check(String input, final IdRange[] idSet,
            final boolean useUids, final FetchData data, final String tag) throws Exception {
        ImapRequestLineReader reader = new ImapRequestStreamLineReader(
                new ByteArrayInputStream(input.getBytes("US-ASCII")),
                new ByteArrayOutputStream());

        parser.decode(command, reader, tag, useUids, session);
    }
View Full Code Here

TOP

Related Classes of org.apache.james.imap.decode.ImapRequestStreamLineReader

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.