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 testReplyToConversionWhenRoutingKeySpecified.
@Test
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_8.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_0_8Test method testCorrelationIdConversion.
@Test
public void testCorrelationIdConversion() {
final String correlationId = "testCorrelationId";
final MessageProperties messageProperties = new MessageProperties();
messageProperties.setCorrelationId(correlationId.getBytes());
MessageTransferMessage message = createTestMessage(messageProperties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties properties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected correlationId", correlationId, properties.getCorrelationId().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 testReplyToConversionWhenExchangeAndRoutingKeyAreNull.
@Test
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_8.AMQMessage in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_0_8Test method testApplicationHeadersConversion.
@Test
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 = properties.getHeadersAsMap();
assertEquals("Unexpected headers", headers, new HashMap<>(applicationProperties));
}
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 testMessageIdConversion.
@Test
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());
}
Aggregations