Search in sources :

Example 51 with MessageTransferMessage

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());
}
Also used : Header(org.apache.qpid.server.protocol.v1_0.type.messaging.Header) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)

Example 52 with MessageTransferMessage

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());
}
Also used : Exchange(org.apache.qpid.server.model.Exchange) ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Matchers.anyString(org.mockito.Matchers.anyString) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) 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)

Example 53 with MessageTransferMessage

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());
}
Also used : ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Matchers.anyString(org.mockito.Matchers.anyString) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) 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)

Example 54 with MessageTransferMessage

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());
}
Also used : ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Matchers.anyString(org.mockito.Matchers.anyString) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) 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) Queue(org.apache.qpid.server.model.Queue)

Example 55 with MessageTransferMessage

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());
}
Also used : MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Aggregations

MessageTransferMessage (org.apache.qpid.server.protocol.v0_10.MessageTransferMessage)182 MessageProperties (org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)128 Message_1_0 (org.apache.qpid.server.protocol.v1_0.Message_1_0)116 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)115 Properties (org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)80 AMQMessage (org.apache.qpid.server.protocol.v0_8.AMQMessage)58 ApplicationProperties (org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties)58 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)53 NamedAddressSpace (org.apache.qpid.server.model.NamedAddressSpace)46 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)45 Matchers.anyString (org.mockito.Matchers.anyString)37 InternalMessage (org.apache.qpid.server.message.internal.InternalMessage)34 QpidByteBuffer (org.apache.qpid.server.bytebuffer.QpidByteBuffer)31 ReplyTo (org.apache.qpid.server.protocol.v0_10.transport.ReplyTo)28 Binary (org.apache.qpid.server.protocol.v1_0.type.Binary)23 Header (org.apache.qpid.server.protocol.v1_0.type.messaging.Header)19 AmqpValue (org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue)17 Data (org.apache.qpid.server.protocol.v1_0.type.messaging.Data)14 HashMap (java.util.HashMap)13 MessageAnnotations (org.apache.qpid.server.protocol.v1_0.type.messaging.MessageAnnotations)10