Search in sources :

Example 1 with ServerJMSBytesMessage

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

the class JMSMappingOutboundTransformerTest method testConvertEmptyBytesMessageToAmqpMessageWithAmqpValueBody.

@Test
public void testConvertEmptyBytesMessageToAmqpMessageWithAmqpValueBody() throws Exception {
    ServerJMSBytesMessage outbound = createBytesMessage();
    outbound.encode();
    Message amqp = AMQPConverter.getInstance().fromCore(outbound.getInnerMessage()).getProtonMessage();
    assertNotNull(amqp.getBody());
    assertTrue(amqp.getBody() instanceof AmqpValue);
    assertTrue(((AmqpValue) amqp.getBody()).getValue() instanceof Binary);
    assertEquals(0, ((Binary) ((AmqpValue) 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) ServerJMSBytesMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSBytesMessage) Binary(org.apache.qpid.proton.amqp.Binary) AmqpValue(org.apache.qpid.proton.amqp.messaging.AmqpValue) Test(org.junit.Test)

Example 2 with ServerJMSBytesMessage

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

the class JMSMappingOutboundTransformerTest method testConvertUncompressedBytesMessageToAmqpMessageWithAmqpValueBody.

@Test
public void testConvertUncompressedBytesMessageToAmqpMessageWithAmqpValueBody() throws Exception {
    byte[] expectedPayload = new byte[] { 8, 16, 24, 32 };
    ServerJMSBytesMessage outbound = createBytesMessage();
    outbound.writeBytes(expectedPayload);
    outbound.encode();
    Message amqp = AMQPConverter.getInstance().fromCore(outbound.getInnerMessage()).getProtonMessage();
    assertNotNull(amqp.getBody());
    assertTrue(amqp.getBody() instanceof AmqpValue);
    assertTrue(((AmqpValue) amqp.getBody()).getValue() instanceof Binary);
    assertEquals(4, ((Binary) ((AmqpValue) amqp.getBody()).getValue()).getLength());
    Binary amqpData = (Binary) ((AmqpValue) amqp.getBody()).getValue();
    Binary inputData = new Binary(expectedPayload);
    assertTrue(inputData.equals(amqpData));
}
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) ServerJMSBytesMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSBytesMessage) Binary(org.apache.qpid.proton.amqp.Binary) AmqpValue(org.apache.qpid.proton.amqp.messaging.AmqpValue) Test(org.junit.Test)

Example 3 with ServerJMSBytesMessage

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

the class AMQPMessageSupport method createBytesMessage.

public static ServerJMSBytesMessage createBytesMessage(long id, byte[] array, int arrayOffset, int length, CoreMessageObjectPools coreMessageObjectPools) throws JMSException {
    ServerJMSBytesMessage message = createBytesMessage(id, coreMessageObjectPools);
    message.writeBytes(array, arrayOffset, length);
    return message;
}
Also used : ServerJMSBytesMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSBytesMessage)

Example 4 with ServerJMSBytesMessage

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

the class JMSMappingOutboundTransformerTest method testConvertCompressedBytesMessageToAmqpMessageWithAmqpValueBody.

@Ignore("Compressed message body support not yet implemented.")
@Test
public void testConvertCompressedBytesMessageToAmqpMessageWithAmqpValueBody() throws Exception {
    byte[] expectedPayload = new byte[] { 8, 16, 24, 32 };
    ServerJMSBytesMessage outbound = createBytesMessage(true);
    outbound.writeBytes(expectedPayload);
    outbound.encode();
    Message amqp = AMQPConverter.getInstance().fromCore(outbound.getInnerMessage()).getProtonMessage();
    assertNotNull(amqp.getBody());
    assertTrue(amqp.getBody() instanceof AmqpValue);
    assertTrue(((AmqpValue) amqp.getBody()).getValue() instanceof Binary);
    assertEquals(4, ((Binary) ((AmqpValue) amqp.getBody()).getValue()).getLength());
    Binary amqpData = (Binary) ((AmqpValue) amqp.getBody()).getValue();
    Binary inputData = new Binary(expectedPayload);
    assertTrue(inputData.equals(amqpData));
}
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) ServerJMSBytesMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSBytesMessage) Binary(org.apache.qpid.proton.amqp.Binary) AmqpValue(org.apache.qpid.proton.amqp.messaging.AmqpValue) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 5 with ServerJMSBytesMessage

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

the class JMSMappingOutboundTransformerTest method testConvertCompressedBytesMessageToAmqpMessageWithDataBody.

// ----- no-body Message type tests ---------------------------------------//
@Ignore("Compressed message body support not yet implemented.")
@Test
public void testConvertCompressedBytesMessageToAmqpMessageWithDataBody() throws Exception {
    byte[] expectedPayload = new byte[] { 8, 16, 24, 32 };
    ServerJMSBytesMessage outbound = createBytesMessage(true);
    outbound.writeBytes(expectedPayload);
    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);
    assertEquals(4, ((Data) amqp.getBody()).getValue().getLength());
    Binary amqpData = ((Data) amqp.getBody()).getValue();
    Binary inputData = new Binary(expectedPayload);
    assertTrue(inputData.equals(amqpData));
}
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) ServerJMSBytesMessage(org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSBytesMessage) Data(org.apache.qpid.proton.amqp.messaging.Data) Binary(org.apache.qpid.proton.amqp.Binary) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

ServerJMSBytesMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSBytesMessage)7 Binary (org.apache.qpid.proton.amqp.Binary)6 ServerJMSMapMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMapMessage)5 ServerJMSMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMessage)5 ServerJMSObjectMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage)5 ServerJMSStreamMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSStreamMessage)5 ServerJMSTextMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSTextMessage)5 Test (org.junit.Test)5 CoreMessage (org.apache.activemq.artemis.core.message.impl.CoreMessage)4 AmqpValue (org.apache.qpid.proton.amqp.messaging.AmqpValue)4 Message (org.apache.qpid.proton.message.Message)4 Data (org.apache.qpid.proton.amqp.messaging.Data)3 ICoreMessage (org.apache.activemq.artemis.api.core.ICoreMessage)2 Ignore (org.junit.Ignore)2 ArrayList (java.util.ArrayList)1 MessageEOFException (javax.jms.MessageEOFException)1 AMQPMessage (org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage)1 AmqpSequence (org.apache.qpid.proton.amqp.messaging.AmqpSequence)1 ApplicationProperties (org.apache.qpid.proton.amqp.messaging.ApplicationProperties)1 Section (org.apache.qpid.proton.amqp.messaging.Section)1