use of org.apache.qpid.server.protocol.v0_10.MessageTransferMessage in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testPriorityConversion.
public void testPriorityConversion() {
final Header header = new Header();
final byte priority = (byte) 7;
header.setPriority(UnsignedByte.valueOf(priority));
Message_1_0 message = createTestMessage(header);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
assertEquals("Unexpected priority", priority, deliveryProperties.getPriority().getValue());
}
use of org.apache.qpid.server.protocol.v0_10.MessageTransferMessage in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testReplyToConversionWhenExchangeAndRoutingKeyAreSpecifiedAndGlobalPrefixIsUsed.
public void testReplyToConversionWhenExchangeAndRoutingKeyAreSpecifiedAndGlobalPrefixIsUsed() throws IOException {
final String exchangeName = "testExchnageName";
final String routingKey = "testRoutingKey";
final String globalPrefix = "/testPrefix";
final String replyTo = String.format("%s/%s/%s", globalPrefix, exchangeName, routingKey);
when(_namedAddressSpace.getLocalAddress(replyTo)).thenReturn(exchangeName + "/" + routingKey);
final Exchange exchange = mock(Exchange.class);
when(exchange.getName()).thenReturn(exchangeName);
when(_namedAddressSpace.getAttainedMessageDestination(exchangeName)).thenReturn(exchange);
Properties properties = new Properties();
properties.setReplyTo(replyTo);
Message_1_0 message = createTestMessage(properties);
MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final ReplyTo convertedReplyTo = convertedMessage.getHeader().getMessageProperties().getReplyTo();
assertEquals("Unexpected exchange", exchangeName, convertedReplyTo.getExchange());
assertEquals("Unexpected routing key", routingKey, convertedReplyTo.getRoutingKey());
}
use of org.apache.qpid.server.protocol.v0_10.MessageTransferMessage in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testReplyToConversionWhenReplyToCannotBeResolved.
public void testReplyToConversionWhenReplyToCannotBeResolved() throws IOException {
final String replyTo = "direct://amq.direct//test?routingkey='test'";
Properties properties = new Properties();
properties.setReplyTo(replyTo);
Message_1_0 message = createTestMessage(properties);
MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
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.MessageTransferMessage in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testReplyToConversionWhenQueueIsSpecified.
public void testReplyToConversionWhenQueueIsSpecified() throws IOException {
final String replyTo = "myTestQueue";
final Queue queue = mock(Queue.class);
when(queue.getName()).thenReturn(replyTo);
when(_namedAddressSpace.getAttainedMessageDestination(replyTo)).thenReturn(queue);
Properties properties = new Properties();
properties.setReplyTo(replyTo);
Message_1_0 message = createTestMessage(properties);
MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
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.MessageTransferMessage in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_0_8Test method testPriorityConversion.
public void testPriorityConversion() {
final byte priority = 5;
final DeliveryProperties deliveryProperties = new DeliveryProperties();
deliveryProperties.setPriority(MessageDeliveryPriority.get(priority));
MessageTransferMessage message = createTestMessage(deliveryProperties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties properties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected priority", priority, properties.getPriority());
}
Aggregations