Search in sources :

Example 1 with MessageAnnotations

use of org.apache.qpid.amqp_1_0.type.messaging.MessageAnnotations in project qpid-broker-j by apache.

the class MessageConverter_v1_0_to_InternalTest method testAmqpValueWithNullWithUnknownMessageAnnotation.

public void testAmqpValueWithNullWithUnknownMessageAnnotation() throws Exception {
    final Object expected = null;
    final AmqpValue amqpValue = new AmqpValue(expected);
    Message_1_0 sourceMessage = createTestMessage(new MessageAnnotations(Collections.singletonMap(Symbol.valueOf("x-opt-jms-msg-type"), (byte) 11)), amqpValue.createEncodingRetainingSection());
    final InternalMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
    assertEquals("Unexpected mime type", null, convertedMessage.getMessageHeader().getMimeType());
    assertNull("Unexpected content", convertedMessage.getMessageBody());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) MessageAnnotations(org.apache.qpid.server.protocol.v1_0.type.messaging.MessageAnnotations) NamedAddressSpace(org.apache.qpid.server.model.NamedAddressSpace) AmqpValue(org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue)

Example 2 with MessageAnnotations

use of org.apache.qpid.amqp_1_0.type.messaging.MessageAnnotations in project qpid-broker-j by apache.

the class MessageConverter_v1_0_to_InternalTest method testDataWithUnsupportedMessageAnnotationWithContentType.

public void testDataWithUnsupportedMessageAnnotationWithContentType() throws Exception {
    final String mimeType = "foo/bar";
    doTestDataWithAnnotation("helloworld".getBytes(UTF_8), new MessageAnnotations(Collections.singletonMap(Symbol.valueOf("x-opt-jms-msg-type"), (byte) 11)), mimeType, mimeType);
}
Also used : MessageAnnotations(org.apache.qpid.server.protocol.v1_0.type.messaging.MessageAnnotations)

Example 3 with MessageAnnotations

use of org.apache.qpid.amqp_1_0.type.messaging.MessageAnnotations in project qpid-broker-j by apache.

the class MessageConverter_1_0_to_v0_10Test method testAmqpValueWithNullWithUnknownMessageAnnotation.

public void testAmqpValueWithNullWithUnknownMessageAnnotation() throws Exception {
    final Object expected = null;
    final AmqpValue amqpValue = new AmqpValue(expected);
    Message_1_0 sourceMessage = createTestMessage(new MessageAnnotations(Collections.singletonMap(Symbol.valueOf("x-opt-jms-msg-type"), (byte) 11)), amqpValue.createEncodingRetainingSection());
    final MessageTransferMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
    assertEquals("Unexpected mime type", null, convertedMessage.getMessageHeader().getMimeType());
    assertEquals("Unexpected content size", 0, convertedMessage.getSize());
}
Also used : MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) MessageAnnotations(org.apache.qpid.server.protocol.v1_0.type.messaging.MessageAnnotations) NamedAddressSpace(org.apache.qpid.server.model.NamedAddressSpace) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) AmqpValue(org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue)

Example 4 with MessageAnnotations

use of org.apache.qpid.amqp_1_0.type.messaging.MessageAnnotations in project qpid-broker-j by apache.

the class MessageConverter_1_0_to_v0_8Test method testAmqpValueWithNullWithUnknownMessageAnnotation.

public void testAmqpValueWithNullWithUnknownMessageAnnotation() throws Exception {
    final Object expected = null;
    final AmqpValue amqpValue = new AmqpValue(expected);
    Message_1_0 sourceMessage = createTestMessage(new MessageAnnotations(Collections.singletonMap(Symbol.valueOf("x-opt-jms-msg-type"), (byte) 11)), amqpValue.createEncodingRetainingSection());
    final AMQMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
    assertEquals("Unexpected mime type", null, convertedMessage.getMessageHeader().getMimeType());
    assertEquals("Unexpected content size", 0, convertedMessage.getMessageMetaData().getContentSize());
}
Also used : MessageAnnotations(org.apache.qpid.server.protocol.v1_0.type.messaging.MessageAnnotations) NamedAddressSpace(org.apache.qpid.server.model.NamedAddressSpace) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) AmqpValue(org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 5 with MessageAnnotations

use of org.apache.qpid.amqp_1_0.type.messaging.MessageAnnotations in project qpid-broker-j by apache.

the class PropertyConverter_1_0_to_0_8Test method testCreationTimeConversion.

public void testCreationTimeConversion() {
    final long timestamp = System.currentTimeMillis() - 10000;
    final long arrivalTime = timestamp + 1;
    Properties properties = new Properties();
    properties.setCreationTime(new Date(timestamp));
    Message_1_0 message = createTestMessage(new Header(), new DeliveryAnnotations(Collections.emptyMap()), new MessageAnnotations(Collections.emptyMap()), properties, new ApplicationProperties(Collections.emptyMap()), arrivalTime);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
    assertEquals("Unexpected timestamp", timestamp, convertedProperties.getTimestamp());
}
Also used : Header(org.apache.qpid.server.protocol.v1_0.type.messaging.Header) MessageAnnotations(org.apache.qpid.server.protocol.v1_0.type.messaging.MessageAnnotations) DeliveryAnnotations(org.apache.qpid.server.protocol.v1_0.type.messaging.DeliveryAnnotations) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) 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) Date(java.util.Date) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Aggregations

MessageAnnotations (org.apache.qpid.server.protocol.v1_0.type.messaging.MessageAnnotations)22 ApplicationProperties (org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties)14 Properties (org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)14 Message_1_0 (org.apache.qpid.server.protocol.v1_0.Message_1_0)13 Header (org.apache.qpid.server.protocol.v1_0.type.messaging.Header)12 DeliveryAnnotations (org.apache.qpid.server.protocol.v1_0.type.messaging.DeliveryAnnotations)10 MessageTransferMessage (org.apache.qpid.server.protocol.v0_10.MessageTransferMessage)9 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)8 MessageProperties (org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)8 Date (java.util.Date)7 NamedAddressSpace (org.apache.qpid.server.model.NamedAddressSpace)7 AMQMessage (org.apache.qpid.server.protocol.v0_8.AMQMessage)4 Symbol (org.apache.qpid.server.protocol.v1_0.type.Symbol)4 Matchers.anyString (org.mockito.Matchers.anyString)4 InternalMessage (org.apache.qpid.server.message.internal.InternalMessage)3 MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)3 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)3 Binary (org.apache.qpid.server.protocol.v1_0.type.Binary)3 AmqpValue (org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue)3 MessageMetaData_1_0 (org.apache.qpid.server.protocol.v1_0.MessageMetaData_1_0)2