Package org.jibx.ws.encoding.dime

Examples of org.jibx.ws.encoding.dime.DimeInputBuffer


       
        /** {@inheritDoc} */
        public void init() throws IOException {
            if (!m_initialized) {
                if (m_dimeInput == null) {
                    m_dimeInput = new DimeInputBuffer();
                    InByteBuffer ibuff = new InByteBuffer();
                    m_dimeInput.setBuffer(ibuff);
                    ibuff.setInput(m_socket.getInputStream());
                }
                if (m_dimeInput.nextMessage() && m_dimeInput.nextPart()) {
View Full Code Here


        m_socket = socket;
        m_socket.setTcpNoDelay(true);
        m_sdef = sdef;
        m_server = server;
        m_clientAddress = socket.getInetAddress().getHostAddress();
        m_dimeInput = new DimeInputBuffer();
        InByteBuffer ibuff = new InByteBuffer();
        m_dimeInput.setBuffer(ibuff);
        ibuff.setInput(socket.getInputStream());
        m_dimeOutput = new DimeOutputBuffer();
        OutByteBuffer obuff = new OutByteBuffer();
View Full Code Here

     *
     * @param msg string containing message data
     * @return buffer
     */
    private static DimeInputBuffer messageBuffer(String msg) {
        DimeInputBuffer dbuff = new DimeInputBuffer();
        InByteBuffer bbuff = new InByteBuffer();
        bbuff.setInput(new ByteArrayInputStream(TestData.messageBytes(msg)));
        dbuff.setBuffer(bbuff);
        return dbuff;
    }
View Full Code Here

        dbuff.setBuffer(bbuff);
        return dbuff;
    }

    public void testEmptyMessage() throws Exception {
        DimeInputBuffer buff = messageBuffer(TestData.EMPTY_MESSAGE);
        assertTrue("Initial message", buff.nextMessage());
        assertTrue("Initial part", buff.nextPart());
        assertEquals("Wrong offset", DimeCommon.HEADER_SIZE, buff.getOffset());
        assertEquals("Wrong limit", DimeCommon.HEADER_SIZE, buff.getLimit());
        assertFalse("No data in message", buff.require(1));
        assertFalse("No more parts in message", buff.nextPart());
        assertFalse("No more messages", buff.nextMessage());
    }
View Full Code Here

        assertFalse("No more parts in message", buff.nextPart());
        assertFalse("No more messages", buff.nextMessage());
    }

    public void testBadVersionMessage() throws Exception {
        DimeInputBuffer buff = messageBuffer(TestData.BAD_VERSION_MESSAGE);
        try {
            assertTrue("Initial message", buff.nextMessage());
            buff.nextPart();
            fail();
        } catch (IOException e) {
        }
    }
View Full Code Here

        } catch (IOException e) {
        }
    }

    public void testNotFirstMessage() throws Exception {
        DimeInputBuffer buff = messageBuffer(TestData.NOT_FIRST_MESSAGE);
        try {
            assertTrue("Initial message", buff.nextMessage());
            buff.nextPart();
            fail();
        } catch (IOException e) {
        }
    }
View Full Code Here

        } catch (IOException e) {
        }
    }

    public void testNotLastMessage() throws Exception {
        DimeInputBuffer buff = messageBuffer(TestData.NOT_LAST_MESSAGE);
        assertTrue("Initial message", buff.nextMessage());
        assertTrue("Initial part", buff.nextPart());
        try {
            buff.nextPart();
            fail();
        } catch (IOException e) {
        }
    }
View Full Code Here

        } catch (IOException e) {
        }
    }

    public void testChunkedNoChunkMessage() throws Exception {
        DimeInputBuffer buff = messageBuffer(TestData.CHUNKED_NOCHUNK_MESSAGE);
        assertTrue("Initial message", buff.nextMessage());
        assertTrue("Initial part", buff.nextPart());
        try {
            buff.require(1);
            fail();
        } catch (IOException e) {
        }
    }
View Full Code Here

        } catch (IOException e) {
        }
    }

    public void testOptIdTypeOnlyMessage() throws Exception {
        DimeInputBuffer buff = messageBuffer(TestData.OPTIDTYPEONLY_MESSAGE);
        assertTrue("Initial message", buff.nextMessage());
        assertTrue("Initial part", buff.nextPart());
        assertEquals("Record id", "bc", buff.getPartIdentifier());
        assertEquals("Record type", DimeCommon.TYPE_MEDIA, buff.getPartTypeCode());
        assertEquals("Record type text", "def", buff.getPartTypeText());
    }
View Full Code Here

        assertEquals("Record type", DimeCommon.TYPE_MEDIA, buff.getPartTypeCode());
        assertEquals("Record type text", "def", buff.getPartTypeText());
    }

    public void testOneBlockOneDataMessage() throws Exception {
        DimeInputBuffer buff = messageBuffer(TestData.ONEBLOCKONEDATA_MESSAGE);
        assertTrue("Initial message", buff.nextMessage());
        assertTrue("Initial part", buff.nextPart());
        assertTrue("Missing data", buff.require(1));
        assertEquals("Data value", 1, buff.getBuffer()[buff.getOffset()]);
        assertFalse("No more parts in message", buff.nextPart());
        assertFalse("No more messages", buff.nextMessage());
    }
View Full Code Here

TOP

Related Classes of org.jibx.ws.encoding.dime.DimeInputBuffer

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.