Search in sources :

Example 26 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_InternalTest method testTtlConversion.

public void testTtlConversion() {
    long timestamp = System.currentTimeMillis();
    int ttl = 100000;
    final DeliveryProperties deliveryProperties = new DeliveryProperties();
    deliveryProperties.setTtl(ttl);
    MessageTransferMessage message = createTestMessage(deliveryProperties, new MessageProperties(), null, timestamp);
    final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    assertEquals("Unexpected expiration", timestamp + ttl, convertedMessage.getMessageHeader().getExpiration());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)

Example 27 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_InternalTest method testTtlTakesPrecedenceOverExpiration.

public void testTtlTakesPrecedenceOverExpiration() {
    long timestamp = System.currentTimeMillis();
    int ttl = 100000;
    final DeliveryProperties deliveryProperties = new DeliveryProperties();
    deliveryProperties.setTtl(ttl);
    deliveryProperties.setExpiration(timestamp + ttl + 10000);
    MessageTransferMessage message = createTestMessage(deliveryProperties, new MessageProperties(), null, timestamp);
    final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    assertEquals("Unexpected expiration", timestamp + ttl, convertedMessage.getMessageHeader().getExpiration());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)

Example 28 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_InternalTest method testReplyToConversionWhenExchangeSpecified.

public void testReplyToConversionWhenExchangeSpecified() {
    final String exchangeName = "amq.direct";
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setReplyTo(new ReplyTo(exchangeName, null));
    MessageTransferMessage message = createTestMessage(messageProperties);
    final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    assertEquals("Unexpected reply-to", exchangeName, convertedMessage.getMessageHeader().getReplyTo());
}
Also used : ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)

Example 29 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_InternalTest method testCorrelationIdConversionWhenNotString.

public void testCorrelationIdConversionWhenNotString() {
    final byte[] correlationId = new byte[] { (byte) 0xc3, 0x28 };
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setCorrelationId(correlationId);
    MessageTransferMessage message = createTestMessage(messageProperties);
    final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    assertEquals("Unexpected correlationId", new String(correlationId, UTF_8), convertedMessage.getMessageHeader().getCorrelationId());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)

Example 30 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_InternalTest method testPriorityConversion.

public void testPriorityConversion() {
    final byte priority = 7;
    final DeliveryProperties deliveryProperties = new DeliveryProperties();
    deliveryProperties.setPriority(MessageDeliveryPriority.get(priority));
    MessageTransferMessage message = createTestMessage(deliveryProperties);
    final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    assertEquals("Unexpected priority", priority, convertedMessage.getMessageHeader().getPriority());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)

Aggregations

InternalMessage (org.apache.qpid.server.message.internal.InternalMessage)185 AMQMessageHeader (org.apache.qpid.server.message.AMQMessageHeader)60 Matchers.anyString (org.mockito.Matchers.anyString)45 NamedAddressSpace (org.apache.qpid.server.model.NamedAddressSpace)36 ApplicationProperties (org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties)25 Properties (org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)24 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)23 MessageProperties (org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)18 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)18 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)17 AmqpValue (org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue)15 HashMap (java.util.HashMap)13 MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)12 ReplyTo (org.apache.qpid.server.protocol.v0_10.transport.ReplyTo)9 UUID (java.util.UUID)8 Binary (org.apache.qpid.server.protocol.v1_0.type.Binary)8 MessagePublishInfo (org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo)7 Map (java.util.Map)6 Exchange (org.apache.qpid.server.model.Exchange)6 ArrayList (java.util.ArrayList)5