use of org.apache.qpid.amqp_1_0.type.messaging.MessageAnnotations in project qpid-broker-j by apache.
the class MessageConverter_v1_0_to_InternalTest method testAmqpValueWithNullWithUnknownMessageAnnotation.
public void testAmqpValueWithNullWithUnknownMessageAnnotation() throws Exception {
final Object expected = null;
final AmqpValue amqpValue = new AmqpValue(expected);
Message_1_0 sourceMessage = createTestMessage(new MessageAnnotations(Collections.singletonMap(Symbol.valueOf("x-opt-jms-msg-type"), (byte) 11)), amqpValue.createEncodingRetainingSection());
final InternalMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", null, convertedMessage.getMessageHeader().getMimeType());
assertNull("Unexpected content", convertedMessage.getMessageBody());
}
use of org.apache.qpid.amqp_1_0.type.messaging.MessageAnnotations in project qpid-broker-j by apache.
the class MessageConverter_v1_0_to_InternalTest method testDataWithUnsupportedMessageAnnotationWithContentType.
public void testDataWithUnsupportedMessageAnnotationWithContentType() throws Exception {
final String mimeType = "foo/bar";
doTestDataWithAnnotation("helloworld".getBytes(UTF_8), new MessageAnnotations(Collections.singletonMap(Symbol.valueOf("x-opt-jms-msg-type"), (byte) 11)), mimeType, mimeType);
}
use of org.apache.qpid.amqp_1_0.type.messaging.MessageAnnotations in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test method testAmqpValueWithNullWithUnknownMessageAnnotation.
public void testAmqpValueWithNullWithUnknownMessageAnnotation() throws Exception {
final Object expected = null;
final AmqpValue amqpValue = new AmqpValue(expected);
Message_1_0 sourceMessage = createTestMessage(new MessageAnnotations(Collections.singletonMap(Symbol.valueOf("x-opt-jms-msg-type"), (byte) 11)), amqpValue.createEncodingRetainingSection());
final MessageTransferMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", null, convertedMessage.getMessageHeader().getMimeType());
assertEquals("Unexpected content size", 0, convertedMessage.getSize());
}
use of org.apache.qpid.amqp_1_0.type.messaging.MessageAnnotations in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_8Test method testAmqpValueWithNullWithUnknownMessageAnnotation.
public void testAmqpValueWithNullWithUnknownMessageAnnotation() throws Exception {
final Object expected = null;
final AmqpValue amqpValue = new AmqpValue(expected);
Message_1_0 sourceMessage = createTestMessage(new MessageAnnotations(Collections.singletonMap(Symbol.valueOf("x-opt-jms-msg-type"), (byte) 11)), amqpValue.createEncodingRetainingSection());
final AMQMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", null, convertedMessage.getMessageHeader().getMimeType());
assertEquals("Unexpected content size", 0, convertedMessage.getMessageMetaData().getContentSize());
}
use of org.apache.qpid.amqp_1_0.type.messaging.MessageAnnotations in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test method testCreationTimeConversion.
public void testCreationTimeConversion() {
final long timestamp = System.currentTimeMillis() - 10000;
final long arrivalTime = timestamp + 1;
Properties properties = new Properties();
properties.setCreationTime(new Date(timestamp));
Message_1_0 message = createTestMessage(new Header(), new DeliveryAnnotations(Collections.emptyMap()), new MessageAnnotations(Collections.emptyMap()), properties, new ApplicationProperties(Collections.emptyMap()), arrivalTime);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected timestamp", timestamp, convertedProperties.getTimestamp());
}
Aggregations