Search in sources :

Example 71 with MessageProperties

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

the class PropertyConverter_1_0_to_0_10Test method testUserIdConversion.

public void testUserIdConversion() {
    final String userId = "test-userId";
    Properties properties = new Properties();
    properties.setUserId(new Binary(userId.getBytes()));
    Message_1_0 message = createTestMessage(properties);
    final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
    assertTrue("Unexpected user-id", Arrays.equals(userId.getBytes(UTF_8), messageProperties.getUserId()));
}
Also used : MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Matchers.anyString(org.mockito.Matchers.anyString) Binary(org.apache.qpid.server.protocol.v1_0.type.Binary) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)

Example 72 with MessageProperties

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

the class PropertyConverter_1_0_to_0_10Test method testMessageIdBinaryConversionWhenNonUtf8.

public void testMessageIdBinaryConversionWhenNonUtf8() {
    final byte[] messageId = new byte[] { (byte) 0xc3, 0x28 };
    Properties properties = new Properties();
    properties.setMessageId(new Binary(messageId));
    Message_1_0 message = createTestMessage(properties);
    final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
    assertEquals("Unexpected messageId", UUID.nameUUIDFromBytes(messageId), messageProperties.getMessageId());
}
Also used : MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Binary(org.apache.qpid.server.protocol.v1_0.type.Binary) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)

Example 73 with MessageProperties

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

the class PropertyConverter_1_0_to_0_10Test method testGroupIdConversion.

public void testGroupIdConversion() {
    String testGroupId = generateLongString();
    Properties properties = new Properties();
    properties.setGroupId(testGroupId);
    Message_1_0 message = createTestMessage(properties);
    final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
    final Map<String, Object> applicationHeaders = messageProperties.getApplicationHeaders();
    assertEquals("Unexpected group-id", testGroupId, applicationHeaders.get("JMSXGroupID"));
}
Also used : MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Matchers.anyString(org.mockito.Matchers.anyString) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)

Example 74 with MessageProperties

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

the class PropertyConverter_1_0_to_0_10Test method testCorrelationIdUUIDConversion.

public void testCorrelationIdUUIDConversion() {
    final UUID correlationId = UUID.randomUUID();
    Properties properties = new Properties();
    properties.setCorrelationId(correlationId);
    Message_1_0 message = createTestMessage(properties);
    final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
    final byte[] expectedBytes = longToBytes(correlationId.getMostSignificantBits(), correlationId.getLeastSignificantBits());
    assertTrue("Unexpected correlationId", Arrays.equals(expectedBytes, messageProperties.getCorrelationId()));
}
Also used : MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) UUID(java.util.UUID) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)

Example 75 with MessageProperties

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

the class PropertyConverter_1_0_to_0_10Test method testGroupSequenceDoesNotReplaceApplicationPropertiesJMSXGroupSeq.

public void testGroupSequenceDoesNotReplaceApplicationPropertiesJMSXGroupSeq() {
    int testGroupSequence = 1;
    Properties properties = new Properties();
    properties.setGroupSequence(UnsignedInteger.valueOf(testGroupSequence));
    final int JMSXGroupSeq = 2;
    Map<String, Object> applicationPropertiesMap = Collections.singletonMap("JMSXGroupSeq", JMSXGroupSeq);
    ApplicationProperties applicationProperties = new ApplicationProperties(applicationPropertiesMap);
    Message_1_0 message = createTestMessage(new Header(), new DeliveryAnnotations(Collections.emptyMap()), new MessageAnnotations(Collections.emptyMap()), properties, applicationProperties, 0, null);
    final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
    final Map<String, Object> applicationHeaders = messageProperties.getApplicationHeaders();
    assertEquals("Unexpected JMSXGroupSeq", JMSXGroupSeq, applicationHeaders.get("JMSXGroupSeq"));
}
Also used : Header(org.apache.qpid.server.protocol.v1_0.type.messaging.Header) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) MessageAnnotations(org.apache.qpid.server.protocol.v1_0.type.messaging.MessageAnnotations) DeliveryAnnotations(org.apache.qpid.server.protocol.v1_0.type.messaging.DeliveryAnnotations) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Matchers.anyString(org.mockito.Matchers.anyString) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)

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