use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.ListToAmqpListConverter in project qpid-broker-j by apache.
the class MessageConverter_0_10_to_1_0Test method testConvertAmqpListMessageBodyWithNonJmsContent.
public void testConvertAmqpListMessageBodyWithNonJmsContent() throws Exception {
final List<Object> expected = Lists.newArrayList("apple", 43, 31.42D, Lists.newArrayList("nonJMSList"));
final byte[] messageBytes = new ListToAmqpListConverter().toMimeContent(expected);
final String mimeType = "amqp/list";
doTestStreamMessage(messageBytes, mimeType, expected, null);
}
use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.ListToAmqpListConverter in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test method testDataWithStreamMessageAnnotationAndContentTypeAmqpList.
public void testDataWithStreamMessageAnnotationAndContentTypeAmqpList() throws Exception {
List<Object> originalList = Collections.singletonList("testValue");
byte[] data = new ListToAmqpListConverter().toMimeContent(originalList);
String expectedMimeType = "amqp/list";
final Data value = new Data(new Binary(data));
Properties properties = new Properties();
properties.setContentType(Symbol.valueOf(expectedMimeType));
Message_1_0 sourceMessage = createTestMessage(properties, STREAM_MESSAGE_MESSAGE_ANNOTATION, value.createEncodingRetainingSection());
final MessageTransferMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", expectedMimeType, convertedMessage.getMessageHeader().getMimeType());
final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
assertArrayEquals("Unexpected content", data, getBytes(content));
}
use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.ListToAmqpListConverter in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test method testDataWithContentTypeAmqpList.
public void testDataWithContentTypeAmqpList() throws Exception {
List<Object> originalMap = Collections.singletonList("testValue");
byte[] bytes = new ListToAmqpListConverter().toMimeContent(originalMap);
final Data value = new Data(new Binary(bytes));
Properties properties = new Properties();
properties.setContentType(Symbol.valueOf("amqp/list"));
Message_1_0 sourceMessage = createTestMessage(properties, value.createEncodingRetainingSection());
final MessageTransferMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", "amqp/list", convertedMessage.getMessageHeader().getMimeType());
final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
assertArrayEquals("Unexpected content", bytes, getBytes(content));
}
use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.ListToAmqpListConverter in project qpid-broker-j by apache.
the class MessageConverter_0_8_to_1_0Test method testConvertAmqpListMessageBodyWithNonJmsContent.
public void testConvertAmqpListMessageBodyWithNonJmsContent() throws Exception {
final List<Object> expected = Lists.newArrayList("apple", 43, 31.42D, Lists.newArrayList("nonJMSList"));
final byte[] messageBytes = new ListToAmqpListConverter().toMimeContent(expected);
final String mimeType = "amqp/list";
doTestStreamMessage(messageBytes, mimeType, expected, null);
}
use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.ListToAmqpListConverter in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_8Test method testDataWithStreamMessageAnnotationAndContentTypeAmqpList.
public void testDataWithStreamMessageAnnotationAndContentTypeAmqpList() throws Exception {
List<Object> originalList = Collections.singletonList("testValue");
byte[] data = new ListToAmqpListConverter().toMimeContent(originalList);
String expectedMimeType = "amqp/list";
final Data value = new Data(new Binary(data));
Properties properties = new Properties();
properties.setContentType(Symbol.valueOf(expectedMimeType));
Message_1_0 sourceMessage = createTestMessage(properties, STREAM_MESSAGE_MESSAGE_ANNOTATION, value.createEncodingRetainingSection());
final AMQMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", expectedMimeType, convertedMessage.getMessageHeader().getMimeType());
final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
assertArrayEquals("Unexpected content", data, getBytes(content));
}
Aggregations