use of org.apache.qpid.server.typedmessage.mimecontentconverter.JmsStreamMessageToList in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test method testAmqpSequenceWithSimpleTypes.
public void testAmqpSequenceWithSimpleTypes() throws Exception {
final List<Integer> expected = new ArrayList<>();
expected.add(37);
expected.add(42);
final AmqpSequence amqpSequence = new AmqpSequence(expected);
Message_1_0 sourceMessage = createTestMessage(amqpSequence.createEncodingRetainingSection());
final MessageTransferMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", "jms/stream-message", convertedMessage.getMessageHeader().getMimeType());
final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
assertEquals("Unexpected content", expected, new JmsStreamMessageToList().toObject(getBytes(content)));
}
use of org.apache.qpid.server.typedmessage.mimecontentconverter.JmsStreamMessageToList in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test method testAmqpValueWithList.
public void testAmqpValueWithList() throws Exception {
final List<Object> originalList = new ArrayList<>();
originalList.add(new Binary(new byte[] { 0x00, (byte) 0xFF }));
originalList.add(42);
originalList.add(null);
final AmqpValue amqpValue = new AmqpValue(originalList);
Message_1_0 sourceMessage = createTestMessage(amqpValue.createEncodingRetainingSection());
final MessageTransferMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", "jms/stream-message", convertedMessage.getMessageHeader().getMimeType());
final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
List<Object> convertedList = new JmsStreamMessageToList().toObject(getBytes(content));
assertEquals("Unexpected size", originalList.size(), convertedList.size());
assertArrayEquals("Unexpected binary item", ((Binary) originalList.get(0)).getArray(), (byte[]) convertedList.get(0));
assertEquals("Unexpected int item", originalList.get(1), convertedList.get(1));
assertEquals("Unexpected null item", originalList.get(2), convertedList.get(2));
}
use of org.apache.qpid.server.typedmessage.mimecontentconverter.JmsStreamMessageToList in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_8Test method testAmqpValueWithList.
public void testAmqpValueWithList() throws Exception {
final List<Object> originalList = new ArrayList<>();
originalList.add(new Binary(new byte[] { 0x00, (byte) 0xFF }));
originalList.add(42);
originalList.add(null);
final AmqpValue amqpValue = new AmqpValue(originalList);
Message_1_0 sourceMessage = createTestMessage(amqpValue.createEncodingRetainingSection());
final AMQMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", "jms/stream-message", convertedMessage.getMessageHeader().getMimeType());
final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
List<Object> convertedList = new JmsStreamMessageToList().toObject(getBytes(content));
assertEquals("Unexpected size", originalList.size(), convertedList.size());
assertArrayEquals("Unexpected binary item", ((Binary) originalList.get(0)).getArray(), (byte[]) convertedList.get(0));
assertEquals("Unexpected int item", originalList.get(1), convertedList.get(1));
assertEquals("Unexpected null item", originalList.get(2), convertedList.get(2));
}
use of org.apache.qpid.server.typedmessage.mimecontentconverter.JmsStreamMessageToList in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_8Test method testAmqpSequenceWithSimpleTypes.
public void testAmqpSequenceWithSimpleTypes() throws Exception {
final List<Integer> expected = new ArrayList<>();
expected.add(37);
expected.add(42);
final AmqpSequence amqpSequence = new AmqpSequence(expected);
Message_1_0 sourceMessage = createTestMessage(amqpSequence.createEncodingRetainingSection());
final AMQMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", "jms/stream-message", convertedMessage.getMessageHeader().getMimeType());
final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
assertEquals("Unexpected content", expected, new JmsStreamMessageToList().toObject(getBytes(content)));
}
Aggregations