Package org.apache.james.imap.processor.fetch

Examples of org.apache.james.imap.processor.fetch.PartialWritableByteChannel


    @Test
    public void testShouldPassFullBufferWhenStartZeroSizeLimit()
            throws Exception {
        byte[] bytes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        ByteBuffer src = ByteBuffer.wrap(bytes);
        PartialWritableByteChannel channel = new PartialWritableByteChannel(
                this, 0, 10);
        assertEquals(10, channel.write(src));
        assertEquals(10, sink.position());
        sink.flip();
        for (int i = 0; i < 10; i++) {
            assertEquals(i, sink.get());
        }
View Full Code Here


    @Test
    public void testShouldIgnoreBytesAfterLimit() throws Exception {
        byte[] bytes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        ByteBuffer src = ByteBuffer.wrap(bytes);
        PartialWritableByteChannel channel = new PartialWritableByteChannel(
                this, 0, 4);
        assertEquals(10, channel.write(src));
        assertEquals(4, sink.position());
        sink.flip();
        for (int i = 0; i < 4; i++) {
            assertEquals(i, sink.get());
        }
View Full Code Here

    @Test
    public void testShouldIgnoreBytesBeforeStart() throws Exception {
        byte[] bytes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        ByteBuffer src = ByteBuffer.wrap(bytes);
        PartialWritableByteChannel channel = new PartialWritableByteChannel(
                this, 4, 6);
        assertEquals(10, channel.write(src));
        assertEquals(6, sink.position());
        sink.flip();
        for (int i = 4; i < 10; i++) {
            assertEquals(i, sink.get());
        }
View Full Code Here

    @Test
    public void testShouldIgnoreBytesBeforeStartAndAfterLimit()
            throws Exception {
        byte[] bytes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        ByteBuffer src = ByteBuffer.wrap(bytes);
        PartialWritableByteChannel channel = new PartialWritableByteChannel(
                this, 4, 2);
        assertEquals(10, channel.write(src));
        assertEquals(2, sink.position());
        sink.flip();
        for (int i = 4; i < 6; i++) {
            assertEquals(i, sink.get());
        }
View Full Code Here

    @Test
    public void testMultiBufferShouldPassFullBufferWhenStartZeroSizeLimit()
            throws Exception {
        byte[] bytes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        ByteBuffer src = ByteBuffer.wrap(bytes);
        PartialWritableByteChannel channel = new PartialWritableByteChannel(
                this, 0, 50);
        for (int i = 0; i < 5; i++) {
            assertEquals(10, channel.write(src));
            src.rewind();
        }
        assertEquals(50, sink.position());
        sink.flip();
        for (int l = 0; l < 5; l++) {
View Full Code Here

    @Test
    public void testMultiBufferOnBoundaryShouldIgnoreBytesAfterLimit()
            throws Exception {
        byte[] bytes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        ByteBuffer src = ByteBuffer.wrap(bytes);
        PartialWritableByteChannel channel = new PartialWritableByteChannel(
                this, 0, 30);
        for (int i = 0; i < 5; i++) {
            assertEquals(10, channel.write(src));
            src.rewind();
        }
        assertEquals(30, sink.position());
        sink.flip();
        for (int l = 0; l < 3; l++) {
View Full Code Here

    @Test
    public void testMultiBufferBeforeBoundaryShouldIgnoreBytesAfterLimit()
            throws Exception {
        byte[] bytes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        ByteBuffer src = ByteBuffer.wrap(bytes);
        PartialWritableByteChannel channel = new PartialWritableByteChannel(
                this, 0, 39);
        for (int i = 0; i < 5; i++) {
            assertEquals(10, channel.write(src));
            src.rewind();
        }
        assertEquals(39, sink.position());
        sink.flip();
        for (int l = 0; l < 3; l++) {
View Full Code Here

    @Test
    public void testMultiBufferAfterBoundaryShouldIgnoreBytesAfterLimit()
            throws Exception {
        byte[] bytes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        ByteBuffer src = ByteBuffer.wrap(bytes);
        PartialWritableByteChannel channel = new PartialWritableByteChannel(
                this, 0, 31);
        for (int i = 0; i < 5; i++) {
            assertEquals(10, channel.write(src));
            src.rewind();
        }
        assertEquals(31, sink.position());
        sink.flip();
        for (int l = 0; l < 3; l++) {
View Full Code Here

    @Test
    public void testMultiBufferOnBoundaryOctetsOverBufferShouldIgnoreBytesBeforeStart()
            throws Exception {
        byte[] bytes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        ByteBuffer src = ByteBuffer.wrap(bytes);
        PartialWritableByteChannel channel = new PartialWritableByteChannel(
                this, 20, 21);
        for (int i = 0; i < 5; i++) {
            assertEquals(10, channel.write(src));
            src.rewind();
        }
        assertEquals(21, sink.position());
        sink.flip();
        for (int l = 0; l < 2; l++) {
View Full Code Here

    @Test
    public void testMultiBufferAfterBoundaryOctetsOverBufferShouldIgnoreBytesBeforeStart()
            throws Exception {
        byte[] bytes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        ByteBuffer src = ByteBuffer.wrap(bytes);
        PartialWritableByteChannel channel = new PartialWritableByteChannel(
                this, 21, 21);
        for (int i = 0; i < 5; i++) {
            assertEquals(10, channel.write(src));
            src.rewind();
        }
        assertEquals(21, sink.position());
        sink.flip();
        for (int l = 0; l < 2; l++) {
View Full Code Here

TOP

Related Classes of org.apache.james.imap.processor.fetch.PartialWritableByteChannel

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.