Search in sources :

Example 1 with ReplyTo

use of org.apache.qpid.server.protocol.v0_10.transport.ReplyTo in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_1_0Test 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 Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    Properties properties = convertedMessage.getPropertiesSection().getValue();
    assertEquals("Unexpected reply-to", "amq.direct/test_routing_key", properties.getReplyTo());
}
Also used : ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) Test(org.junit.Test)

Example 2 with ReplyTo

use of org.apache.qpid.server.protocol.v0_10.transport.ReplyTo in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_1_0Test method testReplyToConversionWhenExchangeIsEmptyStringAndRoutingKeySpecified.

@Test
public void testReplyToConversionWhenExchangeIsEmptyStringAndRoutingKeySpecified() {
    final String routingKey = "test_routing_key";
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setReplyTo(new ReplyTo("", routingKey));
    MessageTransferMessage message = createTestMessage(messageProperties);
    final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    Properties properties = convertedMessage.getPropertiesSection().getValue();
    assertEquals("Unexpected reply-to", "test_routing_key", properties.getReplyTo());
}
Also used : ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) Test(org.junit.Test)

Example 3 with ReplyTo

use of org.apache.qpid.server.protocol.v0_10.transport.ReplyTo in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_1_0Test method testReplyToConversionWhenExchangeAndRoutingKeyAreNull.

@Test
public void testReplyToConversionWhenExchangeAndRoutingKeyAreNull() {
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setReplyTo(new ReplyTo(null, null));
    MessageTransferMessage message = createTestMessage(messageProperties);
    final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    Properties properties = convertedMessage.getPropertiesSection().getValue();
    assertNull("Unexpected reply-to", properties.getReplyTo());
}
Also used : ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) Test(org.junit.Test)

Example 4 with ReplyTo

use of org.apache.qpid.server.protocol.v0_10.transport.ReplyTo in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_0_8Test method testReplyToConversionWhenExchangeSpecified.

@Test
public void testReplyToConversionWhenExchangeSpecified() {
    final String exchangeName = "amq.direct";
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setReplyTo(new ReplyTo(exchangeName, null));
    MessageTransferMessage message = createTestMessage(messageProperties);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    BasicContentHeaderProperties properties = convertedMessage.getContentHeaderBody().getProperties();
    String expectedReplyTo = String.format("direct://%s//", exchangeName);
    assertEquals("Unexpected reply-to", expectedReplyTo, properties.getReplyTo().toString());
}
Also used : ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage) Test(org.junit.Test)

Example 5 with ReplyTo

use of org.apache.qpid.server.protocol.v0_10.transport.ReplyTo 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());
}
Also used : ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage) Test(org.junit.Test)

Aggregations

MessageProperties (org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)31 ReplyTo (org.apache.qpid.server.protocol.v0_10.transport.ReplyTo)31 Test (org.junit.Test)31 MessageTransferMessage (org.apache.qpid.server.protocol.v0_10.MessageTransferMessage)21 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)14 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)12 Properties (org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)12 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)11 Message_1_0 (org.apache.qpid.server.protocol.v1_0.Message_1_0)11 AMQMessage (org.apache.qpid.server.protocol.v0_8.AMQMessage)10 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)10 InternalMessage (org.apache.qpid.server.message.internal.InternalMessage)9 Exchange (org.apache.qpid.server.model.Exchange)8 ApplicationProperties (org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties)7 AMQMessageHeader (org.apache.qpid.server.message.AMQMessageHeader)5 Queue (org.apache.qpid.server.model.Queue)4 MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)4 MessageDestination (org.apache.qpid.server.message.MessageDestination)3 HashMap (java.util.HashMap)2 DestinationAddress (org.apache.qpid.server.model.DestinationAddress)2