use of org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_8Test method testAmqpValueWithListContainingUnsupportedType.
public void testAmqpValueWithListContainingUnsupportedType() throws Exception {
final List<Object> originalList = Collections.singletonList(new Source());
final AmqpValue amqpValue = new AmqpValue(originalList);
Message_1_0 sourceMessage = createTestMessage(amqpValue.createEncodingRetainingSection());
try {
_converter.convert(sourceMessage, mock(NamedAddressSpace.class));
fail("expected exception not thrown.");
} catch (MessageConversionException e) {
// pass
}
}
use of org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_8Test method testAmqpValueWithStringWithTextMessageAnnotation.
public void testAmqpValueWithStringWithTextMessageAnnotation() throws Exception {
final String expected = "testContent";
final AmqpValue amqpValue = new AmqpValue(expected);
Message_1_0 sourceMessage = createTestMessage(TEXT_MESSAGE_MESSAGE_ANNOTATION, amqpValue.createEncodingRetainingSection());
final AMQMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", "text/plain", convertedMessage.getMessageHeader().getMimeType());
final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
assertEquals("Unexpected content", expected, new String(getBytes(content), UTF_8));
}
use of org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_8Test method testAmqpValueWithString.
public void testAmqpValueWithString() throws Exception {
final String expected = "testContent";
final AmqpValue amqpValue = new AmqpValue(expected);
Message_1_0 sourceMessage = createTestMessage(amqpValue.createEncodingRetainingSection());
final AMQMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", "text/plain", convertedMessage.getMessageHeader().getMimeType());
final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
assertEquals("Unexpected content", expected, new String(getBytes(content), UTF_8));
}
use of org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_8Test method testAmqpValueWithNullWithTextMessageAnnotation.
public void testAmqpValueWithNullWithTextMessageAnnotation() throws Exception {
final Object expected = null;
final AmqpValue amqpValue = new AmqpValue(expected);
Message_1_0 sourceMessage = createTestMessage(TEXT_MESSAGE_MESSAGE_ANNOTATION, amqpValue.createEncodingRetainingSection());
final AMQMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", "text/plain", convertedMessage.getMessageHeader().getMimeType());
assertEquals("Unexpected content size", 0, convertedMessage.getMessageMetaData().getContentSize());
}
use of org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_8Test method testAmqpValueWithNullWithMessageAnnotation.
public void testAmqpValueWithNullWithMessageAnnotation() throws Exception {
final Object expected = null;
final AmqpValue amqpValue = new AmqpValue(expected);
Message_1_0 sourceMessage = createTestMessage(MESSAGE_MESSAGE_ANNOTATION, 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());
}
Aggregations