use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.AmqpMapToMapConverter in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test method testAmqpValueWithMapContainingMap.
public void testAmqpValueWithMapContainingMap() throws Exception {
final Map<String, Object> originalMap = Collections.singletonMap("testMap", Collections.singletonMap("innerKey", "testValue"));
final AmqpValue amqpValue = new AmqpValue(originalMap);
Message_1_0 sourceMessage = createTestMessage(amqpValue.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());
Map<String, Object> convertedMap = new AmqpMapToMapConverter().toObject(getBytes(content));
assertEquals("Unexpected size", originalMap.size(), convertedMap.size());
assertEquals("Unexpected binary entry", new HashMap((Map<String, Object>) originalMap.get("testMap")), new HashMap((Map<String, Object>) convertedMap.get("testMap")));
}
use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.AmqpMapToMapConverter in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_8Test method testAmqpValueWithMapContainingMap.
public void testAmqpValueWithMapContainingMap() throws Exception {
final Map<String, Object> originalMap = Collections.singletonMap("testMap", Collections.singletonMap("innerKey", "testValue"));
final AmqpValue amqpValue = new AmqpValue(originalMap);
Message_1_0 sourceMessage = createTestMessage(amqpValue.createEncodingRetainingSection());
final AMQMessage 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());
Map<String, Object> convertedMap = new AmqpMapToMapConverter().toObject(getBytes(content));
assertEquals("Unexpected size", originalMap.size(), convertedMap.size());
assertEquals("Unexpected binary entry", new HashMap((Map<String, Object>) originalMap.get("testMap")), new HashMap((Map<String, Object>) convertedMap.get("testMap")));
}
Aggregations