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());
}
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));
}
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;
}
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));
}
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));
}
Aggregations