Search in sources :

Example 31 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_1_0Test method testNonPersistentDeliveryModeConversion.

public void testNonPersistentDeliveryModeConversion() {
    final DeliveryProperties deliveryProperties = new DeliveryProperties();
    deliveryProperties.setDeliveryMode(MessageDeliveryMode.NON_PERSISTENT);
    MessageTransferMessage message = createTestMessage(deliveryProperties);
    final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    Header header = convertedMessage.getHeaderSection().getValue();
    assertFalse("Unexpected durable header", header.getDurable());
}
Also used : Header(org.apache.qpid.server.protocol.v1_0.type.messaging.Header) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)

Example 32 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_1_0Test method testReplyToConversionWhenExchangeAndRoutingKeyAreNull.

public void testReplyToConversionWhenExchangeAndRoutingKeyAreNull() {
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setReplyTo(new ReplyTo(null, null));
    MessageTransferMessage message = createTestMessage(messageProperties);
    final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    Properties properties = convertedMessage.getPropertiesSection().getValue();
    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) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)

Example 33 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_1_0Test method testQpidSubjectTakesPrecedenceOverJmsType.

public void testQpidSubjectTakesPrecedenceOverJmsType() {
    final String jmsType = "test-jms-type";
    final String qpidSubjectType = "test-qpid-type";
    final Map<String, Object> headers = new HashMap<>();
    headers.put("x-jms-type", jmsType);
    headers.put("qpid.subject", qpidSubjectType);
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setApplicationHeaders(headers);
    MessageTransferMessage message = createTestMessage(messageProperties);
    final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    Properties properties = convertedMessage.getPropertiesSection().getValue();
    assertEquals("Unexpected subject", qpidSubjectType, properties.getSubject());
    Map<String, Object> applicationProperties = convertedMessage.getApplicationPropertiesSection().getValue();
    assertTrue("Unexpected entries in application properties", applicationProperties.isEmpty());
}
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) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)

Example 34 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_1_0Test method testHeaderJMSXGroupSeqConversionWhenWrongType.

public void testHeaderJMSXGroupSeqConversionWhenWrongType() {
    short testGroupSequenceNumber = (short) 1;
    Map<String, Object> headers = Collections.singletonMap("JMSXGroupSeq", testGroupSequenceNumber);
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setApplicationHeaders(headers);
    MessageTransferMessage message = createTestMessage(messageProperties);
    final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    Properties properties = convertedMessage.getPropertiesSection().getValue();
    assertEquals("Unexpected group-sequence", null, properties.getGroupSequence());
    Map<String, Object> applicationProperties = convertedMessage.getApplicationPropertiesSection().getValue();
    assertTrue("JMSXGroupSeq was removed from application properties", applicationProperties.containsKey("JMSXGroupSeq"));
}
Also used : MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)

Example 35 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_1_0Test method testCorrelationIdConversion.

public void testCorrelationIdConversion() {
    final String correlationId = "testCorrelationId";
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setCorrelationId(correlationId.getBytes(UTF_8));
    MessageTransferMessage message = createTestMessage(messageProperties);
    final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    Properties properties = convertedMessage.getPropertiesSection().getValue();
    assertEquals("Unexpected correlationId", correlationId, properties.getCorrelationId());
}
Also used : MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) 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