Search in sources :

Example 26 with MessageConversionException

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

the class PropertyConverter_Internal_to_v0_8Test method testToConversionWhenRoutingKeyLengthExceeds255.

public void testToConversionWhenRoutingKeyLengthExceeds255() {
    final String testExchange = "testExchange";
    final String testRoutingKey = generateLongString();
    String to = testExchange + "/" + testRoutingKey;
    InternalMessage message = createTestMessage(to);
    try {
        _messageConverter.convert(message, _addressSpace);
        fail("Exception is not thrown");
    } catch (MessageConversionException e) {
    // pass
    }
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) MessageConversionException(org.apache.qpid.server.protocol.converter.MessageConversionException) Matchers.anyString(org.mockito.Matchers.anyString)

Example 27 with MessageConversionException

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

the class PropertyConverter_Internal_to_v0_8Test method testToConversionWhenExchangeLengthExceeds255.

public void testToConversionWhenExchangeLengthExceeds255() {
    final String testExchange = generateLongString();
    final String testRoutingKey = "testRoutingKey";
    String to = testExchange + "/" + testRoutingKey;
    InternalMessage message = createTestMessage(to);
    try {
        _messageConverter.convert(message, _addressSpace);
        fail("Exception is not thrown");
    } catch (MessageConversionException e) {
    // pass
    }
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) MessageConversionException(org.apache.qpid.server.protocol.converter.MessageConversionException) Matchers.anyString(org.mockito.Matchers.anyString)

Example 28 with MessageConversionException

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

the class PropertyConverter_Internal_to_v0_8Test method testLongContentEncodingConversion.

public void testLongContentEncodingConversion() {
    String contentEncoding = generateLongString();
    final AMQMessageHeader header = mock(AMQMessageHeader.class);
    when(header.getEncoding()).thenReturn(contentEncoding);
    InternalMessage originalMessage = createTestMessage(header);
    try {
        _messageConverter.convert(originalMessage, _addressSpace);
        fail("Expected exception is not thrown");
    } catch (MessageConversionException e) {
    // pass
    }
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) MessageConversionException(org.apache.qpid.server.protocol.converter.MessageConversionException) Matchers.anyString(org.mockito.Matchers.anyString) AMQMessageHeader(org.apache.qpid.server.message.AMQMessageHeader)

Example 29 with MessageConversionException

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

the class MessageConverter_1_0_to_v0_8Test method testAmqpValueWithMapContainingNonFieldTableCompliantEntries.

public void testAmqpValueWithMapContainingNonFieldTableCompliantEntries() throws Exception {
    final AmqpValue amqpValue = new AmqpValue(Collections.<Object, Object>singletonMap(13, 42));
    Message_1_0 sourceMessage = createTestMessage(amqpValue.createEncodingRetainingSection());
    try {
        _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
        fail("expected exception not thrown.");
    } catch (MessageConversionException e) {
    // pass
    }
}
Also used : MessageConversionException(org.apache.qpid.server.protocol.converter.MessageConversionException) 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 30 with MessageConversionException

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

the class PropertyConverter_0_8_to_1_0Test method testHeaderWithFieldArrayValueConversionFails.

public void testHeaderWithFieldArrayValueConversionFails() {
    Map<String, Object> headers = Collections.singletonMap("listHeader", Collections.emptyList());
    BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
    basicContentHeaderProperties.setHeaders(FieldTable.convertToFieldTable(headers));
    AMQMessage message = createTestMessage(basicContentHeaderProperties);
    try {
        _messageConverter.convert(message, _namedAddressSpace);
        fail("Exception is expected");
    } catch (MessageConversionException e) {
    // pass
    }
}
Also used : MessageConversionException(org.apache.qpid.server.protocol.converter.MessageConversionException) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

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