Search in sources :

Example 41 with Properties

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Properties in project qpid-broker-j by apache.

the class PropertyConverter_1_0_to_0_8Test method testToConversionWhenExchangeAndRoutingKeyIsSpecified.

public void testToConversionWhenExchangeAndRoutingKeyIsSpecified() {
    final String testExchange = "testExchange";
    final String testRoutingKey = "testRoutingKey";
    String to = testExchange + "/" + testRoutingKey;
    Properties properties = new Properties();
    properties.setTo(to);
    Message_1_0 message = createTestMessage(properties);
    Exchange<?> exchange = mock(Exchange.class);
    when(exchange.getName()).thenReturn(testExchange);
    when(_namedAddressSpace.getAttainedMessageDestination(testExchange)).thenReturn(exchange);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
    assertEquals("Unexpected exchange", testExchange, messagePublishInfo.getExchange().toString());
    assertEquals("Unexpected routing key", testRoutingKey, messagePublishInfo.getRoutingKey().toString());
}
Also used : MessagePublishInfo(org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo) 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) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 42 with Properties

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Properties in project qpid-broker-j by apache.

the class PropertyConverter_1_0_to_0_8Test method testToConversionWhenExchangeLengthExceeds255.

public void testToConversionWhenExchangeLengthExceeds255() {
    final String testExchange = generateLongString();
    final String testRoutingKey = "testRoutingKey";
    String to = testExchange + "/" + testRoutingKey;
    Properties properties = new Properties();
    properties.setTo(to);
    Message_1_0 message = createTestMessage(properties);
    try {
        _messageConverter.convert(message, _namedAddressSpace);
        fail("Exception is not thrown");
    } catch (MessageConversionException e) {
    // pass
    }
}
Also used : MessageConversionException(org.apache.qpid.server.protocol.converter.MessageConversionException) 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)

Example 43 with Properties

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Properties in project qpid-broker-j by apache.

the class PropertyConverter_1_0_to_0_8Test method testSubjectConversionWhenSubjectExceeds255.

public void testSubjectConversionWhenSubjectExceeds255() {
    final String subject = generateLongString();
    Properties properties = new Properties();
    properties.setSubject(subject);
    Message_1_0 message = createTestMessage(properties);
    try {
        _messageConverter.convert(message, _namedAddressSpace);
        fail("Expected conversion exception");
    } catch (MessageConversionException e) {
    // pass
    }
}
Also used : MessageConversionException(org.apache.qpid.server.protocol.converter.MessageConversionException) 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)

Example 44 with Properties

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Properties in project qpid-broker-j by apache.

the class PropertyConverter_1_0_to_0_8Test method testToConversionWhenQueueIsSpecified.

public void testToConversionWhenQueueIsSpecified() {
    final String testQueue = "testQueue";
    Properties properties = new Properties();
    properties.setTo(testQueue);
    Message_1_0 message = createTestMessage(properties);
    final Queue queue = mock(Queue.class);
    when(queue.getName()).thenReturn(testQueue);
    when(_namedAddressSpace.getAttainedMessageDestination(testQueue)).thenReturn(queue);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
    assertEquals("Unexpected exchange", "", messagePublishInfo.getExchange().toString());
    assertEquals("Unexpected routing key", testQueue, messagePublishInfo.getRoutingKey().toString());
}
Also used : MessagePublishInfo(org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo) 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) Queue(org.apache.qpid.server.model.Queue) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 45 with Properties

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Properties in project qpid-broker-j by apache.

the class PropertyConverter_1_0_to_0_8Test method testMessageIdUUIDConversion.

public void testMessageIdUUIDConversion() {
    final UUID messageId = UUID.randomUUID();
    Properties properties = new Properties();
    properties.setMessageId(messageId);
    Message_1_0 message = createTestMessage(properties);
    final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
    assertEquals("Unexpected messageId", messageId.toString(), convertedProperties.getMessageId().toString());
}
Also used : 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) 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)

Aggregations

Properties (org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)203 Message_1_0 (org.apache.qpid.server.protocol.v1_0.Message_1_0)174 ApplicationProperties (org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties)156 MessageTransferMessage (org.apache.qpid.server.protocol.v0_10.MessageTransferMessage)80 AMQMessage (org.apache.qpid.server.protocol.v0_8.AMQMessage)76 MessageProperties (org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)68 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)67 Matchers.anyString (org.mockito.Matchers.anyString)67 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)65 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)51 Binary (org.apache.qpid.server.protocol.v1_0.type.Binary)50 NamedAddressSpace (org.apache.qpid.server.model.NamedAddressSpace)48 QpidByteBuffer (org.apache.qpid.server.bytebuffer.QpidByteBuffer)33 Data (org.apache.qpid.server.protocol.v1_0.type.messaging.Data)27 InternalMessage (org.apache.qpid.server.message.internal.InternalMessage)25 MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)18 Header (org.apache.qpid.server.protocol.v1_0.type.messaging.Header)15 Date (java.util.Date)14 MessageAnnotations (org.apache.qpid.server.protocol.v1_0.type.messaging.MessageAnnotations)14 HashMap (java.util.HashMap)12