Search in sources :

Example 11 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_10Test 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)

Example 12 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_10Test 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) 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 13 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_10Test 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) 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 14 with MessageConversionException

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

the class PropertyConverter_0_10_to_0_8Test method testCorrelationIdConversionWhenLengthExceeds255.

public void testCorrelationIdConversionWhenLengthExceeds255() {
    final String correlationId = generateLongString();
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setCorrelationId(correlationId.getBytes());
    MessageTransferMessage message = createTestMessage(messageProperties);
    try {
        _messageConverter.convert(message, _namedAddressSpace);
        fail("expected exception not thrown");
    } 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) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString)

Example 15 with MessageConversionException

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

the class PropertyConverter_0_10_to_0_8Test method testJmsTypeConversionWhenLengthExceeds255.

public void testJmsTypeConversionWhenLengthExceeds255() {
    final String type = generateLongString();
    final Map<String, Object> headers = Collections.singletonMap("x-jms-type", type);
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setApplicationHeaders(headers);
    MessageTransferMessage message = createTestMessage(messageProperties);
    try {
        _messageConverter.convert(message, _namedAddressSpace);
        fail("Exception is not thrown");
    } 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) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString)

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