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 testReplyToConversionWhenRoutingKeySpecified.
public void testReplyToConversionWhenRoutingKeySpecified() {
final String routingKey = "test_routing_key";
final MessageProperties messageProperties = new MessageProperties();
messageProperties.setReplyTo(new ReplyTo(null, routingKey));
MessageTransferMessage message = createTestMessage(messageProperties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties properties = convertedMessage.getContentHeaderBody().getProperties();
String expectedReplyTo = String.format("direct:////?routingkey='%s'", routingKey);
assertEquals("Unexpected reply-to", expectedReplyTo, properties.getReplyTo().toString());
}
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 testReplyToConversionWhenExchangeAndRoutingKeyAreNull.
public void testReplyToConversionWhenExchangeAndRoutingKeyAreNull() {
final MessageProperties messageProperties = new MessageProperties();
messageProperties.setReplyTo(new ReplyTo(null, null));
MessageTransferMessage message = createTestMessage(messageProperties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties properties = convertedMessage.getContentHeaderBody().getProperties();
assertNull("Unexpected reply-to", properties.getReplyTo());
}
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 testMessageIdConversion.
public void testMessageIdConversion() {
UUID messageId = UUID.randomUUID();
final MessageProperties messageProperties = new MessageProperties();
messageProperties.setMessageId(messageId);
MessageTransferMessage message = createTestMessage(messageProperties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties properties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected messageId", "ID:" + messageId, properties.getMessageId().toString());
}
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 testTTLConversion.
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());
}
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 testApplicationHeadersConversion.
public void testApplicationHeadersConversion() {
Map<String, Object> headers = new HashMap<>();
headers.put("testProperty1", "testProperty1Value");
headers.put("intProperty", 1);
final MessageProperties messageProperties = new MessageProperties();
messageProperties.setApplicationHeaders(headers);
MessageTransferMessage message = createTestMessage(messageProperties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties properties = convertedMessage.getContentHeaderBody().getProperties();
Map<String, Object> applicationProperties = FieldTable.convertToMap(properties.getHeaders());
assertEquals("Unexpected headers", headers, new HashMap<>(applicationProperties));
}
Aggregations