Search in sources :

Example 6 with MessageConversionException

use of org.apache.qpid.server.protocol.converter.MessageConversionException 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 7 with MessageConversionException

use of org.apache.qpid.server.protocol.converter.MessageConversionException 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 8 with MessageConversionException

use of org.apache.qpid.server.protocol.converter.MessageConversionException in project qpid-broker-j by apache.

the class PropertyConverter_1_0_to_0_8Test method testCorrelationIdLongStringConversion.

public void testCorrelationIdLongStringConversion() {
    final String correlationId = generateLongString();
    Properties properties = new Properties();
    properties.setCorrelationId(correlationId);
    Message_1_0 message = createTestMessage(properties);
    try {
        _messageConverter.convert(message, _namedAddressSpace);
        fail("Expected exception 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 9 with MessageConversionException

use of org.apache.qpid.server.protocol.converter.MessageConversionException in project qpid-broker-j by apache.

the class PropertyConverter_1_0_to_0_8Test method testApplicationPropertiesConversionWhenKeyLengthExceeds255.

public void testApplicationPropertiesConversionWhenKeyLengthExceeds255() {
    Map<String, Object> properties = Collections.singletonMap("testProperty-" + generateLongString(), "testValue");
    ApplicationProperties applicationProperties = new ApplicationProperties(properties);
    Message_1_0 message = createTestMessage(applicationProperties);
    try {
        _messageConverter.convert(message, _namedAddressSpace);
        fail("Exception is expected");
    } catch (MessageConversionException e) {
    // pass
    }
}
Also used : MessageConversionException(org.apache.qpid.server.protocol.converter.MessageConversionException) 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) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString)

Example 10 with MessageConversionException

use of org.apache.qpid.server.protocol.converter.MessageConversionException in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_1_0Test method testHeaderWithListValueConversionFails.

public void testHeaderWithListValueConversionFails() {
    Map<String, Object> headers = Collections.singletonMap("listHeader", Collections.emptyList());
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setApplicationHeaders(headers);
    MessageTransferMessage message = createTestMessage(messageProperties);
    try {
        _messageConverter.convert(message, _namedAddressSpace);
        fail("Exception is expected");
    } catch (MessageConversionException e) {
    // pass
    }
}
Also used : MessageConversionException(org.apache.qpid.server.protocol.converter.MessageConversionException) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage)

Aggregations

MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)55 Matchers.anyString (org.mockito.Matchers.anyString)25 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)22 Message_1_0 (org.apache.qpid.server.protocol.v1_0.Message_1_0)22 ApplicationProperties (org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties)17 Properties (org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)15 MessageProperties (org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)14 InternalMessage (org.apache.qpid.server.message.internal.InternalMessage)12 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)12 AMQMessageHeader (org.apache.qpid.server.message.AMQMessageHeader)8 NamedAddressSpace (org.apache.qpid.server.model.NamedAddressSpace)8 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)8 MessageTransferMessage (org.apache.qpid.server.protocol.v0_10.MessageTransferMessage)6 AmqpValue (org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue)6 Date (java.util.Date)4 LinkedHashMap (java.util.LinkedHashMap)4 Binary (org.apache.qpid.server.protocol.v1_0.type.Binary)4 Source (org.apache.qpid.server.protocol.v1_0.type.messaging.Source)4 ReplyTo (org.apache.qpid.server.protocol.v0_10.transport.ReplyTo)3 MessageMetaData_1_0 (org.apache.qpid.server.protocol.v1_0.MessageMetaData_1_0)3