use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class MessageConverter_v1_0_to_InternalTest method testNoBodyWithBytesMessageAnnotation.
public void testNoBodyWithBytesMessageAnnotation() throws Exception {
Message_1_0 sourceMessage = createTestMessage(BYTE_MESSAGE_MESSAGE_ANNOTATION, null);
final InternalMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", "application/octet-stream", convertedMessage.getMessageHeader().getMimeType());
assertEquals("Unexpected content", null, convertedMessage.getMessageBody());
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class MessageConverter_v1_0_to_InternalTest method testAmqpValueWithNullWithStreamMessageAnnotation.
public void testAmqpValueWithNullWithStreamMessageAnnotation() throws Exception {
final Object expected = null;
final AmqpValue amqpValue = new AmqpValue(expected);
Message_1_0 sourceMessage = createTestMessage(STREAM_MESSAGE_MESSAGE_ANNOTATION, amqpValue.createEncodingRetainingSection());
final InternalMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", null, convertedMessage.getMessageHeader().getMimeType());
assertNull("Unexpected content", convertedMessage.getMessageBody());
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class MessageConverter_v1_0_to_InternalTest method testAmqpSequenceWithSimpleTypes.
public void testAmqpSequenceWithSimpleTypes() throws Exception {
final List<Object> originalList = new ArrayList<>();
originalList.add(37);
originalList.add(42F);
final AmqpSequence amqpSequence = new AmqpSequence(originalList);
Message_1_0 sourceMessage = createTestMessage(amqpSequence.createEncodingRetainingSection());
final InternalMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", null, convertedMessage.getMessageHeader().getMimeType());
List<Object> convertedList = ((List<Object>) convertedMessage.getMessageBody());
assertEquals("Unexpected size", originalList.size(), convertedList.size());
assertEquals("Unexpected first item", originalList.get(0), convertedList.get(0));
assertEquals("Unexpected second item", originalList.get(1), convertedList.get(1));
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class MessageConverter_v1_0_to_InternalTest method testMessageAnnotationTakesPrecedenceOverContentType.
public void testMessageAnnotationTakesPrecedenceOverContentType() throws Exception {
final Properties properties = new Properties();
properties.setContentType(Symbol.valueOf("application/octet-stream"));
final Message_1_0 sourceMessage = createTestMessage(OBJECT_MESSAGE_MESSAGE_ANNOTATION, null);
final InternalMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", "application/x-java-serialized-object", convertedMessage.getMessageHeader().getMimeType());
assertEquals("Unexpected content", null, convertedMessage.getMessageBody());
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class MessageConverter_v1_0_to_InternalTest method testNoBodyWithObjectMessageAnnotation.
public void testNoBodyWithObjectMessageAnnotation() throws Exception {
Message_1_0 sourceMessage = createTestMessage(OBJECT_MESSAGE_MESSAGE_ANNOTATION, null);
final InternalMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", "application/x-java-serialized-object", convertedMessage.getMessageHeader().getMimeType());
assertEquals("Unexpected content", null, convertedMessage.getMessageBody());
}
Aggregations