Search in sources :

Example 81 with MessageTransferMessage

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

the class PropertyConverter_0_8_to_0_10Test method testUuidMessageIdConversion.

public void testUuidMessageIdConversion() {
    BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
    final UUID messageId = UUID.randomUUID();
    basicContentHeaderProperties.setMessageId(messageId.toString());
    AMQMessage message = createTestMessage(basicContentHeaderProperties);
    final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
    assertEquals("Unexpected messageId", messageId, messageProperties.getMessageId());
}
Also used : MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) UUID(java.util.UUID) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 82 with MessageTransferMessage

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

the class PropertyConverter_0_8_to_0_10Test method testTimestampConversion.

public void testTimestampConversion() {
    BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
    final long timestamp = System.currentTimeMillis() - 10000;
    basicContentHeaderProperties.setTimestamp(timestamp);
    AMQMessage message = createTestMessage(basicContentHeaderProperties);
    final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
    assertEquals("Unexpected timestamp", timestamp, deliveryProperties.getTimestamp());
}
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)

Example 83 with MessageTransferMessage

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

the class PropertyConverter_0_8_to_0_10Test method testContentLengthConversion.

public void testContentLengthConversion() {
    BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
    final byte[] content = { (byte) 1, (byte) 2 };
    AMQMessage message = createTestMessage(basicContentHeaderProperties, content, 0);
    final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
    assertEquals("Unexpected content-length", content.length, messageProperties.getContentLength());
}
Also used : MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 84 with MessageTransferMessage

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

the class PropertyConverter_0_8_to_0_10Test method testPersistentDeliveryModeConversion.

public void testPersistentDeliveryModeConversion() {
    BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
    basicContentHeaderProperties.setDeliveryMode(BasicContentHeaderProperties.PERSISTENT);
    AMQMessage message = createTestMessage(basicContentHeaderProperties);
    final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
    assertEquals("Unexpected deliveryMode", MessageDeliveryMode.PERSISTENT, deliveryProperties.getDeliveryMode());
}
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)

Example 85 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 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)

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