use of org.apache.qpid.amqp_1_0.type.messaging.AmqpValue in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test method testAmqpValueWithUnsupportedType.
public void testAmqpValueWithUnsupportedType() throws Exception {
final Integer originalValue = 42;
final AmqpValue amqpValue = new AmqpValue(originalValue);
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.amqp_1_0.type.messaging.AmqpValue in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test 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.amqp_1_0.type.messaging.AmqpValue in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test method testAmqpValueWithMap.
public void testAmqpValueWithMap() throws Exception {
final Map<String, Object> originalMap = new LinkedHashMap<>();
originalMap.put("binaryEntry", new Binary(new byte[] { 0x00, (byte) 0xFF }));
originalMap.put("intEntry", 42);
originalMap.put("nullEntry", null);
final AmqpValue amqpValue = new AmqpValue(originalMap);
Message_1_0 sourceMessage = createTestMessage(amqpValue.createEncodingRetainingSection());
final MessageTransferMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", "jms/map-message", convertedMessage.getMessageHeader().getMimeType());
final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
Map<String, Object> convertedMap = new JmsMapMessageToMap().toObject(getBytes(content));
assertEquals("Unexpected size", originalMap.size(), convertedMap.size());
assertArrayEquals("Unexpected binary entry", ((Binary) originalMap.get("binaryEntry")).getArray(), (byte[]) convertedMap.get("binaryEntry"));
assertEquals("Unexpected int entry", originalMap.get("intEntry"), convertedMap.get("intEntry"));
assertEquals("Unexpected null entry", originalMap.get("nullEntry"), convertedMap.get("nullEntry"));
}
use of org.apache.qpid.amqp_1_0.type.messaging.AmqpValue in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_8Test method testAmqpValueWithNullWithBytesMessageAnnotation.
public void testAmqpValueWithNullWithBytesMessageAnnotation() throws Exception {
final Object expected = null;
final AmqpValue amqpValue = new AmqpValue(expected);
Message_1_0 sourceMessage = createTestMessage(BYTE_MESSAGE_MESSAGE_ANNOTATION, amqpValue.createEncodingRetainingSection());
final AMQMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", "application/octet-stream", convertedMessage.getMessageHeader().getMimeType());
assertEquals("Unexpected content size", 0, convertedMessage.getMessageMetaData().getContentSize());
}
use of org.apache.qpid.amqp_1_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
}
}
Aggregations