use of org.apache.qpid.server.protocol.v1_0.Message_1_0 in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test method testNoBodyWithObjectMessageAnnotation.
public void testNoBodyWithObjectMessageAnnotation() throws Exception {
Message_1_0 sourceMessage = createTestMessage(OBJECT_MESSAGE_MESSAGE_ANNOTATION, null);
final MessageTransferMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
assertEquals("Unexpected mime type", "application/java-object-stream", convertedMessage.getMessageHeader().getMimeType());
assertArrayEquals("Unexpected content size", getObjectBytes(null), getBytes(content));
}
use of org.apache.qpid.server.protocol.v1_0.Message_1_0 in project qpid-broker-j by apache.
the class MessageConverter_1_0_to_v0_10Test method testAmqpValueWithNull.
public void testAmqpValueWithNull() throws Exception {
final Object expected = null;
final AmqpValue amqpValue = new AmqpValue(expected);
Message_1_0 sourceMessage = createTestMessage(amqpValue.createEncodingRetainingSection());
final MessageTransferMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", null, convertedMessage.getMessageHeader().getMimeType());
assertEquals("Unexpected content size", 0, convertedMessage.getSize());
}
use of org.apache.qpid.server.protocol.v1_0.Message_1_0 in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_1_0Test method testPersistentDeliveryModeConversion.
public void testPersistentDeliveryModeConversion() {
final DeliveryProperties deliveryProperties = new DeliveryProperties();
deliveryProperties.setDeliveryMode(MessageDeliveryMode.PERSISTENT);
MessageTransferMessage message = createTestMessage(deliveryProperties);
final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
Header header = convertedMessage.getHeaderSection().getValue();
assertTrue("Unexpected durable header", header.getDurable());
}
use of org.apache.qpid.server.protocol.v1_0.Message_1_0 in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_1_0Test method testReplyToConversionWhenExchangeIsEmptyStringAndRoutingKeySpecified.
public void testReplyToConversionWhenExchangeIsEmptyStringAndRoutingKeySpecified() {
final String routingKey = "test_routing_key";
final MessageProperties messageProperties = new MessageProperties();
messageProperties.setReplyTo(new ReplyTo("", routingKey));
MessageTransferMessage message = createTestMessage(messageProperties);
final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
Properties properties = convertedMessage.getPropertiesSection().getValue();
assertEquals("Unexpected reply-to", "test_routing_key", properties.getReplyTo());
}
use of org.apache.qpid.server.protocol.v1_0.Message_1_0 in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_1_0Test method testHeaderConversionWhenQpidSubjectIsPresent.
public void testHeaderConversionWhenQpidSubjectIsPresent() {
String testSubject = "testSubject";
Map<String, Object> headers = new HashMap<>();
headers.put("testProperty1", "testProperty1Value");
headers.put("qpid.subject", testSubject);
final MessageProperties messageProperties = new MessageProperties();
messageProperties.setApplicationHeaders(headers);
MessageTransferMessage message = createTestMessage(messageProperties);
final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
Properties properties = convertedMessage.getPropertiesSection().getValue();
assertEquals("Unexpected subject", testSubject, properties.getSubject());
Map<String, Object> applicationProperties = convertedMessage.getApplicationPropertiesSection().getValue();
assertFalse("Unexpected subject in application properties", applicationProperties.containsKey("qpid.subject"));
}
Aggregations