Examples of ActiveMQObjectMessage


Examples of org.apache.activemq.command.ActiveMQObjectMessage

        protected void init() throws OpenDataException {
            super.init();
        }

        public Map getFields(Object o) throws OpenDataException {
            ActiveMQObjectMessage m = (ActiveMQObjectMessage) o;
            Map rc = super.getFields(o);
            return rc;
        }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQObjectMessage

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

    public void testBytes() throws JMSException, IOException {
        ActiveMQObjectMessage msg = new ActiveMQObjectMessage();
        String str = "testText";
        msg.setObject(str);
       
        msg = (ActiveMQObjectMessage) msg.copy();
        assertEquals(msg.getObject(), str);

    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQObjectMessage

        assertEquals(msg.getObject(), str);

    }

    public void testSetObject() throws JMSException {
        ActiveMQObjectMessage msg = new ActiveMQObjectMessage();
        String str = "testText";
        msg.setObject(str);
        assertTrue(msg.getObject() == str);
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQObjectMessage

        msg.setObject(str);
        assertTrue(msg.getObject() == str);
    }

    public void testClearBody() throws JMSException {
        ActiveMQObjectMessage objectMessage = new ActiveMQObjectMessage();
        try {
            objectMessage.setObject("String");
            objectMessage.clearBody();
            assertFalse(objectMessage.isReadOnlyBody());
            assertNull(objectMessage.getObject());
            objectMessage.setObject("String");
            objectMessage.getObject();
        } catch (MessageNotWriteableException mnwe) {
            fail("should be writeable");
        }
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQObjectMessage

            fail("should be writeable");
        }
    }

    public void testReadOnlyBody() throws JMSException {
        ActiveMQObjectMessage msg = new ActiveMQObjectMessage();
        msg.setObject("test");
        msg.setReadOnlyBody(true);
        try {
            msg.getObject();
        } catch (MessageNotReadableException e) {
            fail("should be readable");
        }
        try {
            msg.setObject("test");
            fail("should throw exception");
        } catch (MessageNotWriteableException e) {
        }
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQObjectMessage

        } catch (MessageNotWriteableException e) {
        }
    }

    public void testWriteOnlyBody() throws JMSException { // should always be readable
        ActiveMQObjectMessage msg = new ActiveMQObjectMessage();
        msg.setReadOnlyBody(false);
        try {
            msg.setObject("test");
            msg.getObject();
        } catch (MessageNotReadableException e) {
            fail("should be readable");
        }
        msg.setReadOnlyBody(true);
        try {
            msg.getObject();
            msg.setObject("test");
            fail("should throw exception");
        } catch (MessageNotReadableException e) {
            fail("should be readable");
        } catch (MessageNotWriteableException mnwe) {
        }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQObjectMessage

     *             if the JMS provider fails to create this message due to some
     *             internal error.
     */
    public ObjectMessage createObjectMessage() throws JMSException {
        checkClosed();
        ActiveMQObjectMessage message = new ActiveMQObjectMessage();
        message.setConnection(connection);
        return message;
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQObjectMessage

     *             if the JMS provider fails to create this message due to some
     *             internal error.
     */
    public ObjectMessage createObjectMessage(Serializable object) throws JMSException {
        checkClosed();
        ActiveMQObjectMessage message = new ActiveMQObjectMessage();
        message.setConnection(connection);
        message.setObject(object);
        return message;
    }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQObjectMessage

                }

                activeMessage = msg;
            } else if (message instanceof ObjectMessage) {
                ObjectMessage objMsg = (ObjectMessage) message;
                ActiveMQObjectMessage msg = new ActiveMQObjectMessage();
                msg.setConnection(connection);
                msg.setObject(objMsg.getObject());
                msg.storeContent();
                activeMessage = msg;
            } else if (message instanceof StreamMessage) {
                StreamMessage streamMessage = (StreamMessage) message;
                streamMessage.reset();
                ActiveMQStreamMessage msg = new ActiveMQStreamMessage();
                msg.setConnection(connection);
                Object obj = null;

                try {
                    while ((obj = streamMessage.readObject()) != null) {
                        msg.writeObject(obj);
                    }
                } catch (MessageEOFException e) {
                    // if an end of message stream as expected
                } catch (JMSException e) {
                }

                activeMessage = msg;
            } else if (message instanceof TextMessage) {
                TextMessage textMsg = (TextMessage) message;
                ActiveMQTextMessage msg = new ActiveMQTextMessage();
                msg.setConnection(connection);
                msg.setText(textMsg.getText());
                activeMessage = msg;
            } else {
                activeMessage = new ActiveMQMessage();
                activeMessage.setConnection(connection);
            }
View Full Code Here

Examples of org.apache.activemq.command.ActiveMQObjectMessage

     * an ObjectMessage.
     */
    public void testConvertsMapWithSerializableValueIntoObjectMessage() throws Exception
    {
        Session session = mock(Session.class);
        when(session.createObjectMessage()).thenReturn(new ActiveMQObjectMessage());

        // Creates a test Map containing a serializable object
        Map data = new HashMap();
        data.put("orange", new Orange());

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.