use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class MessageConverter_v1_0_to_InternalTest method testAmqpValueWithNullWithTextMessageAnnotation.
public void testAmqpValueWithNullWithTextMessageAnnotation() throws Exception {
final Object expected = null;
final AmqpValue amqpValue = new AmqpValue(expected);
Message_1_0 sourceMessage = createTestMessage(TEXT_MESSAGE_MESSAGE_ANNOTATION, amqpValue.createEncodingRetainingSection());
final InternalMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertNull("Unexpected content", convertedMessage.getMessageBody());
assertEquals("Unexpected mime type", "text/plain", convertedMessage.getMessageHeader().getMimeType());
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v1_0Test method testMessageIdUuidConversion.
public void testMessageIdUuidConversion() {
final UUID messageId = UUID.randomUUID();
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getMessageId()).thenReturn(messageId.toString());
InternalMessage originalMessage = createTestMessage(header);
Message_1_0 convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
Object convertedMessageId = MessageConverter_from_1_0.getMessageId(convertedMessage);
assertEquals("Unexpected messageId", messageId, convertedMessageId);
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v1_0Test method testCorrelationIdUnsignedLongConversion.
public void testCorrelationIdUnsignedLongConversion() {
final UnsignedLong correlationId = UnsignedLong.valueOf(-1L);
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getCorrelationId()).thenReturn(correlationId.toString());
InternalMessage originalMessage = createTestMessage(header);
Message_1_0 convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
Object convertedCorrelationId = MessageConverter_from_1_0.getCorrelationId(convertedMessage);
assertEquals("Unexpected correlationId", correlationId, convertedCorrelationId);
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v1_0Test method testMessageIdUnsignedLongConversion.
public void testMessageIdUnsignedLongConversion() {
final UnsignedLong messageId = UnsignedLong.valueOf(-1L);
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getMessageId()).thenReturn(messageId.toString());
InternalMessage originalMessage = createTestMessage(header);
Message_1_0 convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
Object convertedMessageId = MessageConverter_from_1_0.getMessageId(convertedMessage);
assertEquals("Unexpected messageId", messageId, convertedMessageId);
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v1_0Test method createTestMessage.
private InternalMessage createTestMessage(String to) {
final InternalMessageHeader internalMessageHeader = new InternalMessageHeader(mock(AMQMessageHeader.class));
final StoredMessage<InternalMessageMetaData> handle = createInternalStoredMessage(null, false, internalMessageHeader);
return new InternalMessage(handle, internalMessageHeader, null, to);
}
Aggregations