Search in sources :

Example 41 with MessageProperties

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

the class PropertyConverter_0_8_to_0_10Test method testApplicationIdConversion.

public void testApplicationIdConversion() {
    BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
    final String applicationId = "testApplicationId";
    basicContentHeaderProperties.setAppId(applicationId);
    AMQMessage message = createTestMessage(basicContentHeaderProperties);
    final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
    assertEquals("Unexpected applicationId", applicationId, new String(messageProperties.getAppId(), UTF_8));
}
Also used : MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 42 with MessageProperties

use of org.apache.qpid.server.protocol.v0_10.transport.MessageProperties 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 43 with MessageProperties

use of org.apache.qpid.server.protocol.v0_10.transport.MessageProperties 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 44 with MessageProperties

use of org.apache.qpid.server.protocol.v0_10.transport.MessageProperties 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 45 with MessageProperties

use of org.apache.qpid.server.protocol.v0_10.transport.MessageProperties 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)

Aggregations

MessageProperties (org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)121 MessageTransferMessage (org.apache.qpid.server.protocol.v0_10.MessageTransferMessage)90 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)63 Message_1_0 (org.apache.qpid.server.protocol.v1_0.Message_1_0)45 Properties (org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)44 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)39 AMQMessage (org.apache.qpid.server.protocol.v0_8.AMQMessage)37 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)31 ApplicationProperties (org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties)24 ReplyTo (org.apache.qpid.server.protocol.v0_10.transport.ReplyTo)20 InternalMessage (org.apache.qpid.server.message.internal.InternalMessage)18 Matchers.anyString (org.mockito.Matchers.anyString)15 HashMap (java.util.HashMap)10 UUID (java.util.UUID)10 Header (org.apache.qpid.server.protocol.v0_10.transport.Header)10 Header (org.apache.qpid.server.protocol.v1_0.type.messaging.Header)9 MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)8 Binary (org.apache.qpid.server.protocol.v1_0.type.Binary)7 MessageAnnotations (org.apache.qpid.server.protocol.v1_0.type.messaging.MessageAnnotations)6 DeliveryAnnotations (org.apache.qpid.server.protocol.v1_0.type.messaging.DeliveryAnnotations)5