Search in sources :

Example 31 with BasicContentHeaderProperties

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

the class PropertyConverter_0_10_to_0_8Test method testReplyToConversionWhenExchangeAndRoutingKeyAreNull.

public void testReplyToConversionWhenExchangeAndRoutingKeyAreNull() {
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setReplyTo(new ReplyTo(null, null));
    MessageTransferMessage message = createTestMessage(messageProperties);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    BasicContentHeaderProperties properties = convertedMessage.getContentHeaderBody().getProperties();
    assertNull("Unexpected reply-to", properties.getReplyTo());
}
Also used : ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 32 with BasicContentHeaderProperties

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

the class PropertyConverter_0_10_to_0_8Test method testMessageIdConversion.

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

Example 33 with BasicContentHeaderProperties

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

the class PropertyConverter_0_10_to_0_8Test 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 AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    BasicContentHeaderProperties properties = convertedMessage.getContentHeaderBody().getProperties();
    assertEquals("Unexpected expiration", timestamp + ttl, properties.getExpiration());
}
Also used : MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) 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 34 with BasicContentHeaderProperties

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

the class PropertyConverter_0_10_to_0_8Test method testApplicationHeadersConversion.

public void testApplicationHeadersConversion() {
    Map<String, Object> headers = new HashMap<>();
    headers.put("testProperty1", "testProperty1Value");
    headers.put("intProperty", 1);
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setApplicationHeaders(headers);
    MessageTransferMessage message = createTestMessage(messageProperties);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    BasicContentHeaderProperties properties = convertedMessage.getContentHeaderBody().getProperties();
    Map<String, Object> applicationProperties = FieldTable.convertToMap(properties.getHeaders());
    assertEquals("Unexpected headers", headers, new HashMap<>(applicationProperties));
}
Also used : HashMap(java.util.HashMap) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) 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 35 with BasicContentHeaderProperties

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

the class PropertyConverter_0_10_to_0_8Test 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 AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    BasicContentHeaderProperties properties = convertedMessage.getContentHeaderBody().getProperties();
    String expectedReplyTo = String.format("direct://%s//", exchangeName);
    assertEquals("Unexpected reply-to", expectedReplyTo, properties.getReplyTo().toString());
}
Also used : ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) 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)

Aggregations

BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)151 AMQMessage (org.apache.qpid.server.protocol.v0_8.AMQMessage)115 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)74 Message_1_0 (org.apache.qpid.server.protocol.v1_0.Message_1_0)59 MessageTransferMessage (org.apache.qpid.server.protocol.v0_10.MessageTransferMessage)52 Properties (org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)48 MessageProperties (org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)39 ApplicationProperties (org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties)31 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)21 Matchers.anyString (org.mockito.Matchers.anyString)20 InternalMessage (org.apache.qpid.server.message.internal.InternalMessage)18 HashMap (java.util.HashMap)16 ContentHeaderBody (org.apache.qpid.server.protocol.v0_8.transport.ContentHeaderBody)16 Header (org.apache.qpid.server.protocol.v1_0.type.messaging.Header)12 MessagePublishInfo (org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo)9 Binary (org.apache.qpid.server.protocol.v1_0.type.Binary)8 ReplyTo (org.apache.qpid.server.protocol.v0_10.transport.ReplyTo)7 Date (java.util.Date)6 UUID (java.util.UUID)6 MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)6