use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter in project qpid-broker-j by apache.
the class MessageConverter_0_10_to_1_0Test method testConvertAmqpMapMessageBody.
public void testConvertAmqpMapMessageBody() throws Exception {
final Map<String, Object> expected = Collections.singletonMap("key", "value");
final byte[] messageBytes = new MapToAmqpMapConverter().toMimeContent(expected);
doTestMapMessage(messageBytes, "amqp/map", expected, JmsMessageTypeAnnotation.MAP_MESSAGE.getType());
}
use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test method testDataWithContentTypeAmqpMap.
public void testDataWithContentTypeAmqpMap() throws Exception {
Map<String, Object> originalMap = Collections.singletonMap("testKey", "testValue");
byte[] bytes = new MapToAmqpMapConverter().toMimeContent(originalMap);
final Data value = new Data(new Binary(bytes));
Properties properties = new Properties();
properties.setContentType(Symbol.valueOf("amqp/map"));
Message_1_0 sourceMessage = createTestMessage(properties, value.createEncodingRetainingSection());
final MessageTransferMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", "amqp/map", 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.MapToAmqpMapConverter in project qpid-broker-j by apache.
the class MessageConverter_0_8_to_1_0Test method testConvertAmqpMapMessageBody.
public void testConvertAmqpMapMessageBody() throws Exception {
final Map<String, Object> expected = Collections.singletonMap("key", "value");
final byte[] messageBytes = new MapToAmqpMapConverter().toMimeContent(expected);
doTestMapMessage(messageBytes, "amqp/map", expected, JmsMessageTypeAnnotation.MAP_MESSAGE.getType());
}
use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter in project qpid-broker-j by apache.
the class MessageConverter_Internal_to_0_10Test method testMapMessageWithMimeTypeWithNonJmsContent.
public void testMapMessageWithMimeTypeWithNonJmsContent() throws Exception {
HashMap<Object, Object> content = new HashMap<>();
content.put("key", Collections.singletonMap("foo", "bar"));
final String mimeType = "foo/bar";
final MapToAmqpMapConverter mapToAmqpMapConverter = new MapToAmqpMapConverter();
final byte[] expectedContent = mapToAmqpMapConverter.toMimeContent(content);
doTest(content, mimeType, expectedContent, mapToAmqpMapConverter.getMimeType());
}
use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter in project qpid-broker-j by apache.
the class MessageConverter_0_10_to_InternalTest method testConvertAmqpMapMessageBody.
public void testConvertAmqpMapMessageBody() throws Exception {
final Map<String, Object> expected = Collections.singletonMap("key", "value");
final byte[] messageBytes = new MapToAmqpMapConverter().toMimeContent(expected);
doTestMapMessage(messageBytes, "amqp/map", expected);
}
Aggregations