Search in sources :

Example 86 with BasicContentHeaderProperties

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

the class PropertyConverter_1_0_to_0_8Test method testUserIdConversionWhenLengthExceeds255.

public void testUserIdConversionWhenLengthExceeds255() {
    final String userId = generateLongString();
    Properties properties = new Properties();
    properties.setUserId(new Binary(userId.getBytes()));
    Message_1_0 message = createTestMessage(properties);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
    assertNull("Unexpected user-id", convertedProperties.getUserId());
}
Also used : Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Matchers.anyString(org.mockito.Matchers.anyString) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) Binary(org.apache.qpid.server.protocol.v1_0.type.Binary) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 87 with BasicContentHeaderProperties

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

the class PropertyConverter_1_0_to_0_8Test method testReplyToConversionWhenQueueIsSpecified.

public void testReplyToConversionWhenQueueIsSpecified() throws IOException {
    final String replyTo = "myTestQueue";
    final Queue queue = mock(Queue.class);
    when(queue.getName()).thenReturn(replyTo);
    when(_namedAddressSpace.getAttainedMessageDestination(replyTo)).thenReturn(queue);
    Properties properties = new Properties();
    properties.setReplyTo(replyTo);
    Message_1_0 message = createTestMessage(properties);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
    assertEquals("Unexpected reply-to", "direct:////" + replyTo, convertedProperties.getReplyToAsString());
}
Also used : Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Matchers.anyString(org.mockito.Matchers.anyString) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) Queue(org.apache.qpid.server.model.Queue) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 88 with BasicContentHeaderProperties

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

the class PropertyConverter_1_0_to_0_8Test 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 AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
    assertTrue("Unexpected messageId", Arrays.equals(messageId, convertedProperties.getMessageId().getBytes()));
}
Also used : 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) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 89 with BasicContentHeaderProperties

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

the class PropertyConverter_1_0_to_0_8Test method testGroupSequenceConversion.

public void testGroupSequenceConversion() {
    int testGroupSequence = 1;
    Properties properties = new Properties();
    properties.setGroupSequence(UnsignedInteger.valueOf(testGroupSequence));
    Message_1_0 message = createTestMessage(properties);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
    Map<String, Object> headers = FieldTable.convertToMap(convertedProperties.getHeaders());
    assertEquals("Unexpected group-id", testGroupSequence, headers.get("JMSXGroupSeq"));
}
Also used : Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Matchers.anyString(org.mockito.Matchers.anyString) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 90 with BasicContentHeaderProperties

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

the class PropertyConverter_1_0_to_0_8Test method testDurableConversion.

public void testDurableConversion() {
    final Header header = new Header();
    header.setDurable(true);
    Message_1_0 message = createTestMessage(header);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
    assertEquals("Unexpected deliveryMode", BasicContentHeaderProperties.PERSISTENT, convertedProperties.getDeliveryMode());
}
Also used : Header(org.apache.qpid.server.protocol.v1_0.type.messaging.Header) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) 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