Search in sources :

Example 26 with MessagePublishInfo

use of org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_0_8Test method testDiscardUnroutableFalseConversion.

public void testDiscardUnroutableFalseConversion() {
    final boolean discardUnroutable = false;
    final DeliveryProperties deliveryProperties = new DeliveryProperties();
    deliveryProperties.setDiscardUnroutable(discardUnroutable);
    MessageTransferMessage message = createTestMessage(deliveryProperties);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
    assertEquals("Unexpected mandatory flag", !discardUnroutable, messagePublishInfo.isMandatory());
}
Also used : MessagePublishInfo(org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 27 with MessagePublishInfo

use of org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_0_8Test method testImmediateFalseConversion.

public void testImmediateFalseConversion() {
    final boolean immediate = false;
    final DeliveryProperties deliveryProperties = new DeliveryProperties();
    deliveryProperties.setImmediate(immediate);
    MessageTransferMessage message = createTestMessage(deliveryProperties);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
    assertEquals("Unexpected immediate flag", immediate, messagePublishInfo.isImmediate());
}
Also used : MessagePublishInfo(org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 28 with MessagePublishInfo

use of org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_0_8Test method testExchangeConversion.

public void testExchangeConversion() {
    final String testExchange = "testExchange";
    final DeliveryProperties deliveryProperties = new DeliveryProperties();
    deliveryProperties.setExchange(testExchange);
    MessageTransferMessage message = createTestMessage(deliveryProperties);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
    assertEquals("Unexpected exchange", testExchange, messagePublishInfo.getExchange().toString());
}
Also used : MessagePublishInfo(org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 29 with MessagePublishInfo

use of org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_0_8Test method testImmediateTrueConversion.

public void testImmediateTrueConversion() {
    final boolean immediate = true;
    final DeliveryProperties deliveryProperties = new DeliveryProperties();
    deliveryProperties.setImmediate(immediate);
    MessageTransferMessage message = createTestMessage(deliveryProperties);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
    assertEquals("Unexpected immediate flag", immediate, messagePublishInfo.isImmediate());
}
Also used : MessagePublishInfo(org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 30 with MessagePublishInfo

use of org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo in project qpid-broker-j by apache.

the class PropertyConverter_0_8_to_0_10Test method createTestMessage.

private AMQMessage createTestMessage(final BasicContentHeaderProperties basicContentHeaderProperties, final byte[] content, final long arrivalTime) {
    final ContentHeaderBody contentHeaderBody = mock(ContentHeaderBody.class);
    when(contentHeaderBody.getProperties()).thenReturn(basicContentHeaderProperties);
    final StoredMessage<MessageMetaData> storedMessage = mock(StoredMessage.class);
    when(storedMessage.getMetaData()).thenReturn(new MessageMetaData(new MessagePublishInfo(), contentHeaderBody, arrivalTime));
    if (content != null) {
        when(storedMessage.getContentSize()).thenReturn(content.length);
        when(storedMessage.getContent(0, content.length)).thenReturn(QpidByteBuffer.wrap(content));
    } else {
        when(storedMessage.getContentSize()).thenReturn(0);
        when(storedMessage.getContent(0, 0)).thenReturn(QpidByteBuffer.emptyQpidByteBuffer());
    }
    return new AMQMessage(storedMessage);
}
Also used : MessageMetaData(org.apache.qpid.server.protocol.v0_8.MessageMetaData) MessagePublishInfo(org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo) ContentHeaderBody(org.apache.qpid.server.protocol.v0_8.transport.ContentHeaderBody) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Aggregations

MessagePublishInfo (org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo)40 AMQMessage (org.apache.qpid.server.protocol.v0_8.AMQMessage)16 Matchers.anyString (org.mockito.Matchers.anyString)15 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)14 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)13 ContentHeaderBody (org.apache.qpid.server.protocol.v0_8.transport.ContentHeaderBody)11 ApplicationProperties (org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties)9 Properties (org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)9 Message_1_0 (org.apache.qpid.server.protocol.v1_0.Message_1_0)8 InternalMessage (org.apache.qpid.server.message.internal.InternalMessage)7 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)7 Exchange (org.apache.qpid.server.model.Exchange)6 MessageTransferMessage (org.apache.qpid.server.protocol.v0_10.MessageTransferMessage)6 Queue (org.apache.qpid.server.model.Queue)4 MessageMetaData (org.apache.qpid.server.protocol.v0_8.MessageMetaData)4 LinkedHashMap (java.util.LinkedHashMap)3 MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)3 Date (java.util.Date)2 QpidByteBuffer (org.apache.qpid.server.bytebuffer.QpidByteBuffer)2 MessageDestination (org.apache.qpid.server.message.MessageDestination)2