Search in sources :

Example 91 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_InternalTest method testApplicationIdConversion.

public void testApplicationIdConversion() {
    String applicationId = "testAppId";
    MessageProperties messageProperties = new MessageProperties();
    messageProperties.setAppId(applicationId.getBytes(UTF_8));
    MessageTransferMessage message = createTestMessage(messageProperties);
    final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    assertEquals("Unexpected app-id", applicationId, convertedMessage.getMessageHeader().getAppId());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)

Example 92 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_InternalTest method testInitialRoutingAddressConversion.

public void testInitialRoutingAddressConversion() {
    final String testExchange = "testExchange";
    final DeliveryProperties deliveryProperties = new DeliveryProperties();
    deliveryProperties.setExchange(testExchange);
    final String testRoutingKey = "testRoutingKey";
    deliveryProperties.setRoutingKey(testRoutingKey);
    MessageTransferMessage message = createTestMessage(deliveryProperties);
    final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    assertEquals("Unexpected initial routing address", testRoutingKey, convertedMessage.getInitialRoutingAddress());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)

Example 93 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_InternalTest method testPersistentDeliveryModeConversion.

public void testPersistentDeliveryModeConversion() {
    MessageDeliveryMode deliveryMode = MessageDeliveryMode.PERSISTENT;
    final DeliveryProperties deliveryProperties = new DeliveryProperties();
    deliveryProperties.setDeliveryMode(deliveryMode);
    MessageTransferMessage message = createTestMessage(deliveryProperties);
    final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    assertTrue("Unexpected persistence", convertedMessage.isPersistent());
    assertTrue("Unexpected persistence of meta data", convertedMessage.getStoredMessage().getMetaData().isPersistent());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageDeliveryMode(org.apache.qpid.server.protocol.v0_10.transport.MessageDeliveryMode)

Example 94 with MessageTransferMessage

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

the class PropertyConverter_Internal_to_v0_10Test method testReplyToConversionWhenExchangeAndRoutingKeyAreSpecified.

public void testReplyToConversionWhenExchangeAndRoutingKeyAreSpecified() throws IOException {
    final AMQMessageHeader header = mock(AMQMessageHeader.class);
    final String exchangeName = "testExchnageName";
    final String routingKey = "testRoutingKey";
    final String replyTo = String.format("%s/%s", exchangeName, routingKey);
    final Exchange exchange = mock(Exchange.class);
    when(exchange.getName()).thenReturn(exchangeName);
    when(_addressSpace.getAttainedMessageDestination(exchangeName)).thenReturn(exchange);
    when(header.getReplyTo()).thenReturn(replyTo);
    InternalMessage originalMessage = createTestMessage(header);
    MessageTransferMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
    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) InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) AMQMessageHeader(org.apache.qpid.server.message.AMQMessageHeader) Matchers.anyString(org.mockito.Matchers.anyString) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString)

Example 95 with MessageTransferMessage

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

the class PropertyConverter_Internal_to_v0_10Test method testReplyToConversionWhenExchangeIsSpecified.

public void testReplyToConversionWhenExchangeIsSpecified() throws IOException {
    final AMQMessageHeader header = mock(AMQMessageHeader.class);
    final String replyTo = "myTestExchange";
    final Exchange exchange = mock(Exchange.class);
    when(exchange.getName()).thenReturn(replyTo);
    when(_addressSpace.getAttainedMessageDestination(replyTo)).thenReturn(exchange);
    when(header.getReplyTo()).thenReturn(replyTo);
    InternalMessage originalMessage = createTestMessage(header);
    MessageTransferMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
    final ReplyTo convertedReplyTo = convertedMessage.getHeader().getMessageProperties().getReplyTo();
    assertEquals("Unexpected exchange", replyTo, convertedReplyTo.getExchange());
    assertEquals("Unexpected routing key", "", convertedReplyTo.getRoutingKey());
}
Also used : Exchange(org.apache.qpid.server.model.Exchange) ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) AMQMessageHeader(org.apache.qpid.server.message.AMQMessageHeader) Matchers.anyString(org.mockito.Matchers.anyString) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString)

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