Package org.apache.qpid.client.message

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


    public void testWriteInt() throws Exception
    {
        JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage();
        bm.writeInt(10);
        bm.reset();
        int val = bm.readInt();
        assertTrue(val == 10);
    }

    public void testWriteString() throws Exception
View Full Code Here


    public void testWriteString() throws Exception
    {
        JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage();
        bm.writeString("Bananas");
        bm.reset();
        String res = bm.readString();
        assertEquals("Bananas", res);
    }

    public void testWriteBytes() throws Exception
View Full Code Here

    public void testWriteBytes() throws Exception
    {
        JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage();
        byte[] bytes = {1,2,3,4};
        bm.writeBytes(bytes, 1, 2);
        bm.reset();
        bytes = new byte[2];
        bm.readBytes(bytes);
        assertEquals(2, bytes[0]);
        assertEquals(3, bytes[1]);
    }
View Full Code Here

        bm.writeObject(new Integer(101));
        bm.writeObject(new Long(50003222L));
        bm.writeObject("Foobar");
        bm.writeObject(new Float(1.7f));
        bm.writeObject(new Double(8.7d));
        bm.reset();
        assertTrue(bm.readBoolean());
        assertTrue(!bm.readBoolean());
        assertEquals((byte)2, bm.readByte());
        byte[] bytes = new byte[4];
        bm.readBytes(bytes);
View Full Code Here

    public void testReadBoolean() throws Exception
    {
        JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage();
        bm.writeBoolean(true);
        bm.reset();
        boolean result = bm.readBoolean();
        assertTrue(result);
    }

    public void testReadBytesChecksNull() throws Exception
View Full Code Here

        JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage();
        byte[] bytes = {2, 3};
        bm.writeBytes(bytes);
        bm.writeBytes(null);
        bm.writeBytes(new byte[]{});
        bm.reset();
        int len = bm.readBytes(bytes);
        assertEquals(2, len);
        len = bm.readBytes(bytes);
        assertEquals(-1, len);
        len = bm.readBytes(bytes);
View Full Code Here

    {
        JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage();
        bm.writeBytes(new byte[]{2, 3, 4, 5, 6, 7, 8});
        bm.writeBytes(new byte[]{2, 3, 4, 5, 6, 7});
        bm.writeString("Foo");
        bm.reset();
        int len;
        do
        {
            len = bm.readBytes(new byte[2]);
        }
View Full Code Here

    {
        JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage();
        byte[] bytes = {2, 3, 4};
        bm.writeBytes(bytes);
        bm.writeBytes(bytes);
        bm.reset();
        byte[] result = new byte[2];
        int len = bm.readBytes(result);
        assertEquals(2, len);
        len = bm.readBytes(result);
        assertEquals(1, len);
View Full Code Here

    {
        try
        {
            JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage();
            bm.writeByte((byte)1);
            bm.reset();
            bm.readByte();
            // should throw
            bm.readByte();
            fail("expected exception did not occur");
        }
View Full Code Here

    {
        try
        {
            JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage();
            bm.writeBoolean(true);
            bm.reset();
            bm.readBoolean();
            // should throw
            bm.readBoolean();
            fail("expected exception did not occur");
        }
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.