use of org.apache.qpid.server.protocol.v0_8.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_0_8Test method testReplyToConversionWhenExchangeAndRoutingKeySpecified.
@Test
public void testReplyToConversionWhenExchangeAndRoutingKeySpecified() {
final String exchangeName = "amq.direct";
final String routingKey = "test_routing_key";
final MessageProperties messageProperties = new MessageProperties();
messageProperties.setReplyTo(new ReplyTo(exchangeName, routingKey));
MessageTransferMessage message = createTestMessage(messageProperties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties properties = convertedMessage.getContentHeaderBody().getProperties();
String expectedReplyTo = String.format("direct://%s//?routingkey='%s'", exchangeName, routingKey);
assertEquals("Unexpected reply-to", expectedReplyTo, properties.getReplyTo().toString());
}
use of org.apache.qpid.server.protocol.v0_8.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_0_8Test method testDiscardUnroutableTrueConversion.
@Test
public void testDiscardUnroutableTrueConversion() {
final boolean discardUnroutable = true;
final DeliveryProperties deliveryProperties = new DeliveryProperties();
deliveryProperties.setDiscardUnroutable(discardUnroutable);
MessageTransferMessage message = createTestMessage(deliveryProperties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
final Object expected = !discardUnroutable;
assertEquals("Unexpected mandatory flag", expected, messagePublishInfo.isMandatory());
}
use of org.apache.qpid.server.protocol.v0_8.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_0_8Test method testTimestampConversion.
@Test
public void testTimestampConversion() {
final DeliveryProperties deliveryProperties = new DeliveryProperties();
final long timestamp = System.currentTimeMillis() - 1000;
deliveryProperties.setTimestamp(timestamp);
MessageTransferMessage message = createTestMessage(deliveryProperties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties properties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected creation timestamp", timestamp, properties.getTimestamp());
}
use of org.apache.qpid.server.protocol.v0_8.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_0_8Test method testPriorityConversion.
@Test
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", (long) priority, (long) properties.getPriority());
}
use of org.apache.qpid.server.protocol.v0_8.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_0_8Test method testTTLConversion.
@Test
public void testTTLConversion() {
long timestamp = System.currentTimeMillis();
int ttl = 100000;
final DeliveryProperties deliveryProperties = new DeliveryProperties();
deliveryProperties.setTtl(ttl);
MessageTransferMessage message = createTestMessage(deliveryProperties, new MessageProperties(), null, timestamp);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties properties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected expiration", timestamp + ttl, properties.getExpiration());
}
Aggregations