Examples of ActiveMQMapMessage


Examples of org.apache.activemq.command.ActiveMQMapMessage

     * Tests transforming messages into ActiveMQ's message implementation.
     */
    public void testTransformMessage() throws Exception {
      assertTrue("Transforming a BytesMessage message into an ActiveMQBytesMessage",ActiveMQMessageTransformation.transformMessage((BytesMessage)new ActiveMQBytesMessage(), null) instanceof ActiveMQBytesMessage);
     
      assertTrue("Transforming a MapMessage message to an ActiveMQMapMessage",ActiveMQMessageTransformation.transformMessage((MapMessage)new ActiveMQMapMessage(), null) instanceof ActiveMQMapMessage);
     
      assertTrue("Transforming an ObjectMessage message to an ActiveMQObjectMessage",ActiveMQMessageTransformation.transformMessage((ObjectMessage)new ActiveMQObjectMessage(), null) instanceof ActiveMQObjectMessage);
     
      assertTrue("Transforming a StreamMessage message to an ActiveMQStreamMessage",ActiveMQMessageTransformation.transformMessage((StreamMessage)new ActiveMQStreamMessage(), null) instanceof ActiveMQStreamMessage);
     
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQMapMessage

        } catch (MessageNotWriteableException mnwe) {
        }
    }

    public void testWriteOnlyBody() throws JMSException {
        ActiveMQMapMessage msg = new ActiveMQMapMessage();
        msg.setReadOnlyBody(false);

        msg.setBoolean("boolean", true);
        msg.setByte("byte", (byte) 1);
        msg.setBytes("bytes", new byte[1]);
        msg.setBytes("bytes2", new byte[3], 0, 2);
        msg.setChar("char", 'a');
        msg.setDouble("double", 1.5);
        msg.setFloat("float", 1.5f);
        msg.setInt("int", 1);
        msg.setLong("long", 1);
        msg.setObject("object", "stringObj");
        msg.setShort("short", (short) 1);
        msg.setString("string", "string");

        msg.setReadOnlyBody(true);
       
        msg.getBoolean("boolean");
        msg.getByte("byte");
        msg.getBytes("bytes");
        msg.getChar("char");
        msg.getDouble("double");
        msg.getFloat("float");
        msg.getInt("int");
        msg.getLong("long");
        msg.getObject("object");
        msg.getShort("short");
        msg.getString("string");
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQMapMessage

    public ActiveMQMapMessageTest(String arg0) {
        super(arg0);
    }

    public void testBytesConversion() throws JMSException, IOException {
        ActiveMQMapMessage msg = new ActiveMQMapMessage();
        msg.setBoolean("boolean", true);
        msg.setByte("byte", (byte) 1);
        msg.setBytes("bytes", new byte[1]);
        msg.setChar("char", 'a');
        msg.setDouble("double", 1.5);
        msg.setFloat("float", 1.5f);
        msg.setInt("int", 1);
        msg.setLong("long", 1);
        msg.setObject("object", "stringObj");
        msg.setShort("short", (short) 1);
        msg.setString("string", "string");

        // Test with a 1Meg String
        StringBuffer bigSB = new StringBuffer(1024*1024);
        for( int i=0; i < 1024*1024; i++ ) {
            bigSB.append((char)'a'+i%26);
        }
        String bigString = bigSB.toString();
       
        msg.setString("bigString", bigString);
       
        msg = (ActiveMQMapMessage) msg.copy();
       
        assertEquals(msg.getBoolean("boolean"), true);
        assertEquals(msg.getByte("byte"), (byte) 1);
        assertEquals(msg.getBytes("bytes").length, 1);
        assertEquals(msg.getChar("char"), 'a');
        assertEquals(msg.getDouble("double"), 1.5, 0);
        assertEquals(msg.getFloat("float"), 1.5f, 0);
        assertEquals(msg.getInt("int"), 1);
        assertEquals(msg.getLong("long"), 1);
        assertEquals(msg.getObject("object"), "stringObj");
        assertEquals(msg.getShort("short"), (short) 1);
        assertEquals(msg.getString("string"), "string");
        assertEquals(msg.getString("bigString"), bigString);
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQMapMessage

        assertEquals(msg.getString("string"), "string");
        assertEquals(msg.getString("bigString"), bigString);
    }

    public void testGetBoolean() throws JMSException {
        ActiveMQMapMessage msg = new ActiveMQMapMessage();
        msg.setBoolean(name, true);
        msg.setReadOnlyBody(true);
        assertTrue(msg.getBoolean(name));
        msg.clearBody();
        msg.setString(name, "true");
       
        msg = (ActiveMQMapMessage) msg.copy();
       
        assertTrue(msg.getBoolean(name));
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQMapMessage

       
        assertTrue(msg.getBoolean(name));
    }

    public void testGetByte() throws JMSException {
        ActiveMQMapMessage msg = new ActiveMQMapMessage();
        msg.setByte(this.name, (byte) 1);
        msg = (ActiveMQMapMessage) msg.copy();
        assertTrue(msg.getByte(this.name) == (byte) 1);
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQMapMessage

        msg = (ActiveMQMapMessage) msg.copy();
        assertTrue(msg.getByte(this.name) == (byte) 1);
    }

    public void testGetShort() {
        ActiveMQMapMessage msg = new ActiveMQMapMessage();
        try {
            msg.setShort(this.name, (short) 1);
            msg = (ActiveMQMapMessage) msg.copy();
            assertTrue(msg.getShort(this.name) == (short) 1);
        } catch (JMSException jmsEx) {
            jmsEx.printStackTrace();
            assertTrue(false);
        }
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQMapMessage

            assertTrue(false);
        }
    }

    public void testGetChar() {
        ActiveMQMapMessage msg = new ActiveMQMapMessage();
        try {
            msg.setChar(this.name, 'a');
            msg = (ActiveMQMapMessage) msg.copy();
            assertTrue(msg.getChar(this.name) == 'a');
        } catch (JMSException jmsEx) {
            jmsEx.printStackTrace();
            assertTrue(false);
        }
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQMapMessage

            assertTrue(false);
        }
    }

    public void testGetInt() {
        ActiveMQMapMessage msg = new ActiveMQMapMessage();
        try {
            msg.setInt(this.name, 1);
            msg = (ActiveMQMapMessage) msg.copy();
            assertTrue(msg.getInt(this.name) == 1);
        } catch (JMSException jmsEx) {
            jmsEx.printStackTrace();
            assertTrue(false);
        }
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQMapMessage

            assertTrue(false);
        }
    }

    public void testGetLong() {
        ActiveMQMapMessage msg = new ActiveMQMapMessage();
        try {
            msg.setLong(this.name, 1);
            msg = (ActiveMQMapMessage) msg.copy();
            assertTrue(msg.getLong(this.name) == 1);
        } catch (JMSException jmsEx) {
            jmsEx.printStackTrace();
            assertTrue(false);
        }
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQMapMessage

            assertTrue(false);
        }
    }

    public void testGetFloat() {
        ActiveMQMapMessage msg = new ActiveMQMapMessage();
        try {
            msg.setFloat(this.name, 1.5f);
            msg = (ActiveMQMapMessage) msg.copy();
            assertTrue(msg.getFloat(this.name) == 1.5f);
        } catch (JMSException jmsEx) {
            jmsEx.printStackTrace();
            assertTrue(false);
        }
    }
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.