use of org.apache.qpid.server.message.AMQMessageHeader in project qpid-broker-j by apache.
the class SortedQueueEntryListTest method generateTestMessage.
private ServerMessage generateTestMessage(final long id, final String keyValue) {
final ServerMessage message = mock(ServerMessage.class);
AMQMessageHeader hdr = mock(AMQMessageHeader.class);
when(message.getMessageHeader()).thenReturn(hdr);
when(hdr.getHeader(eq("KEY"))).thenReturn(keyValue);
when(hdr.containsHeader(eq("KEY"))).thenReturn(true);
when(hdr.getHeaderNames()).thenReturn(Collections.singleton("KEY"));
MessageReference ref = mock(MessageReference.class);
when(ref.getMessage()).thenReturn(message);
when(message.newReference()).thenReturn(ref);
when(message.newReference(any(TransactionLogResource.class))).thenReturn(ref);
when(message.getMessageNumber()).thenReturn(id);
return message;
}
use of org.apache.qpid.server.message.AMQMessageHeader in project qpid-broker-j by apache.
the class SortedQueueEntryTest method getQueueEntryImpl.
@Override
public QueueEntryImpl getQueueEntryImpl(int msgId) {
final ServerMessage message = mock(ServerMessage.class);
AMQMessageHeader hdr = mock(AMQMessageHeader.class);
when(message.getMessageHeader()).thenReturn(hdr);
when(hdr.getHeader(eq("KEY"))).thenReturn(keys[msgId - 1]);
when(hdr.containsHeader(eq("KEY"))).thenReturn(true);
when(hdr.getHeaderNames()).thenReturn(Collections.singleton("KEY"));
final MessageReference reference = mock(MessageReference.class);
when(reference.getMessage()).thenReturn(message);
when(message.newReference()).thenReturn(reference);
when(message.newReference(any(TransactionLogResource.class))).thenReturn(reference);
return _queueEntryList.add(message, null);
}
use of org.apache.qpid.server.message.AMQMessageHeader in project qpid-broker-j by apache.
the class MessageConverter_v1_0_to_Internal method convert.
@Override
public InternalMessage convert(Message_1_0 serverMessage, NamedAddressSpace addressSpace) {
Object bodyObject = MessageConverter_from_1_0.convertBodyToObject(serverMessage);
final AMQMessageHeader convertHeader = convertHeader(serverMessage, addressSpace, bodyObject);
return InternalMessage.convert(serverMessage, convertHeader, bodyObject);
}
use of org.apache.qpid.server.message.AMQMessageHeader 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.AMQMessageHeader 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);
}
Aggregations