Package org.apache.qpid.client.message

Examples of org.apache.qpid.client.message.JMSBytesMessage.reset()


    public void testReadBytes() throws Exception
    {
        JMSBytesMessage bm = TestMessageHelper.newJMSBytesMessage();
        bm.writeByte((byte)3);
        bm.writeByte((byte)4);
        bm.reset();
        byte[] result = new byte[2];
        int count = bm.readBytes(result);
        assertEquals((byte)3, result[0]);
        assertEquals((byte)4, result[1]);
        assertEquals(2, count);
View Full Code Here


    public void testReadBytesEOF() throws Exception
    {
        JMSBytesMessage bm = TestMessageHelper.newJMSBytesMessage();
        bm.writeByte((byte)3);
        bm.writeByte((byte)4);
        bm.reset();
        byte[] result = new byte[2];
        bm.readBytes(result);
        int count = bm.readBytes(result);
        assertEquals(-1, count);
    }
View Full Code Here

    public void testReadBytesWithLargerArray() throws Exception
    {
        JMSBytesMessage bm = TestMessageHelper.newJMSBytesMessage();
        bm.writeByte((byte)3);
        bm.writeByte((byte)4);
        bm.reset();
        byte[] result = new byte[3];
        int count = bm.readBytes(result);
        assertEquals(2, count);
        assertEquals((byte)3, result[0]);
        assertEquals((byte)4, result[1]);
View Full Code Here

    {
        JMSBytesMessage bm = TestMessageHelper.newJMSBytesMessage();
        bm.writeByte((byte)3);
        bm.writeByte((byte)4);
        bm.writeByte((byte)5);
        bm.reset();
        byte[] result = new byte[3];
        int count = bm.readBytes(result, 2);
        assertEquals(2, count);
        assertEquals((byte)3, result[0]);
        assertEquals((byte)4, result[1]);
View Full Code Here

    }

    public void testToBodyStringWithNull() throws Exception
    {
        JMSBytesMessage bm = TestMessageHelper.newJMSBytesMessage();
        bm.reset();
        String result = bm.toBodyString();
        assertEquals("\"\"", result);
    }

    public static junit.framework.Test suite()
View Full Code Here

    {
        try
        {
            JMSBytesMessage bm = TestMessageHelper.newJMSBytesMessage();
            bm.writeInt(10);
            bm.reset();
            bm.writeInt(12);
            fail("expected exception did not occur");
        }
        catch (MessageNotWriteableException m)
        {
View Full Code Here

    public void testClearBodyMakesWritable() throws Exception
    {
        JMSBytesMessage bm = TestMessageHelper.newJMSBytesMessage();
        bm.writeInt(10);
        bm.reset();
        bm.clearBody();
        bm.writeInt(10);
    }

    public void testWriteBoolean() throws Exception
View Full Code Here

    public void testWriteBoolean() throws Exception
    {
        JMSBytesMessage bm = TestMessageHelper.newJMSBytesMessage();
        bm.writeBoolean(true);
        bm.writeBoolean(false);
        bm.reset();
        boolean val = bm.readBoolean();
        assertEquals(true, val);
        val = bm.readBoolean();
        assertEquals(false, val);
    }
View Full Code Here

    public void testWriteInt() throws Exception
    {
        JMSBytesMessage bm = TestMessageHelper.newJMSBytesMessage();
        bm.writeInt(10);
        bm.reset();
        long len = bm.getBodyLength();
        assertTrue(len == 4);
        int val = bm.readInt();
        assertTrue(val == 10);
    }
View Full Code Here

    public void testWriteString() throws Exception
    {
        JMSBytesMessage bm = TestMessageHelper.newJMSBytesMessage();
        bm.writeUTF("Bananas");
        bm.reset();
        String res = bm.readUTF();
        assertEquals("Bananas", res);
    }

    public void testWriteBytes() throws Exception
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.