use of org.apache.qpid.server.message.AMQMessageHeader in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testReplyToConversionWhenExchangeIsSpecified.
public void testReplyToConversionWhenExchangeIsSpecified() {
final String replyTo = "testExchange";
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getReplyTo()).thenReturn(replyTo);
Exchange exchange = mock(Exchange.class);
when(exchange.getName()).thenReturn(replyTo);
when(exchange.getType()).thenReturn(ExchangeDefaults.FANOUT_EXCHANGE_CLASS);
when(_addressSpace.getAttainedMessageDestination(replyTo)).thenReturn(exchange);
InternalMessage originalMessage = createTestMessage(header);
AMQMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected reply-to", "fanout://" + replyTo + "//", convertedMessage.getContentHeaderBody().getProperties().getReplyToAsString());
}
use of org.apache.qpid.server.message.AMQMessageHeader in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testTimestampConversion.
public void testTimestampConversion() {
final long timestamp = System.currentTimeMillis();
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getTimestamp()).thenReturn(timestamp);
InternalMessage originalMessage = createTestMessage(header);
AMQMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected timestamp", timestamp, convertedMessage.getContentHeaderBody().getProperties().getTimestamp());
}
use of org.apache.qpid.server.message.AMQMessageHeader in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testMessageIdConversionWhenLengthExceeds255.
public void testMessageIdConversionWhenLengthExceeds255() {
final String messageId = generateLongString();
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getMessageId()).thenReturn(messageId);
InternalMessage originalMessage = createTestMessage(header);
AMQMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertNull("Unexpected messageId", convertedMessage.getContentHeaderBody().getProperties().getMessageId());
}
use of org.apache.qpid.server.message.AMQMessageHeader in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testPriorityConversion.
public void testPriorityConversion() {
final AMQMessageHeader header = mock(AMQMessageHeader.class);
byte priority = (byte) 7;
when(header.getPriority()).thenReturn(priority);
InternalMessage originalMessage = createTestMessage(header);
AMQMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected priority", priority, convertedMessage.getContentHeaderBody().getProperties().getPriority());
}
use of org.apache.qpid.server.message.AMQMessageHeader in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_8Test method testReplyToConversionWhenQueueIsSpecified.
public void testReplyToConversionWhenQueueIsSpecified() {
final String replyTo = "testQueue";
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getReplyTo()).thenReturn(replyTo);
Queue queue = mock(Queue.class);
when(queue.getName()).thenReturn(replyTo);
when(_addressSpace.getAttainedMessageDestination(replyTo)).thenReturn(queue);
InternalMessage originalMessage = createTestMessage(header);
AMQMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected reply-to", "direct:////" + replyTo, convertedMessage.getContentHeaderBody().getProperties().getReplyToAsString());
}
Aggregations