Search in sources :

Example 1 with ServerJMSObjectMessage

use of org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage in project activemq-artemis by apache.

the class JMSMappingOutboundTransformerTest method testConvertCompressedObjectMessageToAmqpMessageWithDataBody.

@Test
public void testConvertCompressedObjectMessageToAmqpMessageWithDataBody() throws Exception {
    ServerJMSObjectMessage outbound = createObjectMessage(TEST_OBJECT_VALUE, true);
    outbound.encode();
    Message amqp = AMQPConverter.getInstance().fromCore(outbound.getInnerMessage()).getProtonMessage();
    assertNotNull(amqp.getBody());
    assertTrue(amqp.getBody() instanceof Data);
    assertFalse(0 == ((Data) amqp.getBody()).getValue().getLength());
    Object value = deserialize(((Data) amqp.getBody()).getValue().getArray());
    assertNotNull(value);
    assertTrue(value instanceof UUID);
}
Also used : CoreMessage(org.apache.activemq.artemis.core.message.impl.CoreMessage) ServerJMSTextMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSTextMessage) ServerJMSObjectMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage) Message(org.apache.qpid.proton.message.Message) ServerJMSMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMessage) ServerJMSStreamMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSStreamMessage) ServerJMSBytesMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSBytesMessage) ServerJMSMapMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMapMessage) ServerJMSObjectMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage) Data(org.apache.qpid.proton.amqp.messaging.Data) UUID(java.util.UUID) Test(org.junit.Test)

Example 2 with ServerJMSObjectMessage

use of org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage in project activemq-artemis by apache.

the class JMSMappingOutboundTransformerTest method testConvertCompressedObjectMessageToAmqpMessageWithAmqpValueBody.

@Test
public void testConvertCompressedObjectMessageToAmqpMessageWithAmqpValueBody() throws Exception {
    ServerJMSObjectMessage outbound = createObjectMessage(TEST_OBJECT_VALUE, true);
    outbound.encode();
    Message amqp = AMQPConverter.getInstance().fromCore(outbound.getInnerMessage()).getProtonMessage();
    assertNotNull(amqp.getBody());
    assertTrue(amqp.getBody() instanceof Data);
    assertTrue(((Data) amqp.getBody()).getValue() instanceof Binary);
    assertFalse(0 == ((Binary) ((Data) amqp.getBody()).getValue()).getLength());
    Object value = deserialize((((Data) amqp.getBody()).getValue()).getArray());
    assertNotNull(value);
    assertTrue(value instanceof UUID);
}
Also used : CoreMessage(org.apache.activemq.artemis.core.message.impl.CoreMessage) ServerJMSTextMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSTextMessage) ServerJMSObjectMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage) Message(org.apache.qpid.proton.message.Message) ServerJMSMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMessage) ServerJMSStreamMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSStreamMessage) ServerJMSBytesMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSBytesMessage) ServerJMSMapMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMapMessage) ServerJMSObjectMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage) Data(org.apache.qpid.proton.amqp.messaging.Data) Binary(org.apache.qpid.proton.amqp.Binary) UUID(java.util.UUID) Test(org.junit.Test)

Example 3 with ServerJMSObjectMessage

use of org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage in project activemq-artemis by apache.

the class JMSMappingOutboundTransformerTest method testConvertCompressedObjectMessageToAmqpMessageUnknownEncodingGetsDataSection.

@Test
public void testConvertCompressedObjectMessageToAmqpMessageUnknownEncodingGetsDataSection() throws Exception {
    ServerJMSObjectMessage outbound = createObjectMessage(TEST_OBJECT_VALUE, true);
    outbound.encode();
    Message amqp = AMQPConverter.getInstance().fromCore(outbound.getInnerMessage()).getProtonMessage();
    assertNotNull(amqp.getBody());
    assertTrue(amqp.getBody() instanceof Data);
    assertFalse(0 == ((Data) amqp.getBody()).getValue().getLength());
    Object value = deserialize(((Data) amqp.getBody()).getValue().getArray());
    assertNotNull(value);
    assertTrue(value instanceof UUID);
}
Also used : CoreMessage(org.apache.activemq.artemis.core.message.impl.CoreMessage) ServerJMSTextMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSTextMessage) ServerJMSObjectMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage) Message(org.apache.qpid.proton.message.Message) ServerJMSMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMessage) ServerJMSStreamMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSStreamMessage) ServerJMSBytesMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSBytesMessage) ServerJMSMapMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMapMessage) ServerJMSObjectMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage) Data(org.apache.qpid.proton.amqp.messaging.Data) UUID(java.util.UUID) Test(org.junit.Test)

Example 4 with ServerJMSObjectMessage

use of org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage in project activemq-artemis by apache.

the class JMSMappingOutboundTransformerTest method testConvertEmptyObjectMessageToAmqpMessageUnknownEncodingGetsDataSection.

@Test
public void testConvertEmptyObjectMessageToAmqpMessageUnknownEncodingGetsDataSection() throws Exception {
    ServerJMSObjectMessage outbound = createObjectMessage();
    outbound.encode();
    Message amqp = AMQPConverter.getInstance().fromCore(outbound.getInnerMessage()).getProtonMessage();
    assertNotNull(amqp.getBody());
    assertTrue(amqp.getBody() instanceof Data);
    assertEquals(5, ((Data) amqp.getBody()).getValue().getLength());
}
Also used : CoreMessage(org.apache.activemq.artemis.core.message.impl.CoreMessage) ServerJMSTextMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSTextMessage) ServerJMSObjectMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage) Message(org.apache.qpid.proton.message.Message) ServerJMSMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMessage) ServerJMSStreamMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSStreamMessage) ServerJMSBytesMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSBytesMessage) ServerJMSMapMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMapMessage) ServerJMSObjectMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage) Data(org.apache.qpid.proton.amqp.messaging.Data) Test(org.junit.Test)

Example 5 with ServerJMSObjectMessage

use of org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage in project activemq-artemis by apache.

the class JMSMappingOutboundTransformerTest method testConvertObjectMessageToAmqpMessageWithDataBody.

@Test
public void testConvertObjectMessageToAmqpMessageWithDataBody() throws Exception {
    ServerJMSObjectMessage outbound = createObjectMessage(TEST_OBJECT_VALUE);
    outbound.encode();
    Message amqp = AMQPConverter.getInstance().fromCore(outbound.getInnerMessage()).getProtonMessage();
    assertNotNull(amqp.getBody());
    assertTrue(amqp.getBody() instanceof Data);
    assertFalse(0 == ((Data) amqp.getBody()).getValue().getLength());
    Object value = deserialize(((Data) amqp.getBody()).getValue().getArray());
    assertNotNull(value);
    assertTrue(value instanceof UUID);
}
Also used : CoreMessage(org.apache.activemq.artemis.core.message.impl.CoreMessage) ServerJMSTextMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSTextMessage) ServerJMSObjectMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage) Message(org.apache.qpid.proton.message.Message) ServerJMSMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMessage) ServerJMSStreamMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSStreamMessage) ServerJMSBytesMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSBytesMessage) ServerJMSMapMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMapMessage) ServerJMSObjectMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage) Data(org.apache.qpid.proton.amqp.messaging.Data) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

ServerJMSObjectMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage)11 ServerJMSBytesMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSBytesMessage)8 ServerJMSMapMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMapMessage)8 ServerJMSMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMessage)8 ServerJMSStreamMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSStreamMessage)8 ServerJMSTextMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSTextMessage)8 Data (org.apache.qpid.proton.amqp.messaging.Data)8 CoreMessage (org.apache.activemq.artemis.core.message.impl.CoreMessage)7 Message (org.apache.qpid.proton.message.Message)7 Test (org.junit.Test)7 UUID (java.util.UUID)5 Binary (org.apache.qpid.proton.amqp.Binary)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 ArrayList (java.util.ArrayList)1 JMSException (javax.jms.JMSException)1 MessageEOFException (javax.jms.MessageEOFException)1 ICoreMessage (org.apache.activemq.artemis.api.core.ICoreMessage)1 AmqpSequence (org.apache.qpid.proton.amqp.messaging.AmqpSequence)1 AmqpValue (org.apache.qpid.proton.amqp.messaging.AmqpValue)1