use of org.apache.qpid.server.protocol.v0_10.transport.ReplyTo in project qpid-broker-j by apache.
the class PropertyConverter_Internal_to_v0_10Test method testReplyToConversionWhenQueueIsSpecified.
public void testReplyToConversionWhenQueueIsSpecified() throws IOException {
final AMQMessageHeader header = mock(AMQMessageHeader.class);
final String replyTo = "myTestQueue";
final Queue queue = mock(Queue.class);
when(queue.getName()).thenReturn(replyTo);
when(_addressSpace.getAttainedMessageDestination(replyTo)).thenReturn(queue);
when(header.getReplyTo()).thenReturn(replyTo);
InternalMessage originalMessage = createTestMessage(header);
MessageTransferMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
final ReplyTo convertedReplyTo = convertedMessage.getHeader().getMessageProperties().getReplyTo();
assertEquals("Unexpected exchange", "", convertedReplyTo.getExchange());
assertEquals("Unexpected routing key", replyTo, convertedReplyTo.getRoutingKey());
}
use of org.apache.qpid.server.protocol.v0_10.transport.ReplyTo in project qpid-broker-j by apache.
the class MessageConverter_Internal_to_v0_10 method getReplyTo.
private ReplyTo getReplyTo(final NamedAddressSpace addressSpace, final String origReplyTo) {
DestinationAddress destinationAddress = new DestinationAddress(addressSpace, origReplyTo);
MessageDestination messageDestination = destinationAddress.getMessageDestination();
final String exchange = ensureStr8("reply-to[\"exchange\"]", messageDestination instanceof Exchange ? messageDestination.getName() : "");
final String routingKey = ensureStr8("reply-to[\"routing-key\"]", messageDestination instanceof Queue ? messageDestination.getName() : destinationAddress.getRoutingKey());
return new ReplyTo(exchange, routingKey);
}
Aggregations