use of org.apache.qpid.server.typedmessage.mimecontentconverter.MapToJmsMapMessage in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test method testNoBodyWithJmsMapContentType.
public void testNoBodyWithJmsMapContentType() throws Exception {
final Properties properties = new Properties();
properties.setContentType(Symbol.valueOf("jms/map-message"));
final Message_1_0 sourceMessage = createTestMessage(properties, null);
final MessageTransferMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
assertEquals("Unexpected mime type", "jms/map-message", convertedMessage.getMessageHeader().getMimeType());
assertArrayEquals("Unexpected content size", new MapToJmsMapMessage().toMimeContent(Collections.emptyMap()), getBytes(content));
}
use of org.apache.qpid.server.typedmessage.mimecontentconverter.MapToJmsMapMessage in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test method testAmqpValueWithNullWithJmsMapContentType.
public void testAmqpValueWithNullWithJmsMapContentType() throws Exception {
final Properties properties = new Properties();
properties.setContentType(Symbol.valueOf("jms/map-message"));
final Object expected = null;
final AmqpValue amqpValue = new AmqpValue(expected);
Message_1_0 sourceMessage = createTestMessage(properties, amqpValue.createEncodingRetainingSection());
final MessageTransferMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
assertEquals("Unexpected mime type", "jms/map-message", convertedMessage.getMessageHeader().getMimeType());
assertArrayEquals("Unexpected content size", new MapToJmsMapMessage().toMimeContent(Collections.emptyMap()), getBytes(content));
}
use of org.apache.qpid.server.typedmessage.mimecontentconverter.MapToJmsMapMessage in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test method testDataWithMapMessageAnnotationAndContentTypeJmsMapMessage.
public void testDataWithMapMessageAnnotationAndContentTypeJmsMapMessage() throws Exception {
Map<String, Object> originalMap = Collections.singletonMap("testKey", "testValue");
byte[] data = new MapToJmsMapMessage().toMimeContent(originalMap);
String expectedMimeType = "jms/map-message";
final Data value = new Data(new Binary(data));
Properties properties = new Properties();
properties.setContentType(Symbol.valueOf(expectedMimeType));
Message_1_0 sourceMessage = createTestMessage(properties, MAP_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.typedmessage.mimecontentconverter.MapToJmsMapMessage in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_8Test method testDataWithMapMessageAnnotationAndContentTypeJmsMapMessage.
public void testDataWithMapMessageAnnotationAndContentTypeJmsMapMessage() throws Exception {
Map<String, Object> originalMap = Collections.singletonMap("testKey", "testValue");
byte[] data = new MapToJmsMapMessage().toMimeContent(originalMap);
String expectedMimeType = "jms/map-message";
final Data value = new Data(new Binary(data));
Properties properties = new Properties();
properties.setContentType(Symbol.valueOf(expectedMimeType));
Message_1_0 sourceMessage = createTestMessage(properties, MAP_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));
}
use of org.apache.qpid.server.typedmessage.mimecontentconverter.MapToJmsMapMessage in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_8Test method testAmqpValueWithNullWithJmsMapContentType.
public void testAmqpValueWithNullWithJmsMapContentType() throws Exception {
final Properties properties = new Properties();
properties.setContentType(Symbol.valueOf("jms/map-message"));
final Object expected = null;
final AmqpValue amqpValue = new AmqpValue(expected);
Message_1_0 sourceMessage = createTestMessage(properties, amqpValue.createEncodingRetainingSection());
final AMQMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
assertEquals("Unexpected mime type", "jms/map-message", convertedMessage.getMessageHeader().getMimeType());
assertArrayEquals("Unexpected content size", new MapToJmsMapMessage().toMimeContent(Collections.emptyMap()), getBytes(content));
}
Aggregations